You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
__ze_api_export ze_result_t __zecall
zeDriverAllocDeviceMem(
ze_driver_handle_t hDriver, ///< [in] handle of the driver instance
const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device mem alloc descriptor
size_t size, ///< [in] size in bytes to allocate
size_t alignment, ///< [in] minimum alignment in bytes for the allocation
ze_device_handle_t hDevice, ///< [in] handle of the device
void** pptr ///< [out] pointer to device allocation
);
It looks like it always passes back a (void *). Is this expected to be a mapped pointer accessible from the CPU?
There are GPUs out there (maybe not yet from Intel) that have limited access to the VRAM from the CPU, by forcing that *pptr is a mapped address for all allocation this will limit the amount of mapped accessible objects you can have.
This why Vulkan has VkDeviceMemory objects, and Map/Unmap APIs.
The text was updated successfully, but these errors were encountered:
Okay it says device allocated ptrs should not be accessed by the host. The spec should state clearly what happens if someone tries, undefined behaviour resulting in program termination?
Thanks for the question. You're right that for device memory allocations, the pointer must be in the same virtual address space as the host application, but it does NOT need to be host-accessible so there is no requirement that the allocation be "mapped". This is different than host or shared allocations, where the pointer does need to be host-accessible.
This is documented in the programming guide, in the text and the summary table. Additionally, the API description says: "In general, a device allocation may only be accessed by the device that owns it."
I guess "may not" could be strengthened to "must" in these places? Would that be clearer, or are there other clarifications you would suggest?
Looking at the device memory allocation API,
__ze_api_export ze_result_t __zecall
zeDriverAllocDeviceMem(
ze_driver_handle_t hDriver, ///< [in] handle of the driver instance
const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device mem alloc descriptor
size_t size, ///< [in] size in bytes to allocate
size_t alignment, ///< [in] minimum alignment in bytes for the allocation
ze_device_handle_t hDevice, ///< [in] handle of the device
void** pptr ///< [out] pointer to device allocation
);
It looks like it always passes back a (void *). Is this expected to be a mapped pointer accessible from the CPU?
There are GPUs out there (maybe not yet from Intel) that have limited access to the VRAM from the CPU, by forcing that *pptr is a mapped address for all allocation this will limit the amount of mapped accessible objects you can have.
This why Vulkan has VkDeviceMemory objects, and Map/Unmap APIs.
The text was updated successfully, but these errors were encountered: