Commit 10faa893 by Tianqi Chen Committed by GitHub

[CODEGEN] Force not inline compute core for better debug (#557)

* [CODEGEN] Force not inline compute core for better debug

* also support llvm4
parent eb761f36
......@@ -318,9 +318,11 @@ void CodeGenCPU::CreateComputeScope(const AttrStmt* op) {
// set non alias.
#if TVM_LLVM_VERSION >= 50
fcompute->addParamAttr(idx + 1, llvm::Attribute::NoAlias);
// always not inline compute function to make the code structure clean
#else
fcompute->setDoesNotAlias(idx + 1);
#endif
fcompute->addFnAttr(llvm::Attribute::NoInline);
}
}
std::swap(function_, fcompute);
......
......@@ -79,7 +79,8 @@ LoweredFunc MakeAPI(Stmt body,
args.push_back(v_packed_arg_type_ids);
args.push_back(v_num_packed_args);
std::ostringstream os;
os << "expected num_args to be " << num_packed_args;
os << name << ": num_args should be " << num_packed_args;
seq_init.emplace_back(
MakeAssertEQ(v_num_packed_args, num_packed_args, os.str()));
}
......@@ -98,19 +99,19 @@ LoweredFunc MakeAPI(Stmt body,
Type t = v_arg.type();
if (t.is_handle()) {
std::ostringstream msg;
msg << "Expect argument " << i << " to be pointer";
msg << name << ": Expect arg[" << i << "] to be pointer";
seq_check.emplace_back(
AssertStmt::make(tcode == kHandle ||
tcode == kArrayHandle ||
tcode == kNull, msg.str(), nop));
} else if (t.is_int() || t.is_uint()) {
std::ostringstream msg;
msg << "Expect argument " << i << " to be int";
msg << name << ": Expect arg[" << i << "] to be int";
seq_check.emplace_back(AssertStmt::make(tcode == kInt, msg.str(), nop));
} else {
CHECK(t.is_float());
std::ostringstream msg;
msg << "Expect argument " << i << " to be float";
msg << name << ": Expect arg[" << i << "] to be float";
seq_check.emplace_back(AssertStmt::make(tcode == kFloat, msg.str(), nop));
}
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment