Skip to content

Commit f1d4cd7

Browse files
authored
[SYCL][UR][L0 v2] Use discrete buffer implementation for integrated GPUs (#18354)
1 parent c0010e0 commit f1d4cd7

File tree

1 file changed

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

1 file changed

+13
-4
lines changed

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

+13-4
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,16 @@ void *ur_integrated_buffer_handle_t::getDevicePtr(
114114
void *ur_integrated_buffer_handle_t::mapHostPtr(
115115
ur_map_flags_t /*flags*/, size_t offset, size_t /*size*/,
116116
std::function<void(void *src, void *dst, size_t)> /*migrate*/) {
117+
// TODO: if writeBackPtr is set, we should map to that pointer
118+
// because that's what SYCL expects, SYCL will attempt to call free
119+
// on the resulting pointer leading to double free with the current
120+
// implementation. Investigate the SYCL implementation.
117121
return ur_cast<char *>(ptr.get()) + offset;
118122
}
119123

120124
void ur_integrated_buffer_handle_t::unmapHostPtr(
121125
void * /*pMappedPtr*/, std::function<void(void *src, void *dst, size_t)>) {
126+
// TODO: if writeBackPtr is set, we should copy the data back
122127
/* nop */
123128
}
124129

@@ -371,15 +376,19 @@ void ur_shared_buffer_handle_t::unmapHostPtr(
371376
// nop
372377
}
373378

374-
static bool useHostBuffer(ur_context_handle_t hContext) {
379+
static bool useHostBuffer(ur_context_handle_t /* hContext */) {
375380
// We treat integrated devices (physical memory shared with the CPU)
376381
// differently from discrete devices (those with distinct memories).
377382
// For integrated devices, allocating the buffer in the host memory
378383
// enables automatic access from the device, and makes copying
379384
// unnecessary in the map/unmap operations. This improves performance.
380-
return hContext->getDevices().size() == 1 &&
381-
hContext->getDevices()[0]->ZeDeviceProperties->flags &
382-
ZE_DEVICE_PROPERTY_FLAG_INTEGRATED;
385+
386+
// TODO: fix integrated buffer implementation
387+
return false;
388+
389+
// return hContext->getDevices().size() == 1 &&
390+
// hContext->getDevices()[0]->ZeDeviceProperties->flags &
391+
// ZE_DEVICE_PROPERTY_FLAG_INTEGRATED;
383392
}
384393

385394
ur_mem_sub_buffer_t::ur_mem_sub_buffer_t(ur_mem_handle_t hParent, size_t offset,

0 commit comments

Comments
 (0)