GPU Compute Software
Ask questions about Intel® Graphics Compute software technologies, such as OpenCL* GPU driver and oneAPI Level Zero
153 Discussions

Intel GPU OpenCL with g++ -O3 flag.

luisgo007
Beginner
1,640 Views

Dear All,

 

I have a dynamic library (XXX.so) with a OpenCL kernel.

When I compile the library without -O3 flag the kernel works Ok.

When I compile with the -O3 flag I obtain the follow error from the run of the kernel.

-54 CL_INVALID_WORK_GROUP_SIZE

 

g++ -c -march=native -O3 -fPIC AoA.cpp -o AoA.o
g++ -shared -march=native -o AoA.so AoA.o -L/usr/lib -llapack -lblas -lOpenCL

Is this normal?

Thanks,

 

Luís Gonçalves

 

0 Kudos
3 Replies
Ben_A_Intel
Employee
1,621 Views

Can you see what the arguments are to the call to clEnqueueNDRangeKernel that is generating the error when your program is compiled with -O3?  Are they different than when your program is compiled with -O2?

You might be able to do this with the debugger,  or you can use a tool like the OpenCL Intercept Layer to generate an API "call log":

https://github.com/intel/opencl-intercept-layer

https://github.com/intel/opencl-intercept-layer/blob/main/docs/controls.md#calllogging-bool

I'm guessing that aggressive compiler optimizations are causing the local_work_size to be something other than what you are expecting, which is causing the OpenCL driver to return an error.

0 Kudos
luisgo007
Beginner
1,604 Views

With -O2 happens the same.

I try to put the variables "static" but did not worked as well.

And It also does not accept "volatile" because of incompability of types. 

g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

0 Kudos
luisgo007
Beginner
1,583 Views

I had a bug. Compiles ok with -O3. Sorry.

0 Kudos
Reply