intel / intel/llvm

Group algorithms do not support marray arguments

Open
#14,391 3 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

### Describe the bug

[Section 4.17.3](https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:algorithms) of SYCL 2020 says:

> All algorithms are supported for the fundamental scalar types supported by SYCL (see [Table 179](https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#table.types.fundamental)) and instances of the SYCL `vec` and `marray` classes.

...but DPC++ does not support the `marray` variants.

### To reproduce

```c++
#include

int foo(sycl::queue q) {
q.parallel_for(sycl::nd_range<1>(1, 1), [=](sycl::nd_item<1> it) {
sycl::marray block;
sycl::reduce_over_group(it.get_sub_group(), block, sycl::maximum<>());
});
}
```

Compilation gives the following error:
```
reproducer.cpp:6:5: error: no matching function for call to 'reduce_over_group'
6 | sycl::reduce_over_group(it.get_sub_group(), block, sycl::maximum<>());
| ^~~~~~~~~~~~~~~~~~~~~~~
/bin/compiler/../../include/sycl/group_algorithm.hpp:218:1: note: candidate template ignored: requirement 'detail::is_scalar_arithmetic>::value || (detail::is_complex, void>::value && detail::integral_constant::value)' was not satisfied [with Group = sub_group, T = sycl::marray, BinaryOperation = sycl::maximum<>]
218 | reduce_over_group(Group g, T x, BinaryOperation binary_op) {
| ^
/bin/compiler/../../include/sycl/group_algorithm.hpp:251:1: note: candidate template ignored: requirement 'detail::is_complex, void>::value' was not satisfied [with Group = sub_group, T = sycl::marray, BinaryOperation = sycl::maximum<>]
251 | reduce_over_group(Group g, T x, BinaryOperation) {
| ^
/bin/compiler/../../include/sycl/group_algorithm.hpp:270:1: note: candidate template ignored: requirement 'detail::is_vector_arithmetic_or_complex>::value' was not satisfied [with Group = sub_group, T = sycl::marray, BinaryOperation = sycl::maximum<>]
270 | reduce_over_group(Group g, T x, BinaryOperation binary_op) {
| ^
/bin/compiler/../../include/sycl/group_algorithm.hpp:294:1: note: candidate function template not viable: requires 4 arguments, but 3 were provided
294 | reduce_over_group(Group g, V x, T init, BinaryOperation binary_op) {
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//bin/compiler/../../include/sycl/group_algorithm.hpp:314:1: note: candidate function template not viable: requires 4 arguments, but 3 were provided
314 | reduce_over_group(Group g, V x, T init, BinaryOperation binary_op) {
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```

`marray` does not satisfy `is_vector_arithmetic` and there is no alternative `is_marray` check.

### Environment

- OS: Linux
- Target device and vendor: Any
- DPC++ version: Intel oneAPI DPC++/C++ Compiler 2024.2.0
- Dependencies version: N/A

### Additional context

There doesn't appear to be a corresponding test for group algorithms with `marray` arguments in the SYCL-CTS.

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.