Commit Graph

64 Commits

Author SHA1 Message Date
Milczarek, Slawomir f3f623900a fix: memory prefetch for kmd migrated shared alloc to check for invalid usm ptr
Fix for SIGSEGV in SYCL_CTSO0Debug-usm_api_prefetch_handler_no_events_l0
./run_l0.sh usm_api_prefetch_handler_no_events test_usm

Related-To: LOCI-4742

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
2023-08-08 11:29:14 +02:00
Jitendra Sharma 38415162c5 fix: While creating shared memory use given device
When creating shared USM, currently default root device index
is used when accessing memoryManager.
This change fixes this issue, by using device provided by caller.
In case device is not provided, then default root device index
could be used.

Related-To: LOCI-4474

Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
2023-06-13 15:44:14 +02:00
Neil R Spruit ba6d447b4d feature: Support for using Reserved address with multiple mappings
Related-To: LOCI-4381

- Enabled support for customers to use full Virtual reservation range
with multiple physical mappings with additional allocations implicitly
included in residency.
- Buffer Surface state size extended for first allocation to stretch to
the bufferSize requested.

Signed-off-by: Neil R Spruit <neil.r.spruit@intel.com>
2023-06-07 03:12:29 +02:00
Neil R Spruit ded9d7bff2 feature: Get Peer Allocation with specified base Pointer
Related-To: LOCI-4176

- Given a Base Pointer passed into Get Peer Allocation, then the base
pointer is used in the map of the new allocation to the virtual memory.
- Enables users to use the same pointer for all devices in Peer To Peer.
- Currently unsupported on reserved memory due to mapped and exec
resiedency of Virtual addresses.

Signed-off-by: Neil R Spruit <neil.r.spruit@intel.com>
2023-05-24 20:41:20 +02:00
Lu, Wenbin 5d653c8536 fix: Add alignment support to createUnifiedMemoryAllocation
Allows the user to use alignments > 64KB in `createUnifiedMemoryAllocation`

So that the restriction in `piextUSMDeviceAlloc` of the DPC++ runtime
could be lifted

Related-To: LOCI-4168

Signed-off-by: Lu, Wenbin <wenbin.lu@intel.com>
2023-05-02 09:19:23 +02:00
Fabian Zwolinski cbce863dc2 refactor: Rename member variables to camelCase 3/n
Additionally enable clang-tidy check for member variables

Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
2023-04-28 16:01:14 +02:00
rcombs fc53bbe183 unified_memory_manager: mark comparison operators as const
This fixes the build on some compilers.

Signed-off-by: rcombs <rcombs@rcombs.me>
2023-04-24 10:47:30 +02:00
Milczarek, Slawomir 01d03aa5b6 Extended regkey to force prefetch of shared memory in enqueue commands
Extended the regkey ForceMemoryPrefetchForKmdMigratedSharedAllocations
to force meory prefetch of kmd-migrated shared allocation
in clEnqueueNDRangeKernel(), clEnqueueMemFillINTEL, ...

Related-To: NEO-7841

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
2023-04-11 11:23:48 +02:00
Dominik Dabek 1c52017ceb fix: use correct allocation type in program init
Globals surface allocation via USM manager will have correct allocation
type set (instead of just BUFFER) and will use cpu copy when possible.

Related-To: NEO-7796

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
2023-04-04 11:31:11 +02:00
Compute-Runtime-Validation 2b93126795 Revert "Add alignment support to createUnifiedMemoryAllocation"
This reverts commit ca02bbba4b.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
2023-03-30 15:43:47 +02:00
Lu, Wenbin ca02bbba4b Add alignment support to createUnifiedMemoryAllocation
Allows the user to use alignments > 64KB in `createUnifiedMemoryAllocation`

So that the restriction in `piextUSMDeviceAlloc` of the DPC++ runtime
could be lifted

Related-To: LOCI-4168

Signed-off-by: Lu, Wenbin <wenbin.lu@intel.com>
2023-03-28 10:57:04 +02:00
Warchulski, Jaroslaw c43233dabf Cleanup includes 42
Cleaned up files:
level_zero/core/source/kernel/kernel_hw.h
shared/source/helpers/common_types.h
shared/test/common/libult/linux/drm_mock.h
shared/test/common/libult/ult_command_stream_receiver.h

