OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1722 Discussions

Bug in clCreateImage2D()

danielkoch
Beginner
871 Views
First - would love to see Windows x64 support.

Second - clCreateImage2D() crashes consistently, if CL_MEM_COPY_HOST_PTR is passed.

To repro, modify the GodRays sample. In GodRays.cpp, within ExecuteGodRaysKernel(), replace the first clCreateBuffer() call with the following lines:
[cpp]const cl_image_format imgfmt = { CL_RGBA, CL_FLOAT };
g_inputBuffer = clCreateImage2D(g_context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, &imgfmt, arrayWidth, arrayHeight, 0, inputArray, &err);
[/cpp]
You don't need to modify the .cl; you should see an access violation within clCreateImage2D(), in intelocl.dll at offset 0x4037b.
0 Kudos
1 Solution
jogshy
New Contributor I
871 Views
>>First - would love to see Windows x64 support.
The lastest SDK includes x64 support !!! Please, notice Intel refreshed the Alpha just a few days ago!

>>Second - clCreateImage2D() crashes consistently, if CL_MEM_COPY_HOST_PTR is passed.
Yep, it's strange... in theory should work with 0 but perhaps you could try to pass sizeof(cl_float4)*arrayWidth instead.

The CL 1.1 spec, section "5.3.1 Creating Image Objects" around page 74 is clear though, the image pitch could be zero and it should work:

image_row_pitch is the scan-line pitch in bytes. This must be 0 if host_ptr is NULL and can be
either 0 or >= image_width * size of element in bytes if host_ptr is not NULL. If host_ptr is not
NULL and image_row_pitch = 0, image_row_pitch is calculated as image_width * size of
element in bytes. If image_row_pitch is not 0, it must be a multiple of the image element size in
bytes

View solution in original post

0 Kudos
2 Replies
jogshy
New Contributor I
872 Views
>>First - would love to see Windows x64 support.
The lastest SDK includes x64 support !!! Please, notice Intel refreshed the Alpha just a few days ago!

>>Second - clCreateImage2D() crashes consistently, if CL_MEM_COPY_HOST_PTR is passed.
Yep, it's strange... in theory should work with 0 but perhaps you could try to pass sizeof(cl_float4)*arrayWidth instead.

The CL 1.1 spec, section "5.3.1 Creating Image Objects" around page 74 is clear though, the image pitch could be zero and it should work:

image_row_pitch is the scan-line pitch in bytes. This must be 0 if host_ptr is NULL and can be
either 0 or >= image_width * size of element in bytes if host_ptr is not NULL. If host_ptr is not
NULL and image_row_pitch = 0, image_row_pitch is calculated as image_width * size of
element in bytes. If image_row_pitch is not 0, it must be a multiple of the image element size in
bytes

0 Kudos
danielkoch
Beginner
871 Views
Please, notice Intel refreshed the Alpha just a few days ago!

Cool, didn't see that. x64! and they even fixed my clCreateImage2D() bug! Thanks guys.

Guess my report was just a few days late :-)

you could try to pass sizeof(cl_float4)*arrayWidth instead
Yeah, I did try that. Only thing that worked for me was switching to CL_MEM_USE_HOST_PTR instead of COPY. But it's fixed now, so I'm happy. Thanks for the heads-up.
0 Kudos
Reply