startup: read smpc comparison samplers in published compute manifests (#3075) #3083

Merged
Not-Saii merged 5 commits from upstream-pr/3083 into main 2026-11-27 20:09:12 +00:00
Not-Saii commented 2026-11-27 14:39:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-27T14:39:21Z.


Change

The stand-in reads the published translation of a slot 67 compute request from <key>.txt (load_compute_translation in src/startup_stubs/d3d12_compute_dispatch.inl). It refused every smpc line there with a comparison sampler. It now reads smpc <i> <w0> <w1> <w2> <w3> under the same index and whole-line checks as smp and smpl, through TranslatedSamplers::read_manifest_line. decode_statics already decodes the line to a comparison static sampler for the draw path. smpheap stays refused with a sampler from the sampler heap.

Fixes #3075. Part of #2935.

Scope. #3075 first described this as the in-process route (X2W_NATIVE_SHADERS). The refusal is in the reader of a published manifest, and that is what this changes:

  • Only tools/startup/gfx2hlsl.py writes smpc for a compute program today. Before this change the runtime refused that translation when it loaded the manifest, so a compute request with a comparison sampler could not be dispatched.
  • format_compute_runtime_manifest (src/direct_compute_cache.cpp) still returns no manifest for a comparison sampler, so compile_dxil publishes no compute smpc line.
  • translate_compute_natively is not changed. It reads no manifest lines and refuses every sampler.

Overlap. #3049, #3006 and #2981 also touch d3d12_compute_dispatch.inl. None of them changes the sampler lines of the reader. #3049 also edits tests/startup_compute_dispatch_texture_check.py and tests/startup_stream_consumer.cpp. Its hunks share no line with this change, but its edit of main() in the texture check is next to the one-line call added here, so whichever lands second may need a small rebase.

Verification

Commit cef30beb on main at e1ea515d. main has since moved to 2a4bbff5 (#3059), which touches none of these files.

.\tools\dev.ps1
cmake --build --preset dev --target startup_stream_consumer
ctest --preset dev --no-tests=error -R '^startup_compute_dispatch_texture_(warp|hardware)$' -V

Environment: Windows 11 build 26300.9974, Windows SDK 10.0.26100, DXC 1.9.2602.17, Debug build, D3D12 debug layer enabled.

Test Adapter, driver Result
startup_compute_dispatch_texture_hardware NVIDIA GeForce RTX 4090, 32.0.16.1088 PASS (18.81 s)
startup_compute_dispatch_texture_warp Microsoft Basic Render Driver, 10.0.26100.9818 PASS (7.72 s)

There was no capability skip. The new line, the same on both adapters:

compared input: an smpc point, clamp, LESS sampler passes at 144 of the 288 written words and all 320 words match the CPU model; the same program under GREATER matches its model (108 pass, 252 words differ from LESS); debug layer: enabled, no error message

Negative control. With src/startup_stubs/d3d12_compute_dispatch.inl put back to e1ea515d and the same target rebuilt, the same ctest command fails both tests in the new case, after the cases before it pass:

AssertionError: smpc LESS: x2w-draw compute e9f1d94c2215f572 Dispatch(3, 2, 2) refused: a comparison sampler

Also run: python -B tests/docs_links_check.py (77 Markdown files and 588 links checked, no error).

Not run: the rest of the ctest suite and the Linux Python checks.

Evidence and follow-up

Fixture. tests/startup_compute_dispatch_texture_check.py gains a compared case. It is source-built: case A of startup_gfx2hlsl_compute_check.py with image_sample_c_lz under a constant point, clamp, LESS sampler spliced in before the store.

  • The five new instructions were hand-encoded, not assembled by llvm-mc. The check asserts that the Python decoder reads them as written, and that the translation holds SampleCmpLevelZero and ends with smpc 0 0x8001012 0x0 0x0 0x0.
  • The consumer's new mode dispatch-sampled-depth binds a 2x1 R32_FLOAT texture with depths 1.0 and 2.5. The reference is the thread's z id (0.0 to 3.0) and u its x id, so the written words hold both outcomes.
  • All 320 words are compared with a CPU model of reference < texel.
  • In-test control: the same program with the manifest's function changed to GREATER must match the model of reference > texel. The two models differ at 252 words.
  • The older control in that file rewrote an smpl line as smpc and expected the refusal. This case replaces it. The smpheap refusal check stays.

Not measured. A bilinear comparison filter, a border address mode, a 2D array and the other six functions. The comparison is the desktop sampler's; console behaviour is not measured.

Docs. The note is docs/experiments/startup-compute-comparison-sampler.md. The older paragraph in docs/experiments.md that says smpc is refused now points to it.

Follow-up.

  • Static samplers on the in-process route (translate_compute_natively). This comes after #3049, which adds its texture inputs and keeps its sampler refusal.
  • smpc from format_compute_runtime_manifest, so the C++ compiler's published compute translations can carry a comparison sampler.
  • The sampler heap table (smpheap) for compute.

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.

AI-assisted.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5528435837 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3083). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-27T14:39:21Z. --- ## Change The stand-in reads the published translation of a slot 67 compute request from `<key>.txt` (`load_compute_translation` in `src/startup_stubs/d3d12_compute_dispatch.inl`). It refused every `smpc` line there with `a comparison sampler`. It now reads `smpc <i> <w0> <w1> <w2> <w3>` under the same index and whole-line checks as `smp` and `smpl`, through `TranslatedSamplers::read_manifest_line`. `decode_statics` already decodes the line to a comparison static sampler for the draw path. `smpheap` stays refused with `a sampler from the sampler heap`. Fixes #3075. Part of #2935. **Scope.** #3075 first described this as the in-process route (`X2W_NATIVE_SHADERS`). The refusal is in the reader of a published manifest, and that is what this changes: - Only `tools/startup/gfx2hlsl.py` writes `smpc` for a compute program today. Before this change the runtime refused that translation when it loaded the manifest, so a compute request with a comparison sampler could not be dispatched. - `format_compute_runtime_manifest` (`src/direct_compute_cache.cpp`) still returns no manifest for a comparison sampler, so `compile_dxil` publishes no compute `smpc` line. - `translate_compute_natively` is not changed. It reads no manifest lines and refuses every sampler. **Overlap.** #3049, #3006 and #2981 also touch `d3d12_compute_dispatch.inl`. None of them changes the sampler lines of the reader. #3049 also edits `tests/startup_compute_dispatch_texture_check.py` and `tests/startup_stream_consumer.cpp`. Its hunks share no line with this change, but its edit of `main()` in the texture check is next to the one-line call added here, so whichever lands second may need a small rebase. ## Verification Commit `cef30beb` on `main` at `e1ea515d`. `main` has since moved to `2a4bbff5` (#3059), which touches none of these files. ```powershell .\tools\dev.ps1 cmake --build --preset dev --target startup_stream_consumer ctest --preset dev --no-tests=error -R '^startup_compute_dispatch_texture_(warp|hardware)$' -V ``` Environment: Windows 11 build 26300.9974, Windows SDK 10.0.26100, DXC 1.9.2602.17, Debug build, D3D12 debug layer enabled. | Test | Adapter, driver | Result | |---|---|---| | `startup_compute_dispatch_texture_hardware` | NVIDIA GeForce RTX 4090, 32.0.16.1088 | PASS (18.81 s) | | `startup_compute_dispatch_texture_warp` | Microsoft Basic Render Driver, 10.0.26100.9818 | PASS (7.72 s) | There was no capability skip. The new line, the same on both adapters: ``` compared input: an smpc point, clamp, LESS sampler passes at 144 of the 288 written words and all 320 words match the CPU model; the same program under GREATER matches its model (108 pass, 252 words differ from LESS); debug layer: enabled, no error message ``` **Negative control.** With `src/startup_stubs/d3d12_compute_dispatch.inl` put back to `e1ea515d` and the same target rebuilt, the same `ctest` command fails both tests in the new case, after the cases before it pass: ``` AssertionError: smpc LESS: x2w-draw compute e9f1d94c2215f572 Dispatch(3, 2, 2) refused: a comparison sampler ``` Also run: `python -B tests/docs_links_check.py` (77 Markdown files and 588 links checked, no error). Not run: the rest of the `ctest` suite and the Linux Python checks. ## Evidence and follow-up **Fixture.** `tests/startup_compute_dispatch_texture_check.py` gains a compared case. It is source-built: case A of `startup_gfx2hlsl_compute_check.py` with `image_sample_c_lz` under a constant point, clamp, LESS sampler spliced in before the store. - The five new instructions were hand-encoded, not assembled by llvm-mc. The check asserts that the Python decoder reads them as written, and that the translation holds `SampleCmpLevelZero` and ends with `smpc 0 0x8001012 0x0 0x0 0x0`. - The consumer's new mode `dispatch-sampled-depth` binds a 2x1 `R32_FLOAT` texture with depths 1.0 and 2.5. The reference is the thread's z id (0.0 to 3.0) and u its x id, so the written words hold both outcomes. - All 320 words are compared with a CPU model of `reference < texel`. - In-test control: the same program with the manifest's function changed to GREATER must match the model of `reference > texel`. The two models differ at 252 words. - The older control in that file rewrote an `smpl` line as `smpc` and expected the refusal. This case replaces it. The `smpheap` refusal check stays. **Not measured.** A bilinear comparison filter, a border address mode, a 2D array and the other six functions. The comparison is the desktop sampler's; console behaviour is not measured. **Docs.** The note is `docs/experiments/startup-compute-comparison-sampler.md`. The older paragraph in `docs/experiments.md` that says `smpc` is refused now points to it. **Follow-up.** - Static samplers on the in-process route (`translate_compute_natively`). This comes after #3049, which adds its texture inputs and keeps its sampler refusal. - `smpc` from `format_compute_runtime_manifest`, so the C++ compiler's published compute translations can carry a comparison sampler. - The sampler heap table (`smpheap`) for compute. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
JohnConnorNPC commented 2026-11-27 17:17:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-27T17:17:07Z.


Read through this and checked what can be checked off Windows.

  • On current main (63a30dc1) the merge is clean, and the related Linux checks pass:
    • startup_gfx2hlsl_compute_check, startup_image_sample_c_check, startup_compute_translate_check
    • startup_compute_request_offline_check, docs links, bidi
  • The six hand-encoded words match llvm-mc 19 for gfx1013.
  • The scope statements hold: format_compute_runtime_manifest still returns no manifest for a comparison sampler,
    and translate_compute_natively still refuses samplers.
  • It also merges cleanly with #3049 today.

One thing to fix: docs/experiments.md still says, in the "Static samplers with a LOD clamp" section, that smpc
is "still refused, as "a comparison sampler"". The next paragraph says "The smpc and smpheap lines refuse with
their reasons". This PR removes both the refusal and that control. Could those two sentences drop smpc and keep
the pointer to the new note?

Two smaller notes, no change needed for this PR:

  • The case can't tell point from linear comparison filtering, or clamp from mirror in U. u is 0 or 1 on a 2-texel
    row, so both settings give the same 320 words. A u of 0.75 would separate point from linear, if you want the
    printed "point, clamp" to be measured.
  • A malformed smpc line is now refused as "a sampler that is not a plain static one". A comparison-specific reason
    might read better in triage.

The PR CI's pr preset doesn't run startup_compute_dispatch_texture_*, so the Windows result here is from your run.

This comment was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7224235042 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3083#issuecomment-7224235042). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-27T17:17:07Z. --- Read through this and checked what can be checked off Windows. - On current `main` (63a30dc1) the merge is clean, and the related Linux checks pass: - `startup_gfx2hlsl_compute_check`, `startup_image_sample_c_check`, `startup_compute_translate_check` - `startup_compute_request_offline_check`, docs links, bidi - The six hand-encoded words match `llvm-mc` 19 for gfx1013. - The scope statements hold: `format_compute_runtime_manifest` still returns no manifest for a comparison sampler, and `translate_compute_natively` still refuses samplers. - It also merges cleanly with #3049 today. One thing to fix: `docs/experiments.md` still says, in the "Static samplers with a LOD clamp" section, that `smpc` is "still refused, as "a comparison sampler"". The next paragraph says "The `smpc` and `smpheap` lines refuse with their reasons". This PR removes both the refusal and that control. Could those two sentences drop `smpc` and keep the pointer to the new note? Two smaller notes, no change needed for this PR: - The case can't tell point from linear comparison filtering, or clamp from mirror in U. u is 0 or 1 on a 2-texel row, so both settings give the same 320 words. A u of 0.75 would separate point from linear, if you want the printed "point, clamp" to be measured. - A malformed `smpc` line is now refused as "a sampler that is not a plain static one". A comparison-specific reason might read better in triage. The PR CI's `pr` preset doesn't run `startup_compute_dispatch_texture_*`, so the Windows result here is from your run. This comment was AI-assisted.
Not-Saii commented 2026-11-27 18:19:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-27T18:19:16Z.


Fixed in 73f3cad5: both sentences in that section now name smpheap only, and the first keeps the pointer to the new note.

On the two notes:

  • Agreed that the case does not separate point from linear or clamp from mirror. The note lists the bilinear filter and the other address modes under "Not measured"; the printed "point, clamp" is the manifest's setting. A u of 0.75 is a good follow-up.
  • The reason for a malformed smpc line is left as it is here, to keep the diff to the one refusal.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7225365748 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3083#issuecomment-7225365748). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-27T18:19:16Z. --- Fixed in 73f3cad5: both sentences in that section now name `smpheap` only, and the first keeps the pointer to the new note. On the two notes: - Agreed that the case does not separate point from linear or clamp from mirror. The note lists the bilinear filter and the other address modes under "Not measured"; the printed "point, clamp" is the manifest's setting. A u of 0.75 is a good follow-up. - The reason for a malformed `smpc` line is left as it is here, to keep the diff to the one refusal. AI-assisted.
tedin7 commented 2026-11-27 18:19:31 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T18:19:31Z.

Review: COMMENTED


Review of 0517c12334 (the change from cef30beb, updated with main; the PR's own diff is unchanged). Comment only.

The reader now parses smpc <i> <w0> <w1> <w2> <w3> with the same whole-line and index checks as smp and smpl and hands it to TranslatedSamplers::read_manifest_line; smpheap stays refused. The texture check draws with a comparison sampler on WARP and compares against a CPU reference. The change does not touch the native compiler (compile_dxil, direct_compute_cache.cpp) or translate_compute_natively, as the description says. As noted there, #3049 edits a neighbouring line of the texture check; whichever lands second needs a small rebase.

Windows results are in the comment below.

Commands: git diff origin/main...pull/3083/head (read), plus the Windows commands listed in the comment.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6092020052 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3083#pullrequestreview-6092020052). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T18:19:31Z. **Review:** COMMENTED --- Review of 0517c1233403a54e26796a5669deddc10af92ac1 (the change from cef30beb, updated with main; the PR's own diff is unchanged). Comment only. The reader now parses `smpc <i> <w0> <w1> <w2> <w3>` with the same whole-line and index checks as `smp` and `smpl` and hands it to `TranslatedSamplers::read_manifest_line`; `smpheap` stays refused. The texture check draws with a comparison sampler on WARP and compares against a CPU reference. The change does not touch the native compiler (`compile_dxil`, `direct_compute_cache.cpp`) or `translate_compute_natively`, as the description says. As noted there, #3049 edits a neighbouring line of the texture check; whichever lands second needs a small rebase. Windows results are in the comment below. Commands: `git diff origin/main...pull/3083/head` (read), plus the Windows commands listed in the comment. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-27 18:19:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T18:19:32Z.


Windows Server 2025 verification of 0517c1233403a54e26796a5669deddc10af92ac1 (D3D12 WARP, MSVC 14.44.35207):

  • dev: cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_stream_consumer compile_dxil; ctest --preset dev -R '^startup_(compute_dispatch|stream)': 100% tests passed out of 38 (36 passed, 2 capability skips), including startup_compute_dispatch_texture_warp and _hardware
  • release: same targets with --preset release; ctest --preset release -R '^startup_(compute_dispatch|stream)': 100% tests passed out of 38 (36 passed, 2 skipped)

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7225370187 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3083#issuecomment-7225370187). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T18:19:32Z. --- Windows Server 2025 verification of `0517c1233403a54e26796a5669deddc10af92ac1` (D3D12 WARP, MSVC 14.44.35207): - dev: `cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_stream_consumer compile_dxil`; `ctest --preset dev -R '^startup_(compute_dispatch|stream)'`: 100% tests passed out of 38 (36 passed, 2 capability skips), including `startup_compute_dispatch_texture_warp` and `_hardware` - release: same targets with `--preset release`; `ctest --preset release -R '^startup_(compute_dispatch|stream)'`: 100% tests passed out of 38 (36 passed, 2 skipped) AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-27 20:08:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T20:08:54Z.


Windows Server 2025 re-verification of 00682b60f32f2068754e123cb0fcbf9b18196023 (the same change, updated with main again; D3D12 WARP, MSVC 14.44.35207):

  • dev: cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_stream_consumer compile_dxil; ctest --preset dev -R '^startup_(compute_dispatch|stream)': 100% tests passed out of 38 (36 passed, 2 capability skips), including startup_compute_dispatch_texture_warp and _hardware
  • release: same targets with --preset release; ctest --preset release -R '^startup_(compute_dispatch|stream)': 100% tests passed out of 38 (36 passed, 2 skipped)

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7227221181 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3083#issuecomment-7227221181). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T20:08:54Z. --- Windows Server 2025 re-verification of `00682b60f32f2068754e123cb0fcbf9b18196023` (the same change, updated with main again; D3D12 WARP, MSVC 14.44.35207): - dev: `cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_stream_consumer compile_dxil`; `ctest --preset dev -R '^startup_(compute_dispatch|stream)'`: 100% tests passed out of 38 (36 passed, 2 capability skips), including `startup_compute_dispatch_texture_warp` and `_hardware` - release: same targets with `--preset release`; `ctest --preset release -R '^startup_(compute_dispatch|stream)'`: 100% tests passed out of 38 (36 passed, 2 skipped) 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!3083
No description provided.