-
Notifications
You must be signed in to change notification settings - Fork 15.9k
[OFFLOAD] Build DeviceRTL with SPIRV backend #174675
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
Changes from all commits
996c2e1
5e746a8
3587050
84def59
5b6f225
dc78bad
e98cf56
40dfa28
2922a82
a18c339
ae099ba
db04823
802a65e
f2dbfa2
101fccd
7584cad
a660034
b79e42a
488209c
c5ac596
6366e0c
e090887
d50579f
7cc3270
af38777
4bd07fd
4ad7138
e66a4e4
867d96a
f92b77e
7e5e695
bb719be
b9875fd
e2cc882
5e20646
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ list(APPEND compile_options -fno-rtti) | |
| list(APPEND compile_options -fno-exceptions) | ||
| list(APPEND compile_options -fconvergent-functions) | ||
| list(APPEND compile_options -Wno-unknown-cuda-version) | ||
|
|
||
| if(LLVM_DEFAULT_TARGET_TRIPLE) | ||
| list(APPEND compile_options --target=${LLVM_DEFAULT_TARGET_TRIPLE}) | ||
| endif() | ||
|
|
@@ -52,6 +53,9 @@ elseif("${LLVM_DEFAULT_TARGET_TRIPLE}" MATCHES "^nvptx" OR | |
| "${CMAKE_CXX_COMPILER_TARGET}" MATCHES "^nvptx") | ||
| set(target_name "nvptx") | ||
| list(APPEND compile_options --cuda-feature=+ptx63) | ||
| elseif("${LLVM_DEFAULT_TARGET_TRIPLE}" MATCHES "^spirv64" OR | ||
| "${CMAKE_CXX_COMPILER_TARGET}" MATCHES "^spirv64") | ||
| set(target_name "spirv") | ||
| endif() | ||
|
|
||
| # Trick to combine these into a bitcode file via the linker's LTO pass. | ||
|
|
@@ -74,8 +78,15 @@ target_include_directories(libompdevice PRIVATE | |
| ${CMAKE_CURRENT_SOURCE_DIR}/../../libc | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/../../offload/include) | ||
| target_compile_options(libompdevice PRIVATE ${compile_options}) | ||
| target_link_options(libompdevice PRIVATE | ||
| "-flto" "-r" "-nostdlib" "-Wl,--lto-emit-llvm") | ||
| if(NOT "${LLVM_DEFAULT_TARGET_TRIPLE}" MATCHES "^spirv" AND | ||
| NOT "${CMAKE_CXX_COMPILER_TARGET}" MATCHES "^spirv") | ||
| target_link_options(libompdevice PRIVATE | ||
| "-flto" "-r" "-nostdlib" "-Wl,--lto-emit-llvm") | ||
| else() | ||
| target_link_options(libompdevice PRIVATE | ||
| "-nostdlib" "-emit-llvm") | ||
| endif() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why aren't we building the device RTL in LTO, as we do for the rest?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SPIRV backend doesn't support lto
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, what is the issue? We rely on LTO for performance, and without I doubt we can be competitive.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The library will get linked in and optimized somehow I'm sure, but the library itself gets no individual optimization step together. That definitely hurts performance, but the individual files are optimized so it's likely not catastrophic.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem is currently SPIR-V uses an out of tree linker |
||
|
|
||
| if(LLVM_DEFAULT_TARGET_TRIPLE) | ||
| target_link_options(libompdevice PRIVATE "--target=${LLVM_DEFAULT_TARGET_TRIPLE}") | ||
| endif() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary reordering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed