cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

maelteir
Journeyman III

Segmentation fault with 2d-images of type CL_FLOAT and dimension 512X512

Hi all,

My kernel uses a 2d-image of type CL_FLOAT, when the dimensions of the image are 256 X 256, everything runs successfully, however when the image dimensions are increased to 512 X 512, the kernel produces segmentation fault. Is there any explanation for this behavior?

Thank you for your help

 

0 Likes
7 Replies
himanshu_gautam
Grandmaster

 Maybe you will get better feedback once you post the code.

Also specify your system configuration.

0 Likes

Thank you himanshu.gautam for your reply.

I run my code in AMD 5870, where the maximum dimensions for a 2D image are 8192 X 8192. So, I assumed that I can create an image of any supported data type with these dimensions.

I created the image using this simple code

For the kernel code it looks like the following:

__kernel void kernelFunction(__read_only  image2d_t img, .....) {}

I didn't attach the exact kernel code because even if I commented all of the code in the kernelFunction, I encounter the segmentation fault for 512 X 512 dimension. And no problem with 256 X 256

Thank you for your help

float *h_matrix // contains imageWidth X imageHeight float elements cl_image_format imageFormat; imageFormat.image_channel_order=CL_RGBA; imageFormat.image_channel_data_type=CL_FLOAT; cl_mem d_matrix=clCreateImage2D (context, CL_MEM_READ_ONLY| CL_MEM_USE_HOST_PTR, &imageFormat, imageWidth, imageHeight, NULL, h_matrix, &status);

0 Likes

is h_matrix allocated? ot point to valid memory? or when exactly it segfault?

0 Likes

Yes, h_matrix refers to a valid memory and clCreateImage2D executes successfully even for 512X512 dimensions.

I receive the segmentation fault, when the kernel executes.

Thank you.

 

0 Likes

well i sucessfully run SobelFilterImage with image 4096x4096 with no error.

0 Likes

Yes, this is beacuse the image_channel_data_type is UNSIGNED_INT8, if you changed it to UNSIGNED_INT32 or FLOAT you can see the segmentation fault, even if you comment all of the kernel code.

Thank you.

 

0 Likes

I am able to read a 2d image of size 1024*1024 with image channel data type as CL_UNSIGNED_INT32.

My system config is :
SDK 2.3
Driver 10.12
CPU AMD Athlon II x4 630 processor 2.81GHz
GPU HD 5770 (Juniper)
Os Windows Vista Ultimate 64 bit

 

I suggest you to check if you are crossing some bounds somewhere. Otherwise you can send a precise test case at streamdeveloper@amd.com

0 Likes