Skip to content

Commit cda5a47

Browse files
authored
[SYCL][UR][L0 v2] add missing offset calculation to getDevicePtr and mapHostPtr for ur_usm_handle_t. (#18355)
We never actually use the handle with non-zero offset but we may change that in future.
1 parent 65cf13e commit cda5a47

File tree

1 file changed

+4
-4
lines changed
  • unified-runtime/source/adapters/level_zero/v2

1 file changed

+4
-4
lines changed

unified-runtime/source/adapters/level_zero/v2/memory.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ ur_usm_handle_t::ur_usm_handle_t(ur_context_handle_t hContext, size_t size,
3434

3535
void *ur_usm_handle_t::getDevicePtr(
3636
ur_device_handle_t /*hDevice*/, device_access_mode_t /*access*/,
37-
size_t /*offset*/, size_t /*size*/,
37+
size_t offset, size_t /*size*/,
3838
std::function<void(void *src, void *dst, size_t)> /*migrate*/) {
39-
return ptr;
39+
return ur_cast<char *>(ptr) + offset;
4040
}
4141

4242
void *
43-
ur_usm_handle_t::mapHostPtr(ur_map_flags_t /*flags*/, size_t /*offset*/,
43+
ur_usm_handle_t::mapHostPtr(ur_map_flags_t /*flags*/, size_t offset,
4444
size_t /*size*/,
4545
std::function<void(void *src, void *dst, size_t)>) {
46-
return ptr;
46+
return ur_cast<char *>(ptr) + offset;
4747
}
4848

4949
void ur_usm_handle_t::unmapHostPtr(

0 commit comments

Comments
 (0)