KhronosGroup / KhronosGroup/SPIR
[[cl::max_size]] does not work for all specified pointer/ref types
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 183
- Forks
- 51
- PR merge metrics
- No merged PRs in 30d
Description
OpenCL C++ specification:
This attribute can be provided with a kernel argument of type
constant_ptr<T>,constant<T>*,constant<T>&,local_ptr<T>,local<T>*,local<T>&.
#include <opencl_memory>
template <typename T>
struct local_ptr_test
{
__local T* ptr;
};
typedef local_ptr_test<int> local_int_test;
kernel void foo0([[cl::max_size(1)]] local_ptr_test<int> arg) { }
kernel void foo1([[cl::max_size(1)]] cl::local_ptr<int> arg) { }
kernel void foo2([[cl::max_size(1)]] cl::local<int>* arg) { }
kernel void foo3([[cl::max_size(1)]] cl::local<int>& arg) { }
kernel void foo4([[cl::max_size(1)]] cl::constant_ptr<int> arg) { }
kernel void foo5([[cl::max_size(1)]] cl::constant<int>* arg) { }
kernel void foo6([[cl::max_size(1)]] cl::constant<int>& arg) { }
(foo0 is a kernel from https://github.com/KhronosGroup/SPIR/blob/spirv-1.1/test/OpenCL/OpenCL22/attributes/TestBasicAttributes_max_size.cl)
max_size.cl:14:57: error: max_size attribute only applies to kernel paremeters which are in local or constant address space
kernel void foo1([[cl::max_size(1)]] cl::local_ptr<int> arg) { }
^
max_size.cl:16:54: error: max_size attribute only applies to kernel paremeters which are in local or constant address space
kernel void foo3([[cl::max_size(1)]] cl::local<int>& arg) { }
^
max_size.cl:18:60: error: max_size attribute only applies to kernel paremeters which are in local or constant address space
kernel void foo4([[cl::max_size(1)]] cl::constant_ptr<int> arg) { }
^
max_size.cl:20:57: error: max_size attribute only applies to kernel paremeters which are in local or constant address space
kernel void foo6([[cl::max_size(1)]] cl::constant<int>& arg) { }
^
4 errors generated.
I.e. the attribute works with cl::local<int>* and cl::constant<int>*.
(Also there is a typo (paremeters) in error messages)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the diagnostics with the examples in test/OpenCL/OpenCL22/attributes/TestBasicAttributes_max_size.cl, especially the pointer and reference forms listed in the issue. Trace the compiler's max_size attribute validation for kernel parameters. Done means all specified local and constant pointer/reference types are accepted consistently, while the diagnostic typo is corrected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100