tooling: assess mesh lowering in PSO readiness #1104

Manually merged
github merged 2 commits from gh-pr/1104/head into gh-pr/1104/base 2026-11-26 22:41:53 +00:00
Owner

@⁠tedin7 on GitHub · 2026-11-24 01:04 UTC · original
tedin7:x2w-pso-readiness-mesh-stage → main · +92 −17 · 4 files · 2 commits · merged 2026-11-24 01:52 UTC

Change

Refs #259. Extend pso_readiness.py --llvm to disassemble matched mesh shaders with wave64 byte offsets and run mesh_entry_aot.lower. Report lowering rejection and disassembly failure with stage-specific diagnostics. A passing mesh probe with a present root signature leaves the pipeline in needs_pso_validation. This uses the mesh translator already on main and has no dependency on #1080.

Verification

Linux x64, Python 3.14.8, LLVM 19, commit 065d7662, baseline b9beb159.

Command Result
python3 -B tests/pso_readiness_check.py Passed. One mesh lowering pass, two lowering rejections, two disassembly failures. Also checks no-LLVM evidence, signature status and stage/hash reuse.
build-a-turno python3 -B tests/mesh_entry_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM.so.19.1 Passed.
python3 -B tests/docs_links_check.py Passed, 15 Markdown files and 243 links.
python3 -B tests/bidi_controls_check.py Passed, 922 tracked files.
git diff --check Passed.

Negative control with the new test and the baseline implementation, expected exit 1 and observed exit 1. The triangle reported stage_not_assessed and needs_evidence instead of passing the mesh probe.

git show b9beb159:tools/pso_readiness.py | python3 -B -c 'import runpy, sys, types
sys.path[:0] = ["tools", "tests"]
baseline = types.ModuleType("pso_readiness")
exec(sys.stdin.read(), baseline.__dict__)
sys.modules[baseline.__name__] = baseline
runpy.run_path("tests/pso_readiness_check.py", run_name="__main__")'

The CLI also passed a run with assembled gfx1013 bytes and the real LLVM library. The only pipeline reported mesh_lowering_passed, needs_pso_validation and a null blocker.

build-a-turno python3 -B -c 'import hashlib, json, subprocess, sys
from pathlib import Path
from tempfile import TemporaryDirectory
sys.path.insert(0, "tests")
from mesh_entry_check import binary
with TemporaryDirectory() as tmp:
    root = Path(tmp)
    llvm = "libLLVM.so.19.1"
    binary(root, "llvm-mc-19", "llvm-objcopy-19", llvm)
    digest = hashlib.sha256((root / "fixture.bin").read_bytes()).hexdigest()
    ref = dict(stage="mesh", sha256=digest)
    (root / "manifest.json").write_text(json.dumps(dict(shaders=[dict(ref, native_file="fixture.bin")])))
    (root / "pipelines.json").write_text(json.dumps(dict(pipelines=[dict(id="triangle", effective_root_signature="present", shaders=[ref])])))
    output = subprocess.check_output([sys.executable, "-B", "tools/pso_readiness.py", str(root / "manifest.json"), str(root / "pipelines.json"), "--llvm", llvm])
    row = json.loads(output)["pipelines"][0]
    assert (row["status"], row["shaders"]["mesh"]["status"], row["first_blocker"]) == ("needs_pso_validation", "mesh_lowering_passed", None), row
    print(output.decode(), end="")'

The wider LLVM 19 checks reproduced the same failures on the unchanged baseline:

  • build-a-turno python3 -B tests/pixel_aot_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM.so.19.1 exited 1 on the v_cvt_f16_i16_e32 immediate encoding.
  • build-a-turno env LLVM_LIB=libLLVM.so.19.1 LLVM_MC=llvm-mc-19 LLVM_OBJCOPY=llvm-objcopy-19 python3 -B tests/rdna2_tools_check.py ran 101 tests with two failures and one error. The same three tests failed on the baseline.
  • The initial local command used libLLVM-19.so.1; the installed library is libLLVM.so.19.1. CI uses LLVM 15.

Evidence and follow-up

