Commit Graph

104 Commits

Author SHA1 Message Date
Young Jin Yoon 82728ff394 feature: add logic to iterate for all contexts to check GPU pagefault
Implemented to go through entire contexts in the process and then query
reset status to check the unexpected GPU segfault.

Added a new debug variable GpuFaultCheckThreshold to change the checking
frequency for each hang check for performance analysis.

Related-To: GSD-5673
Signed-off-by: Young Jin Yoon <young.jin.yoon@intel.com>
2024-03-15 07:48:39 +01:00
Dominik Dabek 0120d8a58d performance: program pat index on mtl linux
Enable programming pat indexes on mtl linux for device buffers.

Change DrmMemoryManager::allocateMemoryByKMD to use gemCreateExt.

Set mmap flags based on coherency.
Map as write back on legacy and coherent.
On non-coherent map as write combined.

Changes currently disabled, to enable use debug keys:
DisableGemCreateExtSetPat=0
UseGemCreateExtInAllocateMemoryByKMD=1

Reorder BufferObject to decrease padding.

Related-To: NEO-7896

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
2024-02-16 17:33:07 +01:00
Maciej Plewka 7728123907 fix: Do not use 2mb alignment for host ptr allocs
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>

Related-To: NEO-9945
2024-01-29 11:01:00 +01:00
Warchulski, Jaroslaw f7dc17e6a2 fix: set mmapPtr in every allocation in multiGraphicAllocation
Related-To: GSD-7360
Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
2024-01-16 15:18:44 +01:00
Young Jin Yoon 4ccae1dbb4 feature: support memory policy for GEM_CREATE
Modified ioctl_helper_prelim to support the extension of gem_create_ext,
i.e. prelim_drm_i915_gem_create_ext_mempolicy.

Added two debug variables to be used for the mempolicy extension.

Modified functions in memory_info and drm_memory_manager to support extension

Added numaif.h from https://github.com/numactl/numactl/tree/master,
v2.0.14

Related-To: NEO-8276
Signed-off-by: Young Jin Yoon <young.jin.yoon@intel.com>
2024-01-04 23:49:10 +01:00
Mateusz Jablonski a4888b39c6 build: add clang-tidy restriction for Enum case
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2023-12-21 08:58:51 +01:00
John Falkowski 911acd81a2 feature: add SetBOChunkingSize debug variable
Resolves: NEO-9562

Signed-off-by: John Falkowski <john.falkowski@intel.com>
2023-12-04 06:21:01 +01:00
Compute-Runtime-Validation 9add9f12dc Revert "feature: add SetBOChunkingSize debug variable"
This reverts commit e1df8f9112.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
2023-12-03 03:28:16 +01:00
John Falkowski e1df8f9112 feature: add SetBOChunkingSize debug variable
Resolves: NEO-9562

Signed-off-by: John Falkowski <john.falkowski@intel.com>
2023-12-01 09:39:47 +01:00
Spruit, Neil R 456f07212d fix: Return pageSize/Heap for reservation based on the size and devices
Related-To: NEO-9127,NEO-9142

- Change the heap/pageSize used based on the size of the reservation
required and the device heaps available.
- Return the page size required based on the size requested by the user
for virtual reservation and the devices on the system.
- Check the size passed in by the user in memory map and physical memory
allocation is valid for the heap and page size that is required.

Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
2023-10-19 10:44:13 +02:00
Dunajski, Bartosz 06a02552ce refactor: debug flag to override PAT index for given memory type
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
2023-10-12 15:47:28 +02:00
Mateusz Jablonski a31dd7b454 fix: add unrecoverable to avoid out of bound access
Related-To: NEO-9038
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2023-10-10 10:45:30 +02:00
John Falkowski 56f05303c9 feature: add support for zeMemGet/SetAtomicAccessAttributeExp
Resolves: NEO-8219

Signed-off-by: John Falkowski <john.falkowski@intel.com>
2023-10-02 15:59:17 +02:00
Mateusz Hoppe 371412a826 refactor: remove useLocalMem from allocate32BitGraphicsMemoryImpl
- this method allocates System Memory
- argument is not needed - ExternalHeap is selected inside this function
- remove unneeded ults
- allocate memory in Device Pool for external heap allocation in
OsAgnosticMemoryManager

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
2023-09-18 10:08:09 +02:00
John Falkowski f652c7311d feature: Add prefetch for chunking with shared and device mem
Perform prefetching of chunks on shared and device allocations
after bind.

