compute: keep MIMG sampler index bit 4 out of the reserved-bit check #3146

Merged
Leyukaka merged 2 commits from upstream-pr/3146 into main 2026-11-27 21:02:29 +00:00
Leyukaka commented 2026-11-27 18:20:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-27T18:20:48Z.


Part of #2935. Target branch main.

Bug. MIMG word 1 holds SSAMP in bits 25:21. The direct path (image_io in src/gfx1013_direct_compute.inl) and the HLSL compute emitter (image in src/gfx1013_compute_native.cpp) treated bits 29:25 as reserved with i.b & 0x3e000000u. Any sample or gather whose sampler quad starts at s64 or above was therefore refused with "direct image opcode or descriptor modifiers" (or "unsupported image flags"). The sampler index itself is already decoded with five bits, ((i.b >> 21) & 31) * 4. The checks now test bits 29:26 (0x3c000000u).

Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, on main 80668b97 plus this commit.

  • native_sample_ssamp_hardware passed. The same image_sample_lz program runs with its sampler in s4..s7 and in s68..s71, and both match the CPU reference over 320 readback words. A third case sets bit 26 and stays refused.
  • native_sample_ssamp_warp skips (77), like native_gather_lod_cs_warp.
  • The native_gather*, startup_compute_gather* and native_direct_container tests pass, 15 in all, two of them WARP skips.
  • Mutation check, run by hand: restoring 0x3e000000u in image_io makes the s68 case fail with the old refusal. The test covers only the image_io copy. The HLSL emitter copy in gfx1013_compute_native.cpp, reached through the gfx1013-compute-wave32@ profile, received the same one-bit change and has no test of its own.

Measured on a local capture (counts and instruction shape only) with compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests, on main 80668b97.

  • Of 2,689 compute requests, 68 stopped first at this check with a sampler at s64 or above. 18 of them now reach the same refusal at a later image_store with a partial mask, which is unrelated.
  • Of the other 50, 1 compiles (403 to 404). The requests of one start-up run go from 416 to 417.
  • Of the remaining 49, 40 now stop at "unbound numeric SGPR", 5 at "direct resource-heap load requires the selected GPU slot and its view type", 3 at s_or_saveexec_b32 and 1 at s_bfm_b64.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5531290240 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3146). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-27T18:20:48Z. --- Part of #2935. Target branch `main`. **Bug.** MIMG word 1 holds SSAMP in bits 25:21. The direct path (`image_io` in `src/gfx1013_direct_compute.inl`) and the HLSL compute emitter (`image` in `src/gfx1013_compute_native.cpp`) treated bits 29:25 as reserved with `i.b & 0x3e000000u`. Any sample or gather whose sampler quad starts at s64 or above was therefore refused with "direct image opcode or descriptor modifiers" (or "unsupported image flags"). The sampler index itself is already decoded with five bits, `((i.b >> 21) & 31) * 4`. The checks now test bits 29:26 (`0x3c000000u`). **Tests.** The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, on `main` `80668b97` plus this commit. - `native_sample_ssamp_hardware` passed. The same `image_sample_lz` program runs with its sampler in s4..s7 and in s68..s71, and both match the CPU reference over 320 readback words. A third case sets bit 26 and stays refused. - `native_sample_ssamp_warp` skips (77), like `native_gather_lod_cs_warp`. - The `native_gather*`, `startup_compute_gather*` and `native_direct_container` tests pass, 15 in all, two of them WARP skips. - Mutation check, run by hand: restoring `0x3e000000u` in `image_io` makes the s68 case fail with the old refusal. The test covers only the `image_io` copy. The HLSL emitter copy in `gfx1013_compute_native.cpp`, reached through the `gfx1013-compute-wave32@` profile, received the same one-bit change and has no test of its own. **Measured on a local capture** (counts and instruction shape only) with `compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests`, on `main` `80668b97`. - Of 2,689 compute requests, 68 stopped first at this check with a sampler at s64 or above. 18 of them now reach the same refusal at a later `image_store` with a partial mask, which is unrelated. - Of the other 50, 1 compiles (403 to 404). The requests of one start-up run go from 416 to 417. - Of the remaining 49, 40 now stop at "unbound numeric SGPR", 5 at "direct resource-heap load requires the selected GPU slot and its view type", 3 at `s_or_saveexec_b32` and 1 at `s_bfm_b64`. AI-assisted.
