manupa-arm commented on a change in pull request #8865:
URL: https://github.com/apache/tvm/pull/8865#discussion_r700451281
##########
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 and thanks for the explaination -- maybe a comment would help then :)
--
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]