Repository navigation
perf(agc): draw cache keys on the user words a program reads, memoizes failures, serves data-only hits - #291
Conversation
b75610e to
7dcbc65
Compare
…t, recoverable GPU out-of-memory A guest allocation larger than 64 MiB (APS5_HOST_IMPORT_WINDOW_MIB) is imported in windows around the range a draw or dispatch uses instead of whole, so one large heap no longer takes the import budget (APS5_HOST_IMPORT_MIB, 6 GiB as before). Windows follow a grid from the range's start and the last one takes the remainder, so no window is smaller than the window size. Past the budget the least recently used imports no draw holds are retired first; only what still does not fit is refused. A refused import of 16 MiB or more that failed for memory retires imports and is tried once more; a refused import is never offered again and its range is copied, as before. A draw or dispatch whose allocation fails with VK_ERROR_OUT_OF_DEVICE_MEMORY waits for the GPU, drops the shared resource cache, retires a quarter of the live imports (at least 256 MiB), lowers the import limit to the larger of what stays live and half the budget, trims the buffer pool, and runs once more. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A window made while a smaller import of the same range was still in use, or a window over other cells than an existing one, left two live imports over the same bytes. Lookups and the unit shadows take the one import before an address, so a shadowed write-back in one import stayed hidden from reads through the other. A new import now takes in every import it would overlap and replaces them, and is not made while a build still holds one of them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… of evicting; default budget from RAM An address-based build imports every registered allocation. When that set is larger than the budget, evicting least-recent imports during the pass retires imports the same pass took or will take, moves the import epoch, and keeps the address space from being published, so every build re-imported guest memory (about 20 ms each in GTA V). The pass now refuses past the budget (those ranges use mirrors as before) and no longer evicts. APS5_HOST_IMPORT_MIB now defaults to half of physical memory, at least 6 GiB; the recoverable out-of-memory path still lowers the limit when the driver runs out. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Both returns of configuredBudget's lambda must deduce the same type; on Linux GCC strtoull's unsigned long long and std::uint64_t differ. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…s failures, serves data-only hits The draw key mixes only the user words each stage's RSRC2 counts (APS5_DRAW_KEY_ALL_USER_WORDS=1 mixes all 32). A draw that failed is not retried while the memory it read is unchanged, for at most APS5_DRAW_FAILURE_RETRY_MS (500 ms). A draw that differs from its shape's newest entry only in user data reuses that entry's decode and the compiled stages whose reads still hold, re-reading only the user words (APS5_NO_DRAW_DATA_HITS=1 disables, APS5_VERIFY_DRAW_DATA_HITS=1 compiles and compares). A new key of a shape replaces the shape's previous entry instead of keeping both; it starts without that entry's variants, which were compiled under other user words. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
7dcbc65 to
7b1c071
Compare
|
@boykopovar this one needs your call before Michon rebases it: should a draw that failed be skipped on a timer? This PR keeps a failed draw rejected until the memory it read changes or 500 ms pass ( It also bundles two other mechanisms (draw keys on the user words a program reads, and data-only hits), and #422, merged today, already memoizes source failures one layer down. My read: I'd take the user-word keys and the data-only hits as separate PRs, and a failure memo only if it ends on memory changes alone. It needs a rebase after #290 and #422 either way. |
|
That split makes sense to me, and I'd rather not have a time-based skip in the driver either. My plan, unless @boykopovar prefers otherwise:
I'll close this one when the split PRs are up. |
|
Split as discussed: #493 keys draws on the user words each stage reads, and #494 (on top of it) adds the data-only hits. The time-based failure memo is dropped: #422 already memoizes source failures, and a skip that ends on a clock isn't exact. Both are rebased on current |
What
Split out of #167. Three changes to the draw cache:
APS5_DRAW_KEY_ALL_USER_WORDS=1mixes all 32.APS5_DRAW_FAILURE_RETRY_MS(500 ms).APS5_NO_DRAW_DATA_HITS=1disables them, andAPS5_VERIFY_DRAW_DATA_HITS=1compiles and compares instead.A new key of a shape replaces that shape's previous entry instead of filling the cache with keys that never repeat. The new entry starts without the previous entry's variants: those were compiled under other user words, and a variant validates only the memory it captured, not the user words that pointed there.
That inheritance caused the regression found on #167 (Dreaming Sarah's menu text invisible until clicked). Each text draw took over the previous one's variants and drew with its data.
Tested
Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0.
APS5_NO_DRAW_SRT_ENTRIES=1), the text shows.ctest: all tests pass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository🤖 Generated with Claude Code