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

Closed
tedin7 wants to merge 26 commits from upstream-pr/2758 into main
tedin7 commented 2026-11-26 06:22:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T06:22:03Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6620844908 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2758). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T06:22:03Z. --- 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 commented 2026-11-26 07:00:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T06:35:21Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7184579518 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2758#issuecomment-7184579518). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T06:35:21Z. --- 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.
upstream-sync closed this pull request 2026-11-26 11:02:43 +00:00
tedin7 commented 2026-11-26 11:02:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T10:12:38Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7189055993 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2758#issuecomment-7189055993). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T10:12:38Z. --- 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

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2750
No description provided.