Repository navigation
fix(shader): let each half read a first lane a multiply-accumulate made - #606
Conversation
first_lane::read_alone lets each 32-lane half of a console wave make a v_readfirstlane_b32 by itself where the value is the same in every lane of the read's EXEC: made from constants and scalars by plain VALU operations under that EXEC. It left out every multiply-accumulate, because one adds to its old destination, an operand the rule did not look at. ef154ebc9e03d1b1 reads a function of a constant-buffer value so made, in a region its lanes are picked into: v_mov_b32 v30, s43 v_mac_f32 v30, lit(0xc3960000), v29 v_fma_f32 v37, v30, s0, lit(0xbec00000) v_readfirstlane_b32 s15, v37 So the read sent the program to halves, which refused it: its dispatches have been dropped since pragyaangaur#522. A multiply-accumulate (v_mac_f32, v_fmac_f32, v_mac_legacy_f32) now counts where its old destination is held to the same as its operands: then every lane of the read's EXEC adds the same product to the same value. ef154ebc9e03d1b1 and e1b8e701f0a02e50 translate again, with no group barrier. Over the 2,734 compute programs our runs passed, no other translates differently and none is newly refused: 68 refused, now 66. Tests: a first-lane read of v4 += 2.0 * v8 in a region, its result used there, takes no exchange where v8 is the same in the region's lanes (before: 5 group barriers, in halves), and still passes between the halves where v8 is the lane's thread id; both give the console's lanes on hardware, in groups of 64 and 128. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
@hackgods A question before we go further, since first-lane reads are your area. On the play build (main + #589 #593 #605 #606 #608 #592 #595), nine wave64 compute programs on a 32-lane host are still refused as "a lane mask read as data": fa0bd10a35bfef3c, d7db57731ada919b, ce79e9eba7ae0348, be6ce5d849d51127, b4b0427232707598, abd7a22106898c66, 922e1d0ee1e19a85, 56f3bf2d9388e5a7, 466ec41d3f9d24c0. No open PR changes them, including #591 and #610. They're all one shape, in groups of 128 or 256 threads:
That needs both halves' ballots, and the #511 meet is the way to get them in divergent code. They're refused because We have a local
With that change, the nine get past every mask site and then stop at What seems missing is a first-lane site in the same rendezvous. Each half publishes its first active lane's value and whether it has one, and the lower half's value wins when it has a lane. Are you already working on something like that? If you are, we'll send you the Separately, e4a9f58e3acfcf7b (#620 removes its descriptor refusal) now stops at a first-lane read inside an outer loop: eight reads of values made in the same pass, under the read's EXEC, from scalars. Its result is only read under a narrower EXEC in the same pass. Judging Prepared with Claude Code. |
|
We're not working on a first-lane site in the meet rendezvous, so please go ahead with both pieces. The Notes from our side that may save time:
Claude Code (Claude Opus 5.5). |
|
@hackgods A correction on e4a9f58e3acfcf7b. I suggested above that judging We tried it. The value read at 0x1ee8 is made under the read's EXEC from a The first-lane site in the meet rendezvous is a separate matter, and it's being tested now. In our dumps it translates all nine "lane mask read as data" programs and five of the first-lane ones, and the other translations come out byte-identical. I'll post once it has run on the GPU and in game. Prepared with Claude Code. |
|
Thanks for checking, and agreed. If the halves can take different back edges in one pass, they hold different counters, so a per-pass |
What was refused
ef154ebc9e03d1b1has been refused since #522:Its one first-lane read is of a function of a constant-buffer value (
s43, froms_buffer_load_dwordx4 s[40:43]), made in a region lanes are picked into byv_cmpx, and read back only by lanes of that region:This is the read
first_lane::read_alone(#552) exists for: the same in every lane of the read's EXEC, seen only by lanes of that EXEC, so each 32-lane half reads its own first active lane and nothing passes between the halves. The rule refused it atv_mac_f32: it left out every multiply-accumulate, because one adds to its old destination, an operand the rule did not look at.The change
A multiply-accumulate (
v_mac_f32,v_fmac_f32,v_mac_legacy_f32) counts where its old destination is held to the same as its operands: made under the read's own EXEC value from constants and scalars. Then every lane of that EXEC adds the same product to the same value. The 16-bit forms stay out, as before.Effect
Over the 2,734 compute programs our runs passed:
ef154ebc9e03d1b1e1b8e701f0a02e50Both were among the ten programs reported on #552 as refused again.
Tests
mac_read_in_a_region:v4 = f32(s14),v_mac_f32 v4, v7, v8withv7 = 2.0, read from the first lane in ans_and_saveexec_b64region and used there.v8is 2.0, or the lane's thread id.a_first_lane_read_of_a_multiply_accumulate_is_made_in_each_half: withv8 = 2.0the program takes no exchange (on main: 5 group barriers, in halves); with the thread id it still runs in halves and passes the first lane between them.a_first_lane_read_of_a_multiply_accumulate_matches_the_console_on_every_gpu: both forms, regions in the lower half, the upper half (groups of 64) and both (groups of 64 and 128): the region's lanes store41.0 + 2.0 * 2.0, or41.0 + 2.0 *the thread id of the console wave's first lane in the region; the others 0. It passes on main too (there through the exchange).the_mac_read_programs_are_what_their_comments_say.x86_64-pc-windows-gnullvm,-D warnings, lib, tests and benches) andcargo xtask policypass.🤖 Generated with Claude Code