rdna2spirv: explicit-gradient samples with compare or offset (SHADER-… #1480

Open
github-bot wants to merge 1 commit from github-bot/gh-1480 into main AGit
Owner

@⁠vsking2000 on GitHub · 2026-11-25 01:13 UTC · original
vsking2000:shader-sample-grad-forms → main · +322 −11 · 3 files · 1 commits · open

…SAMPLE-GRAD-FORMS)

image_sample_c_d, image_sample_c_d_cl, image_sample_d_o, image_sample_d_cl_o, image_sample_c_d_o and image_sample_c_d_cl_o were refused by name. They combine pieces the translator already has as GPU-tested rules (depth compare, explicit gradients, _o offsets, the min-LOD clamp): address order offset, z-compare, dP/dx, dP/dy, coordinates, clamp, as LLVM (AMDGPUSampleVariants, lowerImage) and Mesa ACO both emit it. The sample is OpImageSample(Dref)ExplicitLod with Grad, Offset and MinLod in that order; a16 keeps the compare and the f32 gradients whole.

Refused with a reason: compare on a 3D image, 3D gradient forms with tfe/lwe, and the _o forms under --texel-offset-fallback (the shifted level is not computed from explicit gradients). The _cd and g16 forms stay refused. docs/design.md gets a row; the two rows that listed these as refused now point to it. Not run on a GPU.

Claude-Session: https://claude.ai/code/session_01Y7fbZYVY7EtLknWBZUfSLf

Claimed in the coordination issue as:

Depends on:

Fixes:

What and why

Tested

GPUs tested:

AI-assisted:

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.
**@⁠vsking2000** on GitHub · 2026-11-25 01:13 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1480) `vsking2000:shader-sample-grad-forms` → `main` · +322 −11 · 3 files · 1 commits · open …SAMPLE-GRAD-FORMS) image_sample_c_d, image_sample_c_d_cl, image_sample_d_o, image_sample_d_cl_o, image_sample_c_d_o and image_sample_c_d_cl_o were refused by name. They combine pieces the translator already has as GPU-tested rules (depth compare, explicit gradients, _o offsets, the min-LOD clamp): address order offset, z-compare, dP/dx, dP/dy, coordinates, clamp, as LLVM (AMDGPUSampleVariants, lowerImage) and Mesa ACO both emit it. The sample is OpImageSample(Dref)ExplicitLod with Grad, Offset and MinLod in that order; a16 keeps the compare and the f32 gradients whole. Refused with a reason: compare on a 3D image, 3D gradient forms with tfe/lwe, and the _o forms under --texel-offset-fallback (the shifted level is not computed from explicit gradients). The _cd and g16 forms stay refused. docs/design.md gets a row; the two rows that listed these as refused now point to it. Not run on a GPU. Claude-Session: https://claude.ai/code/session_01Y7fbZYVY7EtLknWBZUfSLf Claimed in the coordination issue as: <!-- the item ID from the open "Coordinating who works on what" issue, for example TEST-17, or a link to your claim --> Depends on: <!-- #N for every pull request this one builds on or conflicts with (the coordination issue's Commands section, AGENTS.md); delete the line if it builds on none and conflicts with none --> Fixes: <!-- #N for each issue this closes (GitHub closes it on merge); delete the line if it closes none --> ### What and why <!-- What this changes and the problem it solves. --> ### Tested <!-- What you ran and on which GPU and driver (CONTRIBUTING.md). For the shader translator: how many shaders translate and pass spirv-val, before and after. --> GPUs tested: <!-- vendor, model, driver and OS of each GPU the GPU tests ran on, or n/a --> AI-assisted: <!-- yes or no (AGENTS.md asks a coding agent to say so) --> ### Checklist - [ ] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [ ] One topic; follow-up work goes in a new pull request. - [ ] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed.
image_sample_c_d, image_sample_c_d_cl, image_sample_d_o,
image_sample_d_cl_o, image_sample_c_d_o and image_sample_c_d_cl_o were
refused by name. They combine pieces the translator already has as
GPU-tested rules (depth compare, explicit gradients, _o offsets, the
min-LOD clamp): address order offset, z-compare, dP/dx, dP/dy,
coordinates, clamp, as LLVM (AMDGPUSampleVariants, lowerImage) and Mesa
ACO both emit it. The sample is OpImageSample(Dref)ExplicitLod with
Grad, Offset and MinLod in that order; a16 keeps the compare and the
f32 gradients whole.

Refused with a reason: compare on a 3D image, 3D gradient forms with
tfe/lwe, and the _o forms under --texel-offset-fallback (the shifted
level is not computed from explicit gradients). The _cd and g16 forms
stay refused. docs/design.md gets a row; the two rows that listed these
as refused now point to it. Not run on a GPU.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y7fbZYVY7EtLknWBZUfSLf
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:53:27 +00:00
Author
Owner

@⁠GeorgiyDemo on GitHub · 2026-11-25 01:20 UTC · original

Tested a768a6501 on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main b4b7756e8 (translator-only PR; binaries from the build at 66d4f5aa3):

  • python3 -m unittest test_sample_grad_forms (from tests/semantic): OK at this head. The same file on main fails 2 + 34 errors — the six new combined forms (image_sample_c_d, _c_d_cl, _d_o, _d_cl_o, _c_d_o, _c_d_cl_o) are refused there.
  • GPU regression, --filter ps_sample_ on MoltenVK 1.4.2: 6/6 PASS (ps_sample_c, ps_sample_c_b, ps_sample_c_lz, ps_sample_c_lz_a16, ps_sample_implicit_sint, ps_sample_implicit_uint).
  • Not run: GPU execution of the six new forms themselves — no .asm fixture for them locally; the semantic suite is the evidence.

AI-assisted; synthetic fixtures only, no game data.

**@⁠GeorgiyDemo** on GitHub · 2026-11-25 01:20 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1480#issuecomment-7149446403) Tested `a768a6501` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `b4b7756e8` (translator-only PR; binaries from the build at `66d4f5aa3`): - `python3 -m unittest test_sample_grad_forms` (from `tests/semantic`): **OK** at this head. The same file on `main` fails **2 + 34 errors** — the six new combined forms (`image_sample_c_d`, `_c_d_cl`, `_d_o`, `_d_cl_o`, `_c_d_o`, `_c_d_cl_o`) are refused there. - GPU regression, `--filter ps_sample_` on **MoltenVK 1.4.2**: **6/6 PASS** (`ps_sample_c`, `ps_sample_c_b`, `ps_sample_c_lz`, `ps_sample_c_lz_a16`, `ps_sample_implicit_sint`, `ps_sample_implicit_uint`). - Not run: GPU execution of the six new forms themselves — no `.asm` fixture for them locally; the semantic suite is the evidence. AI-assisted; synthetic fixtures only, no game data.
This pull request has changes conflicting with the target branch.
  • tools/rdna2spirv.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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