Commit Graph

41 Commits

Author SHA1 Message Date
Philip Rebohle 2be0d6842e [dxvk] Add option to limit memory chunk size 2023-03-01 11:53:18 +01:00
Philip Rebohle 1c2df54bdf [dxvk] Improve logging in case of memory errors 2023-01-14 03:39:55 +01:00
Philip Rebohle 2922b780c1 [dxvk] Properly handle bufferImageGranularity for images
Fixes validation errors about dedicated allocations being
bigger than the image's memory requirement on Nvidia.
2023-01-14 03:39:55 +01:00
Philip Rebohle f9db4921e0 [dxvk] Implement sparse memory allocator 2022-08-26 05:53:03 +02:00
Philip Rebohle a2a21cb4d3 [dxvk] Clean up internal memory allocation API 2022-08-25 18:23:02 +02:00
Joshua Ashton 915ec4acc2 [dxvk] Remove WIN32 check for handle type in DxvkSharedHandleInfo
The initial implementation if-deffed this, but it doesn't need to be.
2022-08-21 21:34:39 +02:00
Derek Lesho 02d3e0d31f
[dxvk] Add shared handle access to DxvkImage memory.
Based off preliminary work from Josh.
2022-03-12 16:23:06 +01:00
Philip Rebohle 425fce9200
[dxvk] Introduce transient memory flag for staging buffers
Potentially reduces fragmentation by putting short-lived staging buffers
and sysmem resources created by the application into different memory pools.
2022-02-13 02:08:20 +01:00
Philip Rebohle db2e32ede6
[dxvk] Be smarter about which chunks to free
Freeing all empty chunks immediately may cause issues if an app constantly
allocates and frees a small number of resources that don't fit into any
existing chunk, so try to keep one around. Aggressively free everything
under memory pressure if necessary.
2022-01-13 18:39:31 +01:00
Philip Rebohle 15ab07ab94
[dxvk] Replace allocation priority with allocation flags 2022-01-13 18:39:31 +01:00
Philip Rebohle d34bbdb58e
[dxvk] Free empty memory chunks 2022-01-13 18:22:44 +01:00
Philip Rebohle cd8a2bcfcd [dxvk] Use custom sync primitives 2021-06-29 00:51:20 +02:00
Philip Rebohle e435e071e0 [dxvk] Introduce memory heap budget
Allows more fine-grained control of memory allocations for specific
heaps. For now, target 80% for device-local heaps on UMA devices.
2020-08-22 11:50:37 +02:00
Philip Rebohle ca4c03284f [dxvk] Don't oversubscribe memory heaps on UMA devices
Otherwise, we seem to suffer a major performance penalty
on setups with insufficient dedicated system memory.
2020-01-28 16:31:34 +00:00
Philip Rebohle 60145f0167 [dxvk] Don't enable VK_KHR_dedicated_allocation, VK_KHR_get_memory_requirements2
Core in Vulkan 1.1.
2020-01-17 17:46:59 +01:00
Philip Rebohle 7a18cb1227
[dxvk] Remove unused memory stat counters 2019-12-13 12:08:36 +01:00
Philip Rebohle 8e587af0da
[dxvk] Add method to retrieve per-heap memory stats 2019-12-13 11:54:13 +01:00
Joshua Ashton 7c8d03b3e1 [dxvk] Add helper to get size of memory/image in bytes 2019-12-11 03:18:39 +01:00
Philip Rebohle 4fd41f8550
[dxvk] Don't allow common objects to be reference-counted 2019-07-30 20:06:59 +02:00
Philip Rebohle 493b55b073
[dxvk] Compute memory chunk size per memory type rather than per heap 2019-07-16 09:59:44 +02:00
Philip Rebohle 138dde6c3d
[dxvk] Prefer VRAM allocation over dedicated sysmem allocation
May in some cases improve performance when under memory pressure:
If a dedicated allocation is preferred, but the alloaction fails,
try to allocate memory from an already allocated chunk instead
of falling back to system memory right away.
2019-06-20 10:34:54 +02:00
Philip Rebohle b76f470c5f
[dxvk] Remove dxvk.allowMemoryOvercommit option
The default behaviour is now to allow overallocation by default,
which makes sense especially when VK_EXT_memory_priority is used.

Does not seem to affect Nvidia drivers.
2019-01-30 13:52:43 +01:00
Philip Rebohle 03b488772d
[dxvk] Store device instead of adapter in memory allocator 2019-01-30 13:52:43 +01:00
Philip Rebohle 134613375d
[dxvk] Introduce concept of priorities to device-local memory allocations
The priority defines the importance of any given allocation being
resident in device-local memory rather than system memory, with
values between 0 (low) and 1 (high).

Suballocations will only work on chunks with the requested priority.
This ensures that high-priority allocations are reserved solely for
high-priority resources, and that high-priority resources will be
allocated from a high-priority memory chunk.
2019-01-30 13:52:43 +01:00
Philip Rebohle 1af96347e1
[dxvk] Forward memory allocation statistics to the adapter 2018-11-15 17:08:05 +01:00
Philip Rebohle eac86fab15
[dxvk] Do not map allocations that don't need a HOST_VISIBLE memory type
Should reduce the amount of virtual memory used on systems without
dedicated VRAM. Refs #640.
2018-09-17 09:08:00 +02:00
Philip Rebohle b2c4855490
[dxvk] Use global user config for backend options 2018-08-07 16:59:49 +02:00
Philip Rebohle 43cbe42ea8
[dxvk] Pick memory chunk size dynamically
Reduces the number of Vulkan memory allocations, and
can lead to lower CPU overhead in certain situations.
Improves Shadow Warrior 2 by ~2% on RADV.
2018-07-09 19:18:39 +02:00
ZeroFault b62ccfe7a3 [dxvk] Implement dedicated allocation (#448)
Yields significant performance improvements on some Nvidia GPUs.
2018-06-24 10:55:42 +02:00
Philip Rebohle 420b7218ae
Revert "[dxvk] Increase memory chunk size to 32 MiB"
This reverts commit 83ae39f727.

Does not show any considerable advantage over the 16 MiB chunk size
and reduces the effectiveness of the host-visible device-local memory
type on AMD cards.
2018-06-06 23:47:43 +02:00
Philip Rebohle 83ae39f727
[dxvk] Increase memory chunk size to 32 MiB
Reduces the number of memory allocations considerably.
2018-06-05 18:45:11 +02:00
Philip Rebohle a9eff13b92
[dxvk] Refactor memory allocator
In addition to some much needed code cleanips, the allocator will no
longer try to over-commit memory heaps.
2018-05-29 14:48:27 +02:00
Philip Rebohle 561fa7440b [dxvk] Retrieve actual memory stats for the HUD 2018-04-03 15:32:00 +02:00
Philip Rebohle 894444d43d
[dxvk] Remove old debug code 2018-03-20 22:36:02 +01:00
Philip Rebohle 42d49d7603
[dxvk] Respect bufferImageGranularity for non-linear images
May fix aliasing issues on GPUs where the bufferImageGranularity limit
is greater than the alignment requirement of non-linear resources.
2018-03-20 20:24:11 +01:00
Philip Rebohle e5c0030f06
[dxvk] Fall back to host memory if no device memory is available 2018-02-27 12:36:44 +01:00
Philip Rebohle 1fe5b74762 Optimized command submission
Command submission now does not synchronize with the device every single
time. Instead, the command list and the fence that was created for it are
added to a queue. A separate thread will then wait for the execution to
complete and return the command list to the device.
2017-12-16 18:10:55 +01:00
Philip Rebohle d5a49698b4 [dxvk] Implemented new memory allocator with sub-allocation 2017-12-16 16:48:42 +01:00
Philip Rebohle 52f1c4fa00 [dxvk] Implemented staging buffers for large data transfers 2017-12-10 15:57:51 +01:00
Philip Rebohle e433c01ad4 [dxvk] Some more work on shader resources and resource bindings 2017-10-15 17:56:06 +02:00
Philip Rebohle 00e63d71a9 Initial commit 2017-10-10 23:32:13 +02:00