composable_kernel icon indicating copy to clipboard operation
composable_kernel copied to clipboard

[Issue]: Can't compile for debugging with -O0

Open cameronshinn opened this issue 1 year ago • 2 comments

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

cameronshinn avatar Mar 17 '24 20:03 cameronshinn

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.

illsilin avatar Mar 19 '24 15:03 illsilin

Just checked for any improvements with ROCm6.1. Still getting a bunch of compiler errors...

illsilin avatar May 14 '24 23:05 illsilin

@cameronshinn Internal ticket has been created to investigate this issue. Thanks!

ppanchad-amd avatar Aug 22 '24 19:08 ppanchad-amd

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?

alexxu-amd avatar Aug 28 '24 20:08 alexxu-amd

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.

alexxu-amd avatar Sep 11 '24 17:09 alexxu-amd

Thanks for fixing it, I haven't had time to test but if I run into it I'll re-open.

cameronshinn avatar Sep 11 '24 18:09 cameronshinn