anv: add an option to disable allocation over subscription

Usually I'm able to run B580 capture on LNL, but in some cases the
oversubscription on replay would lead to allocation failures.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41501>
This commit is contained in:
Lionel Landwerlin 2026-05-05 16:52:58 +03:00 committed by Marge Bot
parent 45db78332e
commit 8e3084dfe6
4 changed files with 46 additions and 37 deletions

View file

@ -1696,16 +1696,18 @@ anv_device_alloc_bo(struct anv_device *device,
* MTL(Xe KMD only)/LNL platforms, which incur largest perf penalty from
* page misses.
*/
if (align64(size, 2 * 1024 * 1024) <= (size * 4 / 3) &&
anv_device_has_perf_improvement_with_2mb_pages_oversubscription(device))
size = align64(size, 2 * 1024 * 1024);
/* bos larger than 1MB can't be allocated with slab but to reduce pages we
* could align size to 64k pages to gain performance with minimum memory
* waste.
*/
else if ((size > (1 * 1024 * 1024)) &&
anv_device_has_perf_improvement_with_64k_pages(device))
size = align64(size, 64 * 1024);
if (!ANV_DEBUG(NO_ALLOC_OVER_SUBSCRIPTION)) {
if (align64(size, 2 * 1024 * 1024) <= (size * 4 / 3) &&
anv_device_has_perf_improvement_with_2mb_pages_oversubscription(device))
size = align64(size, 2 * 1024 * 1024);
/* bos larger than 1MB can't be allocated with slab but to reduce pages we
* could align size to 64k pages to gain performance with minimum memory
* waste.
*/
else if ((size > (1 * 1024 * 1024)) &&
anv_device_has_perf_improvement_with_64k_pages(device))
size = align64(size, 64 * 1024);
}
const struct intel_memory_class_instance *regions[2];
uint32_t nregions = 0;

View file

@ -1574,6 +1574,11 @@ anv_vma_alloc(struct anv_device *device,
done:
pthread_mutex_unlock(&device->vma_mutex);
if (addr == 0 && client_address) {
mesa_logi("Virtual address allocation failed, "
"consider running with ANV_DEBUG=no-alloc-oversubscription");
}
assert(addr == intel_48b_address(addr));
return intel_canonical_address(addr);
}

View file

@ -119,19 +119,20 @@ static const driOptionDescription anv_dri_options[] = {
};
static const struct debug_control debug_control[] = {
{ "bindless", ANV_DEBUG_BINDLESS},
{ "desc-dirty", ANV_DEBUG_DESCRIPTOR_DIRTY},
{ "dgc-dump", ANV_DEBUG_DGC_DUMP},
{ "experimental", ANV_DEBUG_EXPERIMENTAL},
{ "no-gpl", ANV_DEBUG_NO_GPL},
{ "no-slab", ANV_DEBUG_NO_SLAB},
{ "no-sparse", ANV_DEBUG_NO_SPARSE},
{ "sparse-trtt", ANV_DEBUG_SPARSE_TRTT},
{ "video-decode", ANV_DEBUG_VIDEO_DECODE},
{ "video-encode", ANV_DEBUG_VIDEO_ENCODE},
{ "shader-dump", ANV_DEBUG_SHADER_DUMP},
{ "shader-hash", ANV_DEBUG_SHADER_HASH},
{ "shader-print", ANV_DEBUG_SHADER_PRINT},
{ "bindless", ANV_DEBUG_BINDLESS},
{ "desc-dirty", ANV_DEBUG_DESCRIPTOR_DIRTY},
{ "dgc-dump", ANV_DEBUG_DGC_DUMP},
{ "experimental", ANV_DEBUG_EXPERIMENTAL},
{ "no-gpl", ANV_DEBUG_NO_GPL},
{ "no-alloc-oversubscription", ANV_DEBUG_NO_ALLOC_OVER_SUBSCRIPTION},
{ "no-slab", ANV_DEBUG_NO_SLAB},
{ "no-sparse", ANV_DEBUG_NO_SPARSE},
{ "sparse-trtt", ANV_DEBUG_SPARSE_TRTT},
{ "video-decode", ANV_DEBUG_VIDEO_DECODE},
{ "video-encode", ANV_DEBUG_VIDEO_ENCODE},
{ "shader-dump", ANV_DEBUG_SHADER_DUMP},
{ "shader-hash", ANV_DEBUG_SHADER_HASH},
{ "shader-print", ANV_DEBUG_SHADER_PRINT},
{ NULL, 0 }
};

View file

@ -1735,20 +1735,21 @@ anv_physical_device_has_vram(const struct anv_physical_device *device)
}
enum anv_debug {
ANV_DEBUG_BINDLESS = BITFIELD_BIT(0),
ANV_DEBUG_NO_GPL = BITFIELD_BIT(1),
ANV_DEBUG_NO_SECONDARY_CALL = BITFIELD_BIT(2),
ANV_DEBUG_NO_SPARSE = BITFIELD_BIT(3),
ANV_DEBUG_SPARSE_TRTT = BITFIELD_BIT(4),
ANV_DEBUG_VIDEO_DECODE = BITFIELD_BIT(5),
ANV_DEBUG_VIDEO_ENCODE = BITFIELD_BIT(6),
ANV_DEBUG_SHADER_HASH = BITFIELD_BIT(7),
ANV_DEBUG_NO_SLAB = BITFIELD_BIT(8),
ANV_DEBUG_DESCRIPTOR_DIRTY = BITFIELD_BIT(9),
ANV_DEBUG_SHADER_PRINT = BITFIELD_BIT(10),
ANV_DEBUG_SHADER_DUMP = BITFIELD_BIT(11),
ANV_DEBUG_EXPERIMENTAL = BITFIELD_BIT(12),
ANV_DEBUG_DGC_DUMP = BITFIELD_BIT(13),
ANV_DEBUG_BINDLESS = BITFIELD_BIT(0),
ANV_DEBUG_NO_GPL = BITFIELD_BIT(1),
ANV_DEBUG_NO_SECONDARY_CALL = BITFIELD_BIT(2),
ANV_DEBUG_NO_SPARSE = BITFIELD_BIT(3),
ANV_DEBUG_SPARSE_TRTT = BITFIELD_BIT(4),
ANV_DEBUG_VIDEO_DECODE = BITFIELD_BIT(5),
ANV_DEBUG_VIDEO_ENCODE = BITFIELD_BIT(6),
ANV_DEBUG_SHADER_HASH = BITFIELD_BIT(7),
ANV_DEBUG_NO_SLAB = BITFIELD_BIT(8),
ANV_DEBUG_DESCRIPTOR_DIRTY = BITFIELD_BIT(9),
ANV_DEBUG_SHADER_PRINT = BITFIELD_BIT(10),
ANV_DEBUG_SHADER_DUMP = BITFIELD_BIT(11),
ANV_DEBUG_EXPERIMENTAL = BITFIELD_BIT(12),
ANV_DEBUG_DGC_DUMP = BITFIELD_BIT(13),
ANV_DEBUG_NO_ALLOC_OVER_SUBSCRIPTION = BITFIELD_BIT(14),
};
extern enum anv_debug anv_debug;