xshader, triage: harden the run-time sampler-heap fetch and the triage CLI #33

Manually merged
github merged 1 commit from gh-pr/33/head into gh-pr/33/base 2026-11-26 06:26:35 +00:00
Owner

@⁠NathansDomainSolutions on GitHub · 2026-11-24 05:51 UTC · original
NathansDomainSolutions:fix/heap-sampler-hardening → main · +23 −3 · 3 files · 1 commits · merged 2026-11-24 05:58 UTC

Small follow-ups to #31 and #29 found in a review pass. None of them change translation output.

xshader (hlsl.rs, from #31)

  • The new compute sampler-heap branch for s_load at a dynamic soffset now skips SGPRs that already hold a statically resolved Sym::SamplerOffset, which keeps their existing path. Today the two layouts don't overlap: compute_heap requires no resource base, while SamplerOffset needs the raster root-constant layout. This makes that explicit rather than depending on the branch order.
  • Adds a comment explaining that ({offset} >> 4) needs no base index: the guest sampler-heap pointer is the heap start, the same as on the static path.

triage (tools/triage_scarlett_shaders.py, from #29)

  • A .stencil request with no _rt<N> suffix is now recorded as a failed entry. Before, IndexError was raised inside the worker pool and aborted the whole run.
  • --limit rejects negative values. Before, --limit -1 silently dropped the last request.
  • Two new tests cover these cases.

Testing

  • python -m unittest tests.test_triage_scarlett_shaders: 7 pass. cargo test for shader-compiler: 63 pass.
  • Ran the main and patched xshader over 6,977 recorded ProjectScarlett requests. Exit codes and HLSL output are identical for all of them.

This PR was prepared with AI assistance (Claude Code) and reviewed before submission.

🤖 Generated with Claude Code

**@⁠NathansDomainSolutions** on GitHub · 2026-11-24 05:51 UTC · [original](https://github.com/brcly/TuxBox/pull/33) `NathansDomainSolutions:fix/heap-sampler-hardening` → `main` · +23 −3 · 3 files · 1 commits · merged 2026-11-24 05:58 UTC Small follow-ups to #31 and #29 found in a review pass. None of them change translation output. **xshader (`hlsl.rs`, from #31)** - The new compute sampler-heap branch for `s_load` at a dynamic soffset now skips SGPRs that already hold a statically resolved `Sym::SamplerOffset`, which keeps their existing path. Today the two layouts don't overlap: `compute_heap` requires no resource base, while `SamplerOffset` needs the raster root-constant layout. This makes that explicit rather than depending on the branch order. - Adds a comment explaining that `({offset} >> 4)` needs no base index: the guest sampler-heap pointer is the heap start, the same as on the static path. **triage (`tools/triage_scarlett_shaders.py`, from #29)** - A `.stencil` request with no `_rt<N>` suffix is now recorded as a `failed` entry. Before, `IndexError` was raised inside the worker pool and aborted the whole run. - `--limit` rejects negative values. Before, `--limit -1` silently dropped the last request. - Two new tests cover these cases. **Testing** - `python -m unittest tests.test_triage_scarlett_shaders`: 7 pass. `cargo test` for shader-compiler: 63 pass. - Ran the main and patched `xshader` over 6,977 recorded ProjectScarlett requests. Exit codes and HLSL output are identical for all of them. This PR was prepared with AI assistance (Claude Code) and reviewed before submission. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- s_load at a dynamic soffset: leave a statically resolved SamplerOffset to
  its own path instead of relying on the two layouts never overlapping, and
  note why `>> 4` needs no heap base.
- triage: a .stencil request without an _rt suffix is recorded as a failure
  instead of raising inside the worker pool; --limit rejects negative values.

No translation output changes over the recorded ProjectScarlett requests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:26:34 +00:00
github manually merged commit c4183164cf into gh-pr/33/base 2026-11-26 06:26:35 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.