Skip to content

Commit 5d86a2c

Browse files
committed
[SYCL][UR][L0 v2] add missing offset calculation to
getDevicePtr and mapHostPtr for ur_usm_handle_t. We never actually use the handle with non-zero offset but we may change that in future.
1 parent 1a87eec commit 5d86a2c

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ ur_usm_handle_t::ur_usm_handle_t(ur_context_handle_t hContext, size_t size,
4747

4848
void *ur_usm_handle_t::getDevicePtr(
4949
ur_device_handle_t /*hDevice*/, device_access_mode_t /*access*/,
50-
size_t /*offset*/, size_t /*size*/,
50+
size_t offset, size_t /*size*/,
5151
std::function<void(void *src, void *dst, size_t)> /*migrate*/) {
52-
return ptr;
52+
return ur_cast<char*>(ptr) + offset;
5353
}
5454

5555
void *
56-
ur_usm_handle_t::mapHostPtr(ur_map_flags_t /*flags*/, size_t /*offset*/,
56+
ur_usm_handle_t::mapHostPtr(ur_map_flags_t /*flags*/, size_t offset,
5757
size_t /*size*/,
5858
std::function<void(void *src, void *dst, size_t)>) {
59-
return ptr;
59+
return ur_cast<char*>(ptr) + offset;
6060
}
6161

6262
void ur_usm_handle_t::unmapHostPtr(

0 commit comments

Comments
 (0)