Repository navigation
shader: allow uniform IADD3 carry-out above 1 - #638
CloudP4bbs wants to merge 1 commit into
Conversation
The uniform form of IADD3 with a carry-out predicate was rejected when the output predicate index was above 1, with the reason native integer carry mode. The lowering below that guard already emits the carry into the uniform bank (R239, bit 6-n) with save and restore of the predicate, so the guard was refusing a case the code handles. Ocarina of Time emits opcode 0x290 with Bits(81,3) == 3, which lands in that guard. Measured on an RX 5700 with the 0x4a4 lowering from Eglantine-Community#604 also applied: zero rejected programs at boot instead of one, and 4800 to 7800 presented frames in 260 to 280 seconds where the program used to be discarded.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Confirmation with the clean patch, rebuilt from this branch alone on top of That is the same result as the first measurement, now from a source tree that contains only this change and #604, so the frame count difference against the earlier 4800 was indeed cold pipeline compilation and not something this patch introduced. For the record, the rejections this title produced before the two patches together were |
|
Closing this. It causes a regression that I found on my own machine, and it is worse than the rejection it removes. What the change did Removing the What I did not check before opening it I did not look at the rendered output. On this machine, with that clause removed, the title boots with zero rejections and presents 9600 frames in 300 s, and the 3D scene is completely black: the intro subtitle draws at 32 FPS over an empty background. The frame dump shows With the clause restored, same tree, same machine, same title: The 20 KB against 2.4 MB is the same client area captured with Why the removal is wrong The clause was not conservative, it was a guard on a shape the lowering below does not actually handle: So the correct statement for this title is: the program is rejected for a reason, and making the rejection go away without implementing the carry-out properly moves the failure from "program discarded" to "geometry silently missing". The rejection was the honest behaviour. What is left The Thanks to anyone who looked at this one; sorry for the noise. |
One line removed from a guard in the Ampere to Maxwell lowering.
What was rejected
In the IADD3 with carry-out path, the uniform forms were refused when the carry-out predicate index was above 1:
The third clause is the one that fires. The lowering directly below it already handles the uniform case: it picks the target with
6 - carry_out, emits the compare that produces the carry, writes it into the uniform bank (R239, bit6-n) and restores the predicate around it. So the clause was refusing a shape the code below can already lower.Why it matters for Ocarina of Time
That title emits
[op 290 0f067290 00000006 0ff5e03f 000fe200], whereBits(81, 3) == 3: uniform IADD3 with a carry-out, no carry-in. It lands exactly in the removed clause, and the program is discarded with reasonnative integer carry mode.Measured before and after
Same machine, RX 5700, Windows 11, amdvlk 32.0.21045.16010, clean
cache/shader/0400486024dec000before each run,EDEN_NX2_SPLIT=2andEDEN_NX2_FENCE_BATCH=1,0400486024DEC000. Both runs also carry the0x4a4lowering from #604, which is the other rejection this title produced; without #604 this one is not reached.The two runs differ in duration because of pipeline compilation on a cold cache, so the meaningful number is the rejection count, not the frame count.
What I did not change
carry_incombined with a uniformcarry_outis still refused, andcarry_outfor the non-uniform forms is untouched. I only tested the case above, with the title that produces it, so this is intentionally the smallest change that makes that program lower.If a reviewer would rather relax it differently, for example keeping the clause for
carry_out > 6as a defensive check, that also works for this case and I can adjust.Summary by CodeRabbit