intel / intel/llvm

attribute 'reqd_work_group_size' does not support argument pack expansion

Open
#13,686 0 comments 1 reaction 1 assignee Claimed by @smanna12 View on GitHub
confirmed enhancement
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

### Is your feature request related to a problem? Please describe

The `sycl::reqd_work_group_size` attribute (and `sycl::work_group_size_hint`) does not accept a parameter pack expansion.

```c++
#include

using namespace sycl;

template
void foo1(queue &q) {
range r(Dims...);
nd_range ndr(r, r);
q.parallel_for(ndr, [=](auto id) [[sycl::reqd_work_group_size(Dims...)]] {});
}

template
void foo2(queue &q) {
range r(Dims...);
nd_range ndr(r, r);
q.parallel_for(ndr, [=](auto id) [[sycl::work_group_size_hint(Dims...)]] {});
}

int main() {
queue q;
foo1<2>(q);
foo1<2, 2>(q);
foo1<2, 2, 2>(q);
foo2<2>(q);
foo2<2, 2>(q);
foo2<2, 2, 2>(q);
}
```
Compiling this results with this error:

```c++
error: attribute 'reqd_work_group_size' does not support argument pack expansion
9 | q.parallel_for(ndr, [=](auto id) [[sycl::reqd_work_group_size(Dims...)]] {});
| ^
error: attribute 'work_group_size_hint' does not support argument pack expansion
16 | q.parallel_for(ndr, [=](auto id) [[sycl::work_group_size_hint(Dims...)]] {});
```

note that `sycl::device_has` does support parameter pack expansions; the following similar code compiles:

```c++
template
void foo(queue &q) {
q.parallel_for(1, [=](auto id) [[sycl::device_has(Aspects...)]] {});
}
```

### Describe the solution you would like

_No response_

### Describe alternatives you have considered

_No response_

### Additional context

_No response_

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.