The GPU address map for device faults is off by default (#1174)

With VK_EXT_device_address_binding_report enabled, AMD's Windows driver (26.10.1) tracks every bound range in a
chained hash map that it searches on nearly every recorded command. The chains grow as textures stream in and out, so
after 5-10 minutes in a busy area recording a submission cost 3-4 times more and an RX 9070 XT fell from 60 to 20-30
fps. The map only serves the fault report after a device lost, so TOTK_ADDR_REPORT now defaults to 0 and =1 turns it
on for a run that chases a fault. ADDR_REPORT is a known key now, so the ini line no longer logs "unknown key".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-15 20:13:00 +03:00
1 parent 6151ac4fbc
commit c5b1cc7fac
5 files changed
+18 -7

No files matched your search

+7 -5
View File
@@ -22,7 +22,10 @@ static PlatMutex g_lock = PLAT_MUTEX_INIT;
// the debug messenger. The newest AB_N events stay in a ring written without a lock (one atomic add each), so a device
// fault names the object behind its address and whether it was unbound before the fault, which is memory freed while
// a submission still used it. One event per image, buffer or memory block made or freed, none per draw.
// TOTK_ADDR_REPORT=0 turns it off.
// Off by default; TOTK_ADDR_REPORT=1 turns it on for a run that chases a device fault. Our callback is cheap, but with
// the feature on AMD's Windows driver (26.10.1) tracks every bound range in a chained hash map it searches on nearly
// every recorded command: the chains grow as textures stream in and out, and recording a submission cost 3-4 times
// more after minutes of play in a busy area (#1174).
#define AB_N (1u << 15)
typedef struct { uint64_t seq, base, size, handle, issued, done; int32_t type; uint32_t unbind; } AbEvent;
static AbEvent *ab_ring;
@@ -137,8 +140,7 @@ static int create_instance(void) {
rt_log("vk: TOTK_VK_VALIDATION set but %s is not installed; continuing without", layers[0]);
validate = 0;
}
const char *ar = cfg_get("TOTK_ADDR_REPORT");
ab_want = !(ar && !strcmp(ar, "0")) && instance_ext_present(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
ab_want = cfg_bool("TOTK_ADDR_REPORT") && instance_ext_present(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
if (ab_want && !ab_ring && !(ab_ring = calloc(AB_N, sizeof *ab_ring))) ab_want = 0;
if (validate || ab_want) ext[n_ext++] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
if (vk_hdr_wanted() && instance_ext_present(VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME)) // HDR10 surface formats
@@ -405,8 +407,8 @@ static int create_device(void) {
// wherever reported; vk_pipeline.c spirv_demote emits OpDemoteToHelperInvocation only when it is.
vk_caps.demote = c->f13.shaderDemoteToHelperInvocation;
rt_log("vk: GPU address map for device faults: %s",
has_abr && c->abr.reportAddressBinding ? "on (VK_EXT_device_address_binding_report; TOTK_ADDR_REPORT=0 turns it off)"
: !ab_want ? "off (TOTK_ADDR_REPORT=0 or no VK_EXT_debug_utils)"
has_abr && c->abr.reportAddressBinding ? "on (VK_EXT_device_address_binding_report, TOTK_ADDR_REPORT=1)"
: !ab_want ? "off (TOTK_ADDR_REPORT=1 turns it on; it slows recording on some drivers)"
: "unavailable (no VK_EXT_device_address_binding_report)");
g_vk.has_buffer_device_address = c->f12.bufferDeviceAddress;
// VkPresentIdKHR on a present needs the presentId feature, not just the extension