You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SYCL] Defer shadow copy creation in SYCLMemObjT (#11348)
#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]>
0 commit comments