Repository: pytorch
Issue: Unable for CMake in setup.py to list anything OpenCL-ROCm
Labels: module: build,module: rocm,triaged

### Commands that are run to build PyTorch
```
python3.11 -m venv /opt/pyt2c1k/pyenv
source /opt/pyt2c1k/pyenv/bin/activate
export HSA_OVERRIDE_GFX_VERSION=9.0.0
export PATH=/opt/rocm/bin:$PATH
export LD_LIBRARY_PATH=/opt/rocm/lib:$LD_LIBRARY_PATH
export OpenCL_INCLUDE_DIR=/opt/rocm-6.3.0/include
export OpenCL_LIBRARY=/opt/rocm-6.3.0/lib/libOpenCL.so

git clone --recursive https://github.com/pytorch/pytorch.git PyTorch
cd PyTorch
git pull
git checkout main
git submodule sync
git submodule update --init --recursive
PIP_REQUIRE_VIRTUALENV=true python3.11 -m pip install setuptools ninja mkl-static mkl-include -r requirements.txt
doas rm -rf $(locate LibTorch|grep -Eie 'CMakeCache.txt|CMakeFiles')
PYTORCH_ROCM_ARCH=gfx90c USE_OPENCL=1 USE_CUDA=0 USE_CUDNN=0 USE_CUSPARSELT=0 USE_CUDSS=0 USE_CUFILE=0 BUILD_TEST=0 PROJECT_BINARY_DIR=/opt/LibTorch/MkTorch CFLAGS="-DCMAKE_C_FLAGS='-w',-DCMAKE_CXX_FLAGS='-w'" python3.11 setup.py clean
PYTORCH_ROCM_ARCH=gfx90c USE_OPENCL=1 USE_CUDA=0 USE_CUDNN=0 USE_CUSPARSELT=0 USE_CUDSS=0 USE_CUFILE=0 BUILD_TEST=0 PROJECT_BINARY_DIR=/opt/LibTorch/MkTorch CFLAGS="-DCMAKE_C_FLAGS='-w',-DCMAKE_CXX_FLAGS='-w'" python3.11 setup.py bdist_wheel
PIP_REQUIRE_VIRTUALENV=true python3.11 -m pip install dist/*.whl
python3.11 -c "import torch; print(torch.__version__)"

cd ..
git clone https://github.com/mlverse/torchvision.git TorchVision
cd TorchVision
git pull
git checkout main
PIP_REQUIRE_VIRTUALENV=true python3.11 -m pip install setuptools ninja -r requirements.txt
python3.11 setup.py clean
python3.11 setup.py bdist_wheel
PIP_REQUIRE_VIRTUALENV=true python3.11 -m pip install dist/*.whl

cd ..
git clone https://github.com/mlverse/torchaudio.git TorchAudio
cd TorchAudio
git pull
git checkout main
PIP_REQUIRE_VIRTUALENV=true python3.11 -m pip install setuptools ninja -r requirements.txt
python3.11 setup.py clean
python3.11 setup.py bdist_wheel
PIP_REQUIRE_VIRTUALENV=true python3.11 -m pip install dist/*.whl

cd ..
python3.11 -c "import torch; print(torch.__version__)"
python3.11 -c "import torchvision; print(torchvision.__version__)"
python3.11 -c "import torchaudio; print(torchaudio.__version__)"
echo "LibTorch, TorchVision, and TorchAudio installed successfully from my custom wheel files! :)"

```

### 🐛 Describe the bug

```INFOUSING OPENCL
-- Looking for CL_VERSION_3_0
-- Looking for CL_VERSION_3_0 - not found
-- Looking for CL_VERSION_2_2
-- Looking for CL_VERSION_2_2 - not found
-- Looking for CL_VERSION_2_1
-- Looking for CL_VERSION_2_1 - not found
-- Looking for CL_VERSION_2_0
-- Looking for CL_VERSION_2_0 - not found
-- Looking for CL_VERSION_1_2
-- Looking for CL_VERSION_1_2 - not found
-- Looking for CL_VERSION_1_1
-- Looking for CL_VERSION_1_1 - not found
-- Looking for CL_VERSION_1_0
-- Looking for CL_VERSION_1_0 - not found
CMake Error at /opt/pyt2c1k/pyenv/lib/python3.11/site-packages/cmake/data/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find OpenCL (missing: OpenCL_INCLUDE_DIR)
Call Stack (most recent call first):
  /opt/pyt2c1k/pyenv/lib/python3.11/site-packages/cmake/data/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
  /opt/pyt2c1k/pyenv/lib/python3.11/site-packages/cmake/data/share/cmake-3.31/Modules/FindOpenCL.cmake:177 (find_package_handle_standard_args)
  cmake/Dependencies.cmake:761 (find_package)
  CMakeLists.txt:865 (include)


-- Configuring incomplete, errors occurred!
WARNING: Requirement 'dist/*.whl' looks like a filename, but the file does not exist
ERROR: *.whl is not a valid wheel filename.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/local/.B/terminal/AI/LibTorch/PyTorch/torch/__init__.py", line 77, in <module>
    from torch.torch_version import __version__ as __version__
  File "/opt/local/.B/terminal/AI/LibTorch/PyTorch/torch/torch_version.py", line 4, in <module>
    from torch.version import __version__ as internal_version
ModuleNotFoundError: No module named 'torch.version'
```

### Versions

```
Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Artix Linux (x86_64)
GCC version: (GCC) 14.2.1 20240910
Clang version: 18.1.8
CMake version: version 3.31.2
Libc version: glibc-2.40

Python version: 3.11.9 (main, Jul  9 2024, 00:31:01) [GCC 14.1.1 20240522] (64-bit runtime)
Python platform: Linux-6.12.5-lqx1-1-lqx-x86_64-with-glibc2.40
Is CUDA available: N/A
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

CPU:
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        48 bits physical, 48 bits virtual
Byte Order:                           Little Endian
CPU(s):                               16
On-line CPU(s) list:                  0-15
Vendor ID:                            AuthenticAMD
Model name:                           AMD Ryzen 7 PRO 4750G with Radeon Graphics
CPU family:                           23
Model:                                96
Thread(s) per core:                   2
Core(s) per socket:                   8
Socket(s):                            1
Stepping:                             1
Frequency boost:                      enabled
CPU(s) scaling MHz:                   19%
CPU max MHz:                          4454.0000
CPU min MHz:                          400.0000
BogoMIPS:                             7186.09
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca
Virtualization:                       AMD-V
L1d cache:                            256 KiB (8 instances)
L1i cache:                            256 KiB (8 instances)
L2 cache:                             4 MiB (8 instances)
L3 cache:                             8 MiB (2 instances)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-15
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Mitigation; untrained return thunk; SMT enabled with STIBP protection
Vulnerability Spec rstack overflow:   Mitigation; Safe RET
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Retpolines; IBPB conditional; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

Versions of relevant libraries:
[pip3] numpy==2.2.0
[pip3] optree==0.13.1
[conda] Could not collect
```

cc @malfet @seemethere @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @dllehr-amd @jataylo @hongxiayang @naromero77amd