[SYCL][UR] Remove redundant SYCL shadow copy of user host pointers - #22169
[SYCL][UR] Remove redundant SYCL shadow copy of user host pointers#22169mateuszpn wants to merge 9 commits into
Conversation
c5d940a to
a1ac8a7
Compare
pbalcer
left a comment
There was a problem hiding this comment.
So CUDA/HIP/OpenCL adapters require no changes?
| // doZeUSMImport silently ignores driver-level failures (e.g., misaligned | ||
| // ptr), so re-query to confirm the import actually succeeded before | ||
| // reporting it to callers. |
There was a problem hiding this comment.
I noticed that we don't actually verify the return value from the underlying L0 call. Maybe we can just check that instead?
b71b61c to
5182443
Compare
CUDA: no change — never zero-copies (USE_HOST_PTR disabled), always copies. |
|
@slawekptak, could you take a look at this please. |
|
@intel/llvm-reviewers-runtime I'd appreciate your feedback |
|
@cperkinsintel Are you able to take a look? |
|
Work on this issue will be continued here: #23050 |
Problem. A SYCL buffer built from a misaligned user host pointer caused both SYCL and the UR adapter to allocate their own storage, leaving three live copies of the data — the user's memory, a SYCL shadow copy, and the adapter's device/USM allocation — kept in sync by two copy-back chains. The shadow copy dated from when SYCL assumed OpenCL's strict CL_MEM_USE_HOST_PTR alignment rules; adapters now handle such pointers themselves.
Fix. SYCL passes the user pointer to UR unchanged; each adapter decides whether to use it directly or allocate and copy.
Testing. New E2E test Regression/buffer_shadow_copy_platform_policy.cpp covers read, write-back, read-only immutability, and mid-life host_accessor map/unmap, for aligned and misaligned pointers (offsets 1/4/64 B) with use_host_ptr set.