Skip to content

[opencl] printf will lead to clCreateKernel exception  #121

@qiji2023

Description

@qiji2023

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 < num; t += tnum) {
       out[t] = out[t] * t + out[t]&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??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions