GPU-SPIRV-AS-DIAGNOSTICS: Preserve spirv-as diagnostics containing undecodable bytes #1839

Merged
delysidemanYT1 merged 1 commit from upstream-pr/1839 into main 2026-11-29 15:43:02 +00:00
delysidemanYT1 commented 2026-11-25 12:58:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by delysidemanYT1 on 2026-11-25T12:58:25Z.


Claimed in the coordination issue as: GPU-SPIRV-AS-DIAGNOSTICS
Claim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163027205

Use UTF-8 for external helper shader assembly and escape undecodable output bytes. A synthetic assembler emitting an invalid byte previously lost its diagnostic; the new regression test checks that the original message remains visible.

Targeted checks on Windows: python -m unittest discover -s tests -p test_run_gpu_tests_python_assembler.py and git diff --check. No game files. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5491781710 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1839). Originally posted by [delysidemanYT1](https://github.com/delysidemanYT1) on 2026-11-25T12:58:25Z. --- Claimed in the coordination issue as: GPU-SPIRV-AS-DIAGNOSTICS Claim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163027205 Use UTF-8 for external helper shader assembly and escape undecodable output bytes. A synthetic assembler emitting an invalid byte previously lost its diagnostic; the new regression test checks that the original message remains visible. Targeted checks on Windows: python -m unittest discover -s tests -p test_run_gpu_tests_python_assembler.py and git diff --check. No game files. AI-assisted (Codex).
GeorgiyDemo commented 2026-11-25 13:20:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-25T13:20:21Z.


Tested 65c673e3f on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main 384abe5b0 (GPU tooling; no GPU run):

  • python3 -I tests/test_run_gpu_tests_python_assembler.py: OK at this head; the same file on main errors 1 — the undecodable-byte diagnostic case is the new coverage.
  • Not run: a real spirv-as emitting invalid bytes; the regression uses a synthetic assembler. The default llvm-mc/spirv-as paths are unaffected by the change.

AI-assisted; synthetic fixtures only, no game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7163632678 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1839#issuecomment-7163632678). Originally posted by [GeorgiyDemo](https://github.com/GeorgiyDemo) on 2026-11-25T13:20:21Z. --- Tested `65c673e3f` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `384abe5b0` (GPU tooling; no GPU run): - `python3 -I tests/test_run_gpu_tests_python_assembler.py`: **OK** at this head; the same file on `main` errors **1** — the undecodable-byte diagnostic case is the new coverage. - Not run: a real `spirv-as` emitting invalid bytes; the regression uses a synthetic assembler. The default `llvm-mc`/`spirv-as` paths are unaffected by the change. AI-assisted; synthetic fixtures only, no game data.
DeadlyChirp commented 2026-11-25 15:37:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-25T15:37:46Z.


Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.

python -m pytest -q tests/test_run_gpu_tests_python_assembler.py:

  • PR: 11 passed. main: 10 passed. The new test passes on Windows.

(AI-assisted test run; output checked by hand.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7167136819 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1839#issuecomment-7167136819). Originally posted by [DeadlyChirp](https://github.com/DeadlyChirp) on 2026-11-25T15:37:46Z. --- Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main. `python -m pytest -q tests/test_run_gpu_tests_python_assembler.py`: - PR: 11 passed. main: 10 passed. The new test passes on Windows. (AI-assisted test run; output checked by hand.)
OreoFR commented 2026-11-28 21:54:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:54:59Z.


Verified by OreoFR

  • Base: main 4a54aedcb + PR head 65c673e3f
  • Test: python -I tests/test_run_gpu_tests_python_assembler.py
  • Red on main: 1 failure (byte ÿ replaced with U+FFFD)
  • Green with the PR: 11 OK
  • Verdict: READY
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246365683 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1839#issuecomment-7246365683). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:54:59Z. --- **Verified by OreoFR** - Base: main `4a54aedcb` + PR head `65c673e3f` - Test: `python -I tests/test_run_gpu_tests_python_assembler.py` - Red on main: 1 failure (byte ÿ replaced with U+FFFD) - Green with the PR: 11 OK - Verdict: READY - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-29 01:31:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:31:19Z.


Independent verification on Windows 11 (10.0.26200, x64) with 65c673e3fe merged onto origin/main (53b77df14f, 0 merge conflicts), tested under both Python 3.12.10 and Python 3.14.5:

  • Red (origin/main scripts/run_gpu_tests.py + #1839 tests/test_run_gpu_tests_python_assembler.py):
    • python -I -B tests/test_run_gpu_tests_python_assembler.py: Ran 11 tests, FAILED (failures=1) on both Python 3.12.10 and Python 3.14.5.
    • Under default Windows cp1252 (python -I without UTF-8 mode), an unassigned cp1252 byte on spirv-as stderr (b"diag \x81\x8d") is even worse on origin/main: subprocess._readerthread raises UnicodeDecodeError: 'charmap' codec can't decode byte 0x81, leaving p.stderr = None and crashing p.stderr.strip() with AttributeError.
  • Green (65c673e3fe merged onto origin/main):
    • python -I -B tests/test_run_gpu_tests_python_assembler.py: Ran 11 tests, OK on both Python 3.12.10 (2.15 s) and Python 3.14.5 (2.11 s).
    • With b"diag \x81\x8d" on stderr, spirv_as() now cleanly raises RuntimeError containing diag \x81\x8d with no _readerthread exception.
  • Hygiene: git diff --check, python -I -m compileall -q, and python -I scripts/check_no_game_data.py exited 0, and git merge-tree with #1966 is clean (0 conflicts).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248836254 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1839#issuecomment-7248836254). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T01:31:19Z. --- Independent verification on Windows 11 (`10.0.26200`, x64) with `65c673e3fe` merged onto `origin/main` (`53b77df14f`, `0` merge conflicts), tested under both `Python 3.12.10` and `Python 3.14.5`: - **Red (`origin/main` `scripts/run_gpu_tests.py` + `#1839` `tests/test_run_gpu_tests_python_assembler.py`)**: - `python -I -B tests/test_run_gpu_tests_python_assembler.py`: `Ran 11 tests`, `FAILED (failures=1)` on both `Python 3.12.10` and `Python 3.14.5`. - Under default Windows `cp1252` (`python -I` without UTF-8 mode), an unassigned `cp1252` byte on `spirv-as` stderr (`b"diag \x81\x8d"`) is even worse on `origin/main`: `subprocess._readerthread` raises `UnicodeDecodeError: 'charmap' codec can't decode byte 0x81`, leaving `p.stderr = None` and crashing `p.stderr.strip()` with `AttributeError`. - **Green (`65c673e3fe` merged onto `origin/main`)**: - `python -I -B tests/test_run_gpu_tests_python_assembler.py`: `Ran 11 tests`, `OK` on both `Python 3.12.10` (`2.15 s`) and `Python 3.14.5` (`2.11 s`). - With `b"diag \x81\x8d"` on stderr, `spirv_as()` now cleanly raises `RuntimeError` containing `diag \x81\x8d` with no `_readerthread` exception. - **Hygiene**: `git diff --check`, `python -I -m compileall -q`, and `python -I scripts/check_no_game_data.py` exited `0`, and `git merge-tree` with `#1966` is clean (`0` conflicts). AI-assisted.
MoonEyes commented 2026-11-29 15:43:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T15:43:04Z.


Merged. Tested by @OreoFR on head 65c673e3f (CPU only (python tool)): red: 1 failure (byte replaced by U+FFFD); green 11 OK. Correction: no CI check run or commit status exists for this head, so CI did not validate it. My earlier sentence about red jobs was wrong. Thanks @delysidemanYT1!

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7258310303 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1839#issuecomment-7258310303). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T15:43:04Z. --- Merged. Tested by @OreoFR on head 65c673e3f (CPU only (python tool)): red: 1 failure (byte replaced by U+FFFD); green 11 OK. Correction: no CI check run or commit status exists for this head, so CI did not validate it. My earlier sentence about red jobs was wrong. Thanks @delysidemanYT1! AI-assisted: yes
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
ProjectLeonida/mandy!1839
No description provided.