Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dpl::execution::device_policy construction from SYCL selector is broken #1965

Open
dmitriy-sobolev opened this issue Dec 11, 2024 · 0 comments
Labels

Comments

@dmitriy-sobolev
Copy link
Contributor

dmitriy-sobolev commented Dec 11, 2024

Describe the Bug:
The documentation allows dpl::execution::device_policy object construction from a SYCL selector (e.g. sycl::default_selector_v), but it does not work.

Note in the documentation:

This code does not work:

// t.cpp
#include <oneapi/dpl/execution>
int main()
{
    auto policy_a = oneapi::dpl::execution::device_policy{sycl::default_selector_v};
    auto policy_b = oneapi::dpl::execution::make_device_policy(sycl::default_selector_v);
    return 0;
}

To Reproduce:

icpx -fsycl -I /path/to/oneDPL/include t.cpp -o t && ./t

// icpx --version
// >> Intel(R) oneAPI DPC++/C++ Compiler 2025.0.0 (2025.0.0.20240909)

Expected Behavior:
The reproducer compiles and silently passes.

Observed Behavior:

t.cpp:4:21: error: no viable constructor or deduction guide for deduction of template arguments of 'oneapi::dpl::execution::device_policy'
    4 |     auto policy_a = oneapi::dpl::execution::device_policy{sycl::default_selector_v};
      |                     ^
/oneDPL/include/oneapi/dpl/pstl/hetero/dpcpp/execution_sycl_defs.h:163:14: note: candidate function template not viable: no known conversion from 'int (const device &)' to 'sycl::queue' for 1st argument
  163 |     explicit device_policy(sycl::queue q) : __qh(std::move(q)) {}
      |              ^             ~~~~~~~~~~~~~
/oneDPL/include/oneapi/dpl/pstl/hetero/dpcpp/execution_sycl_defs.h:163:14: note: implicit deduction guide declared as 'template <typename KernelName = DefaultKernelName> explicit device_policy(sycl::queue q) -> device_policy<KernelName>'
/oneDPL/include/oneapi/dpl/pstl/hetero/dpcpp/execution_sycl_defs.h:164:14: note: candidate function template not viable: no known conversion from 'int (const device &)' to 'sycl::device' for 1st argument
  164 |     explicit device_policy(sycl::device d) : __qh(std::move(d)) {}
      |              ^             ~~~~~~~~~~~~~~
/oneDPL/include/oneapi/dpl/pstl/hetero/dpcpp/execution_sycl_defs.h:164:14: note: implicit deduction guide declared as 'template <typename KernelName = DefaultKernelName> explicit device_policy(sycl::device d) -> device_policy<KernelName>'
/oneDPL/include/oneapi/dpl/pstl/hetero/dpcpp/execution_sycl_defs.h:174:14: note: candidate function template not viable: no known conversion from 'int (const device &)' to '__internal::__global_instance_tag' for 1st argument
  174 |     explicit device_policy(__internal::__global_instance_tag __t)
      |              ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/oneDPL/include/oneapi/dpl/pstl/hetero/dpcpp/execution_sycl_defs.h:174:14: note: implicit deduction guide declared as 'template <typename KernelName = DefaultKernelName> explicit device_policy(__internal::__global_instance_tag __t) -> device_policy<KernelName>'
/oneDPL/include/oneapi/dpl/pstl/hetero/dpcpp/execution_sycl_defs.h:155:7: note: candidate template ignored: could not match 'device_policy<KernelName>' against 'int (*)(const device &)'
  155 | class device_policy
      |       ^
/oneDPL/include/oneapi/dpl/pstl/hetero/dpcpp/execution_sycl_defs.h:155:7: note: implicit deduction guide declared as 'template <typename KernelName = DefaultKernelName> device_policy(device_policy<KernelName>) -> device_policy<KernelName>'
/oneDPL/include/oneapi/dpl/pstl/hetero/dpcpp/execution_sycl_defs.h:162:5: note: candidate template ignored: could not match 'device_policy<type-parameter-0-1>' against 'int (const device &)'
  162 |     device_policy(const device_policy<OtherName>& other) : __qh(other.queue()) {}
      |     ^
/oneDPL/include/oneapi/dpl/pstl/hetero/dpcpp/execution_sycl_defs.h:162:5: note: implicit deduction guide declared as 'template <typename KernelName = DefaultKernelName, typename OtherName> device_policy(const device_policy<type-parameter-0-1> &other) -> device_policy<KernelName>'
/oneDPL/include/oneapi/dpl/pstl/hetero/dpcpp/execution_sycl_defs.h:160:5: note: candidate function template not viable: requires 0 arguments, but 1 was provided
  160 |     device_policy() : device_policy(__internal::__get_default_queue()) {}
      |     ^
/oneDPL/include/oneapi/dpl/pstl/hetero/dpcpp/execution_sycl_defs.h:160:5: note: implicit deduction guide declared as 'template <typename KernelName = DefaultKernelName> device_policy() -> device_policy<KernelName>'
/oneDPL/include/oneapi/dpl/pstl/hetero/dpcpp/execution_sycl_defs.h:178:5: note: candidate function template not viable: requires 2 arguments, but 1 was provided
  178 |     device_policy(__internal::__global_instance_tag __t, __internal::__queue_factory __f) : __qh(__t, __f) {}
      |     ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Additional Context:

Possible solutions:

  • Remove the note from the documentation. The bug has been here for ~2 years according to Fix error in make_device_policy call #762, so it is questionable whether it should be considered as a breaking change or not.
  • Fix it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant