Repository navigation
Conversation
The console gives a thread group up to 64 KiB of LDS; D3D12 gives group shared memory 32 KiB in compute shaders and 28 KiB in mesh shaders. A program asking for more was translated anyway and failed later in the validator or at pipeline creation, with an error that did not say why, and counted as translated meanwhile. It is now refused as unsupported, naming the limit. A compute program that never reads or writes its LDS (swizzles and permutes do not) declares none and is left alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed and tested on Linux ( Tests
Is the compute predicate in line with lowering? Yes, I believe so. In
So the predicate covers everything that declares LDS and a few things that don't. A shader that translates today is never newly refused. The only change is which reason a few already-refused programs report: GDS plus more than 32 KiB of LDS now says "compute LDS over the host's 32 KiB" instead of "GDS". That seems fine. It works alongside #333. #333 adds a separate check in Nits (none blocking)
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mercuryVM
left a comment
There was a problem hiding this comment.
Tested a3f219e on Windows 11, RTX 5070, MSVC: cargo test -p victory-shader -- --test-threads=1 70 passed, including lds_past_the_host_limit_is_refused_by_name. cargo clippy -p victory-shader --all-targets is clean. victory translate --validate --pipelines on the local title executable still reports 12 of 12 programs.
- Refusing at
emitwith the host limit in the message (32 KiB compute, 28 KiB mesh) is much easier to act on than a validator or pipeline failure later. The boundary is exact: 64 granules (32 KiB) passes and 65 is refused, which the test covers. - Excluding
ds_swizzle/*permutefrom "uses LDS" is right, since they move data through the crossbar without group memory. A compute program that never touches LDS isn't refused for a largeLDS_SIZE.
AI-assisted (Claude Code).
catminou4
left a comment
There was a problem hiding this comment.
Test-merge with current main (ffe310e) is textually clean but breaks compilation — a semantic conflict, not a textual one:
error[E0061]: this function takes 4 arguments but 3 arguments were supplied
--> crates/victory-shader/src/emit/mod.rs:579:23
|
579 | let res = resource::track(&p, &native.layout, native.stage).unwrap();
| ^^^^^^^^^^^^^^^ argument #4 of type `Option<&structure::Structured>` is missing
Main added a 4th parameter to resource::track (the Option<&Structured> from #235-era structure tracking), and this PR's branch still calls it with 3. The fix is one line at emit/mod.rs:579 — pass the structure variable (the same way the neighbouring test helpers do after rebase). Please rebase and re-run; I'll re-review then.
The tester tree (upstream main ffe310e plus its PRs, update 8; see its INTEGRATION.md) ran 11-25 minutes in the world on an RTX 5070 without a device removal. Where both sides carry the same PR (the wave64 stack #223/#233/#320 with #439 and #180, #454, #336, #259, #331 and others), the tester tree's newer head is taken; our own work and the PRs only we merged are kept. Conflicts, file by file: - descriptor/host.rs: the tester layout (`spare`, the guard slot after the dynamic slots, `free_table`, the capped sampler heap). A capped view heap keeps `capped_reserve()` dynamic slots, now 2^18 by default (the tester measurement, and our 91fed158), still `VICTORY_DYNAMIC_SLOTS` in diagnostics builds; uncapped hosts keep our 2^19. Our slot statistics (TAKEN/PEAK/SHORT), the bindless plan cache (`CommittedRegions`, `timed_valid_title_address`, `timed_find`, `title_bounds`) and the revision triple are kept beside the tester's `guard_slot`. - Buffer states: the tester tree's buffer-state tracker (#334: every list moves host copies of title memory between GENERIC_READ and UNORDERED_ACCESS and back to common before it closes) and depth twins (#469) are taken. #40's enhanced/legacy indirect barriers (the indirect prelude, `use_indirect_buffers`, the title buffer handoff mirrored in `host_barrier`) cannot share buffers with that tracker and are dropped; #40's argument checks (`byte_len`, exact spans, overflow-safe clamp shader, aligned counts) stay. `indirect::bound` and #282's `rectangles` go through `buffer_state`, and `indirect::execute` (#334) replaces `done`. #178's DXC fallback compiles both of our passes. Our segments (#387: `close` ends the segment, `close_native` closes a native list) carry the tracker: each native list returns its buffers to common and its twins to their depth targets, and each prelude also holds our texture uploads. - shadow.rs: our write flow (`queue_write`, one `snapshot` after the batch's refreshes, `finish_writes`, the unchanged-page cache) with #261's copy-back that also gives the snapshot the title's bytes; its tests run through our flow. - pipeline/make.rs: #275's per-frame budget and per-pipeline wake pair, with our compute waits (a dispatch waits for its pipeline, up to 20 s). - pipeline/library.rs: the tester version (#347, #275's saver thread); our concurrent-write test kept. shader_cache.rs: our byte-returning cache API with #358's "translated, only not kept". - draw.rs: #493's root SRV tables; where no table can stand in, our drop of a draw whose root view is unset or outside title buffers. Our refusal of a table offset past the capped heap stays. - resource.rs: `HostTexture` has both our `staged` generation and the depth twin. - Shaders: the tester's lower.rs for the wave64 stack, #160's image sampling (it covers our #73 and #136 sample forms) and #453/#587; kept from our side: #136's preference for an image or buffer use of a descriptor read as data and its `s_buffer_` arm, #422's nearest-even narrowing (also for #169's d16 loads and #453's interpolation), #452's spin-wait limit, #391's LDS limit, #302's spilled root arguments (now in `NativeProgram::translation_ir`), #136's PSV0 interpolation beside the tester's row harmonisation. split_tests.rs, lane_read_loop_tests.rs and docs/wave64-on-wave32.md are the tester versions (the same PRs at newer heads). - Tests: #483's heap guard dwords filled in our GPU tests of #200 (v_div_scale) and #437 (scalar loads from a raw view), which read through the guard slot otherwise; #334's debug-layer test passes an offset to our `indirect::bound`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged onto Checked with CI's steps (both clippy runs with |
|
Automated triage for the maintainers. This pull request conflicts with Generated by Claude Code |
What
emitnow refuses, asUnsupported, a compute program that reads or writes more than 32 KiB of LDS and a mesh program that declares more than 28 KiB, with the limit in the message (compute LDS over the host's 32 KiB,mesh LDS over the host's 28 KiB).Why
The console gives a thread group up to 64 KiB of LDS (
rsrc2LDS_SIZE, 512-byte granules); D3D12 gives group shared memory 32 KiB in a compute shader and 28 KiB in a mesh shader. Nothing compared the two: such a program was translated, counted as translated byvictory translate, and then failed in the validator or at pipeline creation with an error that did not say why.A compute program declares its LDS array only when it reads or writes it (
Shader::ldsis lazy; swizzles and permutes do not touch it), so one that asks for more but never uses it is left alone – it works today and keeps working. A mesh program always declares its size in PSV0, so it is checked as is.Tested
Windows 11 (build 26300), Rust 1.98.1 (pinned toolchain), x86_64-pc-windows-msvc:
emit::tests::lds_past_the_host_limit_is_refused_by_name(synthetic words, no game data): a compute program withds_read_b32and 65 granules is refused throughemitwith the message; 64 granules (32 KiB) is not; 65 granules with no LDS access is not; a mesh program at 28 KiB + 4 is refused, at 28 KiB it is not. With thelds_fitscall removed fromemitthe test fails.cargo test --workspace --no-fail-fast: 265 passed, 0 failed, 4 ignored (main: 264 / 0 / 4).cargo clippy --workspace --all-targets: the same two warnings as main.rustfmt --check --edition 2024 crates/victory-shader/src/emit/mod.rs: clean.Not run: the title, so I cannot say how many of its programs ask for more than the host limit;
victory translatewould now name them.Improvements by William "kaairim" Deivid (wdcore). AI-assisted: Claude Code with Claude Opus 5.5 wrote the change, the test and this description; a second Claude Opus 5.5 agent reviewed the diff.
🤖 Generated with Claude Code