image3d_t segfault

Hi,
I’m using ;
Developer Drivers for Linux (260.24)
cudatoolkit_3.2.9_linux_64_ubuntu10.04.run

consider this kernel :
__kernel void render(__read_only image3d_t volume)
{
// read from 3D texture
float4 voxel = read_imagef(volume, volumeSampler, (float4)(1.0f,1.0f,1.0f,1.0f));

// whatever

}

If read_image_f is not called, ciErrNum = clBuildProgram(cpProgram, 0, NULL, NULL, NULL, NULL); segfault!

Hi,
I’m using ;
Developer Drivers for Linux (260.24)
cudatoolkit_3.2.9_linux_64_ubuntu10.04.run

consider this kernel :
__kernel void render(__read_only image3d_t volume)
{
// read from 3D texture
float4 voxel = read_imagef(volume, volumeSampler, (float4)(1.0f,1.0f,1.0f,1.0f));

// whatever

}

If read_image_f is not called, ciErrNum = clBuildProgram(cpProgram, 0, NULL, NULL, NULL, NULL); segfault!

Unfortunately NVidia OpenCL compiler doesn’t give you error messages what’s wrong with your code, it only crashes :angry: Change your code to become syntax right. Define volumeSampler and compilation runs fine after that.

consider this kernel :
__kernel void render(__read_only image3d_t volume)
{
const volumeSampler = CLK_FILTER_NEAREST;
// read from 3D texture
float4 voxel = read_imagef(volume, volumeSampler, (float4)(1.0f,1.0f,1.0f,1.0f));

// whatever

}

Unfortunately NVidia OpenCL compiler doesn’t give you error messages what’s wrong with your code, it only crashes :angry: Change your code to become syntax right. Define volumeSampler and compilation runs fine after that.

consider this kernel :
__kernel void render(__read_only image3d_t volume)
{
const volumeSampler = CLK_FILTER_NEAREST;
// read from 3D texture
float4 voxel = read_imagef(volume, volumeSampler, (float4)(1.0f,1.0f,1.0f,1.0f));

// whatever

}

Oups, I’m sorry, Of course, volumeSample is a kernel parameter.

__kernel void render(__read_only image3d_t volume, sampler_t volumeSampler)
{
//
}

I wanted to simplify but did it too much.

Oups, I’m sorry, Of course, volumeSample is a kernel parameter.

__kernel void render(__read_only image3d_t volume, sampler_t volumeSampler)
{
//
}

I wanted to simplify but did it too much.

Well, after that I can’t reproduce clBuildProgram segfaulting. I’m using driver version 256.40 and Ubuntu toolkit version, though.

Well, after that I can’t reproduce clBuildProgram segfaulting. I’m using driver version 256.40 and Ubuntu toolkit version, though.

ok, thanks.
So maybe I should not use the 3.2rc…

ok, thanks.
So maybe I should not use the 3.2rc…

Sorry for misleading you about error messages from nvidia OpenCL compiler - register callback function at clBuildProgram and in that callback function call clGetProgramBuildInfo with CL_PROGRAM_BUILD_LOG . I must have been blinded, great function!

Try to read the CL_PROGRAM_BUILD_LOG first before you change your driver to older one.

Sorry for misleading you about error messages from nvidia OpenCL compiler - register callback function at clBuildProgram and in that callback function call clGetProgramBuildInfo with CL_PROGRAM_BUILD_LOG . I must have been blinded, great function!

Try to read the CL_PROGRAM_BUILD_LOG first before you change your driver to older one.

I did not know that, and that’s very very very what I need.

Unfortunately, it segfauts before !

But, well… Now that I know that I must use at leat one time read_imagef for the compiler to be happy, I do it once at the begining of the kernel

Eric

I did not know that, and that’s very very very what I need.

Unfortunately, it segfauts before !

But, well… Now that I know that I must use at leat one time read_imagef for the compiler to be happy, I do it once at the begining of the kernel

Eric

Strange you aren’t able to read the build log. Although I sometimes end with segmentation fault in clBuildProgram I always get that info, because the callback function is called in those cases as well.

Fine you found a workaround, but it is rather strange. I wish NVidia developers answer our questions. (AMD forums are much better and there are questions quickly solved.)

Strange you aren’t able to read the build log. Although I sometimes end with segmentation fault in clBuildProgram I always get that info, because the callback function is called in those cases as well.

Fine you found a workaround, but it is rather strange. I wish NVidia developers answer our questions. (AMD forums are much better and there are questions quickly solved.)

I wanted to confirm that I have seen the same issue.

Ubuntu 10.10 64-bit

GeForce GTX 460

NVIDIA developer driver 3.2 Linux 64 260.19.26

This code

const samper_t imgSamp = CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;

__kernel void aKernel(read_only image3d_t vol)

{

}

will cause clBuildProgram to segfault (before the build log can even be retrieved). Adding a call to read_image, though, like so

const samper_t imgSamp = CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;

__kernel void aKernel(read_only image3d_t vol)

{

    float4 voxel = read_imagef(vol, imgSamp, (float4)(0.f));

}

will compile just fine, and with no errors in the build log.

The NVIDIA OpenCL implementation has some serious bugs in it with image objects. I personally would consider the image extension ‘beta’ in all current drivers.