Skip to content

Implementing USM memory management in dpCtrl #27

Closed
@diptorupd

Description

@diptorupd

PyDPPL should expose sycl USM allocators to Python.

What needs to be done?

  1. Add a C-API wrapper into pydppl/backends for the functions that we need from cl::sycl::usm. The C-API will be similar to what we currently have for cl::sycl::queue (ref. https://github.com/IntelPython/pydppl/blob/master/backends/include/dppl_sycl_queue_interface.h).

  2. We need this so that Sycl headers do not have to be directly included in the Cython extension module and we can use MSVC/GCC to build the extension and link to our helper (libDPPLSyclInteface).

  3. Cython extension:

  • We need three classes: MemoryUSMShared, MemoryUSMHost, MemoryUSMDevice. Each class corresponds to the three USM memory allocator.
  • MemoryUSMDevice should not expose __getbuffer__ as Python objects cannot directly use device memory.
  • The __cinit__ of the Memory classes perhaps should provide a way to specify the context in which memory is to be allocated. The other option will be to use dppl.get_current_queue(). Using the current queue always can lead to programmer errors where he/she tries to use a memory allocated on a given context on a device that is not in that context.
  • MemoryUSMxxx should provide a factory function to copy data between incompatible device.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions