compute: lower the depth sample CL variants #3619

Open
github-bot wants to merge 7 commits from github-bot/gh-3617 into main AGit
Owner

@⁠lambirou on GitHub · 2026-11-30 14:57 UTC · original
lambirou:compute/sample-depth-cl → main · +2271 −40 · 6 files · 7 commits · open

Stacked on #3606 and #3616 (compute/gather4-variants → compute/sample-cl): the diff includes those commits until they land. Rebase after they merge.

Part of the MIMG slice (P6). This adds the twenty depth/gradient sample CL forms: image_sample_c_cd*, image_sample_c_d_cl*, image_sample_cd_cl* and image_sample_d_cl*, with the _cl, _o and _g16 suffixes.

The RDNA 2 operand order is respected: packed offset, comparison reference, gradients, U, V, LOD clamp. The LOD is computed at translation time from the static slopes and the base view size declared by --sample-gradient-view WIDTH HEIGHT MIPS: the larger axis length, nearest mip, then the minimum-LOD clamp. _g16 packs U in the low half and V in the high half. Comparison forms use dmask:0x1, a single VGPR destination and a finite reference in [0, 1]; non-comparison forms use dmask:0xf and four VGPRs. Descriptors, the constant sampler, an unguarded lane, a single view and static operands are validated; dynamic or out-of-view cases are refused. The other sample suffixes fall through to the generic refusal.

Tests

  • compute_store_aot_gfx1013_sample_depth_cl_warp and _hardware pass: 26 cases and 5 mutants detected on WARP and the AMD Radeon RX 9060 XT (driver 32.0.32029.2010).
  • gather4_l, gather4_variants and sample_cl still pass on both adapters (8/8 in the combined run), and compute_store_aot_gfx1013_image_store_warp passes.
  • form_coverage_check.py pins exactly the twenty forms; docs_links_check.py passes; compute_mimg_float_store_check.py passes after restoring the generic refusal for image_sample_l.
  • Expected delta: +20 forms on gfx1013 and +20 on gfx1030. On top of the stack's 1,640/1,594, the three PRs reach 1,660/1,614.

Limits

The model loads a texel at an explicit mip; it does not prove the console's native derived LOD. Slopes, coordinates, offsets, references and clamps must be static and lane-uniform; coarse forms assume uniform slopes. No llvm-mc round-trip, debug layer or console measurement was run. The sample_cl base/bias/compare forms keep their own record, and the BVH forms stay uncovered.

AI-assisted.

**@⁠lambirou** on GitHub · 2026-11-30 14:57 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3617) `lambirou:compute/sample-depth-cl` → `main` · +2271 −40 · 6 files · 7 commits · open **Stacked on #3606 and #3616** (`compute/gather4-variants` → `compute/sample-cl`): the diff includes those commits until they land. Rebase after they merge. Part of the MIMG slice (P6). This adds the twenty depth/gradient sample CL forms: `image_sample_c_cd*`, `image_sample_c_d_cl*`, `image_sample_cd_cl*` and `image_sample_d_cl*`, with the `_cl`, `_o` and `_g16` suffixes. The RDNA 2 operand order is respected: packed offset, comparison reference, gradients, U, V, LOD clamp. The LOD is computed at translation time from the static slopes and the base view size declared by `--sample-gradient-view WIDTH HEIGHT MIPS`: the larger axis length, nearest mip, then the minimum-LOD clamp. `_g16` packs U in the low half and V in the high half. Comparison forms use `dmask:0x1`, a single VGPR destination and a finite reference in [0, 1]; non-comparison forms use `dmask:0xf` and four VGPRs. Descriptors, the constant sampler, an unguarded lane, a single view and static operands are validated; dynamic or out-of-view cases are refused. The other sample suffixes fall through to the generic refusal. ## Tests - `compute_store_aot_gfx1013_sample_depth_cl_warp` and `_hardware` pass: 26 cases and 5 mutants detected on WARP and the AMD Radeon RX 9060 XT (driver 32.0.32029.2010). - `gather4_l`, `gather4_variants` and `sample_cl` still pass on both adapters (8/8 in the combined run), and `compute_store_aot_gfx1013_image_store_warp` passes. - `form_coverage_check.py` pins exactly the twenty forms; `docs_links_check.py` passes; `compute_mimg_float_store_check.py` passes after restoring the generic refusal for `image_sample_l`. - Expected delta: **+20 forms on gfx1013 and +20 on gfx1030**. On top of the stack's 1,640/1,594, the three PRs reach **1,660/1,614**. ## Limits The model loads a texel at an explicit mip; it does not prove the console's native derived LOD. Slopes, coordinates, offsets, references and clamps must be static and lane-uniform; coarse forms assume uniform slopes. No `llvm-mc` round-trip, debug layer or console measurement was run. The sample_cl base/bias/compare forms keep their own record, and the BVH forms stay uncovered. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 15:00:55 +00:00
Author
Owner

