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
b8c8aadf
Commit
b8c8aadf
authored
Aug 31, 2017
by
Tianqi Chen
Committed by
GitHub
Aug 31, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BACKEND] Allow nvptx to pass ll ir to CUDAModule (#404)
parent
50c7a01b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
src/codegen/llvm/codegen_nvptx.cc
+10
-8
No files found.
src/codegen/llvm/codegen_nvptx.cc
View file @
b8c8aadf
...
...
@@ -131,8 +131,7 @@ class CodeGenNVPTX : public CodeGenLLVM {
};
runtime
::
Module
BuildNVPTX
(
Array
<
LoweredFunc
>
funcs
,
std
::
string
target
)
{
CHECK
(
target
.
length
(
)
>=
5
&&
CHECK
(
target
.
length
()
>=
5
&&
target
.
substr
(
0
,
5
)
==
"nvptx"
);
llvm
::
TargetMachine
*
tm
=
GetLLVMTargetMachine
(
"-mtriple=nvptx64-nvidia-cuda -mcpu=sm_20"
+
...
...
@@ -144,16 +143,19 @@ runtime::Module BuildNVPTX(Array<LoweredFunc> funcs, std::string target) {
cg
->
AddFunction
(
f
);
}
std
::
unique_ptr
<
llvm
::
Module
>
module
=
cg
->
Finish
();
llvm
::
SmallString
<
8
>
data
;
llvm
::
raw_svector_ostream
dest
(
data
);
dest
.
SetUnbuffered
();
llvm
::
SmallString
<
8
>
data_ptx
,
data_ll
;
llvm
::
raw_svector_ostream
dest_ptx
(
data_ptx
),
dest_ll
(
data_ll
);
dest_ptx
.
SetUnbuffered
();
dest_ll
.
SetUnbuffered
();
llvm
::
legacy
::
PassManager
pass
;
CHECK
(
tm
->
addPassesToEmitFile
(
pass
,
dest
,
llvm
::
TargetMachine
::
CGFT_AssemblyFile
)
==
0
)
pass
,
dest
_ptx
,
llvm
::
TargetMachine
::
CGFT_AssemblyFile
)
==
0
)
<<
"Cannot emit target CGFT_ObjectFile"
;
pass
.
run
(
*
module
);
std
::
string
ptx
(
data
.
begin
(),
data
.
end
());
return
CUDAModuleCreate
(
ptx
,
"ptx"
,
ExtractFuncInfo
(
funcs
),
""
);
module
->
print
(
dest_ll
,
nullptr
);
std
::
string
ptx
(
data_ptx
.
begin
(),
data_ptx
.
end
());
std
::
string
ll
(
data_ll
.
begin
(),
data_ll
.
end
());
return
CUDAModuleCreate
(
ptx
,
"ptx"
,
ExtractFuncInfo
(
funcs
),
ll
);
}
TVM_REGISTER_API
(
"codegen.build_nvptx"
)
...
...
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