tombox-xshader: count ds_read/ds_write b96 and b128 at their full size in ds_reach (follow-up to #257) #380

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

@⁠SchmashinPrunes on GitHub · 2026-11-25 14:42 UTC · original
SchmashinPrunes:lds-reach-b96-b128 → main · +20 −1 · 1 files · 1 commits · open

@⁠omonkeyz, this is a follow-up to #257. It fixes the ds_reach sizing I flagged in my #257 review. It does not close the gap from your follow-up comment, sub-version 5 containers whose ISA starts before 0x130. More on that below.

The fix

ds_reach in hlsl/lds64.rs gave ds_read_b96, ds_read_b128, ds_write_b96 and ds_write_b128 a 4-byte element, because none of those names contains 64, _b8 or _b16. Their real sizes are 12 and 16 bytes. Two places use ds_reach:

  • lds64_dwords refuses a shader with a 64-bit LDS atomic when a static LDS offset reaches past the declared LDS size. A 128-bit access was undercounted by 12 bytes, so for example ds_read_b128 at offset 0x1ff4 passed in a shader that declares 8 KiB.
  • The fixture test's static_reach, which decides which header dwords "fit" a shader, was short by the same amount for shaders whose highest access is a 96- or 128-bit one.

Now 96- and 128-bit accesses count at their full size. The other forms are unchanged.

The short-header sub-version 5 containers

I can't help with this part from here. Proving a location needs real console containers, and I don't have any. Your fixture test already prints the offsets that fit each fixture, per sub-version. For the 7 that fail, that list should show whether one location fits all of them, or whether the dword sits at a fixed distance before the ISA (the case scan_recovers_a_planted_dword_and_tells_a_fixed_offset_from_one_counted_back_from_the_isa checks for). The fixture test uses the corrected ds_reach, so rerun it on this branch.

Tests

  • New ds_reach_counts_the_whole_access: ds_read/ds_write b32, b64, b96 and b128 at offset 0x1ff0 must reach 0x1ff0 + 4, 8, 12 and 16 bytes. Each case first checks that the encoding decodes to the expected mnemonic.
  • Without the ds_reach change, the b96/b128 cases fail.

Results (Windows 11, WARP):

run result
tombox-xshader --lib 150 passed, 5 ignored, including the new test
without the ds_reach change the new test fails at the first wide form: ds_write_b96 at 0x1ff0 reaches 8180, want 8188
full tombox-xshader suite 34 suites ok, tests/exec.rs 189/189

The PR gate is clean.

🤖 Generated with Claude Code

**@⁠SchmashinPrunes** on GitHub · 2026-11-25 14:42 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/380) `SchmashinPrunes:lds-reach-b96-b128` → `main` · +20 −1 · 1 files · 1 commits · open @⁠omonkeyz, this is a follow-up to #257. It fixes the `ds_reach` sizing I flagged in my #257 review. It does **not** close the gap from your follow-up comment, sub-version 5 containers whose ISA starts before 0x130. More on that below. ### The fix `ds_reach` in `hlsl/lds64.rs` gave `ds_read_b96`, `ds_read_b128`, `ds_write_b96` and `ds_write_b128` a 4-byte element, because none of those names contains `64`, `_b8` or `_b16`. Their real sizes are 12 and 16 bytes. Two places use `ds_reach`: - `lds64_dwords` refuses a shader with a 64-bit LDS atomic when a static LDS offset reaches past the declared LDS size. A 128-bit access was undercounted by 12 bytes, so for example `ds_read_b128` at offset 0x1ff4 passed in a shader that declares 8 KiB. - The fixture test's `static_reach`, which decides which header dwords "fit" a shader, was short by the same amount for shaders whose highest access is a 96- or 128-bit one. Now 96- and 128-bit accesses count at their full size. The other forms are unchanged. ### The short-header sub-version 5 containers I can't help with this part from here. Proving a location needs real console containers, and I don't have any. Your fixture test already prints the offsets that fit each fixture, per sub-version. For the 7 that fail, that list should show whether one location fits all of them, or whether the dword sits at a fixed distance before the ISA (the case `scan_recovers_a_planted_dword_and_tells_a_fixed_offset_from_one_counted_back_from_the_isa` checks for). The fixture test uses the corrected `ds_reach`, so rerun it on this branch. ### Tests - New `ds_reach_counts_the_whole_access`: `ds_read`/`ds_write` b32, b64, b96 and b128 at offset 0x1ff0 must reach 0x1ff0 + 4, 8, 12 and 16 bytes. Each case first checks that the encoding decodes to the expected mnemonic. - Without the `ds_reach` change, the b96/b128 cases fail. **Results** (Windows 11, WARP): | run | result | |---|---| | `tombox-xshader --lib` | 150 passed, 5 ignored, including the new test | | without the `ds_reach` change | the new test fails at the first wide form: `ds_write_b96` at 0x1ff0 reaches 8180, want 8188 | | full `tombox-xshader` suite | 34 suites ok, `tests/exec.rs` 189/189 | The PR gate is clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ds_reach gave 96- and 128-bit DS accesses a 4-byte element, so the check
that static LDS offsets stay inside the declared LDS size (shaders with a
64-bit LDS atomic) undercounted their reach by 8 or 12 bytes, and the
fixture scan's static reach was short by the same amount.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:20:56 +00:00
This pull request can be merged automatically.
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/380/head:github-bot/gh-380'
git switch 'github-bot/gh-380'

Merge

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