Hi, folks,
I’m debugging some codegen in C++ and would like to print out tvm::LoweredFunc
. It seems that print
in Python just works but LOG(INFO) << lowered_func;
doesn’t. It gives me something like
LoweredFunc(fused_sparse, 0x6080000c68a0)
Instead of the whole IR. Any idea? Thanks.
2 Likes
Resolved. The print function is fine. We just need to do LOG(INFO) << stmt;
before calling ir::MakeAPI
here:
return stmt;
}
Array<LoweredFunc> lower(Schedule sch,
const Array<Tensor>& args,
const std::string& name,
const std::unordered_map<Tensor, Buffer>& binds,
const BuildConfig& config) {
Array<NodeRef> out_arg_list;
auto stmt = BuildStmt(sch, args, binds, true, &out_arg_list, config);
return Array<LoweredFunc>({ ir::MakeAPI(stmt, name, out_arg_list, 0, config->restricted_func) });
}
runtime::Module build(const Array<LoweredFunc>& funcs,
const Target& target,
const Target& target_host,
const BuildConfig& config) {
std::unordered_set<std::string> all_names;
for (const auto &x : funcs) {
CHECK(all_names.count(x->name) == 0) << "Duplicate function name " << x->name;
all_names.insert(x->name);
1 Like