[SYCL][CUDA][HIP] Throw a runtime error with invalid sub-group size to kernel
- Dominant language
- LLVM
- Stars
- 1.5k
- Forks
- 854
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 137
Description
**Describe the bug**
Using an invalid sub-group size to the kernel doesn't result in a runtime error. Possibly throw a RT error as seen on Intel devices with invalid sub-group sizes. This behavior was observed for both the CUDA and HIP Plugins.
For CUDA possibly 32, for HIP possibly 64.
From the SYCL spec:
Each device supports only certain sub-group sizes as defined by info::device::sub_group_sizes. In addition, some device features may be incompatible with certain sub-group sizes. If a kernel is decorated with this attribute and then submitted to a device that does not support the sub-group size or if the kernel uses a feature that the device does not support with this sub-group size, the implementation must throw a synchronous exception with the errc::kernel_not_supported error code.
**To Reproduce**
```
#include
int main() {
auto const& gpu_devices = sycl::device::get_devices(sycl::info::device_type::gpu);
std::cout << "Number of Root GPUs: " << gpu_devices.size() << std::endl;
for(const auto& d : gpu_devices) {
std::cout << "Found Root GPU-ID: " << d.get_info() << std::endl;
std::vector sg_sizes = d.get_info();
std::cout << "Supported sub-group sizes: ";
for (int i=0; i(N, Q);
Q.parallel_for(N, [=](sycl::item<1> id) [[sycl::reqd_sub_group_size(8)]] { ptr[id] = id; }).wait();
return 0;
}
```
**Environment (please complete the following information):**
CUDA PI built with CUDA-11.6.2, HIP PI built with room-5.1.0
llvm compiler: ac6a4f555be01a65e92321aaa63528a1f576e5ea
Contributor guide
Assessment
This issue has not been assessed yet.