[Issue]: Can't compile for debugging with -O0
Problem Description
I currently am unable to compile for debugging with -O0. When I add that flag, I get an error "error: Illegal instruction detected: Operand has incorrect register class.". The errors span various lines within include/ck/utility/amd_buffer_addressing.hpp.
I found a comment about this in another issue here. The fix is to disable CK_USE_AMD_BUFFER_LOAD and CK_USE_AMD_BUFFER_STORE in ck.hpp. That allows me to successfully compile, but when I run my program I get segfaults.
Operating System
Ubuntu 22.04.4 LTS (Jammy Jellyfish)
CPU
AMD EPYC 7402 24-Core Processor
GPU
AMD Instinct MI210
Other
No response
ROCm Version
ROCm 6.0.0
ROCm Component
Composable Kernel
Steps to Reproduce
Commands:
mkdir build && cd build
cmake -D CMAKE_PREFIX_PATH=/opt/rocm -D CMAKE_CXX_COMPILER=/opt/rocm/bin/hipcc -D CMAKE_BUILD_TYPE=Debug -D GPU_TARGETS=gfx90a -D CMAKE_CXX_FLAGS_DEBUG="-g -O0" .. # Specifically the CMAKE_CXX_FLAGS_DEBUG
make -j example_gemm_xdl
Output: compile_example_gemm_xdl.txt
(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support
No response
Additional Information
No response
In general, clang does not handle debug compilation with -O0 optimization level very well. The compiler team has been working on this issue for quite some time. I think some of the fixes should become available in the next ROCm release.
Just checked for any improvements with ROCm6.1. Still getting a bunch of compiler errors...
@cameronshinn Internal ticket has been created to investigate this issue. Thanks!
Hi @cameronshinn ,
I was able to compile example_gemm_xdl with the debugging flag -D CMAKE_CXX_FLAGS_DEBUG="-g -O0" on ROCm 6.2. I'm using Clang 18.0.0 and cmake 3.22.1. Could you please try upgrading ROCm to 6.2 and re-compile to see if the problem still persists?
Closing the issue now as example_gemm_xdl does seem to compile with the debugging flag on ROCm 6.2. @cameronshinn Feel free to reopen the issue if you are still not able to compile with ROCm 6.2 on your end. I'd be happy to assist.
Thanks for fixing it, I haven't had time to test but if I run into it I'll re-open.