Related-To: NEO-8066

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
Signed-off by: John Falkowski <john.falkowski@intel.com>
2023-08-05 02:17:39 +02:00
Jaime Arteaga 2efd6e547a feature: Add support for chunking in the UMD (1/N)
Read if support for chunking is available in the KMD.
If available, KMD will create a BO with 1 or more chunks,
depending on the chunk size selected.

Related-To: NEO-7695

Sync to
https://github.com/intel-gpu/drm-uapi-helper/releases/tag/v2.0-rc18

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
Signed-off-by: John Falkowski <john.falkowski@intel.com>
2023-06-02 23:27:40 +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
Mateusz Jablonski 32d8a3bc6d fix: store registered engines per root device
in most cases we need to iterate over engines associated to single root device

Related-To: NEO-7925
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2023-04-27 10:54:07 +02:00
Spruit, Neil R 364c2da9fb feature: Add Support for zeMemPutIpcHandle & zeMemGet IPC Handle converters
Related-To: LOCI-4172, LOCI-4305, LOCI-4306

- Create a new IPC Memory handle upon call to getIpcMemHandle if the
previous handle has been freed.
- Release the Ipc Memory Handle when zeMemPutIpcHandle is called.
- Create a new IPC Handle for tracking thru zeMemGetAllocProperties
when ze_external_memory_export_fd_t is used.
- Convert FD to opaque IPC handle and IPC Handle to FD.

Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
2023-04-27 03:53:52 +02:00
Maciej Bielski 09b111cc97 refactor: improve code reuse and readability
Extract distinct steps as dedicated functions, especially when the code
is duplicated. This eases analysis of the logic and highlights
differences between callers of a common code.

Related-To: NEO-7788
Signed-off-by: Maciej Bielski <maciej.bielski@intel.com>
2023-04-24 12:30:01 +02:00
Spruit, Neil R 86e739e9dc feature: Relaxed Virtual Memory reservation with pStart
Related-To: LOCI-3871

- Relaxed the Virtual Memory Reservation to allow pStart and not fail if
the pStart value is not obtained.
- Moves checks on pStart to the user to check and determine if they want
to re-reserve or use the address allocated.
- Changed reserveGpuAddress to use unit64_t type to allow internal
address range structure assignment without cast.

Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
2023-03-08 08:06:50 +01:00
Milczarek, Slawomir 674691d170 Fix check for page faults enabled in get memory access properties
Related-To: NEO-6465

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
2023-02-28 10:13:25 +01:00
Neil Spruit 2aaebddb37 Revert "Heap allocation allow base address and growable addresses"
This reverts commit 44ec497b1a.

Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
2023-02-15 18:34:40 +01:00
Spruit, Neil R 44ec497b1a feature: Allow for Allocating a base address in the heap and grow an allocation
Related-To: LOCI-3871

- Enabled allocation of specified base address in the targeted heap.
- Enabled virtual memory reservations to grow by allocating at the start
of the heap vs the end of the heap.

Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
2023-02-15 08:13:38 +01:00
Wrobel, Patryk 4c58eda90d Ensure that BO handle is closed only once
When one process had exported and then opened IPC handle
of memory, then close function was called twice for the
same BO handle. It caused debugBreak() and aborted
an application.

This change allows multiple separate BOs to share one
handle. The last shared handle owner calls close() function.

Related-To: NEO-7200
Signed-off-by: Wrobel, Patryk <patryk.wrobel@intel.com>
2023-02-13 14:42:49 +01:00
Spruit, Neil R f928d695e7 Support for Mapping Physical with Virtual Memory
Related-To: LOCI-3422, LOCI-3421

Signed-off-by: Neil R Spruit <neil.r.spruit@intel.com>
2023-01-20 05:17:10 +01:00
Lukasz Jobczyk dff2c2d8e3 Align external host ptr allocation gpu va to 2MB
Related-To: NEO-7116

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
2023-01-13 12:37:10 +01:00
Compute-Runtime-Validation ddb7eb07b0 Revert "Align external host ptr allocation gpu va to 2MB"
This reverts commit d24f403cc4.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
2023-01-12 09:33:16 +01:00
Lukasz Jobczyk d24f403cc4 Align external host ptr allocation gpu va to 2MB
Related-To: NEO-7116

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
2023-01-11 13:45:06 +01:00
Jaime Arteaga 675272a32c Return a unique pointer for multiple calls to openIpcHandles
This to make zexMemOpenIpcHandles and zeMemOpenIpcHandle
behave similarly.

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2022-12-08 21:56:21 +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
Jaime Arteaga 99655d34f9 Return a unique pointer for multiple calls to openIpcHandle
This to follow specification, which says:

