Repository navigation
Conversation
…heir views (D3D12-RDNA-GBUFFER-TERRAIN-TILES) The raw twin of a buffer view that does not begin on 16 bytes is moved to where its view begins only in the one slot views are made in beside the heaps (move_raw, where the card's CPU descriptors hold the hardware descriptor). A twin made in a slot a list keeps its views in is left at the multiple of 16 before its view, with a bias, or null. So such a card has moved twins in the title's slots and biased or null ones in the tables its lists make. monte-alt/vesper 7b7e556 (GPL-3.0, as this) moves both kinds (its TwinSlot::private) and has no bias; it draws on an RX 9070 XT the ground this tree leaves black in patches (ProjectLeonida#2770). With LEONIDA_LIST_TWIN_MOVE=1 a list's own twins are moved too where move_raw applies; elsewhere nothing changes. Off by default: that the patches come from here is a hypothesis, and which of the two kinds of card an RX 7800 XT or an RX 9070 XT is was not measured (no such card here). By turns with LEONIDA_AB in a diagnostics build; the frame line of the raw twins counts those moved. Tests: a_twin_in_a_lists_own_slot_is_moved_to_its_view (descriptor memory of the test's own: moved with the switch, biased without; it fails with the list branch of own_slot off). listed_twins_moved_readback reads through moved twins on a card that has raw twins: ignored and not run, it needs an AMD card. AI-assisted (Claude Fable 5.2; reviewed by GPT-6.2 Astra and Claude Opus 5.5). Tested on RTX 3090, driver 610.88, and on WARP: leonida-gpu lib tests 597 passed (677 with --features diagnostics), no clippy warning on the changed lines. Not run on an AMD card. Refs ProjectLeonida#2771 Refs ProjectLeonida#2770 AI-assisted: yes
…DNA card (D3D12-RDNA-GBUFFER-TERRAIN-TILES) On a card whose widest wave has 64 lanes the translator emits the forms for 64 lanes (a console wave64 compute program runs with WaveSize(64)); a card of 32 lanes, every NVIDIA card, gets other forms of the same programs. The forms for 64 lanes run on AMD cards only, and none was at hand here. monte-alt/vesper 7b7e556 (GPL-3.0, as this) takes the forms for 32 lanes by default on such a card for the programs they fit (its VESPER_RDNA_WAVE32, default 2), and draws on an RX 9070 XT the ground this tree leaves black in patches (ProjectLeonida#2770; ProjectLeonida#2771 on an RX 7800 XT). With LEONIDA_HOST_WAVE32=1 the translator takes an AMD card with waves of 32 to 64 lanes (set_host_rdna) for one of 32: it gets what an NVIDIA card gets, WaveSize(32) declared where a form depends on it. A program the forms for 32 lanes cannot take is refused as there ("no wave32 lowering for this wave64 program"); vesper leaves those at 64, which this does not. Off by default: a switch to tell the two sets of forms apart on such a card. Reading found no defect in the forms for 64 lanes. The shader cache keys on the lanes taken (host_settings) and on the switch's value, so a run with it translates anew. host_wave32() says what the switch came to on the card, for the log. emit/lower.rs is over the repository's file size limit as it is on main (753,642 bytes of 655,360): the decision and its test are in emit/mod.rs, and lower.rs grows by the lines that ask it. AI-assisted (Claude Fable 5.2; reviewed by GPT-6.2 Astra and Claude Opus 5.5). Tested on RTX 3090, driver 610.88: leonida-shader lib tests 404 passed, also with --features diagnostics; no clippy warning on the changed lines. With LEONIDA_WARP=1 396 pass and 8 fail, the same 8 that fail on main (d4fabd3) so. Not run on an AMD card. Refs ProjectLeonida#2771 Refs ProjectLeonida#2770 AI-assisted: yes
…d syncs to the host's textures (D3D12-RDNA-GBUFFER-TERRAIN-TILES) The title's enhanced barriers (Barrier(group count, groups)) and its pipeline syncs each record one wait for shader writes, an unordered access barrier with no resource, and move no texture: the groups are not read. A host texture changes state where the host sees it used, and a view a shader picks from the heap by a number it computes is not seen (host.rs: "directly indexed textures are not transitioned"). So what a draw wrote into a target is read by such a shader with the texture still in its target state, and with no wait before it that names targets; D3D12 asks for the texture to leave the target state first. monte-alt/vesper 7b7e556 (GPL-3.0, as this) moves the textures such barriers name and waits at the others (its summarize_barrier_groups and classify_texture_direct_transition), and draws on an RX 9070 XT the ground this tree leaves black in patches (ProjectLeonida#2770; ProjectLeonida#2771 on an RX 7800 XT). LEONIDA_TARGET_BARRIERS is a set of two bits, off by default: - 1: a texture barrier that names a texture and leaves it to be read (by shaders, or as a copy's source after draws) moves the host's texture to that state through the list's own tracking, as a legacy transition of the title's does. Behind draws into it, a copy into it, or no access among the lists run together; never behind unordered access or any access, and not back towards a target (the next draw does that). By the accesses, or by the layout where the barrier names no access after it. A barrier on a part of a texture moves it only if the host's texture is one subresource. - 2: a barrier on all memory (a texture barrier that names no texture, a global barrier) and a pipeline sync record a wait for everything (HostList::wait_for_everything: the wait of the copies done at their place in a list) in place of the one for shader writes, if the list recorded a draw, a clear or a resolve into a target since its last. A list whose calls are only written down (LEONIDA_THIN) writes down what the groups ask when the title calls and does it when it is replayed; with the switch off a call is written down as before. The frame lines say how many waits and moves a frame; one line says what the switch was taken as, and one what LEONIDA_HOST_WAVE32 came to on the card. That this is what the issues show is a hypothesis: no AMD card was here, there is no report of the patches from an RX 6800, and what the waits cost a frame is not measured. The debug layer has not said that the recorded barriers are legal (it is not on the machine, and installing it needs elevation): the lists ran on an RTX 3090 and on WARP. Tests (list::groups, list::thin): what a barrier asks, by its words; through the list's own methods on the card, a texture drawn into is moved by a barrier that names it (each bit alone, and both), also one another list drew into, submitted with it and before it; a part of a texture; the waits at barriers that name no texture and at syncs, after a clear and a resolve the card does; a call written down and replayed. Each fails with its part of the change taken out. No test records a draw through a title list (it needs a console pipeline): the mark a draw sets (State::bind) is covered by reading only. AI-assisted (Claude Fable 5.2; reviewed by GPT-6.2 Astra and Claude Opus 5.5). Tested on RTX 3090, driver 610.88, and on WARP (LEONIDA_D3D12_WARP=1): leonida-gpu lib tests 597 passed (677 with --features diagnostics), no clippy warning on the changed lines. Not run on an AMD card. Refs ProjectLeonida#2771 Refs ProjectLeonida#2770 AI-assisted: yes
…OVE and LEONIDA_HOST_WAVE32 (D3D12-RDNA-GBUFFER-TERRAIN-TILES) Regenerated with tools/d3d12_switches.py for the three names of this branch: LEONIDA_TARGET_BARRIERS, LEONIDA_LIST_TWIN_MOVE and LEONIDA_HOST_WAVE32. The comments of the first and the last now begin with the sentence that says what the switch does, which is the one the page takes. The page was behind the sources before this branch: regenerated on d4fabd3 it changes 13 rows that are not this branch's (the rows whose first file is now apps/leonida/src/leonida.rs, some counts of files, the names test code makes up), and those come with this. This branch's own are the three new rows, the count of names, and one file more for LEONIDA_AB, LEONIDA_D3D12_DEBUG and LEONIDA_THIN. AI-assisted (Claude Fable 5.2). python -I tools/d3d12_switches.py --check d3d12/docs/switches.md: no difference. The two comments are the only change to the code: leonida-gpu lib tests 597 passed (677 with --features diagnostics) on RTX 3090, driver 610.88, and on WARP, no clippy warning on the changed lines. Refs ProjectLeonida#2771 Refs ProjectLeonida#2770 AI-assisted: yes
…r-terrain-tiles # Conflicts: # d3d12/docs/switches.md
|
Verified on Windows with the three code commits and without the fourth, which is documentation and conflicts on its own. The workspace is green apart from the asset policy that
That remaining failure is So the 1,567 lines of code across What I could not test: what the switches do. One thing worth saying about the shape: three switches and 1,096 new lines in one file is a lot to review, and the split this branch already has - one commit per switch plus the doc row - is the right one. If it is rebased, keep that split: the doc commit is what needs the rerere, and the code is what a reviewer should read. AI-assisted: yes - DeepSeek v4.1 (flash), a 6.9-minute workspace run on the three-commit tree. Written with an AI assistant. |
KelboLive
left a comment
There was a problem hiding this comment.
The code is careful and the default path is genuinely the old one: words() returns the single count word when the bits are 0, own_slot keeps the staging-slot behaviour and leaves a listed twin biased, and host_max_wave() returns the real lanes when asked is false. The bit combinations, the thin-list round trip and the WARP paths are covered (13 list::groups, the enhanced-barrier and twin tests, all passing on this machine's GPU and on WARP), and the barrier moves/waits are per call — so an A/B phase boundary cannot leave a texture permanently in a wrong state; the worst case is a few calls from the previous phase at the boundary on thin lists, which are valid barriers. switches.md is current (--check rc 0), the shader and gpu crates are 405/0 and 607/0 here.
Three things before merge:
- The
LEONIDA_HOST_WAVE32experiment guidance is incomplete, and this is the one that will waste someone's run: the switch refuses wave64-only programs (emit/mod.rs:1104, "no wave32 lowering for this wave64 program"), but the A/B plan only says "any DROPPED / no host pipeline lines". Name that message and state that missing pipelines are expected on the=1run — otherwise a tester reads a worse picture as #2771 getting worse and abandons the experiment. one_subresourcequeries the device per named partial barrier (list.rs:2828:GetDesc+CheckFeatureSupport) inside a switch whose frame-time delta is a reported result. Cache the answer per host texture, or state the overhead, so the A/B is not partly measuring a driver query.- The real
LIST_SLOTSpath has no running test:LIST_SLOTS.setinmake_listedis exercised only by the#[ignore]dlisted_twins_moved_readback, while the unignored twin test fakes the slot range. A WARP test that makes a real list view would close it, or say in the body that the ignored test was run and passed.
Nits, both about the log rather than behaviour: the 31-texture fallback wait requires bit 2 (the groups.rs warning says so, the body implies more), and TARGET_WAITS[2] counts named textures rather than actual moves, so the "each moved … unless it was in it" line reports a count that is not the number of moves.
…ounter, and test LIST_SLOTS Refs ProjectLeonida#2771 Refs ProjectLeonida#2770 AI-assisted: yes
|
Thanks for the thorough review @KelboLive (and @fiestorra for the full-workspace run)! Pushed
AI-assisted: authored with Gemini 4 Carbon; independently reviewed with Gemini 4 Neon ( |
…r-terrain-tiles # Conflicts: # d3d12/docs/switches.md
…r-terrain-tiles # Conflicts: # d3d12/docs/switches.md
…r-terrain-tiles # Conflicts: # d3d12/crates/leonida-shader/src/emit/mod.rs # d3d12/docs/switches.md
…r-terrain-tiles # Conflicts: # d3d12/docs/switches.md
|
I ran two-vendor barrier and descriptor checks at 6e1b7eb against 88a9f13. The Rust tree auto-merges. The only unresolved path is d3d12/docs/switches.md, so this is coverage of the merged Rust code. Win64 MSVC target, Wine 11.22 and VKD3D-Proton 3.1.0, Radeon Raphael RADV 26.3.1 and RTX 4070 SUPER 620.73.04. Each GPU passed 18 tests across list::groups, the enhanced-barrier round trip and the listed descriptor tests. Each also passed the 26 paired-wave and twin-bias shader tests. The off-by-default wave-limit selector test passed separately. The two ignored raw-twin readbacks, when explicitly run, both stopped at the prerequisite that a raw-twin heap be available. To exercise the readbacks, I made a local build with only the test heap sizes reduced (raw twin base 2^18 and dynamic minimum 2^15). All six listed-descriptor tests then passed on each GPU. The two readbacks returned the expected values with the switch both off and on. Both drivers retained a bias in the on arm because their descriptor layouts do not satisfy move_raw, so that part verifies fallback readback only. The test with synthetic descriptors separately covers an actual move. No RDNA3/RDNA4 terrain-repro claim. MEASURED with synthetic tests. AI-assisted (Codex). |
…r-terrain-tiles # Conflicts: # d3d12/docs/switches.md
…r-terrain-tiles # Conflicts: # d3d12/docs/switches.md
…r-terrain-tiles # Conflicts: # d3d12/docs/switches.md
Summary
Refs #2771, #2770 (
D3D12-RDNA-GBUFFER-TERRAIN-TILES).Because #2771 (RX 7800 XT, RDNA 3) and #2770 (RX 9070 XT, RDNA 4) reproduce only on RDNA 3 / RDNA 4 hardware in outdoor scenes and our local test machine has an RTX 3090 + WARP with no retail game data, the root cause is not claimed as proven here. Instead of changing default runtime behaviour unmeasured, this PR lands the three concrete AMD-relevant gaps between Mandy and
monte-alt/vesper(7b7e556, GPL-3.0) as opt-in switches — all off by default — with per-frame diagnostic counters and hardware/WARP unit tests so RDNA 3 / RDNA 4 testers can isolate the exact mechanism in a single A/B pass.With all three switches unset (the default), command-list recording, thin-list streams, descriptor slots, and shader translation are unchanged from
main.Switches Added (All Off by Default)
LEONIDA_TARGET_BARRIERS=<bits>(leonida-gpu/src/list/groups.rs,list.rs,list/thin.rs,draw.rs,host/place.rs; adapted aftermonte-alt/vesper7b7e556VESPER_SMART_BARRIERS, GPL-3.0):1(named texture moves): parses the console'sID3D12GraphicsCommandList7::Barriertexture barrier groups (list.rspreviously ignored_groupsand emitted one null-resource UAV barrier) and transitions named single-subresource host textures left for reading (RENDER_TARGET/DEPTH_WRITE/COPY_DEST-> shader-read / copy-source state) throughHostList::ensure_state, caching the single-subresource check (GetDesc+CheckFeatureSupport) perHostTexture::serialso partial barriers do not query the driver repeatedly. Capped at 31 textures per call with a once-logged warning; when bit2is also enabled (=3), calls exceeding 31 textures fall back to a full target wait for the remainder.2(target waits): upgrades resource-less texture barriers, global barriers, and pipeline syncs toHostList::wait_for_everything(wait_for_all) when the host list has recorded a draw, clear, or resolve into a target since its last target wait.LEONIDA_THIN=1record/replay round-trips while keeping the unset thin-list encoding identical tomain(single word) and supports live toggling viaLEONIDA_AB=4,LEONIDA_TARGET_BARRIERS.LEONIDA_LIST_TWIN_MOVE=1(leonida-gpu/src/descriptor.rs,descriptor/host.rs,descriptor/host/listed_raw_tests.rs; aftermonte-alt/vesper7b7e556, GPL-3.0):move_rawin place to non-16-byte-aligned raw buffer twins inside per-threadLIST_VIEWSslots (wheremainonly moved the single staging slot and left per-list raw twins biased or null), and adds the moved-in-list count to the raw-twins frame diagnostic line. Supports live toggling viaLEONIDA_AB=4,LEONIDA_LIST_TWIN_MOVE.LEONIDA_HOST_WAVE32=1(leonida-shader/src/emit/mod.rs,emit/lower.rs; aftermonte-alt/vesper7b7e556VESPER_RDNA_WAVE32, GPL-3.0):32..64wave lanes), tells the shader translator to target 32-lane waves (matching the wave-32 forms run on NVIDIA) and keys the shader cache on both the effective lane count and switch value."no wave32 lowering for this wave64 program"(emit/mod.rs), so missing pipelines / skipped draws are expected on aLEONIDA_HOST_WAVE32=1run. Do not read unrelated missing geometry or passes as RX 7800 XT: flickering black tile patches in the open world; CS_FinalGather tiles missing (not the 65,535 cut) #2771/AMD RX 9070 XT (RDNA4): black flickering patches on roads and soil outdoors #2770 getting worse — judge only whether the flickering black/grey ground tiles themselves disappear or change.d3d12/docs/switches.md: Regenerated viapython -I tools/d3d12_switches.py --out d3d12/docs/switches.md.A/B Isolation Plan for RDNA 3 / RDNA 4 (#2771, #2770)
From the same outdoor save spot through the launcher (
diagprofile):Useful existing zero-code controls on the same spot if needed:
LEONIDA_INDIRECT_BATCH='0'; LEONIDA_INDIRECT_WINDOW='0',LEONIDA_RAW_VIEWS='0', andLEONIDA_TWIN_BIAS='0'.Key log lines to include from each run:
host wave lanesthe title's waits for what was drawn into targets per frame ...(reports full target waits, skipped waits, named read textures, and in-list transitions)raw twins of buffer views made per frame ...LEONIDA_HOST_WAVE32=1: ...plus"no wave32 lowering for this wave64 program"/DROPPED/no host pipelinelines (onLEONIDA_HOST_WAVE32=1, wave64-only shader refusals and missing pipelines are expected)Once a reporter confirms which switch resolves the outdoor ground tiles (and its frame-time delta), flipping that default is a one-line follow-up.
Verification & AI Disclosure
go, risk0/4), Claude Opus 5.5 (4 adversarial review passes), and Gemini 4 Neon (opus-systems-criticreview on the follow-up cache/counter/test commit).10.0.26200), NVIDIA GeForce RTX 3090 (24 GB, driver610.88) and D3D12 WARP (LEONIDA_D3D12_WARP=1):cargo test -p leonida-gpu --lib(default,--features diagnostics, andLEONIDA_D3D12_WARP=1): all passing, including 16 new hardware/WARP tests acrosslist::groups(including cachedone_subresourcequery count verification),list::thin, anddescriptor::host::listed_raw_tests(including fresh-threadmake_listed->LIST_SLOTS->own_slotverification on hardware and WARP).cargo test -p leonida-shader --lib(default and--features diagnostics):404passed,0failed (includingemit::tests::a_card_with_waves_of_32_to_64_is_taken_for_one_of_32_only_when_asked).cargo clippy --all-targets(0warnings on added lines),python -I tools/d3d12_switches.py --check d3d12/docs/switches.md(rc=0),tests/test_docs_*.py(rc=0),python -I scripts/check_no_game_data.py(rc=0).listed_twins_moved_readbackremains#[ignore]d locally becauseheap.raw == 0on RTX 3090 / WARP), andID3D12Debuglayer barrier validation (d3d12SDKLayers.dll/ Windows Graphics Tools is not installed on this machine).