Skip to content

[[cl::max_size]] does not work for all specified pointer/ref types #63

@ex-rzr

Description

@ex-rzr

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions