startup: lower fixed-mip 2D comparison gathers in gfx2hlsl #2242

Merged
ArnabSaga merged 2 commits from upstream-pr/2250 into main 2026-11-25 08:22:39 +00:00
ArnabSaga commented 2026-11-25 07:46:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ArnabSaga on 2026-11-25T07:46:46Z.


Lower gfx1013 image_gather4_c_lz for a bounded 2D pixel-shader profile with red DMASK and a constant comparison sampler.

Reuse the existing comparison-gather sampler validation and smpc bindings. Emit GatherCmp and write four consecutive destination VGPRs in gather order. Preserve the ordinary gather implementation and reject unsupported comparison-gather forms.

Add source-built encoded fixtures, independent CPU expectations, all eight comparison functions, view-relative mip tests, refusal controls and GPU sensitivity checks.

Verified with FXC ps_5_1 and DXC ps_6_0 on WARP and Intel Iris Xe: 92 positive draws, 32 expected sensitivity mismatches, 23,552 bitwise-equal channel comparisons, 21 selected CTest tests passing, and zero debug warnings or errors.

The verified texture contract is R32_FLOAT with reference and texels in [0,1]. No console or title-level execution claim.

AI assistance: developed with DeepSeek V4.1 Flash in OpenCode, with ChatGPT-assisted planning and acceptance review.

Refs #1802

Change

Describe the observable change and the task or milestone it advances, or the
independent problem it solves. Link related issues with Refs #123 or
Fixes #123. If the change touches a shared interface, name it and link any
overlapping work or PR that must land first. For a documentation patch,
identify the contributor task the edit helps someone complete.

Verification

Give the commit or build, command and result. For GPU changes include the
adapter, backend, first mismatch if any, and capability skips. If you could not
run a check, say so and identify the missing prerequisite.

Evidence and follow-up

For new fixtures, describe their source or generation method and license.
Identify assumptions that affect the result and link any work another
contributor can pick up.

If this changes what contributors can run, link the updated README entry or
build step and the reproduction command. For a local-data result, identify the
part the public fixture verifies.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

