llvm
cf18fe15 - [SYCL][Bindless][UR][L0][E2E] Fix linear interop memory and L0 V1 adapter leaks. (#18353)

Commit
312 days ago
[SYCL][Bindless][UR][L0][E2E] Fix linear interop memory and L0 V1 adapter leaks. (#18353) This patch fixes the mapping of interop memory to a linear range represented by a `void*`. The SYCL Bindless Images spec is clarified with wording to indicate which free APIs should be used on mapped imported memory. Using `sycl::free` for freeing mapped imported linear memory regions does not work for the LevelZero adapter, as the backend needs to call `zeMemFree` directly - it cannot go through the regular `sycl::free` code as that will use UMF free functions by default. This is invalid for memory regions mapped using `map_external_linear_memory`. The `unmap_external_linear_memory` SYCL API has been added to the Bindless Images specification to remedy this problem. An `unmap_external_image_memory` has also been added. This patch also introduces an E2E test which verifies that a Vulkan buffer's memory can be correctly imported into SYCL and its data retrieved from and written to within a SYCL kernel by using purely USM pointers (i.e. without using bindless images). This is a step towards extending the test coverage of interop functionality currently in the Bindless Images extension, with the goal being at some point splitting the interop functionality into one or more separate extensions. Two other fixes have been made in the LevelZero UR adapter. A leaked `ze_image_handle_t` object has been fixed in the LevelZero V1 adapter. The previous implementation incorrectly reinterpreted bindless memory handles as `ur_mem_handle_t` types. The implementation of `urBindlessImagesImageFreeExp` is now unified between V1 and V2, removing the leak. As such the `level_zero/v2/image.cpp` file has been removed. The `urMemoryHandle` member of `ur_ze_external_memory_data` has been removed. Aside from being incorrectly reinterpreted from `ur_bindless_mem_handle_t`, the LevelZero adapter does not need to track the memory handle for external memory resources.
Author
przemektmalon
Committer
Parents
Loading