Hi there, I found if we access buffer var in let binding value like
@T.prim_func
def func(A: T.Buffer[(1,), "float32"]):
x = T.var("float32")
B = T.allocate((1,), "float32", "global")
B[0] = A[0] + 1.0
with T.let(x, B[0]):
T.evaluate(x)
The StorageRewrite
pass will raise:
Check failed: it->second.level < scope_.size() (0 vs. 0) : Load memory in places other than store.
In LinearAccessPatternFinder
, certain stmts are visited as “new scope”, thus, we can write memory accesses in a while or if condition (without store). Are there any special concerns to forbid the accesses in let binding
value?
void VisitStmt_(const IfThenElseNode* op) final { VisitNewScope(op); }
void VisitStmt_(const ForNode* op) final { VisitNewScope(op); }
void VisitStmt_(const WhileNode* op) final { VisitNewScope(op); }
void VisitStmt_(const AssertStmtNode* op) final { VisitNewScope(op); }