zeMemOpenIpcHandle:

- Multiple calls to this function with the same IPC handle will return
unique pointers.

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2022-12-01 18:42:54 +01:00
Spruit, Neil R d81b0b14a1 L0 Virtual Memory Reservation support
- Enable support for L0 Virtual Memory reservation on Linux and Windows.
- Excludes support for Linux to allow pStart option

Related-To: LOCI-3397, LOCI-1543

Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
2022-12-01 00:55:19 +01:00
Mateusz Jablonski 6648adef15 Handle error in register memory allocation methods
Related-To: NEO-7412
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2022-11-15 17:23:55 +01:00
Patryk Wrobel 9b26e96b11 Do not copy std::vector of OS handles when it is not needed
This change replaces unneeded copying of std::vectors
with usage of const references. Furthermore, it adds
reserve() call before filling the container via push_back().

Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
2022-10-21 10:28:58 +02:00
Milczarek, Slawomir 6edbfa04a0 Add regkey to create kmd-migrated shared allocation with multiple BOs
Related-To: NEO-7395

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
2022-10-11 16:16:43 +02:00
Jaime Arteaga a3b3f3e86e Add support for PRELIM_I915_PARAM_SET_PAIR
This extension allows pairing two buffer objects so they can be
exported using a single dma-buf handle. When imported, a single
buffer object is created with a total size of the two buffer
objects.

Related-To: LOCI-3355

Sync to
https://github.com/intel-gpu/drm-uapi-helper/releases/tag/v2.0-rc15

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2022-09-29 23:41:39 +02:00
Patryk Wrobel 90ba50bf52 Warn when RAII lock returned from function is discarded
Discarding RAII lock returned from function almost always
is a bug. This change introduces usage of [[no_discard]]
attribute from C++17 to prevent such misues.

Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
2022-09-01 16:53:03 +02:00
Mateusz Jablonski db2d1a53b9 Cleanup includes in drm_memory_manager.h
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2022-07-26 20:53:21 +02:00
Bartosz Dunajski 39c1c4d530 Remove virtual padding support
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
2022-06-08 12:42:44 +02:00
Bartosz Dunajski 9e1c9ec95e Use MMAP_OFFSET ioctl to lock BufferObject
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
2022-06-07 11:12:31 +02:00
Bartosz Dunajski 1a7c11e4f1 Dont pass redundant flags param to allocUserPtr
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
2022-06-06 17:53:04 +02:00
Jaime Arteaga 3f26f45c10 Add support for IPC handles with implicit scaling
When using implicit scaling, device allocations may have
more than one internal allocation created internally. In that case,
a separate dma-buf handle per internal allocation needs to be
exported.

So introduced two driver experimental extensions to export and
import more than one IPC handle:

- zexMemGetIpcHandles
- zexMemOpenIpcHandles

Related-To: LOCI-2919

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2022-05-09 00:38:17 +02:00
Bartosz Dunajski 06fa316a75 Assign pat_index to BO during creation
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
2022-04-21 13:25:13 +02:00
John Falkowski 789587bacc Return nullptr for gfx alloc mmap error
Signed-off-by: John Falkowski <john.falkowski@intel.com>
2022-04-12 10:08:19 +02:00
Milczarek, Slawomir f03f530327 Extend zeCommandListAppendMemoryPrefetch to migrate to associated device
Related-To: NEO-6740

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
2022-03-23 14:21:17 +01:00
Milczarek, Slawomir c0b7f05897 Add memory prefetch for kmd migrated shared allocations
This feature is disabled by default, controlled with the knob
AppendMemoryPrefetchForKmdMigratedSharedAllocations

Related-To: NEO-6740

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
2022-03-09 16:02:18 +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 538e0aea87 Add debug flag to bind at creation time
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
2022-02-09 09:26:02 +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