manupa-arm commented on a change in pull request #8865:
URL: https://github.com/apache/tvm/pull/8865#discussion_r700415536
##########
File path: src/target/llvm/codegen_hexagon.cc
##########
@@ -706,12 +706,42 @@ runtime::Module BuildHexagon(IRModule mod, Target target)
{
std::unique_ptr<llvm::TargetMachine> tm = GetLLVMTargetMachine(target);
std::unique_ptr<llvm::LLVMContext> ctx(new llvm::LLVMContext());
std::unique_ptr<CodeGenHexagon> cg(new CodeGenHexagon());
- cg->Init("TVMHexagonModule", tm.get(), ctx.get(), false, false, false);
+
+ std::vector<PrimFunc> funcs;
+ std::string entry_func;
+ Map<String, LinkedParam> linked_params;
+ bool found_linked_params = false;
+ bool could_have_linked_params =
target->GetAttr<Bool>("link-params").value_or(Bool(false));
+
for (auto kv : mod->functions) {
ICHECK(kv.second->IsInstance<PrimFuncNode>()) << "Can only lower IR Module
with PrimFuncs";
+ if (could_have_linked_params &&
+ kv.first->name_hint ==
::tvm::runtime::symbol::tvm_lookup_linked_param) {
+ Map<String, ObjectRef> attrs_dict = Downcast<Map<String,
ObjectRef>>(kv.second->attrs->dict);
+ CHECK(attrs_dict.find(::tvm::tir::attr::kLinkedParams) !=
attrs_dict.end())
+ << "no " << ::tvm::tir::attr::kLinkedParams << " attribute found!";
+ linked_params =
+ Downcast<Map<String,
LinkedParam>>(attrs_dict[::tvm::tir::attr::kLinkedParams]);
+ found_linked_params = true;
+ continue;
Review comment:
Ack, so this is just to skip the linked-params function -- might be
better to add a comment.
I guess my original concern is it would be bit more readable if it was a
different function to obtain the linked-params altogether rather than fusing it
with the loop as you correctly note here -- it being not the only effect, WDYT?
cc: @d-smirnov , another occurence where linked-param will be used.
--
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]