-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR #11424: [XLA:GPU] Add SPIRV-LLVM-Translator and translation pass
Imported from GitHub PR openxla/xla#11424 It is a sub PR of openxla/xla#9042 to add spirv-llvm-translator and translation pass Copybara import of the project: -- 6d8ce76e2b71120106ffae91945df9b974e74dec by Sheng, Yang <[email protected]>: Add SPIRV-LLVM-Translator and translation pass update comments and SPIRV-LLVM-Translator commit Merging this change closes #11424 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#11424 from Intel-tensorflow:yang/llvm-spirv 6d8ce76e2b71120106ffae91945df9b974e74dec PiperOrigin-RevId: 660816063
- Loading branch information
1 parent
c0191b4
commit 1e3e93a
Showing
5 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package( | ||
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"], | ||
default_visibility = ["//visibility:public"], | ||
licenses = ["notice"], | ||
) | ||
|
||
# spirv_llvm_translator license placeholder |
34 changes: 34 additions & 0 deletions
34
third_party/spirv_llvm_translator/spirv_llvm_translator.BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
cc_library( | ||
name = "spirv_llvm_translator", | ||
srcs = glob([ | ||
"lib/SPIRV/libSPIRV/*.cpp", | ||
"lib/SPIRV/libSPIRV/*.hpp", | ||
"lib/SPIRV/libSPIRV/*.h", | ||
"lib/SPIRV/Mangler/*.cpp", | ||
"lib/SPIRV/Mangler/*.h", | ||
"lib/SPIRV/*.cpp", | ||
"lib/SPIRV/*.hpp", | ||
"lib/SPIRV/*.h", | ||
]), | ||
hdrs = glob(["include/*"]), | ||
includes = [ | ||
"include/", | ||
"lib/SPIRV/", | ||
"lib/SPIRV/Mangler/", | ||
"lib/SPIRV/libSPIRV/", | ||
], | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"@llvm-project//llvm:Analysis", | ||
"@llvm-project//llvm:BitWriter", | ||
"@llvm-project//llvm:CodeGen", | ||
"@llvm-project//llvm:Core", | ||
"@llvm-project//llvm:Demangle", | ||
"@llvm-project//llvm:IRReader", | ||
"@llvm-project//llvm:Linker", | ||
"@llvm-project//llvm:Passes", | ||
"@llvm-project//llvm:Support", | ||
"@llvm-project//llvm:TransformUtils", | ||
"@spirv_headers//:spirv_cpp_headers", | ||
], | ||
) |
25 changes: 25 additions & 0 deletions
25
third_party/spirv_llvm_translator/spirv_llvm_translator.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
diff --git a/lib/SPIRV/SPIRVInternal.h b/lib/SPIRV/SPIRVInternal.h | ||
index a828add8..924e13b4 100644 | ||
|
||
Spir backend uses different addrspace representations link with nvptx backend link. | ||
We reorder the enum value here so that we can make XLA LLVM codegen simple(avoiding | ||
changing addrspace based on device backend everywhere) | ||
|
||
--- a/lib/SPIRV/SPIRVInternal.h | ||
+++ b/lib/SPIRV/SPIRVInternal.h | ||
@@ -179,11 +179,12 @@ typedef SPIRVMap<Op, Op, IntBoolOpMapId> IntBoolOpMap; | ||
"-v512:512:512-v1024:1024:1024" | ||
|
||
enum SPIRAddressSpace { | ||
- SPIRAS_Private, | ||
+ SPIRAS_Generic, | ||
SPIRAS_Global, | ||
- SPIRAS_Constant, | ||
+ SPIRAS_Internal, | ||
SPIRAS_Local, | ||
- SPIRAS_Generic, | ||
+ SPIRAS_Constant, | ||
+ SPIRAS_Private, | ||
SPIRAS_GlobalDevice, | ||
SPIRAS_GlobalHost, | ||
SPIRAS_Input, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters