mbaret commented on a change in pull request #6655:
URL: https://github.com/apache/tvm/pull/6655#discussion_r529678285
##########
File path: src/relay/transforms/annotate_target.cc
##########
@@ -61,20 +67,27 @@ class AnnotateTargetRewriter : public ExprRewriter {
std::pair<std::string, Array<Expr>> AnnotateArgs(const Array<Expr>& args,
const std::string& target =
"") {
std::string ref_target = "";
+ Array<Expr> compiler_begins;
Array<Expr> compiler_ends;
for (auto arg : args) {
- std::string arg_target = "default";
+ std::string arg_target = default_target;
const CallNode* call = arg.as<CallNode>();
if (call && call->op == CompilerBeginOp()) {
// Argument is already compiler begin node meaning that this is not
the first time
// running this pass, so we simply remove it and will add a new one
later.
ICHECK_EQ(call->args.size(), 1U);
+ // Do not alter existing annotation if not default
+ if (default_target != call->attrs.as<CompilerAttrs>()->compiler) {
+ compiler_begins.push_back(arg);
+ } else {
+ // Remove default
+ compiler_ends.push_back(call->args[0]);
+ }
Review comment:
I think we need to separate the (valid) concerns about the design and
overall maintainability of AnnotateTarget from the intention of this PR.
Currently, we have user facing errors with ACL because of this tuple annotation
bug and so I think our first priority should be merging something which fixes
that. We can discuss possible refactors/redesigns of AnnotateTarget separately
with an RFC on the forum where more people can see it and participate.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]