[SYCL] Disable HostPtr reuse when the pointer is read-only#10334
Merged
againull merged 1 commit intointel:syclfrom Jul 13, 2023
Merged
[SYCL] Disable HostPtr reuse when the pointer is read-only#10334againull merged 1 commit intointel:syclfrom
HostPtr reuse when the pointer is read-only#10334againull merged 1 commit intointel:syclfrom
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 <michael.aziz@intel.com>
Contributor
|
@0x12CC, @steffenlarsen, @againull, in my pre-commit the test fails on CUDA and Intel: Any ideas why? |
Contributor
|
@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. |
0x12CC
added a commit
to 0x12CC/llvm
that referenced
this pull request
Sep 27, 2023
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 <michael.aziz@intel.com>
steffenlarsen
pushed a commit
that referenced
this pull request
Oct 11, 2023
#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 <michael.aziz@intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.