radeon_gpu_analyzer icon indicating copy to clipboard operation
radeon_gpu_analyzer copied to clipboard

[opencl] `printf` will lead to clCreateKernel exception

Open qiji2023 opened this issue 1 year ago • 1 comments

I wrote a opencl code , such as:

#pragma OPENCL EXTENSION cl_amd_printf : enable

__kernel void test_ker(__global int* out, int num) {
    int tid = get_global_id(0);
    int tnum = get_global_size(0);

     if (tid == 0) {
         printf("hello**************************");
     }

    for (int t = tid; t 

I Compiled the code by rga using the command:

rga -s opencl -c gfx1030 --O2 -b a.bin test.cl

when I executed the kernel, I got the error:

unknown file: Failure
C++ exception with description "clCreateKernel" thrown in the test body.

but if I remove printf, the kernel will run successfully, so How should I print something inside the kernel??

qiji2023 avatar Oct 22 '24 09:10 qiji2023

Hi @qiji2023,

Thanks for reporting this issue.

Can you please set the following environment variables, then rerun and share the stderr output?

  • AMD_LOG_LEVEL=7
  • AMD_COMGR_EMIT_VERBOSE_LOGS=1

AmitBM avatar Nov 06 '24 21:11 AmitBM