Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
74b0ca86
Commit
74b0ca86
authored
Oct 12, 2017
by
Tianqi Chen
Committed by
GitHub
Oct 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CODEGEN] Skip unrolled hint, export symbol on win32 (#547)
parent
b20678b0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
src/codegen/codegen.cc
+6
-2
src/codegen/llvm/codegen_cpu.cc
+2
-1
src/codegen/llvm/codegen_llvm.cc
+5
-0
No files found.
src/codegen/codegen.cc
View file @
74b0ca86
...
@@ -46,10 +46,15 @@ std::string PackImportsToC(const runtime::Module& mod, bool system_lib) {
...
@@ -46,10 +46,15 @@ std::string PackImportsToC(const runtime::Module& mod, bool system_lib) {
}
}
// translate to C program
// translate to C program
std
::
ostringstream
os
;
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
"
os
<<
"#ifdef __cplusplus
\n
"
<<
"extern
\"
C
\"
{
\n
"
<<
"extern
\"
C
\"
{
\n
"
<<
"#endif
\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
();
uint64_t
nbytes
=
bin
.
length
();
os
<<
"const char "
<<
runtime
::
symbol
::
tvm_dev_mblob
os
<<
"const char "
<<
runtime
::
symbol
::
tvm_dev_mblob
<<
"["
<<
bin
.
length
()
+
sizeof
(
nbytes
)
<<
"] = {
\n
"
;
<<
"["
<<
bin
.
length
()
+
sizeof
(
nbytes
)
<<
"] = {
\n
"
;
...
@@ -82,7 +87,6 @@ std::string PackImportsToC(const runtime::Module& mod, bool system_lib) {
...
@@ -82,7 +87,6 @@ std::string PackImportsToC(const runtime::Module& mod, bool system_lib) {
os
<<
"#ifdef __cplusplus
\n
"
os
<<
"#ifdef __cplusplus
\n
"
<<
"}
\n
"
<<
"}
\n
"
<<
"#endif
\n
"
;
<<
"#endif
\n
"
;
return
os
.
str
();
return
os
.
str
();
}
}
}
// namespace codegen
}
// namespace codegen
...
...
src/codegen/llvm/codegen_cpu.cc
View file @
74b0ca86
...
@@ -697,7 +697,8 @@ void CodeGenCPU::VisitStmt_(const AttrStmt* op) {
...
@@ -697,7 +697,8 @@ void CodeGenCPU::VisitStmt_(const AttrStmt* op) {
void
CodeGenCPU
::
VisitStmt_
(
const
For
*
op
)
{
void
CodeGenCPU
::
VisitStmt_
(
const
For
*
op
)
{
CHECK
(
is_zero
(
op
->
min
));
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
);
CodeGenLLVM
::
VisitStmt_
(
op
);
}
else
if
(
op
->
for_type
==
ForType
::
Parallel
)
{
}
else
if
(
op
->
for_type
==
ForType
::
Parallel
)
{
if
(
parallel_env_
.
penv
==
nullptr
)
{
if
(
parallel_env_
.
penv
==
nullptr
)
{
...
...
src/codegen/llvm/codegen_llvm.cc
View file @
74b0ca86
...
@@ -891,7 +891,12 @@ void CodeGenLLVM::VisitStmt_(const Store* op) {
...
@@ -891,7 +891,12 @@ void CodeGenLLVM::VisitStmt_(const Store* op) {
void
CodeGenLLVM
::
VisitStmt_
(
const
For
*
op
)
{
void
CodeGenLLVM
::
VisitStmt_
(
const
For
*
op
)
{
CHECK
(
is_zero
(
op
->
min
));
CHECK
(
is_zero
(
op
->
min
));
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
);
CHECK
(
op
->
for_type
==
ForType
::
Serial
);
}
CreateSerialFor
(
MakeValue
(
op
->
min
),
MakeValue
(
op
->
extent
),
CreateSerialFor
(
MakeValue
(
op
->
min
),
MakeValue
(
op
->
extent
),
ConstInt32
(
1
),
op
->
loop_var
,
op
->
body
);
ConstInt32
(
1
),
op
->
loop_var
,
op
->
body
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment