Skip to content

startup: draw a per-lane sample_b bias past a divergent EXEC - #2758

Closed
tedin7 wants to merge 26 commits into
R0Y00:mainfrom
tedin7:x2w-texflow-bias
Closed

tedin7 wants to merge 26 commits into
R0Y00:mainfrom
tedin7:x2w-texflow-bias

Conversation

@tedin7

@tedin7 tedin7 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #1723

What this unblocks: image_sample_b past a divergent EXEC when the bias differs per lane (a join of two bias values), which #2736 refused by name until it had a draw.
Source: AMD "RDNA 2" Instruction Set Architecture reference guide, MIMG instruction IMAGE_SAMPLE_B (per-lane bias) and the EXEC mask rules; Microsoft DirectX-Specs, D3D11 functional specification, sample_b.

Stacked on #2747 and #2736 (this branch contains their commits until they merge; the new work is the last three commits). Builds on #2659.

What changed

  • The by-name refusal "image_sample_b with a per-lane bias past a divergent EXEC" is gone. SampleBias takes its bias per pixel, as the guest takes it per lane, so nothing in the lowering needed to change; the refusal only existed because no draw covered the form.
  • New draw fixture bias_lane in startup_image_sample_b_flow_check.py: the drawn lane (x = 0) takes bias -2 and its helper column keeps -1, then an EXEC branch and a join before the op. LOD 2 - 2 = 0 reads mip 0; the helper's bias would read mip 1, and an ignored bias mip 2. Two mutants (helper column bias, bias ignored) must fail the draw.
  • The refused fixture bias_per_lane of startup: keep sample_b and get_lod past a divergent EXEC with a per-quad vote #2736 became this accepted fixture.
  • Also in this stack: startup: lower s_wqm exec, exec on a narrowed EXEC as a quad vote #2747 restored the scalar_in_block and bias_per_lane refused entries that its own edit had dropped by mistake (the check passed without them); they are present again.

Verification (Linux only):

python3 -B tests/startup_image_sample_b_flow_check.py                     rc=0
python3 -B tests/startup_image_get_lod_flow_check.py                      rc=0
python3 -B tests/startup_image_sample_b_flow_check.py binary llvm-mc-19   fixtures reassemble
for every tests/startup_gfx2hlsl_*_check.py (no arguments)                all rc=0 except the two draw-only checks that need adapter arguments (untouched)

Win2025 WARP dev+release: pending Stage-2.

AI-assisted; commands listed were executed locally.

tedin7 and others added 25 commits November 26, 2026 05:29
- a voted block may hold only instructions whose destinations are VGPRs (no carry-out, compare, readlane);
- s_endpgm in a voted block only when no EXEC write follows the branch;
- a scalar EXEC write from a non-mask source (s_mov exec, 1) records a lane-exec break.
Three refused fixtures with recorded words; each fails on the previous head.
@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Added in 8b66e93 (c18 and RonLogic class): two draw fixtures where the bias is written INSIDE the divergent EXEC block.

  • bias_in_block: the drawn lane writes +1 inside the block (LOD 1 + 1 = 2, mip 2). Wrong-value control: the block write dropped (bias -1, mip 0) must fail the draw.
  • bias_in_block_helper: only the helper column writes +1; the drawn lane keeps -1 (mip 0). Wrong-value control: every lane writes (mip 2) must fail the draw.
  • Both also have the bias-ignored mutant (mip 1). Words reassemble with llvm-mc; CPU reference computed from the guest rule (LOD from the quad derivatives plus the lane own bias).

Linux: sample_b flow check rc=0, get_lod flow check rc=0, binary check passes. Win2025 WARP and hardware: pending Stage-2.

AI-assisted; commands listed were executed locally.

@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Withdrawn: shader translation is moving to the native C++ frontend (see #870), so we are not continuing this change to the Python translator. The branch stays available if any part is useful later. Thank you to everyone who reviewed and tested it.

@tedin7 tedin7 closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant