diff options
| author | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2025-03-25 17:19:28 -0700 |
|---|---|---|
| committer | Marge Bot <emma+marge@anholt.net> | 2025-04-09 22:48:18 +0000 |
| commit | fdbdfaed0157bea23a17fef9fdbf3d380d7ff8ef (patch) | |
| tree | e0114bdae11a1ff06d1a74bfa9b15dc320da02f3 | |
| parent | ec4b2ce6644de01817200a3915689222497f4c5e (diff) | |
anv: add ANV_SYS_MEM_LIMIT for debugging system memory restrictions
If you suspect a workload is failing because it needs more memory, you
can set ANV_SYS_MEM_LIMIT=100 to give it all the memory available.
This could make, for example, certain games start working (it really
depends on how much RAM you have and how much the game wants).
If you suspect a workload is too resource hungry, you can try to limit
it with ANV_SYS_MEM_LIMIT=30 (or some other value) to see if it can
deal with the more restricted environment and behave accordingly.
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28513>
| -rw-r--r-- | src/intel/vulkan/anv_physical_device.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_physical_device.c b/src/intel/vulkan/anv_physical_device.c index 2918212cb1b..69dfd426a36 100644 --- a/src/intel/vulkan/anv_physical_device.c +++ b/src/intel/vulkan/anv_physical_device.c @@ -1993,6 +1993,17 @@ anv_restrict_sys_heap_size(struct anv_physical_device *device, return kmd_reported_sram; } + const char *env_limit = os_get_option("ANV_SYS_MEM_LIMIT"); + if (env_limit) { + int64_t limit_percent = debug_parse_num_option(env_limit, 75); + if (limit_percent < 10) + limit_percent = 10; + else if (limit_percent > 100) + limit_percent = 100; + + return kmd_reported_sram * limit_percent / 100; + } + if (kmd_reported_sram <= 4ull * 1024ull * 1024ull * 1024ull) return kmd_reported_sram / 2; else |