Lunderberg commented on code in PR #16655:
URL: https://github.com/apache/tvm/pull/16655#discussion_r1521724121
##########
src/tir/ir/tir_visitor_with_path.cc:
##########
@@ -199,12 +174,23 @@ void TIRVisitorWithPath::VisitStmt_(const LetStmtNode*
op, ObjectPath path) {
void TIRVisitorWithPath::VisitStmt_(const AttrStmtNode* op, ObjectPath path) {
Visit(op->value, path->Attr("value"));
- std::optional<DefContext<IterVar>> context = std::nullopt;
+ std::vector<std::variant<DefContext<IterVar>, DefContext<Var>>> context;
Review Comment:
There aren't any reads from it, as it holds a scoped context manager. On
destruction, the `DefContext<T>` object removes items from
`TIRVisitorWithPath::in_scope_definitions_`, and calls the `ExitDef` handler of
the child class.
Also, thank you for pointing this one out. When switching from
`std::optional` to `std::vector`, I forgot to add a `while(context.size())
context.pop_back();` loop in case child classes rely on `ExitDef` being called
in the reverse order from `EnterDef`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]