intel / intel/llvm

[[sycl::vec_type_hint]] kernel attribute doesn't compile with sycl::vec

Open
#9,836 5 comments 0 reactions 0 assignees View on GitHub
bug confirmed
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

h3. Summary

[[sycl::vec_type_hint]] kernel attribute doesn't compile neither with functor or lambda submission call using sycl::vec. Here is the [spec](https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#table.kernel.attributes)

h3. Impact

kernel_attributes tests

h3. Environment details

clang version 17.0.0 (https://github.com/intel/llvm.git f44d0133d4b0077298f034697a1f3818ff1d6134)
Target: x86_64-pc-windows-msvc
Thread model: posix

h3. Reproducer

```
#pragma clang diagnostic ignored "-Wdeprecated-attributes"

#include
#include

using vec_t = sycl::vec;

class functor {
public:
using acc_t = sycl::accessor;
functor(acc_t _acc) : acc(_acc) {}

[[sycl::vec_type_hint(vec_t)]] void operator()() const {
acc[0] = 523;
}

private:
acc_t acc;
};

int main() {
sycl::queue queue;

vec_t vec;

// functor
{
sycl::buffer buf(&vec, {1});
queue.submit([&](sycl::handler& cgh) {
auto acc = buf.template get_access(cgh);
cgh.single_task(functor{acc});
});
}
// lambda
{
sycl::buffer buf(&vec, {1});
queue.submit([&](sycl::handler& cgh) {
auto acc = buf.template get_access(cgh);
cgh.single_task([=]() [[sycl::vec_type_hint(vec_t)]] {
acc[0] = 523;
});
});
}

return 0;
}
```

`clang++ -fsycl vec_type_hint.cpp -o test.exe`

Output
```
vec_type_hint.cpp:13:13: error: a non-vector or non-vectorizable scalar type is an invalid argument to
attribute 'vec_type_hint'
[[sycl::vec_type_hint(vec_t)]] void operator()() const {
^
vec_type_hint.cpp:39:43: error: 'vec_type_hint' attribute cannot be applied to types
cgh.single_task([=]() [[sycl::vec_type_hint(vec_t)]] {
^
2 errors generated.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.