Skip to content

Commit ea8489f

Browse files
authored
ROCm: Allow setting compilation target (#2581)
1 parent 1b20639 commit ea8489f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

setup.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,15 @@ def get_torch_arch_list() -> Set[str]:
287287
},
288288
))
289289
elif _is_hip():
290-
amd_arch = get_amdgpu_offload_arch()
291-
if amd_arch not in ROCM_SUPPORTED_ARCHS:
292-
raise RuntimeError(
293-
f"Only the following arch is supported: {ROCM_SUPPORTED_ARCHS}"
294-
f"amdgpu_arch_found: {amd_arch}")
290+
amd_archs = os.getenv("GPU_ARCHS")
291+
if amd_archs is None:
292+
amd_archs = get_amdgpu_offload_arch()
293+
for arch in amd_archs.split(";"):
294+
if arch not in ROCM_SUPPORTED_ARCHS:
295+
raise RuntimeError(
296+
f"Only the following arch is supported: {ROCM_SUPPORTED_ARCHS}"
297+
f"amdgpu_arch_found: {arch}")
298+
NVCC_FLAGS += [f"--offload-arch={arch}"]
295299

296300
elif _is_neuron():
297301
neuronxcc_version = get_neuronxcc_version()

0 commit comments

Comments
 (0)