tedin7 commented 2026-11-27 21:02:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T21:02:20Z.

Review: COMMENTED


Review of d719ab8e65 (updated with main). Comment only.

The MIMG reserved-bit mask for the second dword drops bit 25 (0x3e000000 to 0x3c000000) in both the direct frontend (gfx1013_direct_compute.inl) and the native analysis (gfx1013_compute_native.cpp), so the two stay in step. Bit 25 is the top bit of the 5-bit SSAMP field (bits 21-25), so a sampler in s64 and above was refused before. Bits 26-29 stay reserved, and the new check keeps a bit-26 case refused. Both test legs need a wave32 adapter and skip on our WARP host (77), so the readback for s4..s7 and s68..s71 rests on the RTX 5080 run in the description; the change itself is a one-bit mask in two mirrored places.

src/gfx1013_direct_compute.inl is also changed on cpp-migration; this merges cleanly there and the native sweep passes on that merge (comment below).

Commands: git diff origin/main...pull/3146/head (read), git merge-tree --write-tree origin/cpp-migration pull/3146/head, plus the Windows commands in the comment below.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6093326146 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3146#pullrequestreview-6093326146). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T21:02:20Z. **Review:** COMMENTED --- Review of d719ab8e6596d7d99b1a8fafa8be3f65f7409e4a (updated with main). Comment only. The MIMG reserved-bit mask for the second dword drops bit 25 (`0x3e000000` to `0x3c000000`) in both the direct frontend (`gfx1013_direct_compute.inl`) and the native analysis (`gfx1013_compute_native.cpp`), so the two stay in step. Bit 25 is the top bit of the 5-bit SSAMP field (bits 21-25), so a sampler in s64 and above was refused before. Bits 26-29 stay reserved, and the new check keeps a bit-26 case refused. Both test legs need a wave32 adapter and skip on our WARP host (77), so the readback for s4..s7 and s68..s71 rests on the RTX 5080 run in the description; the change itself is a one-bit mask in two mirrored places. `src/gfx1013_direct_compute.inl` is also changed on `cpp-migration`; this merges cleanly there and the native sweep passes on that merge (comment below). Commands: `git diff origin/main...pull/3146/head` (read), `git merge-tree --write-tree origin/cpp-migration pull/3146/head`, plus the Windows commands in the comment below. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-27 21:02:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T21:02:21Z.


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

  • dev: cmake --build --preset dev --target compile_dxil native_store_replay native_compute_ir_dump; ctest --preset dev -R <native sweep>: 100% tests passed out of 145 (84 passed, 61 skipped; native_sample_ssamp_warp and _hardware skip here, as they need a wave32 adapter)
  • release: same targets with --preset release; ctest --preset release -R <native sweep>: 100% tests passed out of 145 (84 passed, 61 skipped)
  • The same dev and release sweep on this head merged with cpp-migration (a0f67731): 100% tests passed out of 145 in both presets

<native sweep> = every native_* test except native_startup_request_cache_hardware, which fails on WARP-only hosts with or without this PR.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7228074906 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3146#issuecomment-7228074906). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T21:02:21Z. --- Windows Server 2025 verification of `d719ab8e6596d7d99b1a8fafa8be3f65f7409e4a` (D3D12 WARP, MSVC 14.44.35207): - dev: `cmake --build --preset dev --target compile_dxil native_store_replay native_compute_ir_dump`; `ctest --preset dev -R <native sweep>`: 100% tests passed out of 145 (84 passed, 61 skipped; `native_sample_ssamp_warp` and `_hardware` skip here, as they need a wave32 adapter) - release: same targets with `--preset release`; `ctest --preset release -R <native sweep>`: 100% tests passed out of 145 (84 passed, 61 skipped) - The same dev and release sweep on this head merged with `cpp-migration` (`a0f67731`): 100% tests passed out of 145 in both presets `<native sweep>` = every `native_*` test except `native_startup_request_cache_hardware`, which fails on WARP-only hosts with or without this PR. 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!3146
No description provided.