[pr-fix][shaders][INTEL] Mesh programs declare the output counts they request (DARNER_MESH_COUNTS=exact; Arc A770 device losses in LinearDepthPreSkin) #425
Loading…
Reference in a new issue
No description provided.
Delete branch "kisekinopureya/Darner:kisekinopureya/pr/mesh-counts"
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
0x887A0006, DRED: a page fault at a 64 KiB-aligned0x8000…address that DRED ties to no allocation, so in the driver's own memory) inside the indirect mesh draws ofMS_VS_LinearDepthPreSkin(mesh824dc1956e7e38b6, also6be582cb5252bc65; DRED's stopped list ends oncommand 448 ran [mesh 824dc1956e7e38b6, pixel 0b079b0d230eecef] (indirect kind 10 max 1 …)). In two runs of two it happened the first time the player stepped outside one building into the sun.A mesh program's translation declares the program's maxima (here 128 vertices, 128 primitives) at its start, culls every primitive up front, and the lanes then write their primitives again. The console program asks for its real counts instead: thread 0 sends them (
s_sendmsgGS_ALLOC_REQ, m0 = vertices | primitives << 12), with one culled primitive of its own on the path for an empty or oversized meshlet, and a barrier every thread passes comes before the exports.DARNER_MESH_COUNTS=exact(off by default; keyed in the shader cache) translates that shape as the console has it. Thread 0 keeps its request in two dwords of group shared memory. After that barrier, with a group barrier of its own, the program declares the requested counts (SetMeshOutputCounts, within the declared maxima). Primitives are culled up front only when the request's path exported its culled primitive, which is left out there, so each primitive is written once. The site must be a block every thread passes once, after the request, that dominates every export outside the request's path. A program without one request, or without such a block, keeps the maxima.Off by default because only one card was tested; turning it on for Intel cards needs the translator to know the card is Intel's (#31), so that would be a follow-up.
How it was tested
Tested revision: in the game, the same change at
3fcd4c67on myintel-arcbranch (this change on top of my open Intel drafts and of #292), withDARNER_MESH_COUNTS=exact. On this branch (b7e8f43e, on mainf3840d73): the cargo gates below only.Commands and results:
cargo test -p darner-shader --lib -- mesh: 13 passed. The new testa_mesh_request_gives_the_counts_with_the_switchbuilds a 128-thread wave64 mesh program with a request, a fallback culled primitive and a barrier, and checks that the counts are declared once after the barrier with the switch, never without it, and never for a program without a request. Both translations pass the DXIL validator.824dc1956e7e38b6, translated offline as on the A770 (waves of 32 at most, Intel host, emulated barycentrics), passes the DXIL validator with the switch on and off.Changes a default: no.
A/B result: off by default, so checked as follows, on an Intel Arc A770, Series S profile, XeSS ultra performance, same save, same door:
DARNER_MESH_COUNTS=exact)A is
intel-arcatf73316fa(the same branch without this change): one run with its defaults (lost after 53.5 minutes, at the door), one with indirect clamp batching off as well (DARNER_INDIRECT_BATCH=0 DARNER_INDIRECT_WINDOW=0, lost after 29 minutes, at the door). Earlier A runs lost the device elsewhere too (after 13.5, 21 and 38.7 minutes), not all traced to this door.Also with A: skipping both
LinearDepthPreSkinvariants (DARNER_SKIP_PIPELINES=6be582cb5252bc65,824dc1956e7e38b6) got past the door in 1 run;DARNER_MESH_REST=0lost the device (a hang, no page fault) after about 70 s, before reaching it. With B the run went on among people outside for about 19 minutes in all, without a loss, and closed normally. No frame-rate claim: the B run started on a freshly rebuilt shader cache and pipeline library.Gates run on
b7e8f43e:cargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean.cargo test --workspace --locked: darner-shader 556 passed, 3 failed, 16 ignored. The three (valu_tests::whole_wave_f64_sum_and_cvt_f32_f64,waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders,wave64_tests::a_pair_that_runs_out_stores_nothing_more_and_notes_its_program) fail the same way on mainf3840d73without this change, on this PC. The other crates (--no-fail-fast): all pass butdarner-gpu'swatch::tests::ask_once_by_res_splits_reservations_without_refusals, which fails in the fulldarner-gpurun on mainf3840d73too and passes when run alone on both.Gameplay: Intel Arc A770, Series S profile, XeSS ultra performance, no frame generation, no ray tracing.
Shader wave sizes tested: 32 (the A770's waves are 8 to 32 lanes) in the game; the unit test's host is this PC's.
Hardware dependence: untested elsewhere. The device loss was only seen on the A770; the change is off unless set.
Coverage gaps: one card, one place in the world, one B run (six crossings). Not run with the switch on an NVIDIA or AMD card.
Checklist
main.docs/asset-policy.md.Checked for overlap
🤖 Generated with Claude Code
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.