- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've found a bug in the 2013 beta Linux build: when using clSetKernelArg to set an int3 argument, it fails if sizeof(cl_int3) is used as the size. It accepts 3 * sizeof(cl_int), but the CL spec is pretty clear that the API type corresponding to int3 is cl_int3, not cl_int[3] (there's a table at the start of section 6.1.2 in the CL 1.1 spec). The sizes are different because cl_int3 is padded to 4*sizeof(cl_int).
Both the NVIDIA and AMD OpenCL implementations expect the size to be sizeof(cl_int3).
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bruce,
I don't think that's a bug. The spec clearly says this about sizeof - "When applied to an operand that is a vector type, the result is number of components * size of each scalar component (Except for 3-component vectors whose size is defined as 4 * size of each scalar component.)". So it appears that Intel's behavior is correct.
Thanks,
Raghu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Raghupathi Muthyalampalli (Intel) wrote:Actually I think the part in parentheses supports my point: the size of an int3 is 16, not 12, yet clSetKernelArg only works when I pass a size of 12.Bruce,
"When applied to an operand that is a vector type, the result is number of components * size of each scalar component (Except for 3-component vectors whose size is defined as 4 * size of each scalar component.)"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah sorry. I thought your original post said the opposite. Can you attach a small test case?
Thanks,
Raghu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've written and attached a testcase that uses CLU. I included the CLU runtime in the zipfile, which I had to edit slightly to get it to compile with GCC. When I run it, it outputs
intel_sizeof.c:50: clSetKernelArg(kernel, 0, sizeof(arg), &arg) failed: -51
and -51 is CL_INVALID_ARG_SIZE.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page