@@ -2295,20 +2295,16 @@ pi_result piMemBufferCreate(pi_context Context, pi_mem_flags Flags, size_t Size,
2295
2295
Context->Devices [0 ]->ZeDeviceProperties .flags &
2296
2296
ZE_DEVICE_PROPERTY_FLAG_INTEGRATED;
2297
2297
2298
- // Having PI_MEM_FLAGS_HOST_PTR_ALLOC for buffer requires allocation of
2299
- // pinned host memory which then becomes automatically accessible from
2300
- // discrete devices through PCI. This property ensures that the memory
2301
- // map/unmap operations are free of cost and the buffer is optimized for
2302
- // frequent accesses from the host giving improved performance.
2303
- // see:
2304
- // https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/UsePinnedMemoryProperty/UsePinnedMemoryPropery.adoc
2305
- bool AllocHostPtr = Flags & PI_MEM_FLAGS_HOST_PTR_ALLOC;
2306
-
2307
- if (AllocHostPtr) {
2308
- PI_ASSERT (HostPtr == nullptr , PI_INVALID_VALUE);
2298
+ if (Flags & PI_MEM_FLAGS_HOST_PTR_ALLOC) {
2299
+ // Having PI_MEM_FLAGS_HOST_PTR_ALLOC for buffer requires allocation of
2300
+ // pinned host memory, see:
2301
+ // https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/UsePinnedMemoryProperty/UsePinnedMemoryPropery.adoc
2302
+ // We are however missing such functionality in Level Zero, so we just
2303
+ // ignore the flag for now.
2304
+ //
2309
2305
}
2310
2306
2311
- if (AllocHostPtr || DeviceIsIntegrated) {
2307
+ if (DeviceIsIntegrated) {
2312
2308
ze_host_mem_alloc_desc_t ZeDesc = {};
2313
2309
ZeDesc.flags = 0 ;
2314
2310
@@ -2350,7 +2346,7 @@ pi_result piMemBufferCreate(pi_context Context, pi_mem_flags Flags, size_t Size,
2350
2346
*RetMem = new _pi_buffer (
2351
2347
Context, pi_cast<char *>(Ptr) /* Level Zero Memory Handle */ ,
2352
2348
HostPtrOrNull, nullptr , 0 , 0 ,
2353
- AllocHostPtr || DeviceIsIntegrated /* allocation in host memory */ );
2349
+ DeviceIsIntegrated /* allocation in host memory */ );
2354
2350
} catch (const std::bad_alloc &) {
2355
2351
return PI_OUT_OF_HOST_MEMORY;
2356
2352
} catch (...) {
@@ -4602,18 +4598,17 @@ pi_result piEnqueueMemBufferMap(pi_queue Queue, pi_mem Buffer,
4602
4598
4603
4599
// TODO: Level Zero is missing the memory "mapping" capabilities, so we are
4604
4600
// left to doing new memory allocation and a copy (read) on discrete devices.
4605
- // For pinned host memory and integrated devices, we have allocated the
4606
- // buffer in host memory so no actions are needed here except for
4607
- // synchronizing on incoming events. A host-to-host copy is done if a host
4608
- // pointer had been supplied during buffer creation on integrated devices.
4601
+ // For integrated devices, we have allocated the buffer in host memory so no
4602
+ // actions are needed here except for synchronizing on incoming events.
4603
+ // A host-to-host copy is done if a host pointer had been supplied during
4604
+ // buffer creation on integrated devices.
4609
4605
//
4610
4606
// TODO: for discrete, check if the input buffer is already allocated
4611
4607
// in shared memory and thus is accessible from the host as is.
4612
4608
// Can we get SYCL RT to predict/allocate in shared memory
4613
4609
// from the beginning?
4614
4610
4615
- // For pinned host memory and integrated devices the buffer has been
4616
- // allocated in host memory.
4611
+ // For integrated devices the buffer has been allocated in host memory.
4617
4612
if (Buffer->OnHost ) {
4618
4613
// Wait on incoming events before doing the copy
4619
4614
PI_CALL (piEventsWait (NumEventsInWaitList, EventWaitList));
@@ -4718,8 +4713,7 @@ pi_result piEnqueueMemUnmap(pi_queue Queue, pi_mem MemObj, void *MappedPtr,
4718
4713
(*Event)->CommandData =
4719
4714
(MemObj->OnHost ? nullptr : (MemObj->MapHostPtr ? nullptr : MappedPtr));
4720
4715
4721
- // For pinned host memory and integrated devices the buffer is allocated
4722
- // in host memory.
4716
+ // For integrated devices the buffer is allocated in host memory.
4723
4717
if (MemObj->OnHost ) {
4724
4718
// Wait on incoming events before doing the copy
4725
4719
PI_CALL (piEventsWait (NumEventsInWaitList, EventWaitList));
0 commit comments