Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attribute 'reqd_work_group_size' does not support argument pack expansion #13686

Open
jzc opened this issue May 7, 2024 · 0 comments
Open

attribute 'reqd_work_group_size' does not support argument pack expansion #13686

jzc opened this issue May 7, 2024 · 0 comments
Labels
confirmed enhancement New feature or request

Comments

@jzc
Copy link
Contributor

jzc commented May 7, 2024

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.

#include <sycl/sycl.hpp>

using namespace sycl;

template <int... Dims>
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 <int... Dims>
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:

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:

template <aspect... Aspects>
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants