Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CODEGEN] Skip unrolled hint, export symbol on win32 #547

Merged
merged 1 commit into from
Oct 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/codegen/codegen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ std::string PackImportsToC(const runtime::Module& mod, bool system_lib) {
}
// translate to C program
std::ostringstream os;
os << "#ifdef _WIN32\n"
<< "#define TVM_EXPORT __declspec(dllexport)\n"
<< "#else\n"
<< "#define TVM_EXPORT\n"
<< "#endif\n";
os << "#ifdef __cplusplus\n"
<< "extern \"C\" {\n"
<< "#endif\n";
os << "extern const char " << runtime::symbol::tvm_dev_mblob << "[];\n";
os << "TVM_EXPORT extern const char " << runtime::symbol::tvm_dev_mblob << "[];\n";
uint64_t nbytes = bin.length();
os << "const char " << runtime::symbol::tvm_dev_mblob
<< "[" << bin.length() + sizeof(nbytes) << "] = {\n ";
Expand Down Expand Up @@ -82,7 +87,6 @@ std::string PackImportsToC(const runtime::Module& mod, bool system_lib) {
os << "#ifdef __cplusplus\n"
<< "}\n"
<< "#endif\n";

return os.str();
}
} // namespace codegen
Expand Down
3 changes: 2 additions & 1 deletion src/codegen/llvm/codegen_cpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,8 @@ void CodeGenCPU::VisitStmt_(const AttrStmt* op) {

void CodeGenCPU::VisitStmt_(const For* op) {
CHECK(is_zero(op->min));
if (op->for_type == ForType::Serial) {
if (op->for_type == ForType::Serial ||
op->for_type == ForType::Unrolled) {
CodeGenLLVM::VisitStmt_(op);
} else if (op->for_type == ForType::Parallel) {
if (parallel_env_.penv == nullptr) {
Expand Down
7 changes: 6 additions & 1 deletion src/codegen/llvm/codegen_llvm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,12 @@ void CodeGenLLVM::VisitStmt_(const Store* op) {

void CodeGenLLVM::VisitStmt_(const For* op) {
CHECK(is_zero(op->min));
CHECK(op->for_type == ForType::Serial);
if (op->for_type == ForType::Unrolled) {
LOG(WARNING) << "Unroll hint get ignore at CodeGenLLVM backend, "
<< " consider set unroll_explicit=True";
} else {
CHECK(op->for_type == ForType::Serial);
}
CreateSerialFor(MakeValue(op->min), MakeValue(op->extent),
ConstInt32(1), op->loop_var, op->body);
}
Expand Down