24 #ifndef TVM_ARITH_INT_SOLVER_H_
25 #define TVM_ARITH_INT_SOLVER_H_
31 #include <unordered_map>
66 v->Visit(
"coef", &
coef);
67 v->Visit(
"lower", &
lower);
68 v->Visit(
"equal", &
equal);
69 v->Visit(
"upper", &
upper);
85 static constexpr
const char*
_type_key =
"arith.IntGroupBounds";
157 v->Visit(
"ranges", &
ranges);
173 static constexpr
const char*
_type_key =
"arith.IntConstraints";
217 v->Visit(
"src", &
src);
218 v->Visit(
"dst", &
dst);
236 static constexpr
const char*
_type_key =
"arith.IntConstraintsTransform";
289 std::vector<PrimExpr>* x, std::vector<PrimExpr>* y);
Algebra expression simplifications.
Visitor class to get the attributes of an AST/IR node. The content is going to be called for each fie...
Definition: reflection.h:52
Reference to PrimExprNode.
Definition: expr.h:115
Range container
Definition: expr.h:725
A Reducer class to reduce the structural equality result of two objects.
Definition: structural_equal.h:137
A Reducer class to reduce the structural hash value.
Definition: structural_hash.h:121
Represent integer constrains including (integer) variables, their ranges and the relations between th...
Definition: int_solver.h:143
Array< PrimExpr > relations
Definition: int_solver.h:153
TVM_DECLARE_FINAL_OBJECT_INFO(IntConstraintsNode, Object)
static constexpr const char * _type_key
Definition: int_solver.h:173
bool SEqualReduce(const IntConstraintsNode *other, SEqualReducer equal) const
Definition: int_solver.h:161
void VisitAttrs(tvm::AttrVisitor *v)
Definition: int_solver.h:155
static constexpr const bool _type_has_method_sequal_reduce
Definition: int_solver.h:172
Map< Var, Range > ranges
Definition: int_solver.h:150
void SHashReduce(SHashReducer hash_reduce) const
Definition: int_solver.h:166
Array< Var > variables
Definition: int_solver.h:146
Managed reference to IntConstraintsNode.
Definition: int_solver.h:181
IntConstraints(Array< Var > variables, Map< Var, Range > ranges, Array< PrimExpr > relations)
Constructor by fields.
TVM_DEFINE_OBJECT_REF_METHODS(IntConstraints, ObjectRef, IntConstraintsNode)
Represent integer grouped bounds which are classified into lower bounds (inclusive),...
Definition: int_solver.h:58
static constexpr const char * _type_key
Definition: int_solver.h:85
Array< PrimExpr > upper
Definition: int_solver.h:63
bool SEqualReduce(const IntGroupBoundsNode *other, SEqualReducer eq) const
Definition: int_solver.h:72
PrimExpr coef
Definition: int_solver.h:60
Array< PrimExpr > equal
Definition: int_solver.h:62
void VisitAttrs(tvm::AttrVisitor *v)
Definition: int_solver.h:65
void SHashReduce(SHashReducer hash_reduce) const
Definition: int_solver.h:77
static constexpr const bool _type_has_method_sequal_reduce
Definition: int_solver.h:84
Array< PrimExpr > lower
Definition: int_solver.h:61
TVM_DECLARE_FINAL_OBJECT_INFO(IntGroupBoundsNode, Object)
Managed reference to IntGroupBoundsNode.
Definition: int_solver.h:93
static IntGroupBounds FromRange(const Range &r)
Construct bounds from a range.
IntGroupBounds Substitute(const Map< Var, PrimExpr > &subst) const
Perform substitution on all components of the struct.
IntGroupBounds operator+(const Range &r)
Combine the bounds with another range.
IntGroupBounds(PrimExpr coef, Array< PrimExpr > lower, Array< PrimExpr > equal, Array< PrimExpr > upper)
Constructor by fields.
Range FindBestRange(const Map< Var, Range > &vranges_addl={}) const
Find the best range from the grouped bounds.
TVM_DEFINE_OBJECT_REF_METHODS(IntGroupBounds, ObjectRef, IntGroupBoundsNode)
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics,...
Definition: map.h:1271
Base class of all object reference.
Definition: object.h:519
base class of all object containers.
Definition: object.h:171
void SmithNormalFormDiag(std::vector< std::vector< int64_t >> *S, std::vector< std::vector< int64_t >> *V, std::vector< PrimExpr > *x, std::vector< PrimExpr > *y)
Obtain Smith Normal Form of linear equation A x = y. Smith Normal Form of matrix A_{mxn} is S_{mxn} =...
IntConstraints SolveInequalitiesToRange(const IntConstraints &system_to_solve)
Solve linear inequalities and infer the range of each variable.
constexpr int kSimplifyRewriteCanonicalRewrite
Definition: int_solver.h:47
Array< PrimExpr > AsConditions(const Array< Var > &variables, const Map< Var, IntGroupBounds > &bounds, const Array< PrimExpr > &relations)
Combine the information into an array of (in)equalities.
IntConstraintsTransform SolveInequalitiesDeskewRange(const IntConstraints &system_to_solve)
Solve linear inequalities and deskew the ranges towards zero.
PartialSolvedInequalities SolveLinearInequalities(const IntConstraints &system_to_solve)
Solve linear inequalities.
std::pair< Map< Var, IntGroupBounds >, Array< PrimExpr > > PartialSolvedInequalities
Definition: int_solver.h:271
IntConstraintsTransform SolveLinearEquations(const IntConstraints &system_to_solve)
Solve linear equations.
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
Common operators defined for Expr.