BDA write tracking (note_bda_write) costs ~48% of a write-heavy dispatch; proposal: per-range written bitmap #22372
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Ketz7 on 2026-11-17T13:14:03Z.
Problem
Every BDA store and atomic calls
note_bda_write(address)after the store. It looks the page's 128 KiB chunk up in a 2048-slot hash table in the fault buffer: up to 8 probes, each an atomic load and CAS, then anAtomicIAddon the list count and an atomic OR on the page mask. A dispatch that writes more than 2048 chunks hits the hostRequire("more than 2048 chunks … not implemented"), and writable ranges must end belowWrittenAddressLimit.Measurement
vkQuake's BVH builder (compute shader 0x20c612000), replayed from a capture on an RX 7900 XT, 2 rounds each:
note_bda_write)So write tracking is about half of this dispatch's time, and a single OR per write recovers almost all of it.
Proposal
FaultBufferBytesandSrtGuardWordstay where they are.Rangea block in that pool, encoded inRange.reserved(renamedwritten): the block's word offset plus a granule shift.get_bda_write_pointer,probe_bda_write_pointer,get_bda_atomic_pointer) already find the range and know[address, address + bytes). After their checks pass, they:AtomicOr, or two when the bits are in different words;note_bda_writeand all its call sites go away. Stores that cross a page are also covered: today only the first page is noted, except on the wide-store path.markWrittenPagesruns when the dirty flag is set:GuestMemory::MarkPossiblyWrittenfor each run of set bits;faultSlotCleankeeps checking only the head words, since a set bit implies a set flag.WrittenAddressLimitare removed.BdaAbi::Versiongoes to 2.Questions before I open the PR
Range.reserveda meaning? Bumping the ABI version invalidates cached shaders.Require.AI-assisted: yes