check.py, run_gpu_tests.py: exact-word pixel tests accept KosmicKrisp's canonical NaN (TEST-KOSMICKRISP-CANONICAL-NAN) #2110

Closed
Tauwni wants to merge 1 commit from upstream-pr/2110 into main
Tauwni commented 2026-11-25 21:07:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-25T21:07:09Z.


Claimed in the coordination issue as: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7174641023

What and why

KosmicKrisp (Mesa 26.3.1) writes any f32 NaN to an RGBA32F attachment as 0x7fc00000. That is the measured row in docs/testing.md, and until now only ps_nan_payload allowed it. So ps_cndmask_sign_mods and ps_valu16_mad_sel, which expect non-canonical NaN words (0xff800001, 0x7f800001, 0xffffffff), failed every pixel on KosmicKrisp while passing on MoltenVK and llvmpipe (the finding in #1608).

The same rule now covers every exact-word pixel test, in check.py and in run_gpu_tests.py (check_pixel_const): the canonical word is accepted only in a channel that expects an f32 NaN, and only when vk_harness reports driver: KosmicKrisp. Finite channels and other drivers stay exact. The Known problems row names the two fixtures.

Tested

Apple M3, macOS 26.5.1, test programs built from this branch:

ps_cndmask_sign_mods ps_valu16_mad_sel ps_nan_payload
MoltenVK 1.4.2 PASS, exact PASS, exact PASS
KosmicKrisp (Mesa 26.3.1) FAIL on main, PASS ("exact but for KosmicKrisp's canonical NaN") same PASS
llvmpipe (Mesa 26.3.1) PASS, exact PASS, exact PASS
  • Full run_gpu_tests.py on all three: no new failure. KosmicKrisp's remaining ones are cs_bvh / cs_bvh32 (#1212) and cs_imgatomic_ext (#1518).
  • check.py (with #1444 applied locally so build.py runs): the same two pass on KosmicKrisp.
  • New unit tests in tests/test_shader_checks.py (KosmicKrispCanonicalNaN): canonical NaN accepted on KosmicKrisp only, only that word, only in a NaN channel.
  • Not covered: cs_fmt_all on KosmicKrisp. Its two mismatches (word 293, an f16 sNaN stored quiet, and word 312, an 11/11/10 float with a changed finite G) aren't this canonicalization, so they stay a finding.

GPUs tested: Apple M3 (10-core GPU) with MoltenVK 1.4.2, KosmicKrisp (Mesa 26.3.1) and llvmpipe (Mesa 26.3.1), macOS 26.5.1

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • No translator rule.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5499188290 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2110). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-25T21:07:09Z. --- Claimed in the coordination issue as: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7174641023 ### What and why KosmicKrisp (Mesa 26.3.1) writes any f32 NaN to an RGBA32F attachment as `0x7fc00000`. That is the measured row in `docs/testing.md`, and until now only `ps_nan_payload` allowed it. So `ps_cndmask_sign_mods` and `ps_valu16_mad_sel`, which expect non-canonical NaN words (`0xff800001`, `0x7f800001`, `0xffffffff`), failed every pixel on KosmicKrisp while passing on MoltenVK and llvmpipe (the finding in #1608). The same rule now covers every exact-word pixel test, in `check.py` and in `run_gpu_tests.py` (`check_pixel_const`): the canonical word is accepted only in a channel that expects an f32 NaN, and only when `vk_harness` reports `driver: KosmicKrisp`. Finite channels and other drivers stay exact. The Known problems row names the two fixtures. ### Tested Apple M3, macOS 26.5.1, test programs built from this branch: | | `ps_cndmask_sign_mods` | `ps_valu16_mad_sel` | `ps_nan_payload` | |---|---|---|---| | MoltenVK 1.4.2 | PASS, exact | PASS, exact | PASS | | KosmicKrisp (Mesa 26.3.1) | FAIL on `main`, PASS ("exact but for KosmicKrisp's canonical NaN") | same | PASS | | llvmpipe (Mesa 26.3.1) | PASS, exact | PASS, exact | PASS | - Full `run_gpu_tests.py` on all three: no new failure. KosmicKrisp's remaining ones are `cs_bvh` / `cs_bvh32` (#1212) and `cs_imgatomic_ext` (#1518). - `check.py` (with #1444 applied locally so `build.py` runs): the same two pass on KosmicKrisp. - New unit tests in `tests/test_shader_checks.py` (`KosmicKrispCanonicalNaN`): canonical NaN accepted on KosmicKrisp only, only that word, only in a NaN channel. - Not covered: `cs_fmt_all` on KosmicKrisp. Its two mismatches (word 293, an f16 sNaN stored quiet, and word 312, an 11/11/10 float with a changed finite G) aren't this canonicalization, so they stay a finding. GPUs tested: Apple M3 (10-core GPU) with MoltenVK 1.4.2, KosmicKrisp (Mesa 26.3.1) and llvmpipe (Mesa 26.3.1), macOS 26.5.1 AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [x] No translator rule. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Tauwni commented 2026-11-26 10:56:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T10:56:16Z.


Closing this one. Since I opened it, I found the cause: emit_src_component in Mesa's src/kosmickrisp/compiler/msl_type_inference.c prints every float-typed NaN constant as (NAN). It is a driver bug, so making the exact-word checks accept the canonical word on KosmicKrisp would hide it. That also goes against the "do not weaken the expected words" rule of the cs_bvh row.

#2229 documents these fixtures (ps_cndmask_sign_mods, ps_valu16_mad_sel, and cs_fmt_all word 293) as expected failures on KosmicKrisp, the same way the cs_bvh row does. A KosmicKrisp 26.3.1 built locally with that line printing the NaN's bits instead passes all of them.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7190037965 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2110#issuecomment-7190037965). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-26T10:56:16Z. --- Closing this one. Since I opened it, I found the cause: `emit_src_component` in Mesa's `src/kosmickrisp/compiler/msl_type_inference.c` prints every float-typed NaN constant as `(NAN)`. It is a driver bug, so making the exact-word checks accept the canonical word on KosmicKrisp would hide it. That also goes against the "do not weaken the expected words" rule of the `cs_bvh` row. #2229 documents these fixtures (`ps_cndmask_sign_mods`, `ps_valu16_mad_sel`, and `cs_fmt_all` word 293) as expected failures on KosmicKrisp, the same way the `cs_bvh` row does. A KosmicKrisp 26.3.1 built locally with that line printing the NaN's bits instead passes all of them. AI-assisted (Claude Code).

Pull request closed

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!2110
No description provided.