TheRock: [Windows] hipcc is looking for tools, headers, and libraries in the wrong places

On Linux, one can use hipcc from TheRock’s build directory like hipcc hello.cpp -o hello as expected. On Windows, hipcc fails looking for clang++ and lld:

D:\therock-output-gfx1036\build\dist\rocm\bin\hipcc.exe -Og .\hello.cpp -c -o .\hello.o
'D:\therock-output-gfx1036\build\dist\rocm\bin\clang++' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.
'nvcc' is not recognized as an internal or external command,
operable program or batch file.
Device not supported - Defaulting to AMD

To successfully build hip test program, I have to:

  1. Make a symlink to clang++ and place it next to hipcc.exe in dist\rocm\bin (Tools)
  2. Explicitly pass -I to dist\rocm\include, which should be in the default header search path (Headers)
  3. Explicitly pass -L to the directory containing amdhip64.lib, which is not placed under dist\rocm\lib (Libraries)
    • All .lib files should probably be installed in dist\rocm\lib
\therock-output\build\dist\rocm\bin\hipcc -c -Og --driver-mode=g++ -D__HIP_PLATFORM_AMD__ --offload-arch=$AMD_GPU_FAMILY -I D:\therock-output-gfx1036\build\dist\rocm\include .\hello.cpp -o hello.o      
\therock-output\build\dist\rocm\lib\llvm\bin\clang.exe -Og --driver-mode=g++ --offload-arch=$AMD_GPU_FAMILY -D__HIP_PLATFORM_AMD__ -L D:\therock-output\build\core\clr\dist\lib .\hello.o -lamdhip64 -o hello.exe

hipcc -v logs from Windows and Linux attached.

hipcc-v-windows.log

hipcc-linux.log

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (12 by maintainers)

Commits related to this issue

Most upvoted comments

I was able to workaround this by setting HIP_CLANG_PATH to <therock_build_dir>/dist/rocm/lib/llvm/bin. It’s likely that the hipcc.pl script is incorrectly setting the default HIP_CLANG_PATH

This is still using the legacy locations for the compiler tools vs in lib/llvm/bin. On Linux, we install some backward compat symlinks. We should just send a patch that updates it to the right paths across the board.

#422 fixes the bug that was keeping .lib files from installing.

We’re going to have the same directory layout between Linux/Windows. The old layout and windows paths just haven’t been updated.

The choices that hipsdk made were not synchronized with where anything else was going, so we’ll just fix forward to the right layout.

@jammm , some current if (isWindows()) code in hipBin_amd.h etc does not look compatible with the dist\rocm tree layout of TheRock to me.

Since TheRock has the same layout on Windows as Linux, I think everyone adopting that would be easier but I’ll defer to you guys as I don’t know the internal AMD stakeholders.

Yeah I’m not sure either. If the AMD provided HIP SDK installs into rocm/bin instead of rocm/lib/llvm/bin, that would explain this isWindows thing.

Regardless, we could either have your diff as a patch applied while building TheRock, or have TheRock itself building llvm binaries into the new path. I’m leaning towards having them unified, but differing from what AMD has done might break things down the road, so not sure… though at the moment, nothing seems broken yet as long as you have the correct HIP_CLANG_PATH set.