If this change was AI-assisted, say so in the description. Recent contributions
follow this practice.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6599740149 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2250). Originally posted by [ArnabSaga](https://github.com/ArnabSaga) on 2026-11-25T07:46:46Z. --- Lower gfx1013 image_gather4_c_lz for a bounded 2D pixel-shader profile with red DMASK and a constant comparison sampler. Reuse the existing comparison-gather sampler validation and smpc bindings. Emit GatherCmp and write four consecutive destination VGPRs in gather order. Preserve the ordinary gather implementation and reject unsupported comparison-gather forms. Add source-built encoded fixtures, independent CPU expectations, all eight comparison functions, view-relative mip tests, refusal controls and GPU sensitivity checks. Verified with FXC ps_5_1 and DXC ps_6_0 on WARP and Intel Iris Xe: 92 positive draws, 32 expected sensitivity mismatches, 23,552 bitwise-equal channel comparisons, 21 selected CTest tests passing, and zero debug warnings or errors. The verified texture contract is R32_FLOAT with reference and texels in [0,1]. No console or title-level execution claim. AI assistance: developed with DeepSeek V4.1 Flash in OpenCode, with ChatGPT-assisted planning and acceptance review. Refs #1802 ## Change Describe the observable change and the task or milestone it advances, or the independent problem it solves. Link related issues with `Refs #123` or `Fixes #123`. If the change touches a shared interface, name it and link any overlapping work or PR that must land first. For a documentation patch, identify the contributor task the edit helps someone complete. ## Verification Give the commit or build, command and result. For GPU changes include the adapter, backend, first mismatch if any, and capability skips. If you could not run a check, say so and identify the missing prerequisite. ## Evidence and follow-up For new fixtures, describe their source or generation method and license. Identify assumptions that affect the result and link any work another contributor can pick up. If this changes what contributors can run, link the updated README entry or build step and the reproduction command. For a local-data result, identify the part the public fixture verifies. ## Checklist - [ ] This pull request covers one reviewable behavior. - [ ] I included the exact command and result for every check I ran. - [ ] I considered a negative control or failure case for a new fixture. - [ ] I updated README/docs when a capability or build requirement changed. - [ ] I did not include game files, dumps, distribution links or secrets. If this change was AI-assisted, say so in the description. Recent contributions follow this practice.
tedin7 commented 2026-11-25 08:05:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T07:48:09Z.

Review: COMMENTED


Review of head 64287bc5ebc2d06a84250d14f6925d411c9a251d (comment only, not an approval).

Summary: The lowering of image_gather4_c_lz is correct on read: red-only dmask, 2D, constant comparison sampler, address order (reference, u, v) and GatherCmp writing four consecutive VGPRs. It reuses check_gather_sampler(..., comparison=True). One merge blocker below.

P1

  • The PR is CONFLICTING with main. git merge-tree --write-tree origin/main HEAD reports a content conflict in CMakeLists.txt (the test registration block near the startup_image_sample_c / startup_image_gather_lz_* entries). Please rebase. The Windows run for this head does not describe the merged tree.

P2

  • The PR body still contains the unfilled template sections (## Change, ## Verification) below the summary. The Windows results quoted (92 draws, 21 CTest tests, adapters) are not tied to a commit or command line as the template asks. Please fill them in with the exact commands and the rebased SHA.
  • The body names tooling products. Please keep the description neutral and drop those lines.
  • gh pr checks reports no checks for this branch, so there is no CI signal yet for the .github/workflows/windows.yml edit.

Nits

  • tools/startup/gfx2hlsl.py (op_image_gather4_c_lz): the dst[2] > 255 / addr[2] > 255 checks are fine, but the comment "an alias between address and destination keeps the original operands" holds only because t is assigned before set_v. A test with an aliased range (e.g. v[0:3] dest and v[0:2] address) would pin that. I did not see one in the new check.

Commands executed locally in the worktree

  • git diff --stat origin/main...HEAD: 10 files, 854 insertions, 9 deletions.
  • python3 -B tests/startup_image_gather_c_lz_check.py: passes, including its text and guard controls.
  • python3 -B tests/startup_image_gather_lz_check.py: passes.
  • python3 -B tests/startup_image_sample_c_check.py: passes (opcode edits to the refusal controls are consistent with the new lowering).
  • python3 tests/docs_links_check.py: passes (18 files, 407 links).
  • python3 tests/bidi_controls_check.py: passes (1488 files).
  • git diff --check origin/main...HEAD: clean.
  • Mutation 1: swapped u and v in the emitted GatherCmp call. The check fails (assertion on the exact call text, exit 1).
  • Mutation 2: removed the red dmask:0x1 guard. The check fails (comparison gather accepted a form expected to report 'requires red dmask 0x1').
  • Worktree restored with git checkout -- . after each mutation.
  • Windows WARP/GPU run: not run by me. The GPU readback tests depend on Win2025, and the PR is not mergeable until rebased, so a run is more useful after the rebase.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6053676287 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2250#pullrequestreview-6053676287). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T07:48:09Z. **Review:** COMMENTED --- Review of head `64287bc5ebc2d06a84250d14f6925d411c9a251d` (comment only, not an approval). **Summary:** The lowering of `image_gather4_c_lz` is correct on read: red-only dmask, 2D, constant comparison sampler, address order (reference, u, v) and `GatherCmp` writing four consecutive VGPRs. It reuses `check_gather_sampler(..., comparison=True)`. One merge blocker below. **P1** - The PR is `CONFLICTING` with `main`. `git merge-tree --write-tree origin/main HEAD` reports a content conflict in `CMakeLists.txt` (the test registration block near the `startup_image_sample_c` / `startup_image_gather_lz_*` entries). Please rebase. The Windows run for this head does not describe the merged tree. **P2** - The PR body still contains the unfilled template sections (`## Change`, `## Verification`) below the summary. The Windows results quoted (92 draws, 21 CTest tests, adapters) are not tied to a commit or command line as the template asks. Please fill them in with the exact commands and the rebased SHA. - The body names tooling products. Please keep the description neutral and drop those lines. - `gh pr checks` reports no checks for this branch, so there is no CI signal yet for the `.github/workflows/windows.yml` edit. **Nits** - `tools/startup/gfx2hlsl.py` (`op_image_gather4_c_lz`): the `dst[2] > 255` / `addr[2] > 255` checks are fine, but the comment "an alias between address and destination keeps the original operands" holds only because `t` is assigned before `set_v`. A test with an aliased range (e.g. `v[0:3]` dest and `v[0:2]` address) would pin that. I did not see one in the new check. **Commands executed locally in the worktree** - `git diff --stat origin/main...HEAD`: 10 files, 854 insertions, 9 deletions. - `python3 -B tests/startup_image_gather_c_lz_check.py`: passes, including its text and guard controls. - `python3 -B tests/startup_image_gather_lz_check.py`: passes. - `python3 -B tests/startup_image_sample_c_check.py`: passes (opcode edits to the refusal controls are consistent with the new lowering). - `python3 tests/docs_links_check.py`: passes (18 files, 407 links). - `python3 tests/bidi_controls_check.py`: passes (1488 files). - `git diff --check origin/main...HEAD`: clean. - Mutation 1: swapped `u` and `v` in the emitted `GatherCmp` call. The check fails (assertion on the exact call text, exit 1). - Mutation 2: removed the red `dmask:0x1` guard. The check fails (`comparison gather accepted a form expected to report 'requires red dmask 0x1'`). - Worktree restored with `git checkout -- .` after each mutation. - Windows WARP/GPU run: not run by me. The GPU readback tests depend on Win2025, and the PR is not mergeable until rebased, so a run is more useful after the rebase. AI-assisted; commands listed were executed locally.
ArnabSaga commented 2026-11-25 08:05:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ArnabSaga on 2026-11-25T07:57:59Z.


Thanks for the detailed review and for independently running the
translation and mutation controls.

I'll rebase onto current main, preserve the upstream CMake registrations,
and rerun the verification matrix against the rebased commit.

I'll also complete the PR template with the exact verification commands and
commit SHA, keep the description neutral, and verify the aliased
destination/address register case.

I'll update the PR once the corrected candidate has been verified.

On Wed, Nov 25, 2026 at 1:48 PM tedin7 @.***> wrote:

@.**** commented on this pull request.

Review of head 64287bc5eb (comment only,
not an approval).

Summary: The lowering of image_gather4_c_lz is correct on read:
red-only dmask, 2D, constant comparison sampler, address order (reference,
u, v) and GatherCmp writing four consecutive VGPRs. It reuses check_gather_sampler(...,
comparison=True). One merge blocker below.

P1

  • The PR is CONFLICTING with main. git merge-tree --write-tree
    origin/main HEAD reports a content conflict in CMakeLists.txt (the
    test registration block near the startup_image_sample_c /
    startup_image_gather_lz_* entries). Please rebase. The Windows run for
    this head does not describe the merged tree.

P2

  • The PR body still contains the unfilled template sections (## Change,

Verification) below the summary. The Windows results quoted (92

draws, 21 CTest tests, adapters) are not tied to a commit or command line
as the template asks. Please fill them in with the exact commands and the
rebased SHA.

  • The body names tooling products. Please keep the description neutral
    and drop those lines.
  • gh pr checks reports no checks for this branch, so there is no CI
    signal yet for the .github/workflows/windows.yml edit.

Nits

  • tools/startup/gfx2hlsl.py (op_image_gather4_c_lz): the dst[2] > 255
    / addr[2] > 255 checks are fine, but the comment "an alias between
    address and destination keeps the original operands" holds only because
    t is assigned before set_v. A test with an aliased range (e.g. v[0:3]
    dest and v[0:2] address) would pin that. I did not see one in the new
    check.

Commands executed locally in the worktree

  • git diff --stat origin/main...HEAD: 10 files, 854 insertions, 9
    deletions.
  • python3 -B tests/startup_image_gather_c_lz_check.py: passes,
    including its text and guard controls.
  • python3 -B tests/startup_image_gather_lz_check.py: passes.
  • python3 -B tests/startup_image_sample_c_check.py: passes (opcode
    edits to the refusal controls are consistent with the new lowering).
  • python3 tests/docs_links_check.py: passes (18 files, 407 links).
  • python3 tests/bidi_controls_check.py: passes (1488 files).
  • git diff --check origin/main...HEAD: clean.
  • Mutation 1: swapped u and v in the emitted GatherCmp call. The check
    fails (assertion on the exact call text, exit 1).
  • Mutation 2: removed the red dmask:0x1 guard. The check fails (comparison
    gather accepted a form expected to report 'requires red dmask 0x1').
  • Worktree restored with git checkout -- . after each mutation.
  • Windows WARP/GPU run: not run by me. The GPU readback tests depend
    on Win2025, and the PR is not mergeable until rebased, so a run is more
    useful after the rebase.

AI-assisted; commands listed were executed locally.

—
Reply to this email directly, view it on GitHub
https://github.com/R0Y00/Xbox2Windows/pull/2250?email_source=notifications&email_token=A3EVBOYM6HCAC6BT3UXLYEL522FE7A5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTMMBVGM3DONRSHA32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#pullrequestreview-6053676287,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/A3EVBO5HAUWQSCBLMPS6L4D522FE7AVCNFSNUABGKJSXA33TNF2G64TZHMYTINRVG4ZDQNRTG45US43TOVSTWNRVHE4TONBQGE2DTILWAI
.
You are receiving this because you authored the thread.Message ID:
<R0Y00/Xbox2Windows/pull/2250/review/6053676287 @.***
com>

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7156451919 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2250#issuecomment-7156451919). Originally posted by [ArnabSaga](https://github.com/ArnabSaga) on 2026-11-25T07:57:59Z. --- Thanks for the detailed review and for independently running the translation and mutation controls. I'll rebase onto current main, preserve the upstream CMake registrations, and rerun the verification matrix against the rebased commit. I'll also complete the PR template with the exact verification commands and commit SHA, keep the description neutral, and verify the aliased destination/address register case. I'll update the PR once the corrected candidate has been verified. On Wed, Nov 25, 2026 at 1:48 PM tedin7 ***@***.***> wrote: > ***@***.**** commented on this pull request. > > Review of head 64287bc5ebc2d06a84250d14f6925d411c9a251d (comment only, > not an approval). > > *Summary:* The lowering of image_gather4_c_lz is correct on read: > red-only dmask, 2D, constant comparison sampler, address order (reference, > u, v) and GatherCmp writing four consecutive VGPRs. It reuses check_gather_sampler(..., > comparison=True). One merge blocker below. > > *P1* > > - The PR is CONFLICTING with main. git merge-tree --write-tree > origin/main HEAD reports a content conflict in CMakeLists.txt (the > test registration block near the startup_image_sample_c / > startup_image_gather_lz_* entries). Please rebase. The Windows run for > this head does not describe the merged tree. > > *P2* > > - The PR body still contains the unfilled template sections (## Change, > ## Verification) below the summary. The Windows results quoted (92 > draws, 21 CTest tests, adapters) are not tied to a commit or command line > as the template asks. Please fill them in with the exact commands and the > rebased SHA. > - The body names tooling products. Please keep the description neutral > and drop those lines. > - gh pr checks reports no checks for this branch, so there is no CI > signal yet for the .github/workflows/windows.yml edit. > > *Nits* > > - tools/startup/gfx2hlsl.py (op_image_gather4_c_lz): the dst[2] > 255 > / addr[2] > 255 checks are fine, but the comment "an alias between > address and destination keeps the original operands" holds only because > t is assigned before set_v. A test with an aliased range (e.g. v[0:3] > dest and v[0:2] address) would pin that. I did not see one in the new > check. > > *Commands executed locally in the worktree* > > - git diff --stat origin/main...HEAD: 10 files, 854 insertions, 9 > deletions. > - python3 -B tests/startup_image_gather_c_lz_check.py: passes, > including its text and guard controls. > - python3 -B tests/startup_image_gather_lz_check.py: passes. > - python3 -B tests/startup_image_sample_c_check.py: passes (opcode > edits to the refusal controls are consistent with the new lowering). > - python3 tests/docs_links_check.py: passes (18 files, 407 links). > - python3 tests/bidi_controls_check.py: passes (1488 files). > - git diff --check origin/main...HEAD: clean. > - Mutation 1: swapped u and v in the emitted GatherCmp call. The check > fails (assertion on the exact call text, exit 1). > - Mutation 2: removed the red dmask:0x1 guard. The check fails (comparison > gather accepted a form expected to report 'requires red dmask 0x1'). > - Worktree restored with git checkout -- . after each mutation. > - Windows WARP/GPU run: not run by me. The GPU readback tests depend > on Win2025, and the PR is not mergeable until rebased, so a run is more > useful after the rebase. > > AI-assisted; commands listed were executed locally. > > — > Reply to this email directly, view it on GitHub > <https://github.com/R0Y00/Xbox2Windows/pull/2250?email_source=notifications&email_token=A3EVBOYM6HCAC6BT3UXLYEL522FE7A5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTMMBVGM3DONRSHA32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#pullrequestreview-6053676287>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/A3EVBO5HAUWQSCBLMPS6L4D522FE7AVCNFSNUABGKJSXA33TNF2G64TZHMYTINRVG4ZDQNRTG45US43TOVSTWNRVHE4TONBQGE2DTILWAI> > . > You are receiving this because you authored the thread.Message ID: > <R0Y00/Xbox2Windows/pull/2250/review/6053676287 ***@***.*** > com> >
upstream-sync closed this pull request 2026-11-25 09:04:00 +00:00
tedin7 commented 2026-11-25 09:04:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T08:21:21Z.

Review: COMMENTED


Re-review of head 060aaac43b0182fd062bb765970b2112db3d4ae2 (comment only, not an approval).

Previous findings

  • P1 (merge conflict in CMakeLists.txt): resolved. gh pr view reports MERGEABLE / CLEAN, and git merge-tree --write-tree origin/main HEAD returns a tree with no conflict.
  • P2 (no CI signal): resolved. gh pr checks: Linux Python checks, gfx1013 fixture assembly and Windows build+test all pass (the /O2 job and the chart publish step are skipped).
  • Nit (aliased ranges): resolved. tests/startup_image_gather_c_lz_check.py now covers the v[0:3] / v[0:2] overlap and destination v[252:255].
  • P2 (PR body): NOT resolved. The body still contains the unfilled template sections (## Change, ## Verification, ## Evidence and follow-up, ## Checklist) below the summary. The verification line is not tied to a commit or command line. It also still names tooling products in the AI-assistance line. Please fill in the sections with the exact commands, results and the current head SHA, and keep the AI-assistance note neutral.

New findings

  • P1: none.
  • P2: none beyond the body above (counted once).
  • No new issues in the merge commit: the registrations for gather and sample tests are preserved in CMakeLists.txt, tests/desktop_gpu.h and tests/offscreen_check.cpp.

Commands executed locally in the worktree

  • git diff --stat origin/main...HEAD: 10 files, 854 insertions, 9 deletions.
  • python3 -B tests/startup_image_gather_c_lz_check.py: passes.
  • python3 -B tests/startup_image_gather_lz_check.py: passes.
  • python3 -B tests/startup_image_sample_c_check.py: passes.
  • python3 tests/docs_links_check.py: passes (18 files, 428 links).
  • python3 tests/bidi_controls_check.py: passes (1536 files).
  • git diff --check origin/main...HEAD: clean.
  • Mutation 1: swapped u and v in the emitted GatherCmp call. The check exits 1.
  • Mutation 2: bypassed the red dmask:0x1 guard. The check fails (comparison gather accepted a form expected to report 'requires red dmask 0x1').
  • Worktree restored with git checkout -- . after each mutation (git status clean).
  • Windows WARP/GPU run: not run by me. The PR's Windows CI job passes on this head. A local Win2025 readback run is left to the final gate before Ready.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6054049404 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2250#pullrequestreview-6054049404). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T08:21:21Z. **Review:** COMMENTED --- Re-review of head `060aaac43b0182fd062bb765970b2112db3d4ae2` (comment only, not an approval). **Previous findings** - P1 (merge conflict in `CMakeLists.txt`): resolved. `gh pr view` reports `MERGEABLE` / `CLEAN`, and `git merge-tree --write-tree origin/main HEAD` returns a tree with no conflict. - P2 (no CI signal): resolved. `gh pr checks`: Linux Python checks, gfx1013 fixture assembly and Windows build+test all pass (the /O2 job and the chart publish step are skipped). - Nit (aliased ranges): resolved. `tests/startup_image_gather_c_lz_check.py` now covers the `v[0:3]` / `v[0:2]` overlap and destination `v[252:255]`. - P2 (PR body): NOT resolved. The body still contains the unfilled template sections (`## Change`, `## Verification`, `## Evidence and follow-up`, `## Checklist`) below the summary. The verification line is not tied to a commit or command line. It also still names tooling products in the AI-assistance line. Please fill in the sections with the exact commands, results and the current head SHA, and keep the AI-assistance note neutral. **New findings** - P1: none. - P2: none beyond the body above (counted once). - No new issues in the merge commit: the registrations for gather and sample tests are preserved in `CMakeLists.txt`, `tests/desktop_gpu.h` and `tests/offscreen_check.cpp`. **Commands executed locally in the worktree** - `git diff --stat origin/main...HEAD`: 10 files, 854 insertions, 9 deletions. - `python3 -B tests/startup_image_gather_c_lz_check.py`: passes. - `python3 -B tests/startup_image_gather_lz_check.py`: passes. - `python3 -B tests/startup_image_sample_c_check.py`: passes. - `python3 tests/docs_links_check.py`: passes (18 files, 428 links). - `python3 tests/bidi_controls_check.py`: passes (1536 files). - `git diff --check origin/main...HEAD`: clean. - Mutation 1: swapped `u` and `v` in the emitted `GatherCmp` call. The check exits 1. - Mutation 2: bypassed the red `dmask:0x1` guard. The check fails (`comparison gather accepted a form expected to report 'requires red dmask 0x1'`). - Worktree restored with `git checkout -- .` after each mutation (`git status` clean). - Windows WARP/GPU run: not run by me. The PR's Windows CI job passes on this head. A local Win2025 readback run is left to the final gate before Ready. AI-assisted; commands listed were executed locally.
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!2242
No description provided.