Skip to content

Commit ddf75a1

Browse files
authored
Remove CUDA from PyTorch/XLA build. (#9609)
This PR removes the CUDA specific build related source code. This is in line with the CUDA deprecation that started on release 2.8. **Key Changes:** - (`.bazelrc`) Removed CUDA specific environment variables - (`WORKSPACE`) Removed CUDA dependencies and CUDA specific OpenXLA patches - (`BUILD` files) Removed CUDA specific build dependencies
1 parent 94fdadc commit ddf75a1

File tree

6 files changed

+13
-70
lines changed

6 files changed

+13
-70
lines changed

.bazelrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ build:short_logs --output_filter=DONT_MATCH_ANYTHING
9191
#build:tpu --@xla//xla/python:enable_tpu=true
9292
build:tpu --define=with_tpu_support=true
9393

94-
# Run tests serially with TPU and GPU (only 1 device is available).
94+
# Run tests serially with TPU (only 1 device is available).
9595
test:tpu --local_test_jobs=1
9696

9797
#########################################################################
@@ -100,11 +100,11 @@ test:tpu --local_test_jobs=1
100100
common --experimental_repo_remote_exec
101101

102102
# Inherit environmental variables that are used in testing.
103-
test --test_env=TPU_NUM_DEVICES --test_env=GPU_NUM_DEVICES --test_env=CPU_NUM_DEVICES --test_env=XRT_LOCAL_WORKER
103+
test --test_env=TPU_NUM_DEVICES --test_env=CPU_NUM_DEVICES --test_env=XRT_LOCAL_WORKER
104104
test --test_env=XRT_TPU_CONFIG --test_env=XRT_DEVICE_MAP --test_env=XRT_WORKERS --test_env=XRT_MESH_SERVICE_ADDRESS
105105
test --test_env=XRT_SHARD_WORLD_SIZE --test_env=XRT_MULTI_PROCESSING_DEVICE --test_env=XRT_HOST_ORDINAL --test_env=XRT_SHARD_ORDINAL
106106
test --test_env=XRT_START_LOCAL_SERVER --test_env=TPUVM_MODE --test_env=PJRT_DEVICE --test_env=PJRT_TPU_MAX_INFLIGHT_COMPUTATIONS
107-
test --test_env=PJRT_CPU_ASYNC_CLIENT --test_env=PJRT_GPU_ASYNC_CLIENT --test_env=TPU_LIBRARY_PATH --test_env=PJRT_DIST_SERVICE_ADDR
107+
test --test_env=PJRT_CPU_ASYNC_CLIENT --test_env=TPU_LIBRARY_PATH --test_env=PJRT_DIST_SERVICE_ADDR
108108
test --test_env=PJRT_LOCAL_PROCESS_RANK
109109

110110
# This environmental variable is important for properly integrating with XLA.

BUILD

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
load(
2-
"@xla//xla/tsl/platform/default:cuda_build_defs.bzl",
3-
"if_cuda_is_configured",
4-
)
5-
61
load("@python//:defs.bzl", "compile_pip_requirements")
72
load("@python_version_repo//:py_version.bzl", "REQUIREMENTS")
83

@@ -41,9 +36,7 @@ cc_binary(
4136
"@torch//:libtorch",
4237
"@torch//:libtorch_cpu",
4338
"@torch//:libtorch_python",
44-
] + if_cuda_is_configured([
45-
"@xla//xla/stream_executor:cuda_platform",
46-
]),
39+
],
4740
)
4841

4942
test_suite(

WORKSPACE

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ http_archive(
5656
],
5757
patch_tool = "patch",
5858
patches = [
59-
"//openxla_patches:gpu_nvml.diff",
60-
"//openxla_patches:gpu_race_condition.diff",
6159
"//openxla_patches:no_fortify.diff",
6260
],
6361
strip_prefix = "xla-" + xla_hash,
@@ -142,16 +140,16 @@ load("@xla//:workspace0.bzl", "xla_workspace0")
142140
xla_workspace0()
143141

144142

143+
# Even though we don't support XLA:CUDA anymore, we still need to keep the
144+
# following. The reason being that `pjrt_computation_client_test` depends on
145+
# `@xla//xla/tools`, which calls:
146+
#
147+
# ```
148+
# load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda")`
149+
# ```
145150
load(
146151
"@xla//third_party/gpus:cuda_configure.bzl",
147152
"cuda_configure",
148153
)
149154

150155
cuda_configure(name = "local_config_cuda")
151-
152-
load(
153-
"@xla//third_party/nccl:nccl_configure.bzl",
154-
"nccl_configure",
155-
)
156-
157-
nccl_configure(name = "local_config_nccl")

openxla_patches/gpu_nvml.diff

Lines changed: 0 additions & 26 deletions
This file was deleted.

openxla_patches/gpu_race_condition.diff

Lines changed: 0 additions & 14 deletions
This file was deleted.

torch_xla/csrc/runtime/BUILD

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ load(
22
"//bazel:rules_def.bzl",
33
"ptxla_cc_test",
44
)
5-
load(
6-
"@xla//xla/tsl/platform/default:cuda_build_defs.bzl",
7-
"if_cuda_is_configured",
8-
)
95

106
licenses(["notice"]) # Apache 2.0
117

@@ -134,7 +130,6 @@ cc_library(
134130
"@xla//xla:shape_util",
135131
"@xla//xla/hlo/builder:xla_computation",
136132
"@xla//xla/pjrt:pjrt_client",
137-
"@xla//xla/pjrt/c:pjrt_c_api_gpu_extension_hdrs",
138133
"@xla//xla/pjrt/c:pjrt_c_api_hdrs",
139134
"@xla//xla/pjrt/c:pjrt_c_api_wrapper_impl",
140135
"@xla//xla/pjrt:pjrt_c_api_client",
@@ -216,10 +211,9 @@ cc_library(
216211
"@torch//:headers",
217212
"@com_google_absl//absl/log:absl_check",
218213
"@com_google_absl//absl/log:initialize",
214+
"@xla//xla/pjrt/distributed:in_memory_key_value_store",
219215
"@xla//xla/pjrt:pjrt_c_api_client",
220216
"@xla//xla/pjrt:tfrt_cpu_pjrt_client",
221-
"@xla//xla/pjrt/gpu:se_gpu_pjrt_client",
222-
"@xla//xla/service:gpu_plugin",
223217
],
224218
)
225219

@@ -295,9 +289,7 @@ cc_library(
295289
deps = [
296290
"@xla//xla/backends/profiler/cpu:host_tracer",
297291
"@xla//xla/backends/profiler/cpu:metadata_collector",
298-
] + if_cuda_is_configured([
299-
"@xla//xla/backends/profiler/gpu:device_tracer",
300-
]),
292+
],
301293
alwayslink = True,
302294
)
303295

0 commit comments

Comments
 (0)