Physical Mem#

oneAPI Level Zero Specification - Version 1.18.31

Physical Mem Functions#

zePhysicalMemCreate#

Added in version 1.0

ZE_APIEXPORT ze_result_t ZE_APICALL zePhysicalMemCreate(ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_physical_mem_desc_t *desc, ze_physical_mem_handle_t *phPhysicalMemory)#

Creates a physical memory object for the context.

  • The application must only use the physical memory object on the context for which it was created.

  • The size must be page aligned. For host memory, the operating system page size should be used. For device memory, see zeVirtualMemQueryPageSize.

  • The application may call this function from simultaneous threads.

  • The implementation of this function must be thread-safe.

Parameters:
  • hContext – [in] handle of the context object

  • hDevice – [in] handle of the device object, can be nullptr if creating physical host memory.

  • desc – [in] pointer to physical memory descriptor.

  • phPhysicalMemory – [out] pointer to handle of physical memory object created

Returns:

zePhysicalMemDestroy#

Added in version 1.0

ZE_APIEXPORT ze_result_t ZE_APICALL zePhysicalMemDestroy(ze_context_handle_t hContext, ze_physical_mem_handle_t hPhysicalMemory)#

Destroys a physical memory object.

  • The application must ensure the device is not currently referencing the physical memory object before it is deleted

  • The application must not call this function from simultaneous threads with the same physical memory handle.

  • The implementation of this function must be thread-safe.

Parameters:
  • hContext – [in] handle of the context object

  • hPhysicalMemory – [in][release] handle of physical memory object to destroy

Returns:

zePhysicalMemGetProperties#

Added in version 1.15

ZE_APIEXPORT ze_result_t ZE_APICALL zePhysicalMemGetProperties(ze_context_handle_t hContext, ze_physical_mem_handle_t hPhysicalMem, ze_physical_mem_properties_t *pMemProperties)#

Retrieves memory properties of the physical memory object.

  • The application must only use the physical memory object on the context for which it was created.

  • The application may call this function from simultaneous threads.

  • The implementation of this function must be thread-safe.

Parameters:
  • hContext – [in] handle of the context object

  • hPhysicalMem – [in] handle of the physical memory object

  • pMemProperties – [in,out] pointer to physical memory properties structure.

Returns:

Physical Mem Enums#

ze_physical_mem_flags_t#

Added in version 1.0

enum ze_physical_mem_flag_t#

Values:

enumerator ZE_PHYSICAL_MEM_FLAG_ALLOCATE_ON_DEVICE#

[default] allocate physical device memory.

enumerator ZE_PHYSICAL_MEM_FLAG_ALLOCATE_ON_HOST#

Allocate physical host memory instead.

enumerator ZE_PHYSICAL_MEM_FLAG_FORCE_UINT32#

Value marking end of ZE_PHYSICAL_MEM_FLAG_* ENUMs.

Physical Mem Structures#

ze_physical_mem_desc_t#

Added in version 1.0

struct ze_physical_mem_desc_t#

Physical memory descriptor.

Public Members

ze_structure_type_t stype#

[in] type of this structure

const void *pNext#

[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).

ze_physical_mem_flags_t flags#

[in] creation flags. must be 0 (default) or a valid combination of ze_physical_mem_flag_t; default is to create physical device memory.

size_t size#

[in] size in bytes to reserve; must be page aligned.

ze_physical_mem_properties_t#

Added in version 1.15

struct ze_physical_mem_properties_t#

Physical memory properties queried using zePhysicalMemGetProperties.

Public Members

ze_structure_type_t stype#

[in] type of this structure

void *pNext#

[in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).

uint64_t id#

[out] unique identifier for the physical memory object

uint64_t size#

[out] size of the physical memory object in bytes