The MIT-licensed triangle fixture comes from tests/mesh_entry_check.py. The report test replaces only the LLVM boundary and exercises the real lowerer. Its allocation negative control replaces the value written to m0 with zero. The probe uses synthetic geometry and a 128-thread triangle declaration, as described in the updated experiment. Actual bindings and PSO creation require separate validation. No GPU commands or readback were added. Local Windows tests require an x64 Windows host.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact commands and results for the checks.
  • I included a negative control for the new fixture.
  • I updated README and experiment documentation.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

**@⁠tedin7** on GitHub · 2026-11-24 01:04 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1104) `tedin7:x2w-pso-readiness-mesh-stage` → `main` · +92 −17 · 4 files · 2 commits · merged 2026-11-24 01:52 UTC ## Change Refs #259. Extend `pso_readiness.py --llvm` to disassemble matched mesh shaders with wave64 byte offsets and run `mesh_entry_aot.lower`. Report lowering rejection and disassembly failure with stage-specific diagnostics. A passing mesh probe with a present root signature leaves the pipeline in `needs_pso_validation`. This uses the mesh translator already on main and has no dependency on #1080. ## Verification Linux x64, Python 3.14.8, LLVM 19, commit `065d7662`, baseline `b9beb159`. | Command | Result | | --- | --- | | `python3 -B tests/pso_readiness_check.py` | Passed. One mesh lowering pass, two lowering rejections, two disassembly failures. Also checks no-LLVM evidence, signature status and stage/hash reuse. | | `build-a-turno python3 -B tests/mesh_entry_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM.so.19.1` | Passed. | | `python3 -B tests/docs_links_check.py` | Passed, 15 Markdown files and 243 links. | | `python3 -B tests/bidi_controls_check.py` | Passed, 922 tracked files. | | `git diff --check` | Passed. | Negative control with the new test and the baseline implementation, expected exit 1 and observed exit 1. The triangle reported `stage_not_assessed` and `needs_evidence` instead of passing the mesh probe. ```sh git show b9beb159:tools/pso_readiness.py | python3 -B -c 'import runpy, sys, types sys.path[:0] = ["tools", "tests"] baseline = types.ModuleType("pso_readiness") exec(sys.stdin.read(), baseline.__dict__) sys.modules[baseline.__name__] = baseline runpy.run_path("tests/pso_readiness_check.py", run_name="__main__")' ``` The CLI also passed a run with assembled gfx1013 bytes and the real LLVM library. The only pipeline reported `mesh_lowering_passed`, `needs_pso_validation` and a null blocker. ```sh build-a-turno python3 -B -c 'import hashlib, json, subprocess, sys from pathlib import Path from tempfile import TemporaryDirectory sys.path.insert(0, "tests") from mesh_entry_check import binary with TemporaryDirectory() as tmp: root = Path(tmp) llvm = "libLLVM.so.19.1" binary(root, "llvm-mc-19", "llvm-objcopy-19", llvm) digest = hashlib.sha256((root / "fixture.bin").read_bytes()).hexdigest() ref = dict(stage="mesh", sha256=digest) (root / "manifest.json").write_text(json.dumps(dict(shaders=[dict(ref, native_file="fixture.bin")]))) (root / "pipelines.json").write_text(json.dumps(dict(pipelines=[dict(id="triangle", effective_root_signature="present", shaders=[ref])]))) output = subprocess.check_output([sys.executable, "-B", "tools/pso_readiness.py", str(root / "manifest.json"), str(root / "pipelines.json"), "--llvm", llvm]) row = json.loads(output)["pipelines"][0] assert (row["status"], row["shaders"]["mesh"]["status"], row["first_blocker"]) == ("needs_pso_validation", "mesh_lowering_passed", None), row print(output.decode(), end="")' ``` The wider LLVM 19 checks reproduced the same failures on the unchanged baseline: - `build-a-turno python3 -B tests/pixel_aot_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM.so.19.1` exited 1 on the `v_cvt_f16_i16_e32` immediate encoding. - `build-a-turno env LLVM_LIB=libLLVM.so.19.1 LLVM_MC=llvm-mc-19 LLVM_OBJCOPY=llvm-objcopy-19 python3 -B tests/rdna2_tools_check.py` ran 101 tests with two failures and one error. The same three tests failed on the baseline. - The initial local command used `libLLVM-19.so.1`; the installed library is `libLLVM.so.19.1`. CI uses LLVM 15. ## Evidence and follow-up The MIT-licensed triangle fixture comes from `tests/mesh_entry_check.py`. The report test replaces only the LLVM boundary and exercises the real lowerer. Its allocation negative control replaces the value written to `m0` with zero. The probe uses synthetic geometry and a 128-thread triangle declaration, as described in the updated [experiment](docs/experiments.md#pipeline-readiness-from-shader-manifests). Actual bindings and PSO creation require separate validation. No GPU commands or readback were added. Local Windows tests require an x64 Windows host. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact commands and results for the checks. - [x] I included a negative control for the new fixture. - [x] I updated README and experiment documentation. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
A decoded instruction with an unsupported operand shape raised outside the handled exception types and aborted the whole report. The shader is now reported as mesh_lowering_rejected with a short reason.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:41:50 +00:00
github manually merged commit 01c992ae2f into gh-pr/1104/base 2026-11-26 22:41:53 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 01:04 UTC · original · edited 2026-11-24 01:08 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T01:08:48.196317Z 065d766 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 01:04 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1104#issuecomment-7118722505) · edited 2026-11-24 01:08 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"065d766258273319ff91b3c27afe0fe5cdfbf185","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T01:08:48.196317Z">2026-11-24T01:08:48.196317Z</relative-time> | `065d766` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
@ -36,0 +42,4 @@
try:
lower(instructions, [0x1003], (3, 1))
except (ValueError, KeyError) as exc:
return "mesh_lowering_rejected", str(exc)
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 01:08 UTC · original

