Skip to content

Commit ff74b5f

Browse files
authored
update to remove previously hard-coded rocprofiler-sdk path (#369)
* update to remove previously hard-coded rocprofiler-sdk path and add skip_rocprofiler_sdk to avoid loading `rocprofiler-sdk`
1 parent d65c2f6 commit ff74b5f

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

build_tools/lint/tags.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
"multi_gpu_h100": (
9595
"Used by `xla_test` to signal that multiple H100s are needed."
9696
),
97+
"skip_rocprofiler_sdk": "used to skip rocmtracer test as it calls rocprofiler-sdk via rocprofiler_force_configure",
9798
}
9899

99100

build_tools/rocm/run_xla.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ BAZEL_DISK_CACHE_DIR="/tf/disk_cache/rocm-jaxlib-v0.6.0"
6969
mkdir -p ${BAZEL_DISK_CACHE_DIR}
7070

7171
SCRIPT_DIR=$(realpath $(dirname $0))
72-
TAG_FILTERS=$($SCRIPT_DIR/rocm_tag_filters.sh),gpu,-multigpu,-multi_gpu_h100,requires-gpu-amd
72+
TAG_FILTERS=$($SCRIPT_DIR/rocm_tag_filters.sh),gpu,-multigpu,-multi_gpu_h100,requires-gpu-amd,-skip_rocprofiler_sdk
7373

7474
SANITIZER_ARGS=()
7575
if [[ $1 == "asan" ]]; then

third_party/gpus/rocm/BUILD.tpl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,19 @@ cc_library(
347347
deps = [":rocm_config"],
348348
)
349349

350+
cc_library(
351+
name = "rocprofiler-sdk",
352+
srcs = glob(["%{rocm_root}/lib/librocprofiler-sdk*.so*"]),
353+
hdrs = glob(["%{rocm_root}/include/rocprofiler-sdk/**"]),
354+
include_prefix = "rocm",
355+
includes = [
356+
"%{rocm_root}/include/",
357+
],
358+
strip_include_prefix = "%{rocm_root}",
359+
visibility = ["//visibility:public"],
360+
deps = [":rocm_config"],
361+
)
362+
350363
cc_library(
351364
name = "rocsolver",
352365
srcs = glob(["%{rocm_root}/lib/librocsolver*.so*"]),

third_party/gpus/rocm_configure.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ def _find_libs(repository_ctx, rocm_config, miopen_path, rccl_path, bash_bin):
341341
("rocsolver", rocm_config.rocm_toolkit_path),
342342
("hipfft", rocm_config.rocm_toolkit_path),
343343
("rocrand", rocm_config.rocm_toolkit_path),
344+
("rocprofiler-sdk", rocm_config.rocm_toolkit_path),
344345
]
345346
]
346347
if int(rocm_config.rocm_version_number) >= 40500:

xla/backends/profiler/gpu/BUILD

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,6 @@ cc_library(
246246
"manual",
247247
"rocm-only",
248248
],
249-
linkopts = [
250-
"-Wl,--no-as-needed",
251-
"-L/opt/rocm/lib",
252-
"-Wl,-rpath,/opt/rocm/lib",
253-
"-lhsa-runtime64",
254-
],
255249
deps = [
256250
"//xla/tsl/profiler/backends/cpu:annotation_stack",
257251
"//xla/tsl/profiler/utils:time_utils",
@@ -266,6 +260,7 @@ cc_library(
266260
"@tsl//tsl/platform:errors",
267261
"@tsl//tsl/platform:logging",
268262
"@tsl//tsl/platform:macros",
263+
"@local_config_rocm//rocm:rocprofiler-sdk",
269264
],
270265
visibility = ["//visibility:public"],
271266
)
@@ -274,13 +269,6 @@ cc_library(
274269
name = "rocm_collector",
275270
srcs = ["rocm_collector.cc"],
276271
hdrs = ["rocm_collector.h"],
277-
# copybara:uncomment compatible_with = ["//buildenv/target:non_prod"],
278-
linkopts = select({
279-
"//conditions:default": [
280-
"-L/opt/rocm/lib", # search path for all ROCm shared objects
281-
"-lrocprofiler-sdk", # the library that owns the missing symbols
282-
],
283-
}),
284272
tags = [
285273
"gpu",
286274
"rocm-only",
@@ -315,6 +303,7 @@ cc_library(
315303
"@tsl//tsl/platform:types",
316304
"@tsl//tsl/profiler/lib:profiler_factory",
317305
"@tsl//tsl/profiler/lib:profiler_interface",
306+
"@local_config_rocm//rocm:rocprofiler-sdk",
318307
],
319308
)
320309

@@ -401,6 +390,7 @@ xla_test(
401390
tags = [
402391
"gpu",
403392
"rocm-only",
393+
"skip_rocprofiler_sdk", # due to rocprofiler-sdk's rocprofiler_force_configure
404394
] + if_google([
405395
# Optional: only run internally if ROCm config is enabled
406396
"manual",

0 commit comments

Comments
 (0)