Related-To: NEO-5548
Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
2023-01-25 09:16:39 +01:00
John Falkowski 01017a5df3 L0: add support for deferred memory free as per ContextImp::freeMemExt
Signed-off-by: John Falkowski <john.falkowski@intel.com>
2023-01-12 21:05:02 +01:00
Warchulski, Jaroslaw 0dc5fb3e51 Cleanup includes 24
Cleaned up files:
opencl/source/mem_obj/image.h
opencl/source/platform/platform.h
shared/source/command_stream/preemption.h
shared/source/helpers/mt_helpers.h
shared/source/memory_manager/unified_memory_manager.h

Related-To: NEO-5548
Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
2023-01-10 07:56:16 +01:00
Compute-Runtime-Validation 429755e0f4 Revert "Check for context in appendMemoryCopy"
This reverts commit 32bab85f7e.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
2022-12-21 05:38:37 +01:00
Jaime Arteaga 32bab85f7e Check for context in appendMemoryCopy
Confirm the allocations used in an appendMemoryCopy operation
belong to the same context as the list.

Related-To: LOCI-1996
Resolves: NEO-6162

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2022-12-20 00:13:36 +01:00
Compute-Runtime-Validation 5a29cf8508 Revert "Check for context in appendMemoryCopy"
This reverts commit afd0784c16.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
2022-12-16 03:28:06 +01:00
Jaime Arteaga afd0784c16 Check for context in appendMemoryCopy
Confirm the allocations used in an appendMemoryCopy operation
belong to the same context as the list.

Related-To: LOCI-1996
Resolves: NEO-6162

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2022-12-15 23:42:10 +01:00
Slawomir Milczarek 5c1b50bccf Add memory prefetch modes for single and multiple subdevices
Single-subdevice prefetch for cmd list copy-only (with bcs) and acc mode.
Multi-subdevice prefetch (default) for shared allocation with multiple BOs.

Related-To: NEO-6740

Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
2022-12-07 15:25:32 +01:00
Lukasz Jobczyk 7c572b4090 Do not free SVM alloc under SVM manager lock
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
2022-12-02 12:36:10 +01:00
Maciej Plewka 4b42b066f8 Use dedicated using type for TaskCount
Related-To: NEO-7155

Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
2022-11-28 16:44:44 +01:00
Dominik Dabek 526ba1bde5 Fix l0 kernel set arg buffer caching
Fix for incorrect cache hit if alloc id was uninitialized
and allocations counter was the same.

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
2022-10-27 17:25:10 +02:00
Maciej Plewka 1458602efc Store indirect residency at command queue level
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
2022-09-22 14:07:19 +02:00
Compute-Runtime-Validation 643e21631c Revert "Store indirect residency at command queue level"
This reverts commit ffad5c6c09.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
2022-09-20 18:12:12 +02:00
Maciej Plewka ffad5c6c09 Store indirect residency at command queue level
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>

Related-To: NEO-7211
2022-09-19 17:01:20 +02:00
Kamil Kopryk 17f22990e6 Cleanup includes 4/n
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
2022-07-28 09:44:48 +02:00
Kamil Kopryk d4d54f5093 Cleanup includes
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
2022-07-25 09:58:38 +02:00
Milczarek, Slawomir 3e22f30ed5 clEnqueueMigrateMemINTEL with memory prefetch for KMD migrated shared allocation
Related-To: NEO-6740

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
2022-07-14 17:35:22 +02:00
Dominik Dabek cdfe2ce8ad Feature: Flag for device usm allocation reusing
With flag enabled, when app calls freeSVMAlloc on device usm allocation,
don't free it immediately but save it,
and try to use it on subsequent allocations.

This allocation cache will be trimmed if an allocation fails.

Related-To: NEO-6893

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
2022-06-13 20:02:52 +02:00
Dominik Dabek 8d1ad5a4f3 Refactor: use stack vector for root device indices
Stack vector will not cause dynamic allocations in most circumstances
ie. number of root device indices not more than 16

Related-To: NEO-6837

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
2022-04-14 14:05:42 +02:00
Maciej Bielski a71b88fefb PageFaultHandler: speedup UM allocations lookup
Add a per-instance SVMAllocsManager::nonGpuDomainAllocs container for
all allocations to be removed in
moveAllocationsWithinUMAllocsManagerToGpuDomain. This approach replaces
the current iterative search and performs the task faster.

Add 7 new unit-tests to verify the functionality related to
nonGpuDomainAllocs container, both in expected and unexpected/synthetic
scenarios.

For UTs replace a dummy unifiedMemoryManager pointer with a pointer to
an instace of SVMAllocsManager, otherwise a SegFault error is thrown at
the end of tests.

Perform overall cleanup in related tests implementation, includes but
not limited to removal of:

