[ROCm][Windows] Revert copying hipblaslt and rocblas dirs. (#159083)

This reverts the changes from b367e5f6a6. This will also close https://github.com/pytorch/pytorch/pull/158922.

Since 30387ab2e4, ROCm is bootstrapped using the 'rocm' Python module which contains these files (see https://github.com/ROCm/TheRock/blob/main/docs/packaging/python_packaging.md), so they do not need to be bundled into torch/lib.

There was also a bug in here - if `ROCM_DIR` is unset, the code crashes:
```
  File "D:\projects\TheRock\external-builds\pytorch\.venv\Lib\site-packages\setuptools\_distutils\dist.py", line 1002, in run_command
    cmd_obj.run()
  File "D:\b\pytorch_main\setup.py", line 853, in run
    rocm_dir_path = Path(os.environ["ROCM_DIR"])
                         ~~~~~~~~~~^^^^^^^^^^^^
  File "<frozen os>", line 714, in __getitem__
KeyError: 'ROCM_DIR'
```
The code could have checked for `ROCM_PATH` too.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/159083
Approved by: https://github.com/jeffdaily
This commit is contained in:
Scott Todd
2025-08-12 02:45:46 +00:00
committed by PyTorch MergeBot
parent eed9dbf70f
commit bfc873d02e

View File

@ -1226,23 +1226,6 @@ class build_ext(setuptools.command.build_ext.build_ext):
target_dir.mkdir(parents=True, exist_ok=True)
self.copy_file(export_lib, target_lib)
# In ROCm on Windows case copy rocblas and hipblaslt files into
# torch/lib/rocblas/library and torch/lib/hipblaslt/library
if str2bool(os.getenv("USE_ROCM")):
rocm_dir_path = Path(os.environ["ROCM_DIR"])
rocm_bin_path = rocm_dir_path / "bin"
rocblas_dir = rocm_bin_path / "rocblas"
target_rocblas_dir = target_dir / "rocblas"
target_rocblas_dir.mkdir(parents=True, exist_ok=True)
self.copy_tree(rocblas_dir, str(target_rocblas_dir))
hipblaslt_dir = rocm_bin_path / "hipblaslt"
target_hipblaslt_dir = target_dir / "hipblaslt"
target_hipblaslt_dir.mkdir(parents=True, exist_ok=True)
self.copy_tree(hipblaslt_dir, str(target_hipblaslt_dir))
else:
report("The specified environment variable does not exist.")
def build_extensions(self) -> None:
self.create_compile_commands()