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) { ...@@ -318,9 +318,11 @@ void CodeGenCPU::CreateComputeScope(const AttrStmt* op) {
// set non alias. // set non alias.
#if TVM_LLVM_VERSION >= 50 #if TVM_LLVM_VERSION >= 50
fcompute->addParamAttr(idx + 1, llvm::Attribute::NoAlias); fcompute->addParamAttr(idx + 1, llvm::Attribute::NoAlias);
// always not inline compute function to make the code structure clean
#else #else
fcompute->setDoesNotAlias(idx + 1); fcompute->setDoesNotAlias(idx + 1);
#endif #endif
fcompute->addFnAttr(llvm::Attribute::NoInline);
} }
} }
std::swap(function_, fcompute); std::swap(function_, fcompute);
......
...@@ -79,7 +79,8 @@ LoweredFunc MakeAPI(Stmt body, ...@@ -79,7 +79,8 @@ LoweredFunc MakeAPI(Stmt body,
args.push_back(v_packed_arg_type_ids); args.push_back(v_packed_arg_type_ids);
args.push_back(v_num_packed_args); args.push_back(v_num_packed_args);
std::ostringstream os; 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( seq_init.emplace_back(
MakeAssertEQ(v_num_packed_args, num_packed_args, os.str())); MakeAssertEQ(v_num_packed_args, num_packed_args, os.str()));
} }
...@@ -98,19 +99,19 @@ LoweredFunc MakeAPI(Stmt body, ...@@ -98,19 +99,19 @@ LoweredFunc MakeAPI(Stmt body,
Type t = v_arg.type(); Type t = v_arg.type();
if (t.is_handle()) { if (t.is_handle()) {
std::ostringstream msg; std::ostringstream msg;
msg << "Expect argument " << i << " to be pointer"; msg << name << ": Expect arg[" << i << "] to be pointer";
seq_check.emplace_back( seq_check.emplace_back(
AssertStmt::make(tcode == kHandle || AssertStmt::make(tcode == kHandle ||
tcode == kArrayHandle || tcode == kArrayHandle ||
tcode == kNull, msg.str(), nop)); tcode == kNull, msg.str(), nop));
} else if (t.is_int() || t.is_uint()) { } else if (t.is_int() || t.is_uint()) {
std::ostringstream msg; 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)); seq_check.emplace_back(AssertStmt::make(tcode == kInt, msg.str(), nop));
} else { } else {
CHECK(t.is_float()); CHECK(t.is_float());
std::ostringstream msg; 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)); seq_check.emplace_back(AssertStmt::make(tcode == kFloat, msg.str(), nop));
} }
} else { } 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