dpctl.memory
¶
Subpackage dpctl.memory
exposes Unified Shared Memory (USM) operations.
Unified Shared Memory is a pointer-based memory management in SYCL guaranteeing that the host and all devices use a unified address space. As described in the SYCL specification:
Pointer values in the unified address space will always refer to the same location in memory. The unified address space encompasses the host and one or more devices. Note that this does not require addresses in the unified address space to be accessible on all devices, just that pointer values will be consistent.
Three types of USM allocations are supported:
USM allocation type |
Description |
---|---|
|
Allocations in device memory accessible by the device but not by the host |
|
Allocations in device memory accessible by both the host and the device |
|
Allocations in host memory accessible by both the host and the device |
Python classes representing USM allocations
Class representing allocation of SYCL USM-device memory. |
|
An object representing allocation of SYCL USM-shared memory. |
|
An object representing allocation of SYCL USM-host memory. |
Python objects representing USM allocations provide __sycl_usm_array_interface__
attribute.
A Python object can be converted to one of these classes using the following function:
Converts Python object with |
Should the USM allocation fail, the following Python exception will be raised:
An exception raised when Universal Shared Memory (USM) allocation call returns a null pointer, signaling a failure to perform the allocation. |