Support TheRock LLVM layout in Windows HIP build script - #160
Conversation
|
Sorry! I've never used TheRock, so that didn't occur to me. I'm not familiar with it. I'll take a look at how it works tomorrow. Thanks for your PR! |
|
Validated this on Windows 11 with a TheRock nightly tarball instead of a source build, targeting a different GPU family: Environment Ryzen 7 7840U iGPU (gfx1103) Explicit -RocmPath C:\TheRock\7.15 configure: passed — clang is correctly picked up from lib\llvm\bin (fails on main with ROCm clang not found under C:\TheRock\7.15\bin, as expected) No resource compiler in TheRock tarballs. They ship neither llvm-rc nor windres, and CMake 4.x fails configure with No CMAKE_RC_COMPILER could be found. Workaround: run from a VS developer prompt, or set RC to the Windows SDK's rc.exe. MSVC ≥14.40 vs clang 23 HIP wrapper headers. Compiling any HIP TU that pulls fails with error: device function 'isgreater' cannot overload host device function 'isgreater' (and siblings). This is the known collision fixed upstream by llvm/llvm-project#201563, which TheRock's clang 23 does not yet carry. Workaround: apply the same one-file reorder to lib/llvm/lib/clang/23/include/__clang_hip_runtime_wrapper.h (move #include <__clang_cuda_math_forward_declares.h> above #include ). ROCm device libraries not found. The tarball keeps amdgcn/bitcode under lib\llvm, where clang 23 does not look; every HIP compile fails with cannot find ROCm device library. Workaround: a directory junction mklink /J C:\TheRock\7.15\amdgcn C:\TheRock\7.15\lib\llvm\amdgcn so $ROCM_PATH\amdgcn\bitcode resolves (same class of workaround as ROCm/TheRock#1979). One more observation in this PR's direct scope: amdgpu-arch.exe also lives in lib\llvm\bin in the TheRock layout, not bin, so the script's GPU auto-detection can't find it either — I had to pass -GpuTargets explicitly. Might be worth resolving it from $compilerDir instead of $RocmPath\bin, since you already compute that. |
|
@jamesweiym-ops Let me know when the PR is ready. |
|
@IIIIIllllIIIIIlllll I'd like to merge the PR. Is it safe to merge as is based on your tests? |
|
@0xShug0 No problem, safe, but I think we need to make it clear—users need to know how to handle the operations themselves, given that there can be differences between various versions of ROCm. But since they're using TheRock, I'm sure he can handle it. |
|
@IIIIIllllIIIIIlllll Thank! I'll update the docs later (let AI handle it) based on this PR and your feedback. |
|
@jamesweiym-ops @IIIIIllllIIIIIlllll PR merged! Thank you both! |
What changed
binandlib/llvm/binHIP_PATHor auto-discoveringC:\TheRock\buildPATHwhile keeping the ROCm runtimebindirectoryWhy
Current TheRock-based Windows ROCm packages place
hipcc.exeunderbin, but placeclang.exeandclang++.exeunderlib/llvm/bin. The Windows HIP build script previously required<ROCm>\bin\clang++.exe, so an otherwise valid TheRock install failed immediately with:The normal AMD HIP SDK layout remains preferred and unchanged.
Validation
Tested on Windows 11 with Ryzen AI MAX+ 395 / Radeon 8060S (
gfx1151):-RocmPath C:\TheRock\buildconfigure: passedHIP_PATH=C:\TheRock\builddetection: passed-GpuTargets gfx1151 -NoNativeCpu -DeploymentBuild -Target audiocpp_cli: passed (708 build steps)audiocpp_cli.exe --help: passedaudiocpp_cli.exe --list-loaders --json: passed