Skip to content

Broken sycl::get_native<sycl::backend::ext_oneapi_hip, sycl::device> #7223

@al42and

Description

@al42and

Describe the bug

Using sycl::get_native to obtain HIP device handle fails to compile.

To Reproduce

#include <CL/sycl.hpp>

int main() {
    sycl::device d;
    if (d.get_backend() == sycl::backend::ext_oneapi_hip) {
        auto native_d = sycl::get_native<sycl::backend::ext_oneapi_hip>(d);
    }
}
$ clang++ -fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx1032 test.cpp 
In file included from test.cpp:1:
In file included from /home/aland/intel-sycl/llvm/build/install//bin/../include/sycl/CL/sycl.hpp:11:
In file included from /home/aland/intel-sycl/llvm/build/install//bin/../include/sycl/sycl.hpp:16:
/home/aland/intel-sycl/llvm/build/install//bin/../include/sycl/backend.hpp:130:10: error: reinterpret_cast from 'pi_native_handle' (aka 'unsigned long') to 'backend_return_t<(backend)'\x06', device>' (aka 'int') is not allowed
  return reinterpret_cast<backend_return_t<BackendName, SyclObjectT>>(
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cpp:8:31: note: in instantiation of function template specialization 'sycl::get_native<sycl::backend::ext_oneapi_hip, sycl::device>' requested here
        auto native_d = sycl::get_native<sycl::backend::ext_oneapi_hip>(d);
                              ^
1 error generated.

Environment (please complete the following information):

  • OS: Linux, Ubuntu 20.04
  • Target device and vendor: AMD RX6600
  • DPC++ version: bc1b306
  • Dependencies version: ROCm 5.3.0 (from AMD repositories)

Additional context

No such error with sycl::backend::ext_oneapi_cuda

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghipIssues related to execution on HIP backend.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions