24#ifndef TVM_TOPI_DETAIL_CONSTANT_UTILS_H_
25#define TVM_TOPI_DETAIL_CONSTANT_UTILS_H_
29#include <tvm/runtime/logging.h>
59inline bool IsConstIntArray(ffi::Array<PrimExpr>
array) {
79 LOG(
ERROR) <<
"expr must be a constant integer";
92inline std::vector<int> GetConstIntValues(ffi::Array<PrimExpr>
exprs,
const std::string& var_name) {
93 std::vector<int> result;
94 if (!
exprs.defined())
return result;
95 for (
auto expr :
exprs) {
97 <<
"All elements of " << var_name <<
" must be constant integers";
98 result.push_back(GetConstInt(expr));
112inline std::vector<int64_t> GetConstInt64Values(ffi::Array<PrimExpr>
exprs,
113 const std::string& var_name) {
114 std::vector<int64_t> result;
115 if (!
exprs.defined())
return result;
116 for (
auto expr :
exprs) {
118 <<
"All elements of " << var_name <<
" must be constant integers";
119 result.push_back(GetConstInt(expr));
138 result =
i->value == 0;
Algebra expression simplifications.
Constant integer literals in the program.
Definition expr.h:487
Typed reference/view over any Expr whose ExprNode::ty is PrimType.
Definition base_expr.h:401
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
Managed reference to AnalyzerObj.
Definition analyzer.h:931
Tensor expression language DSL.
Definition extracted_task.h:33
bool is_const_int(const PrimExpr &x, int64_t value)
Check whether x is a constant integer expression.
Definition op.h:946
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40
Operation node can generate one or multiple Tensors.
Compare two expressions recursively and check if they are equal to each other without var remapping.
Definition analysis.h:57
Analysis utilities and passes for TIR.