Skip to content

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

@jzc

Description

@jzc

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions