-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Disable HostPtr
reuse when the pointer is read-only
#10334
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
Conversation
Mutable SYCL buffers can be initialized using a `const T* hostData`. This change ensures that these buffers allocate new memory so that their contents can be modified without changing the original host data. Fixes intel#10091. Signed-off-by: Michael Aziz <[email protected]>
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.
Great find! 🚀
@0x12CC, @steffenlarsen, @againull, in my pre-commit the test fails on CUDA and Intel:
Any ideas why? |
@aelovikov-intel told me that it's caused by misalignment between the compiler and tests, which is supposed to be fixed by 7c8932a. I.e. this is CI scripts issue. |
intel#10334 causes a performance regression since `HostPtr` cannot be reused when it is read-only. This change fixes the regression by deferring the copy operation to the creation of a writable accessor. Signed-off-by: Michael Aziz <[email protected]>
#10334 causes a performance regression since `HostPtr` can't be reused when it's read-only. This PR fixes the regression by deferring the copy operation to the creation of a writable accessor. It includes following the changes: - A new `SYCLMemObjT::MCreateShadowCopy` to defer allocation. When the `HostPtr` cannot be reused since it's read-only, `SYCLMemObjT::handleHostData` sets this member to a function that will allocate the shadow copy. - A new `SYCLMemObjT::handleWriteAccessorCreation` member function. This function calls `SYCLMemObjT::MCreateShadowCopy` and updates any existing `MAllocaCommands` if `MUserPtr` changed. - Whenever a writable host or device accessor is created, `handleWriteAccessorCreation` gets called to ensure that any required memory allocation occurs. With this change, the allocation and copying overhead occurs during the creation of the first writable accessor. There's no overhead if all of the relevant accessors use `sycl::access_mode::read`. --------- Signed-off-by: Michael Aziz <[email protected]>
Mutable SYCL buffers can be initialized using a
const T* hostData
. This change ensures that these buffers allocate new memory so that their contents can be modified without changing the original host data. Fixes #10091.