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

Closed
github-bot wants to merge 26 commits from gh-pr/2758/head into gh-pr/2758/base
Owner

@⁠tedin7 on GitHub · 2026-11-26 06:22 UTC · original
tedin7:x2w-texflow-bias → main · +854 −8 · 7 files · 26 commits · closed without merging

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 #2736 became this accepted fixture.
  • Also in this stack: #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** on GitHub · 2026-11-26 06:22 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2758) `tedin7:x2w-texflow-bias` → `main` · +854 −8 · 7 files · 26 commits · closed without merging 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 #2736 became this accepted fixture. - Also in this stack: #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.
- 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:20:32 +00:00
github-bot closed this pull request 2026-11-27 01:20:32 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-26 06:35 UTC · original

Added in 8b66e9375 (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** on GitHub · 2026-11-26 06:35 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2758#issuecomment-7184579518) Added in 8b66e9375 (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.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-26 10:12 UTC · original

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** on GitHub · 2026-11-26 10:12 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2758#issuecomment-7189055993) 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.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.