@⁠lambirou on GitHub · 2026-12-01 03:12 UTC · original · reviewed

Reviewed a8db8d69 against #3616 (ac19d70d), focusing on the depth/gradient delta; not built or run.

Verdict: approve for this delta; merge after #3616. The twenty _d_cl/_cd_cl forms and their _g16/_o variants use the explicit gradient path, not the bias path that #3616 must fix. The sampler checks, operand order, g16 unpacking, comparison direction and offset clamp match the existing sample-CL model.

  • SHOULD The fixture computes its expected mip with aot.sample_gradient_level, the same function as the translator, so a wrong gradient model would pass the draw. The cases use exact one/two-octave slopes; add one row whose expected level is hand-computed or comes from a desktop sampler, especially at a rounding boundary.
  • NIT sample_gradient_level uses Python double intermediates for hypot/log2; the hardware path is float32. The exact slopes avoid the difference today, but a boundary row would either justify the double path or expose a float32 rounding difference.
  • Checked, no finding: _g16 packs U/V in the low/high halves and refuses subnormal components; the _c_cd/_c_d comparison forms take red DMASK 0x1 and a static reference; the descriptor/sampler checks match the sample-CL path; out-of-range gradients are refused rather than silently clamped.
  • The inherited CL bias branch from #3616 remains in the diff; it will be fixed there before this PR is rebased.
**@⁠lambirou** on GitHub · 2026-12-01 03:12 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3617#pullrequestreview-6124508980) · **reviewed** Reviewed `a8db8d69` against #3616 (`ac19d70d`), focusing on the depth/gradient delta; not built or run. **Verdict: approve for this delta; merge after #3616.** The twenty `_d_cl`/`_cd_cl` forms and their `_g16`/`_o` variants use the explicit gradient path, not the bias path that #3616 must fix. The sampler checks, operand order, g16 unpacking, comparison direction and offset clamp match the existing sample-CL model. - **SHOULD** The fixture computes its expected mip with `aot.sample_gradient_level`, the same function as the translator, so a wrong gradient model would pass the draw. The cases use exact one/two-octave slopes; add one row whose expected level is hand-computed or comes from a desktop sampler, especially at a rounding boundary. - **NIT** `sample_gradient_level` uses Python double intermediates for `hypot`/`log2`; the hardware path is float32. The exact slopes avoid the difference today, but a boundary row would either justify the double path or expose a float32 rounding difference. - Checked, no finding: `_g16` packs U/V in the low/high halves and refuses subnormal components; the `_c_cd`/`_c_d` comparison forms take red DMASK 0x1 and a static reference; the descriptor/sampler checks match the sample-CL path; out-of-range gradients are refused rather than silently clamped. - The inherited CL bias branch from #3616 remains in the diff; it will be fixed there before this PR is rebased.
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-03 11:42 UTC · original

At 2dfa8d42 the gather4, sample-cl and sample-depth-cl fixtures passed on WARP and RTX 4060 Laptop, including their mutation controls, with the D3D12 debug layer enabled. The offset correction matches #3606. Please leave this stacked behind #3606 and #3616 while the base bias question is open, then refresh against the landed commits so the PR diff can be reviewed as a depth-sample delta.

**@⁠R0Y00** on GitHub · 2026-12-03 11:42 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3617#issuecomment-7377061338) At 2dfa8d42 the gather4, sample-cl and sample-depth-cl fixtures passed on WARP and RTX 4060 Laptop, including their mutation controls, with the D3D12 debug layer enabled. The offset correction matches #3606. Please leave this stacked behind #3606 and #3616 while the base bias question is open, then refresh against the landed commits so the PR diff can be reviewed as a depth-sample delta.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3619/head:github-bot/gh-3617'
git switch 'github-bot/gh-3617'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3617'
git switch 'github-bot/gh-3617'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3617'
git switch 'github-bot/gh-3617'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3617'
git switch 'main'
git merge --squash 'github-bot/gh-3617'
git switch 'main'
git merge --ff-only 'github-bot/gh-3617'
git switch 'main'
git merge 'github-bot/gh-3617'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.