-
Notifications
You must be signed in to change notification settings - Fork 30
Header for dpctl sycl interface type casters #960
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
Header for dpctl sycl interface type casters #960
Conversation
wrap/unwrap functions for conversions between opaque DPCTL types and underlying SYCL object pointers is provided in this new header. Use of the header is deployed to files in libsyclinterface/source/ and libsyclinterface/tests/ folders. Removed libsyclinterface/include/Support/CBindingWrapping.h
…emplated Moved dpctl_*_selector definitions into dpctl::syclinterface namespace. wrap/unwrap functions are made templated, with template parameter being C++ type to pointer of which the opaque pointer is cast. dpctl_device_selector for SYCL 2020 implements virtual call operator to enable type inference of this type as std::function<int(const device&)>. The derived classes override the call operator as appropriate. Calls to constructors of sycl::device and sycl::platform which take device selector callable are implemented differently depending on the compiler version.
View rendered docs @ https://intelpython.github.io/dpctl/pulls/960/index.html |
Array API standard conformance tests for dpctl=0.14.0dev0=py310h8c27c75_236 ran successfully. |
Array API standard conformance tests for dpctl=0.14.0dev0=py310h8c27c75_238 ran successfully. |
66a7148
to
31cc9db
Compare
Array API standard conformance tests for dpctl=0.14.0dev1=py310h8c27c75_10 ran successfully. |
Should this PR also remove setting of |
…o new file Added config parameters for __SYCL_COMPILER_VERSION cutoffs used throughout. Moved declarations of dpctl_device_selector and other derived classes to a dedicated .hpp file.
Added ifdefs around changes needed to work with both newer OS compiler and current oneAPI DPC++
cf8d625
to
6052ba0
Compare
Array API standard conformance tests for dpctl=0.14.0dev1=py310h8c27c75_8 ran successfully. |
Array API standard conformance tests for dpctl=0.14.0dev1=py310h8c27c75_10 ran successfully. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not go very deep as the changes are fairly mechanical and we have already discussed them offline.
Please merge.
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
Array API standard conformance tests for dpctl=0.14.0dev1=py310h8c27c75_19 ran successfully. |
Array API standard conformance tests for dpctl=0.14.0dev1=py310h8c27c75_19 ran successfully. |
This PR adds "libsyclinterface/include/dpctl_sycl_type_casters.hpp" which defines
dpctl::syclinterface::dpctl_device_selector
class corresponding toDPCTLDeviceSelectorRef
opaque pointer.The class is derived from
sycl::device_selector
to support oneAPI DPC++ 2022.2 and older, but is a stand-aloneclass if
__SYCL_COMPILER_VERSION >= 20221020L
.Use of
dpctl_device_selector
insycl::device
andsycl::platform
constructors is adjusted based on the compiler version too.This PR also exposes
dpctl::syclinterface::wrap<T>
anddpctl::syclinterface::unwrap<T>
templated functions where the template type must be the underlying sycl type to the pointer of which the opaque pointer should bereinterpret_cast
-ed.For example:
DPCTLSyclDeviceRef DRef; auto Dev = ::dpctl::syclinterface::unwrap<sycl::device>(DRef);
libsyclinterface/source and libsyclinterface/tests are adjusted to use exported wrap/unwrap.