-
Notifications
You must be signed in to change notification settings - Fork 790
[SYCL][UR][L0 v2] import host ptr when SYCL_USM_HOSTPTR_IMPORT=1 and fix mapHostPtr #19297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: sycl
Are you sure you want to change the base?
Conversation
This matches v1 functionality and speeds up subsequent buffer map/unmap operations by making memory copy faster.
The logic for freeing mappedPtr was incorrect. We should only free the memory in unmapHostPtr if the pointer was allocated in mapHostPtr, not the other way around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, but tests seem to be failing:
native_specialization_constant
ur_integrated_buffer_handle_t(ur_context_handle_t hContext, void *hostPtr, | ||
size_t size, host_ptr_action_t useHostPtr, | ||
device_access_mode_t accesMode); | ||
size_t size, device_access_mode_t accesMode); | ||
|
||
ur_integrated_buffer_handle_t(ur_context_handle_t hContext, void *hostPtr, | ||
size_t size, device_access_mode_t accesMode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size_t size, device_access_mode_t accesMode, | |
size_t size, device_access_mode_t accessMode, |
(I know, unrelated to this PR :P)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Fixed. It seems that UR_MEM_FLAG_USE_HOST_POINTER does not have to be set when hostPtr is not null. In the legacy adapter this flag controlled whether to import the memory to USM or not but I don't see a reason not to do it in all cases. It seems that SYCL almost always sets UR_MEM_FLAG_USE_HOST_POINTER anyway (except in that one test) |
Actually, I wonder why do we event support that combination (non-null hostPtr and no USE_HOST_PTR flag). OpenCL doesn't seem to allow this: https://registry.khronos.org/OpenCL/sdk/3.0/docs/man/html/clCreateBuffer.html |
No description provided.