1#ifndef FREE_TENSOR_FRONTEND_VAR
2#define FREE_TENSOR_FRONTEND_VAR
19 Expr start_, stop_, len_;
82 return os <<
"(" << idx.
start() <<
", " << idx.
stop() <<
")";
88 std::vector<Expr> fullShape_;
91 std::vector<FrontendVarIdx> indices_;
92 bool isLoadAtVersion_;
97 const std::vector<FrontendVarIdx> &
indices,
98 bool isLoadAtVersion =
false)
100 indices_(
indices), isLoadAtVersion_(isLoadAtVersion) {}
102 const std::string &
name()
const {
return name_; }
107 const std::vector<Expr> &
fullShape()
const {
return fullShape_; }
117 const std::vector<FrontendVarIdx> &
indices()
const {
return indices_; }
124 std::vector<Expr>
shape()
const;
130 bool atomic =
false)
const;
132 std::vector<FrontendVarIdx>
133 chainIndices(
const std::vector<FrontendVarIdx> &next)
const;
137 os << var.
name() <<
"[";
138 for (
auto &&[i, idx] : views::enumerate(var.
indices())) {
139 os << (i == 0 ?
"" :
", ") << idx;
144std::unordered_set<std::string>
allReads(
const FrontendVarIdx &idx);
Definition: data_type.h:106
Definition: frontend_var.h:17
const Expr & start() const
Definition: frontend_var.h:29
const Expr & single() const
Definition: frontend_var.h:24
const Expr & stop() const
Definition: frontend_var.h:34
static FrontendVarIdx fromSingle(const Expr &single)
Definition: frontend_var.h:41
static FrontendVarIdx fromSlice(const Expr &start, const Expr &stop, const Expr &len=nullptr)
Definition: frontend_var.h:49
const Expr & len() const
Definition: frontend_var.h:39
FrontendVarIdxType type() const
Definition: frontend_var.h:22
Definition: frontend_var.h:86
DataType dtype() const
Definition: frontend_var.h:109
const std::vector< FrontendVarIdx > & indices() const
Definition: frontend_var.h:117
const std::vector< Expr > & fullShape() const
Definition: frontend_var.h:107
Stmt asStore(const Metadata &metadata, const Expr &value) const
Definition: frontend_var.cc:87
const std::string & name() const
Definition: frontend_var.h:102
MemType mtype() const
Definition: frontend_var.h:110
Stmt asReduceTo(ReduceOp op, const Metadata &metadata, const Expr &value, bool atomic=false) const
Definition: frontend_var.cc:108
std::vector< FrontendVarIdx > chainIndices(const std::vector< FrontendVarIdx > &next) const
Definition: frontend_var.cc:126
FrontendVar(const std::string &name, const std::vector< Expr > &fullShape, DataType dtype, MemType mtype, const std::vector< FrontendVarIdx > &indices, bool isLoadAtVersion=false)
Definition: frontend_var.h:95
int ndim() const
Definition: frontend_var.cc:8
std::vector< Expr > shape() const
Definition: frontend_var.cc:50
Expr asLoad() const
Definition: frontend_var.cc:67
bool isValid() const
Definition: ref.h:89
#define ASSERT(expr)
Definition: except.h:152
Definition: allocator.h:9
Stmt constFold(const Stmt &op)
Definition: const_fold.h:177
FrontendVarIdxType
Definition: frontend_var.h:15
Expr makeAdd(T &&lhs, U &&rhs, std::source_location loc=std::source_location::current())
Definition: expr.h:174
std::unordered_set< std::string > allReads(const AST &op, bool noRecurseIdx=false, bool noRecurseSubStmt=false)
Definition: all_uses.h:83
ReduceOp
Definition: reduce_op.h:30
Expr makeSub(T &&lhs, U &&rhs, std::source_location loc=std::source_location::current())
Definition: expr.h:188
std::ostream & operator<<(std::ostream &os, const Dependence &dep)
Definition: deps.cc:1404
Expr makeIntConst(int64_t val, std::source_location loc=std::source_location::current())
Definition: expr.h:102
MemType
Definition: mem_type.h:14