[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Question about how to handle HIP vs hipamd



I assume the Debian package excludes .hipInfo and .hipVersion? I was looking into where to move those files, but I was more focused on the patches for the ROCclr and HIP, since those are bigger blockers for Fedora.

On May 17, 2022 12:18:18 a.m. EDT, Cordell Bloor <cgmb-deb@slerp.xyz> wrote:

It's a beautiful day, Étienne.

On 2022-05-16 12:31, Étienne Mollier wrote:
I could work around the issue with dos2unix on oclperf.exclude
while patches are unapplied, and commiting that change (and not
pushing it back to salsa).  You should the be able to reproduce
the __managed__ issue once this is done.

Perfect. I took the failing command

export HIP_CLANG_PATH=/usr/bin
export ROCM_PATH=/usr
export DEVICE_LIB_PATH=/usr/lib/x86_64-linux-gnu/amdgcn/bitcode
export HIP_CLANG_HCC_COMPAT_MODE=1
export HIPCC_VERBOSE=7
/home/cgmb/rocm-hipamd/obj-x86_64-linux-gnu/bin/hipcc -c /home/cgmb/rocm-hipamd/hip/tests/src/runtimeApi/memory/hipManagedKeyword.cpp -o /home/cgmb/rocm-hipamd/obj-x86_64-linux-gnu/CMakeFiles/directed_tests.runtimeApi.memory.hipManagedKeyword.dir/hip/tests/src/runtimeApi/memory/./directed_tests.runtimeApi.memory.hipManagedKeyword_generated_hipManagedKeyword.cpp.o -I/home/cgmb/rocm-hipamd/include -I/home/cgmb/rocm-hipamd/hip/tests/src -I/home/cgmb/rocm-hipamd/hip/tests/unit -I/home/cgmb/rocm-hipamd/hip/tests/performance -I/home/cgmb/rocm-hipamd/include -I/home/cgmb/rocm-hipamd/hip/tests/src --offload-arch=gfx906

then added -v and compared the printed include path list against the list I got when using the AMD packages from the ROCm 5.0.2 release. One thing I noticed is that the upstream releases had cuda_wrappers included and your example did not. When I looked through the logic for that in clang, I noticed a conditional that affects both the __clang_hip_runtime_wrapper.h and the cuda_wrappers [1].

It seems the problem is the HIP version detection. Without a .hipInfo file, clang doesn't know what version of HIP it is using. It skips the wrapper because it thinks that HIP is too old. The simplest fix for this is probably to explicitly pass --hip-version=5.0.0 to clang. I used the HIPCC_COMPILE_FLAGS_APPEND and HIPCC_LINK_FLAGS_APPEND environment variables for that purpose.

I encountered one final linking error in a test and resolved it by installing librocmsmi64-1. Then, I had a successful build!

...though, I haven't actually tried running the tests on a machine with a GPU.

Sincerely,
Cory Bloor

[1]: https://github.com/llvm/llvm-project/blob/llvmorg-14.0.3/clang/lib/Driver/ToolChains/AMDGPU.cpp#L481-L482


Reply to: