Skip to content

Design dpctl classes corresponding to SYCL kernel argument types #71

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

Closed
2 tasks
diptorupd opened this issue Sep 26, 2020 · 5 comments
Closed
2 tasks

Design dpctl classes corresponding to SYCL kernel argument types #71

diptorupd opened this issue Sep 26, 2020 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@diptorupd
Copy link
Contributor

diptorupd commented Sep 26, 2020

Currently to submit (SyclQueue.submit) a kernel all scalar arguments for that kernel should be valid ctypes objects (e.g. ctypes.c_int). Inside SyclQueue._populate_args we have a if-elif statements to first cast the address of the ctypes object to void* and also generate a DPPLKernelArgType enum value for the argument. The two things need to be done to call DPPLQueue_SubmitRange and DPPLQueue_SubmitNdRange

A better design will be if we have the equivalent of ctypes.c_xxx classes defined in dpctl, e.g. dpctl.c_xxx, and users cast the Python objects directly to the required dpctl type. The DPPLKernelArgType enum should then be a an attribute of the dpctl type that can be directly extracted without needed an extra switch. Moreover, users will want us to support other data types than just ctypes, e.g., numpy.dtypes.

The design is also needed if we want to support reduced precision inside dpctl.

  • Design the dpctl.c_xxx data type classes.
  • Change SyclQueue.submit to use dpctl_.c_xxx type instead of ctypes.c_xxx.

Related #72, #85

@diptorupd diptorupd self-assigned this Sep 26, 2020
@diptorupd
Copy link
Contributor Author

@oleksandr-pavlyk need your help with designing this, especially how we can extend to support reduced precision types.

@diptorupd diptorupd added the enhancement New feature or request label Sep 26, 2020
@diptorupd diptorupd changed the title Support dpct C types directly without having to go through ctypes Design dpctl dtypes classes that can be constructed from NumPy.dtypes or ctypes Sep 30, 2020
@diptorupd
Copy link
Contributor Author

@oleksandr-pavlyk adding you to help us design this feature.

@oleksandr-pavlyk
Copy link
Contributor

Does OpenCL or Level-Zero allow for arguments to be structs passed by values?

@PokhodenkoSA
Copy link
Contributor

Data types we have:

  1. Numba - numba.core.types
  2. Ctypes - ctypes
  3. DPCTLKernelArgType - enum
  4. SYCL types which partially are ctypes

Numba -> Ctypes
DPPY. numba_dppy/compiler.py:DPPYKernel._unpack_argument - kernelargs (ctypes with values)
Numba. numba/core/typing/ctypes_utils.py - Numba <-> Ctypes conversion in both ways

Ctypes -> DPCTLKernelArgType
dpCtl.Cyhton.

  1. sycl_queue.submit -> _populate_args - Split to 2 arrays: values pointers and DPCTLKernelArgType types
  2. sycl_queue.submit -> DPCTLQueue_SubmitRange

DPCTLKernelArgType -> SYCL types
dpCtl.backend. DPCTLQueue_SubmitRange -> set_kernel_arg - Dispatch for call handler cgh.set_arg(..., SYCL_TYPE)

@diptorupd diptorupd changed the title Design dpctl dtypes classes that can be constructed from NumPy.dtypes or ctypes Design dpctl classes corresponding to SYCL kernel argument types Apr 16, 2021
@diptorupd
Copy link
Contributor Author

The requested feature is no longer required in numba-dpex. Currently, in numba_dpex.experimental the Python interface of dpctl is no longer used to submit kernels. Instead we directly use libsyclinterface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants