shader: lower a whole-wave f16 sum across the host's two waves (#367) #368
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/368"
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?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by tiagonogueiraa-bit on 2026-11-27T14:25:05Z.
Refs #367
Shape. In wave64 compute shaders the host splits into two 32-lane waves (groups of more than 64 threads), a whole-wave
v_add_f16sum read at lane 63 was refused as "a 16-bit wave reduction across the host's waves". The sum is built from row butterflies,v_permlanex16_b32of lane 0, and lane 0 added in.Shape::Half(low halves summed, high half from one console lanehi) was lowered only when a console wave is one host wave.Change. When
self.halvesis set:waveActiveOp.f32) is combined across the pair withhalves_reduce(Op::AddF, ..), as other float sums are, then rounded to f16 once, as before;hi's value is read withwide_read_lane.That exchange reads 0 for a lane that wrote nothing, but a lane elsewhere must give the identity, so it carries
x ^ identand is XORed back. The single-host-wave path is unchanged.By-output corpus sweep. 12,020 containers from my own boot-to-menus run (Series S), native host options, main
905e7aaagainst this head:Gained:
c943990185ea8740,d98422fd516b6e44.Test.
split_wave_tests::a_whole_wave_half_sum_reads_across_the_host_waves(victory-gpu, on Metal with MSC 4.0 beta 3) runs the title's form in groups of 128 threads, so the fast path splits each wave. Each lane's term isi & 3as an f16, with0x1234in the high half.0x12345600: 96.0 under lane 63's high half.0x00005380(60.0, and lane 63 is off, so the identity's high half), and the rest store nothing.On main,
refusal()gives the old message.Checks.
cargo test -p victory-shader -p victory-hle -p victory -p victory-gpu -p victory-metal -p xtask: 955 passed, 0 failed, 10 ignored.-D warnings: clean.cargo xtask policy: ok.docs/native-host.md(whole-wave sections) describes it. @Olima34, for the board.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T16:05:15Z.
Merged in
be7dc1b5with the other shader PRs from tonight. Ran the tests (native arm64), Windows clippy, the policy check and a release build on the merged tree, and swept my full corpus of 21,600 shaders before and after: 0 lost, 352 newly translated, every changed output accounted for. I have not run the game on it yet. Thanks.