Skip to content

shader: trace guarded high words in scalar memory addresses - #79

Merged
simnJS merged 1 commit into
MiamiGame:mainfrom
AliceWood:shader/trace-address-high-half
Nov 25, 2026
Merged

simnJS merged 1 commit into
MiamiGame:mainfrom
AliceWood:shader/trace-address-high-half

Conversation

@AliceWood

@AliceWood AliceWood commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What and why

A compute shader writes a table pointer's upper word inside an EXEC guard and reads the pointer after a control-flow join. The path that skips the write cannot supply the pointer to this access. The resource tracer now asks its existing wave-path analysis whether exactly one incoming edge can reach the access. If it can, the tracer follows the value written on that edge and checks it against the address base. An ambiguous guard and a proven but incorrect upper word are both refused.

Fixes the single compute-program high-half case tracked in #56. The broader tracker stays open.
Depends on: none.

Area

xtp-shader scalar memory address tracking in resource.rs and a synthetic test module.

Tests

  • cargo xtask pr-check passes on my machine
  • New or changed behaviour has tests that need no game files.
  • Ran on a title: offline survey of the local shader pack using shader-survey --host-lanes 32-32 --validate --jobs 12 with the Windows SDK validator. Gameplay was outside this comparison.
Same 26,698 programs Base 458cd45 Head e0ae94d
Translated 25,813 25,814
Refused 885 884
DXIL validator accepted 25,742 25,743
DXIL validator rejected 71 71

One compute program gained. Zero translations lost, zero previous translation hashes changed, and all other programs kept their previous outcomes and validation results.

The new synthetic shader reproduced the original refusal on the base commit. On the PR head it translates and passes DXIL validation. Two negative controls check the value assigned on the proven edge and an access that can bypass that assignment. The WARP dispatch expects three active threads to write 19 and a fourth to leave its word untouched.

cargo test --release --locked -p xtp-shader --lib resource:: passed all 60 tests. Local WARP reports shader model 6.2 and skipped dispatch. On the GitHub Windows runner the synthetic DXIL validated and the WARP dispatch produced the expected four words. Both tests passed and the log contains neither skip marker. Windows workspace test

On e0ae94d, cargo xtask pr-check --base origin/main passed formatting, both Clippy configurations, asset policy and conventions. The workspace test step stopped at precook_fills_the_cache_once_for_every_build_of_the_translator and precook_keeps_pipelines_across_translation_keys. I reran cargo test --locked -p xtp --test precook on clean 458cd45 with the same hardware settings and reproduced both failures. This Windows 10 D3D12 runtime reports shader model 6.5 on the RTX 4080, and those tests require 6.6.

Provenance

  • I wrote all of this change myself for XTP, or it only moves code already in XTP.
  • Some of it comes from elsewhere.

AI assistance: OpenAI Codex wrote the change and hand-encoded synthetic tests for XTP, ran the comparisons, and reviewed the diff. It read the issue and maintainer discussion, the XTP resource tracer, existing XTP shader tests, and the project contribution and shader analysis docs. It used a private local trace to identify the control-flow relationship. The counts in the table were measured independently. No personal human review is claimed.

Checklist

  • No game data, keys, console SDK code or headers, and nothing that circumvents DRM.
  • No code copied from xcl or AnyPS5.
  • I agree to license this contribution under GPL-3.0-or-later.
  • Title and commit follow <area>: <summary>, one topic, under 400 changed lines.
  • Documentation checked. Public commands and configuration are unchanged.

@github-actions github-actions Bot added area/shader touches crates/xtp-shader size/M 100 to 399 changed lines labels Nov 25, 2026
@AliceWood
AliceWood marked this pull request as ready for review November 25, 2026 18:31

@simnJS simnJS left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Checked statically: the edge value is used only when only_edge proves a single forward edge the wave takes, and address() still validates it, so nothing is assumed. This can't drop an address that translated before. The hand-encoded words decode as commented, and both negative controls still refuse. CI is green. Approving.

@simnJS
simnJS merged commit 9b822f5 into MiamiGame:main Nov 25, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/shader touches crates/xtp-shader size/M 100 to 399 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants