Repository navigation
startup: prove v_cvt_f32_u32 results uniform for v_readfirstlane_b32 - #2153
Merged
R0Y00 merged 1 commit intoNov 25, 2026
Merged
Conversation
The straight-line uniformity proof (R0Y00#1931) followed v_rcp_f32, v_mul_f32 and v_cvt_u32_f32 but not v_cvt_f32_u32, so the unsigned-division reciprocal estimate (v_cvt_f32_u32 of a uniform scalar, v_rcp_f32, v_mul_f32 by 0x4f7ffffe, v_cvt_u32_f32) never reached a proven read. The conversion is a per-lane function of its input bits. The check covers the conversion and the full chain, and keeps the chain refused from a lane-varying source or a lane mask, across an exec write or an overwrite, and in a program with branches. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
tedin7
reviewed
Nov 25, 2026
tedin7
left a comment
Collaborator
There was a problem hiding this comment.
Review at head 6d8ab3d317b3721fc7491f198578eb9b5c4d0b36.
Summary: One-word change, v_cvt_f32_u32 added to UNIFORM_VALU (tools/startup/gfx2hlsl.py:327). The conversion is a pure per-lane function of its source bits, like its siblings v_cvt_u32_f32 and v_cvt_f32_ubyte0. The existing source, exec, branch and overwrite gates still apply. No P1 or P2 found.
Commands run locally on the PR head:
python3 -B tests/startup_gfx2hlsl_readfirstlane_uniform_check.py:Readfirstlane uniformity checks: 0 failedpython3 tests/docs_links_check.py: self-test passed, 18 files, 396 linkspython3 tests/bidi_controls_check.py: 1429 files, no bidi controlsgit diff --check origin/main...HEAD: clean- Mutation: removed
v_cvt_f32_u32fromUNIFORM_VALU. Result:2 failed(the new accepted cases). Reverted withgit checkout -- .. gh pr checks: Linux checks, gfx1013 fixtures and Windows build pass. The/O2and chart jobs were skipped.- Mergeable, title neutral, no clean-room concerns seen in the 3 touched files.
Findings:
- P1: none.
- P2: none.
- nit: The new refused cases cover entry VGPR, mask source, exec write, overwrite, branches and cross-block definition. A refused case for a
v_cvt_f32_u32with SDWA/DPP modifiers would pin the "still not followed" claim in the body. The modifier gate already rejects it, so this is optional. - nit: As the body says, this and #2060 both edit the same
docs/experiments.mdparagraph, so the second to land needs a small text merge.
No Windows run: the change is a set-membership edit in Python analysis code with no new HLSL lowering, so the Linux check is enough.
AI-assisted; commands listed were executed locally.
This was referenced Nov 25, 2026
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.
Change
Part of #1723. Follows #1931.
v_readfirstlane_b32is lowered to a plain copy only when its VGPR source is proven uniform. #1931 follows a list of lane-pure VALU operations in straight-line code with a knownexec. The list hasv_rcp_f32,v_mul_f32andv_cvt_u32_f32but notv_cvt_f32_u32. Compiled shaders compute the unsigned-division reciprocal estimate from a uniform scalar and read the result back:That chain was refused at its first step.
v_cvt_f32_u32is a per-lane function of its input bits (float(x)), so this change adds it toUNIFORM_VALU. Nothing else changes. The source,exec, branch and overwrite rules from #1931 still apply, and the conversion's SDWA and DPP forms are still not followed.Relation to #2060 (open, reviewed at head 454fd64): #2060 admits programs with branches when no instruction in the program writes
exec. This change does not touch branches. The two compose. In the sample below, all 369 branched stages that contain the read also writeexecsomewhere, so #2060 does not change them, with or without this change. Both PRs edit the samedocs/experiments.mdparagraph, so whichever lands second needs a small text merge.Verification
On
a81beb55plus this commit:python -B tests/startup_gfx2hlsl_readfirstlane_uniform_check.py:Readfirstlane uniformity checks: 0 failed.python -B tests/startup_uniform_lane_check.py: passes.python -B tests/docs_links_check.pyandpython -B tests/bidi_controls_check.py: pass.Mutants of the rule, each applied to a copy of
gfx2hlsl.pyand run against the check. Each is a single edit, except the two "both gates" rows:v_cvt_f32_u32from the setexecgate of the readexecgates (proof and read)execgateLocal measurement, not reproducible from the repository: 266 graphics pipelines used by indirect draws in one captured frame, translated offline with
translate_request.v_readfirstlane_b32 requires a proven uniform source.s_mul_hi_u32. 188 still stop at the read; all of their read sites are in programs with branches. None of the 266 translates fully either way.Evidence and follow-up
The fixture is hand-written disassembly text, the same style as the existing check. It is not taken from any title.
New accepted cases: the conversion alone, and the full reciprocal chain. New refused cases: the conversion of an entry VGPR, the conversion of a lane mask, an
execwrite inside the chain, an overwrite inside the chain, the chain in a program with branches, and a definition in another block. The existing negative control, which empties the allowlist, now also covers the two new accepted cases.Follow-up, not in this PR: the remaining read sites in the sample are all in programs with branches.
exec.docs/experiments.md(uniform sources ofv_readfirstlane_b32) lists the new opcode and test cases. Reproduce with:Checklist
AI-assisted (Claude Code). All commands above were run locally.
🤖 Generated with Claude Code