Mousius commented on a change in pull request #8501:
URL: https://github.com/apache/tvm/pull/8501#discussion_r684135783
##########
File path: src/relay/backend/te_compiler.cc
##########
@@ -349,6 +350,9 @@ class LowerTensorExpr : public ExprMutator {
Map<GlobalVar, tir::PrimFunc> prim_fns;
for (auto prim_fn : ext_func->funcs->functions) {
+ if (prim_fn.second->GetAttr<String>(attr::kCompiler).defined()) {
Review comment:
Hi @YuchenJin, thanks for getting back to me, the reason I asked was
because this loop is gated by the `kCompiler` attribute:
```
if (func->GetAttr<String>(attr::kCompiler).defined()) {
```
And then when it goes into `LowerInternal` it'll end up in this block (with
your alterations):
```
if (key->source_func->GetAttr<String>(attr::kCompiler).defined()) {
auto ir_module = IRModule();
const auto name_node =
key->source_func->GetAttr<String>(tvm::attr::kGlobalSymbol);
ICHECK(name_node.defined()) << "External function has not been
attached a name yet.";
auto func_name = GetUniqueName(name_node.value(), &name_map_);
auto target = Target("ext_dev");
auto global_var = GlobalVar(func_name);
global_var->checked_type_ = key->source_func->checked_type();
ir_module->Add(global_var, key->source_func);
value->cached_func = CachedFunc(target, global_var, {}, {},
te::Schedule(), {}, ir_module);
return value;
}
```
Which means when we enter this loop, the only function in the `IRModule`
should be a function taken from `key->source_func` which has the attr on it?
--
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]