Skip to content

Commit 39c8abd

Browse files
authored
Patch rocm (#1583)
* Patch rocm * Fix formatting in workspace.bzl for patch commands * fix
1 parent b348d4a commit 39c8abd

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

patches/xla.patch

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
diff --git a/third_party/rocm_device_libs/rocm_device_libs.BUILD b/third_party/rocm_device_libs/rocm_device_libs.BUILD
2+
index 11795b3537..c6e953d577 100644
3+
--- a/third_party/rocm_device_libs/rocm_device_libs.BUILD
4+
+++ b/third_party/rocm_device_libs/rocm_device_libs.BUILD
5+
@@ -28,35 +28,24 @@ cc_binary(
6+
)
7+
8+
bitcode_library(
9+
- name = "ocml",
10+
+ name = "ockl",
11+
srcs = glob([
12+
"ocml/src/*.cl",
13+
+ "ockl/src/*.cl",
14+
+ "ockl/src/*.ll",
15+
]),
16+
hdrs = glob([
17+
"ocml/src/*.h",
18+
"ocml/inc/*.h",
19+
"irif/inc/*.h",
20+
- "oclc/inc/*.h",
21+
+ "oclc/inc/*.h",
22+
+ "ockl/inc/*.h",
23+
]),
24+
file_specific_flags = {
25+
"native_logF.cl": ["-fapprox-func"],
26+
"native_expF.cl": ["-fapprox-func"],
27+
"sqrtF.cl": ["-cl-fp32-correctly-rounded-divide-sqrt"],
28+
- },
29+
-)
30+
-
31+
-bitcode_library(
32+
- name = "ockl",
33+
- srcs = glob([
34+
- "ockl/src/*.cl",
35+
- "ockl/src/*.ll",
36+
- ]),
37+
- hdrs = glob([
38+
- "ockl/inc/*.h",
39+
- "irif/inc/*.h",
40+
- "oclc/inc/*.h",
41+
- ]),
42+
- file_specific_flags = {
43+
"gaaf.cl": ["-munsafe-fp-atomics"],
44+
},
45+
)
46+
+
47+
diff --git a/xla/service/gpu/llvm_gpu_backend/BUILD b/xla/service/gpu/llvm_gpu_backend/BUILD
48+
index 101b0580e1..1df2b6accb 100644
49+
--- a/xla/service/gpu/llvm_gpu_backend/BUILD
50+
+++ b/xla/service/gpu/llvm_gpu_backend/BUILD
51+
@@ -130,7 +130,6 @@ genrule(
52+
name = "generate_amdgpu_device_lib_data",
53+
srcs = [
54+
"@rocm_device_libs//:ockl",
55+
- "@rocm_device_libs//:ocml",
56+
],
57+
outs = ["amdgpu_device_lib_data.h"],
58+
cmd = "$(location {}) --llvm_link_bin $(location {}) $(SRCS) -o $@ --cpp_identifier=kAMDGPUDeviceLibData".format(

third_party/xla/workspace.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ def repo(extra_patches = [], override_commit = ""):
1717
strip_prefix = "openxla-xla-{commit}".format(commit = commit[:7]),
1818
urls = ["https://api.github.com/repos/openxla/xla/tarball/{commit}".format(commit = commit)],
1919
patch_cmds = XLA_PATCHES + extra_patches,
20+
patches = ["//:patches/xla.patch"],
21+
patch_args = ["-p1"],
2022
)

0 commit comments

Comments
 (0)