Device Memory Properties Extension
API
Enumerations
Structures
Extended Device Memory Properties
Users may wish to build a cost model for computation on accelerators exposed through ‘oneAPI’ Level-Zero. Such cost models require detailed information about the properties of the accelerator such as memory bandwidth. This extension provides extended information about the memories exposed as part of a device. The extension introduces the ze_device_memory_ext_properties_t struct which can be passed to zeDeviceGetMemoryProperties via the pNext member of ze_device_memory_properties_t.
The following psuedo-code demonstrates a sequence for obtaining extended information about the memory properties of a memory module exposed as part of a device:
... // Discover memories on device uint32_t memCount = 0; zeDeviceGetMemoryProperties(hDevice, &memCount, nullptr); // Allocate properties structs ze_device_memory_properties_t* pMemProps = allocate(memCount*sizeof(ze_device_memory_properties_t)); ze_device_memory_ext_properties_t* pExtMemProps = allocate(memCount*sizeof(ze_device_memory_ext_properties_t)); // Make pNext in memProps point at corresponding extMemProps for (uint32_t i = 0; i < memCount; ++i) { pMemProps[i].stype = ZE_STRUCTURE_TYPE_DEVICE_MEMORY_PROPERTIES; pMemProps[i].pNext = &pExtMemProps[i]; pExtMemProps[i].stype = ZE_STRUCTURE_TYPE_DEVICE_MEMORY_EXT_PROPERTIES; pExtMemProps[i].pNext = nullptr; } // Obtain memory & extended memory properties zeDeviceGetMemoryProperties(hDevice, &memCount, pMemProps);