P2 Badge Contain mesh lowerer exceptions within the shader assessment

When a referenced mesh shader contains the legal but unsupported instruction s_getpc_b64 s[0:1], the lowerer's scalar_op() raises IndexError at vals[0], which this handler does not catch. Prepending that instruction to the source-built triangle fixture and assembling/disassembling it with LLVM 20 on Linux reproduces an exit-1 traceback with no JSON output. Consequently, one out-of-profile mesh shader aborts the entire readiness report instead of receiving mesh_lowering_rejected, discarding results for unrelated pipelines. Contain these lowerer exceptions at the per-shader boundary, as the pixel scanner already does.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 01:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1104#discussion_r4674186892) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Contain mesh lowerer exceptions within the shader assessment** When a referenced mesh shader contains the legal but unsupported instruction `s_getpc_b64 s[0:1]`, the lowerer's `scalar_op()` raises `IndexError` at `vals[0]`, which this handler does not catch. Prepending that instruction to the source-built triangle fixture and assembling/disassembling it with LLVM 20 on Linux reproduces an exit-1 traceback with no JSON output. Consequently, one out-of-profile mesh shader aborts the entire readiness report instead of receiving `mesh_lowering_rejected`, discarding results for unrelated pipelines. Contain these lowerer exceptions at the per-shader boundary, as the pixel scanner already does. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 01:12 UTC · original

AI-assisted. Addressed the P2 finding in 01c992ae: unexpected exceptions from the mesh lowering probe (for example an IndexError from a scalar op with an unsupported operand shape) are now contained. The shader is reported as mesh_lowering_rejected with a short reason, the pipeline is blocked, and the report continues without a traceback.

Verification: python3 -B tests/pso_readiness_check.py passes with the new synthetic s_getpc_b64 s[0:1] case; with the previous tools/pso_readiness.py the same test fails with an IndexError. python3 -B tests/rdna2_tools_check.py OK.

**@⁠tedin7** on GitHub · 2026-11-24 01:12 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1104#issuecomment-7118874223) AI-assisted. Addressed the P2 finding in 01c992ae: unexpected exceptions from the mesh lowering probe (for example an IndexError from a scalar op with an unsupported operand shape) are now contained. The shader is reported as `mesh_lowering_rejected` with a short reason, the pipeline is `blocked`, and the report continues without a traceback. Verification: `python3 -B tests/pso_readiness_check.py` passes with the new synthetic `s_getpc_b64 s[0:1]` case; with the previous `tools/pso_readiness.py` the same test fails with an IndexError. `python3 -B tests/rdna2_tools_check.py` OK.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 01:08 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 065d766258

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 01:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1104#pullrequestreview-6032082150) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `065d766258` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
This discussion has been locked. Commenting is limited to contributors.
No description provided.