Skip to content

Commit 03b77a7

Browse files
PR #32439: [ROCm] Fix and enable xla_gpu_use_embeded_device_lib and xla_gpu_use_…
Imported from GitHub PR #32439 …inprocess_lld 📝 Summary of Changes Enable embedded device libs and in-process lld by default. 🎯 Justification Moves amdgpu backend to be more filesystem layout independent. 🚀 Kind of Contribution 🐛 Bug Fix 📊 Benchmark (for Performance Improvements) N\A 🧪 Unit Tests: None 🧪 Execution Tests: None Copybara import of the project: -- 46a1003 by Dragan Mladjenovic <Dragan.Mladjenovic@amd.com>: [ROCm] Fix and enable xla_gpu_use_embeded_device_lib and xla_gpu_use_inprocess_lld Merging this change closes #32439 FUTURE_COPYBARA_INTEGRATE_REVIEW=#32439 from ROCm:enable_bitcode_lld 46a1003 PiperOrigin-RevId: 824375626
1 parent 6bce0b8 commit 03b77a7

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

xla/BUILD

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ load("//third_party/compute_library:build_defs.bzl", "if_enable_acl")
44
# copybara:uncomment load("@rules_python//python:proto.bzl", "py_proto_library")
55
load("//xla:package_groups.bzl", "xla_package_groups")
66
load("//xla:xla.default.bzl", "xla_bzl_library", "xla_cc_test", "xla_py_proto_library")
7-
load("//xla/tsl:tsl.bzl", "if_google", "internal_visibility")
7+
load("//xla/tsl:tsl.bzl", "if_google", "if_oss", "internal_visibility")
88
load("//xla/tsl:tsl.default.bzl", "filegroup", "get_compatible_with_portable")
99
load(
1010
"//xla/tsl/platform:build_config.bzl",
@@ -1215,7 +1215,12 @@ cc_library(
12151215
"debug_options_parsers.h",
12161216
],
12171217
hdrs = ["debug_options_flags.h"],
1218-
copts = if_enable_acl(["-DXLA_CPU_USE_ACL=1"]),
1218+
copts = if_enable_acl([
1219+
"-DXLA_CPU_USE_ACL=1",
1220+
]) + if_oss([
1221+
"-DHAS_SUPPORT_FOR_LLD_AS_A_LIBRARY=1",
1222+
"-DHAS_SUPPORT_FOR_EMBEDDED_LIB_DEVICE=1",
1223+
]),
12191224
visibility = internal_visibility([":friends"]),
12201225
deps =
12211226
[

xla/debug_options_flags.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,14 @@ DebugOptions DefaultDebugOptionsIgnoringFlags() {
389389
const int64_t kDefaultMinGemmRewriteSize = 100;
390390
opts.set_xla_gpu_gemm_rewrite_size_threshold(kDefaultMinGemmRewriteSize);
391391

392+
#ifdef HAS_SUPPORT_FOR_EMBEDDED_LIB_DEVICE
393+
opts.set_xla_gpu_use_embeded_device_lib(true);
394+
#endif
395+
396+
#ifdef HAS_SUPPORT_FOR_LLD_AS_A_LIBRARY
397+
opts.set_xla_gpu_use_inprocess_lld(true);
398+
#endif
399+
392400
opts.set_xla_gpu_use_memcpy_local_p2p(false);
393401

394402
opts.set_xla_reduce_window_rewrite_base_length(16);

xla/service/gpu/llvm_gpu_backend/generate_amdgpu_device_lib_data_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def main():
7575
7676
namespace {cpp_namespace} {{
7777
inline const char kRaw_{cpp_identifier}[] = "{data_string}";
78-
constexpr llvm::StringRef {cpp_identifier}{{kRaw_{cpp_identifier}, sizeof(kRaw_{cpp_identifier})}};
78+
constexpr llvm::StringRef {cpp_identifier}{{kRaw_{cpp_identifier}, sizeof(kRaw_{cpp_identifier}) - 1}};
7979
}} // namespace {cpp_namespace}
8080
""")
8181

0 commit comments

Comments
 (0)