Repository navigation
Conversation
The console compiler reads a constant array at an index it takes as uniform through `v_readfirstlane_b32` of both dwords of a VGPR address (table base from `s_getpc_b64`, plus the index scaled) and an `s_load_dword*` there. The tracker refused such addresses as "an address not from a root parameter". It now follows the two first-lane reads to the VGPR address and records the address with each lane's term and the read (`Address::first_lane`), when the load runs in the same block with the same EXEC. The lowering takes the term of the first lane the read's guard holds in, in every lane, and the program declares the console's wave size, as other code reading other lanes does. Root-parameter bases stay refused, with their own reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
catminou4
left a comment
There was a problem hiding this comment.
Scalar loads from the code table at a first-lane address: resource.rs recognizes v_readfirstlane_b32 pairs as uniform addresses (CODE param only, root-param case rejected), lower.rs emits waveReadLaneFirst + waveActiveOp under the instruction guard and sets WAVE_OPS. The guard/undef handling is careful, but the execution tests (first_lane_tests) are Windows-gated, so macOS only compile-checks the new paths. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, cargo test -p victory-shader --locked. Shader execution tests (valu_tests/host) are #[cfg(all(test, windows))], so macOS covers lowering/decode/unit tests only. 98 passed, 0 failed. Given the wave-op subtlety, a Windows hardware/WARP run of first_lane_tests before merge would be worthwhile.
|
Independent code-table readback on Both 64-lane versions were refused at pipeline creation on this 32-lane adapter. In a separate local merge with #439 at For the four exposure/irradiance programs in the report, do you have the declared wave size for each hash? The cited world logs establish that these hashes hit translation refusals. Their wave sizes would help distinguish which ones need the cross-half path when checking pipeline creation after this change. |
|
Setup: Linux, RX 9070 XT, RADV (Mesa 26.3.1), dxil-spirv master, spirv-val 1.3. Your head folded onto a base of origin/main
+2 programs translate and none is lost: "an address not from a root parameter" goes from 3 compute programs to 1, and no other reason moves. Same 10 SPIR-V validation failures as the base. (It clears the same two programs as #1225 and #1231 — the three reach the same class from different sides.) Not tested: in-game. |
…o the wave64 mesh test build Conflicts: emit/mod.rs (both add a test module) and emit/lower.rs (the first-lane console_lanes line after the fork's formatting of the mask test); first_lane_tests sets the stride_table field Marvisak#704 added to HostShader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Native Windows run on AMD RDNA2: RX 6750 XT (RDNA2, gfx1031), AMD driver 32.0.21045.29003, i5-13400F, Windows 11, Rust 1.98.1 MSVC. Head b95831e on main ffe310e (clean merge).
Synthetic tests only, no game files. AI-assisted (Claude picked the PRs and wrote the batch script; I ran it on my machine). |
|
Thanks for the runs. @MichaelSmithAI, wave sizes. I read the
So 3 of the 4 are wave64. This PR makes a program with a per-lane first-lane address declare the console's wave size ( Overlap with #1225 / #1231. Both are older than this PR, and I missed them when I searched. #1225 handles the uniform case without any wave op: when every lane holds the same index, it reads the source directly. That is better for wave64 programs on 32-lane hosts, since no wave size is declared. pablogonz12 reports that #1225 and #1231 clear the same programs as this PR in their dump. This PR adds the non-uniform case (first-lane semantics under the read's lane guard). That case is only needed where the uniformity proof fails. I'd suggest landing #1225 / #1231 first. I'll then restack this PR on them, so the wave op is used only for addresses they cannot prove uniform. If nothing in the title needs that case, I'll close this PR. @catminou4. |
|
Automated triage for the maintainers. Closing because this change is already in Scalar loads from a code table at a first-lane address. Main traces these since commit 27c3dc9 (resource.rs:816-865, reaches_pc follows v_readfirstlane_b32 back to s_getpc_b64); the world list has no program left with 'an address not from a root parameter'. Same topic as #1225. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
What
The console compiler reads a constant array at an index it treats as uniform in a specific way. It builds a VGPR address (the
s_getpc_b64table base plus the scaled index), reads both dwords withv_readfirstlane_b32, and then issues ans_load_dword*at that address. The resource tracker refused these programs withan address not from a root parameter.resource.rs:Tracer::addressnow follows the two first-lane reads back to the VGPR address. If that address is a code-table base plus a per-lane term, it records the address with the lane's term and the read (Address::first_lane, new field). This only applies when the load is later in the same block and nothing in between writes EXEC. Otherwise the program is refused witha first-lane address read with other lanes. A root-parameter base in this form is refused with its own reason,a first-lane address from a root parameter, because the descriptor paths re-derive addresses from registers.emit/lower.rs: the three places that addAddress::dynamicnow share one helper,address_term. For a first-lane address it emitsWaveReadLaneFirstof the term inside thev_readfirstlane_b32's lane guard. It then broadcasts the result to every lane with an unsignedWaveActiveMaxover the guarded value and zeros.console_lanes, so they declare the console's wave size, like other code that reads other lanes.a descriptor built around a first-lane address). None was seen in the package.Measured
Package: the user's own Series 1.0.2.1
shaders.rpf.victory translate <shaders.rpf> --validate --list --jobs 4,origin/mainffe310e vs this branch:an address not from a root parametera descriptor read only as data.shader does not translatewarnings): an exposure downsample pass (2 programs) and an irradiance SH integration (2 programs).s_or_b32from a descriptor's base address. They are inline ray tracing that reads the BVH (see Ray tracing: what Leonida measured about XboxBvhBuilder and the console BVH format #274), which is out of scope here.--pipelinesover the whole package did not finish within the 20 minutes I can hold the shared GPU, on either build, so I have no pipeline counts. The new GPU test creates the pipeline for its synthetic program.Tests
Windows 11 Pro, NVIDIA GeForce RTX 5070, AMD CPU. All fixtures are hand-written GFX10 words, with no game data.
resource::tests::a_first_lane_address_of_a_code_table_is_traced: the load is traced toCODEat the table's offset, withfirst_laneset.resource::tests::a_first_lane_address_read_with_other_lanes_is_refused: with EXEC restored between the reads and the load, it is refused with the new reason.emit::first_lane_tests::every_lane_loads_the_entry_the_first_lane_addresses: 32 lanes, withv_cmpxleaving lanes 6..31. Each lane addresses entry (lane + 3) & 7 and reads it from the first lane. Expected result: lanes 6..31 all store entry 1, lanes 0..5 store nothing. Passes on the RTX 5070. WARP is skipped because it creates noWaveSize(32)pipeline (the diff tests skip it the same way).Commands:
cargo test -p victory-shader --lib first_lane -- --test-threads=1: 11 passed.cargo test --workspace -- --test-threads=1: 345 passed, 0 failed, 6 ignored.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.rustfmt --edition 2024 --checkon the changed files: no diffs in changed lines. The remaining diffs inlower.rsandresource.rsare already on main.cargo xtask policy: 155 files ok.Not tested
--pipelinescounts (see above).v_readfirstlane_b32lowering does.Overlap
v_readfirstlane_b32in addresses, as part of a 2.2k-line change that currently conflicts with main. Its lowering emitsWaveReadLaneFirstwithout the lane guard, which the GPU test above shows reads the wrong lane underv_cmpx. This PR is the narrow code-table case only. If Shaders: trace multi-term, scaled, masked, and phi-joined addresses in resource tracking #645 lands first, the guard handling here still applies to it.v_readfirstlane_b32lowering has the same unguarded read. That is not changed here; it could follow.AI-assisted (Claude Code).
🤖 Generated with Claude Code