Skip to content

[ROCm OpenCL] device::get_info<device::sub_group_sizes> throws Native API failed #5825

Closed
@al42and

Description

@al42and

Describe the bug

With ROCm 4.5.2, trying to call device.get_info<sycl::info::device::sub_group_sizes>() on an AMD device throws cl::sycl::runtime_error.

To Reproduce

#include <CL/sycl.hpp>
#include <iostream>

int main() {
  std::vector<sycl::device> devices = sycl::device::get_devices();

  for (const auto &dev : devices) {
    std::cout << "Device " << dev.get_info<sycl::info::device::name>()
              << std::endl;
    const auto sg_sizes = dev.get_info<sycl::info::device::sub_group_sizes>();
  }
}
$ clang++ -g -fsycl sgsize.cpp -o sgsizes && SYCL_DEVICE_FILTER=opencl:gpu ./sgsizes
Device gfx906:sramecc+:xnack-
terminate called after throwing an instance of 'cl::sycl::runtime_error'
  what():  Native API failed. Native API returns: -30 (CL_INVALID_VALUE) -30 (CL_INVALID_VALUE)
Aborted

Works fine with SYCL_DEVICE_FILTER=hip:gpu.

Looking at sycl/plugins/opencl/pi_opencl.cpp, it seems CL_DEVICE_SUB_GROUP_SIZES_INTEL is passed to clGetDeviceInfo, which, being non-Intel, does not know what to do with it.

It is understandable that the OpenCL runtime does not support this extension. But it would be nice if it was handled more gracefully, not with a cryptic Native API failed. Native API returns: -30 (CL_INVALID_VALUE).

Better yet, of course, is to provide the supported sub-group sizes.

Environment (please complete the following information):

  • OS: Linux
  • Target device and vendor: AMD MI50 (gfx906)
  • DPC++ version: 16e1920
  • Dependencies version: ROCm 4.5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions