Repository navigation
Shaders: lane masks keep their bool form unless a read may see an integer - #26
Merged
Merged
Conversation
llvm-mc 23 writes source code 0x80 (inline constant 0) into the VOP3 sources an instruction does not read, where older releases wrote 0: a compare such as v_cmp_gt_u32_e64 s40, 4, v0 assembles to d4c40028 02020084. llvm-objdump lists it as the same compare, but the decoder made it .long, so any new test case with a VOP3 compare failed to translate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SKtJsfjasPuTLtS3mEXFru
…eger Mask tracking follows emission order, so a register that is a lane mask on one path and an integer on another is kept in its integer variables (a ballot per mask write, lane_bit per mask read). The rule was global: any register ever used both ways. The first translation now records per block the form each read assumed and each write left (MaskForms); MaskFormAnalysis carries the forms along the branches and keeps only registers a read may reach in the other form. CS_ScreenProbes_ActivateProbes (wave64): 33 of 34 masks were kept as integers, now 1 (s0, also an s_getpc/s_setpc address); HLSL vw_ballot 32,393 -> 17,411, lane_bit 20,976 -> 2,167. New case cs_mask_after_integer; the analysis returning nothing fails 14 of the mask cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XTYmP8DzdtgeCMD6HPuCyc
Owner
|
this one's great, 33 of 34 masks down to 1 on ActivateProbes and 11k → 925 ballots with #24 is a huge cut. merging both #25 and this now. one small nit: it adds two also, the windows failure on the first run wasn't you: it was our profiler test ( thanks again! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #25 (its decoder fix is the first commit here: the new case's assembled code comes from llvm-mc 23). Review only the second commit; I'll rebase once #25 is in.
Mask tracking follows emission order, so a register that is a lane mask on one path and an integer on another is kept in its integer variables: a ballot for each mask write, and
lane_bitfor each mask read. The rule that picks those registers was global: any register ever used both ways. On wave64 programs that is nearly every mask, since the translated code also uses the same SGPR pairs as integers elsewhere.The first translation now records, per block, the form each read assumed and each write left (
MaskForms/BlockForms).MaskFormAnalysiscarries the forms each register may hold along the branches (registers not written yet are integers) and keeps only those a read may reach in the other form. The second translation is unchanged.CS_ScreenProbes_ActivateProbes(wave64, 122k dwords of code):s_getpc/s_setpcaddress)vw_ballotin the HLSLlane_bitin the HLSLwaveActiveBallotin the DXIL, with #24cs_mask_after_integer(w32/w64, every form the compute cases run in). As a mutation check,Mixedreturning nothing fails 14 of the 26 mask cases (cs_mask_on_taken_path,cs_integer_on_taken_pathand the others).🤖 Generated with Claude Code
https://claude.ai/code/session_01XTYmP8DzdtgeCMD6HPuCyc