[pr-fix][memory] darner-gpu: the card ledger records when every listed kind was last used #430
Loading…
Reference in a new issue
No description provided.
Delete branch "qnjk/Darner:cardledger-idle-frames"
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?
Contributor role (optional)
What it changes
The problem on main: the full card-ledger report (
DARNER_CARD_LEDGER=1, every 600 frames) lists the largest objects of nineLISTEDkinds and prints", made {} frames ago, unused for {} frames"withframe.saturating_sub(e.used)(cardledger.rs:554-558), then counts each kind's bytes into the "unused 60+ / 600+" columns when that difference passes the threshold (:568-572).Entry::usedwas only ever moved bytouch, andtouchhad three callers, all inresource.rsforHostTextureuses. SoKind::Indirect(aHostList's keptindirect_args/batch_argsbuffers and its card budget),Kind::BeforeTwin(the hashes of every copy in the card's memory, read again by every submission's compare),Kind::Scratch,Kind::AheadStoreandKind::SwapChainkept the frame they were made in: buffers used every frame were reported as unused for as long as they had existed, and their bytes counted into the column whose purpose is to say what may be moved off the card. The module doc says that column exists so "what is moved off the card is the right thing"; the existing test only passed because it fedusedby hand.This change tells the use where it happens:
touchnow records through one bookkeeping function (cardledger::entry_used, tested), with new calls fromHostList::indirect_scratch(the reused arguments buffer),HostList::batch_place(each batch's buffer),HostList::budget(the card budget the clamp's notes are written through),Host::record_twin_copy, and the three compare sites inHost::card_recordthrough a newShadow::card_before_used. Kinds that have no use site are not given a fake one; the report still lists them (they are listed because they can be large), and they keep the frame they were made in.How it was tested
1592d9e(one commit onf3840d7).cargo test --locked -p darner-gpu --lib -- cardledger— 26 passed, 0 failed.cardledger::tests::uses_are_numbered_after_the_kinds_in_the_order_of_their_namespins the ordering and the new bookkeeping path; the existing report-format tests (the_lines_give_the_sum_dxgi_and_the_difference,the_waste_line_tells_asked_against_taken,the_report_tells_empty_blocks_from_slack,shared_lines_stay_under_400_characters_with_every_origin_and_use) still pass unchanged.cargo clippy --locked -p darner-gpu --all-targets -- -D warningspasses.DARNER_CARD_LEDGERis on.cargo clippy --workspace --all-targets --locked -- -D warnings: passes.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.cargo test --workspace --locked: not green on this machine, and not because of this change. Three pre-existing failures, each covered by an open pull request:darner-gpustands still in parallel on the test deadlock #224 describes, and serially finishes 1772 passed and 1 failed (pipeline::make::tests::a_capped_draw_waits_once_then_drops, which passes on its own) beside the order-dependent flakes of #150;darner-shaderfailsemit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders, whose fixture #227 fixes.DARNER_CARD_LEDGER=1; the bookkeeping and the formatting are pinned by tests. The five kinds still keep their creation frame when they genuinely have no use site — whether the report should print "n/a" for them instead is left to the maintainer.Checklist
main.docs/asset-policy.md. (cargo xtask policy: 555 files ok.)Checked for overlap
crates/darner-gpu/src/host.rsis changed by 40 open pull requests andcrates/darner-gpu/src/shadow.rsby 10, so a textual conflict is possible; this change only adds call sites (no existing line is edited) athost.rs:3962,:10052,:10320,:10403,:15166-15170,:15302-15309,:15353-15360andshadow.rs:10972-10982, which narrows what can collide.cardledger.rsitself is changed by no open pull request, and no open or closed issue mentions the card ledger,DARNER_CARD_LEDGERor the "unused for" column.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.