- givenInitialPlacementGpu\
WhenMovingToGpuDomainThenFirstAccessDoesNotInvokeTransfer

As it is fully covered by:

givenAllocationMovedToGpuDomain\
WhenVerifyingPagefaultThenAllocationIsMovedToCpuDomain

- givenInitialPlacementGpu\
WhenVerifyingPagefaultThenFirstAccessDoesNotInvokeTransfer

As it is fully covered by:

givenTbxAndnitialPlacementGpu\
WhenVerifyingPagefaultThenMemoryIsUnprotectedOnly

Finally, reduce code duplication where possible.

Related-To: NEO-6658
Signed-off-by: Maciej Bielski <maciej.bielski@intel.com>
2022-03-16 11:18:24 +01:00
Jaime Arteaga a010fb3634 Dont close shared handle on imported allocations
Related-To: LOCI-2272

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2022-03-06 04:35:47 +01:00
Lukasz Jobczyk c405fb5c2c Use shared mutex for unified memory manager
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
2022-02-23 19:00:38 +01:00
Bartosz Dunajski 4b0d986876 Move AllocationType enum out of GraphicsAllocation class
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
2022-02-04 17:49:09 +01:00
Jaime Arteaga dbf0f90186 Return pageSize in getMemAllocProperties
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2022-01-25 18:26:13 +01:00
Michal Mrozek 52d636394c [1/n] Improve indirect allocations handling.
Add new functions that would treat all indirect allocations as single pack.

Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
2022-01-25 06:27:33 +01:00
Compute-Runtime-Validation 6082865eb4 Revert "Optimize Level Zero indirect allocations handling."
This reverts commit 3ecbc55ba9.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
2022-01-20 11:41:13 +01:00
Michal Mrozek 3ecbc55ba9 Optimize Level Zero indirect allocations handling.
Make them resident directly instead of populating residency container
Remove finds, not needed, CSR resolves duplicates at makeResident calls
Observed gain is 32x for 10k indirect allocations.


Co-authored-by: Michal Mrozek <michal.mrozek@intel.com>

Co-authored-by: Dominik Dabek <dominik.dabek@intel.com>

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
2022-01-19 13:08:35 +01:00
Jaime Arteaga 3b497270c8 Add support for memory free policies
Add support for ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_BLOCKING_FREE
added in v1.3.

Related-To: LOCI-2672

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2021-12-28 08:27:50 +01:00
Bartosz Dunajski 9481d8a88b Compression refactor [2/n]
Dont use allocation type for compression preference

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
2021-12-03 08:47:46 +01:00
Jaime Arteaga 522d2550ee Add allocation ID to be retrieved by L0 getMemAllocProperties
zeMemGetAllocProperties() specifies an ID for the allocation can be
retrieved by the application. This can be used by applications to
identify the allocation throughout the application lifetime.

We were currently returning as id the same allocation address. This
patch fixes it to return a true unique identifier for the allocation.

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2021-09-15 19:22:50 +02:00
lgotszal 3bd4bca911 Copyright header update
Dates corrected in copyright headers to reflect original publication date
(2018 for OpenCL, 2020 for Level Zero).

Signed-off-by: lgotszal <lukasz.gotszald@intel.com>
2021-05-17 20:38:19 +02:00
Bartosz Dunajski cffac84a3b Simplify creating EventPool allocation
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
2021-05-11 18:26:54 +02:00
Jaime Arteaga 128cd8a31c Add support for non-IPC P2P access to L0
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2021-04-20 01:05:40 +02:00
Jaime Arteaga c540af8e5f Fix multidevice support for events
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2021-04-15 22:12:07 +02:00
Jaime Arteaga 0dc73ad686 Isolate host allocations with respect to context
Related-To: LOCI-1996

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2021-03-25 06:15:59 +01:00
Jaime Arteaga 6a81edfbe1 Add support for ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_MAX_SIZE
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2021-03-15 16:20:10 +01:00
Zbigniew Zdanowicz 779253c49c Add new flag to USM memory manager
Related-To: NEO-5498

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
2021-03-10 11:47:34 +01:00
Slawomir Milczarek 068cb09c90 Add function to check for USM host allocations in SVM Allocs Manager
Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
2021-01-12 15:41:24 +01:00
Mateusz Jablonski 1b7d7afc07 Refactor USM properties
store reference to std of root device indices and device bitfields
store NEO::Device in USM properties

Related-To: NEO-3691
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2020-12-30 11:36:56 +01:00