File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
unified-runtime/source/adapters/level_zero/v2 Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ ur_integrated_buffer_handle_t::ur_integrated_buffer_handle_t(
121121
122122ur_integrated_buffer_handle_t ::~ur_integrated_buffer_handle_t () {
123123 if (writeBackPtr) {
124- std::memcpy (writeBackPtr, this -> ptr .get (), size);
124+ std::memcpy (writeBackPtr, ptr.get (), size);
125125 }
126126}
127127
@@ -618,6 +618,12 @@ ur_result_t urMemBufferCreate(ur_context_handle_t hContext,
618618 void *hostPtr = pProperties ? pProperties->pHost : nullptr ;
619619 auto accessMode = ur_mem_buffer_t::getDeviceAccessMode (flags);
620620
621+ // For integrated devices, use zero-copy host buffers. The integrated buffer
622+ // constructor will handle all cases:
623+ // 1. No host pointer - allocate USM host memory
624+ // 2. Host pointer is already USM - use directly
625+ // 3. Host pointer can be imported - import it
626+ // 4. Otherwise - allocate USM and copy-back on destruction
621627 if (useHostBuffer (hContext)) {
622628 *phBuffer = ur_mem_handle_t_::create<ur_integrated_buffer_handle_t >(
623629 hContext, hostPtr, size, accessMode);
You can’t perform that action at this time.
0 commit comments