shaders: allow two ulps of OpExp2 in the denorm fixture (the macOS GPU job's last red) #2635

Closed
fiestorra wants to merge 1 commit from upstream-pr/2635 into main
fiestorra commented 2026-11-29 20:33:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T20:33:04Z.


Draft on purpose: this changes a test's contract, and it cannot be verified on the hardware it is for from here. Opening it so the change is reviewable as code rather than as a
paragraph in a thread, and so whoever has a MoltenVK device can run it.

What and why

The macos GPU job fails on ps_exp_f32_denorm_rt on the runner's Apple Paravirtual device: it returns 0x00FFFFFE for 0x01000000 - two ulps low on 2^-125 - and the fixture
demands the exact bit pattern (runtime/test/shaders/check.py, the exp_f32_denorm_problem case).

Vulkan gives OpExp2 no bit-exactness requirement, so that assertion tests the device's math library rather than the translation the suite exists to check.

What it changes

A two-ulp tolerance confined to the channel that comes out of OpExp2:

  • zero stays exact, so a flush-to-zero, or a zero where a non-zero was expected, is still caught;
  • the two channels the shader computes itself (the exponent and the column value) stay bit-exact;
  • want == 0 requires got == 0.

runtime/test/shaders/check.py only, +15/-1.

Tested

The logic, with synthetic pixels through the patched checker: exact accepted, 2 ulps low accepted, 3 ulps low rejected, a wrong exponent channel rejected, a wrong
column channel rejected. Plus python3 -m pytest tests/test_runtime_paths.py -q -> 5 passed, and py_compile clean.

NOT tested

On a MoltenVK device. This machine is Windows with an RTX 4090, so the actual runner behaviour is unverified by me. The patch is offered as the shape of the fix, and the
person who can run that job is the one who can close it. If a maintainer decides the fixture should keep demanding bit-exactness and the job should stay red on that runner, that is
a legitimate answer and this can be closed.

GPUs tested: RTX 4090 (driver 32.0.16.2124) for the logic only; no MoltenVK.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5554827325 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2635). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-29T20:33:04Z. --- **Draft on purpose: this changes a test's contract, and it cannot be verified on the hardware it is for from here.** Opening it so the change is reviewable as code rather than as a paragraph in a thread, and so whoever has a MoltenVK device can run it. ### What and why The `macos` GPU job fails on `ps_exp_f32_denorm_rt` on the runner's Apple Paravirtual device: it returns `0x00FFFFFE` for `0x01000000` - two ulps low on 2^-125 - and the fixture demands the exact bit pattern (`runtime/test/shaders/check.py`, the `exp_f32_denorm_problem` case). Vulkan gives `OpExp2` no bit-exactness requirement, so that assertion tests the device's math library rather than the translation the suite exists to check. ### What it changes A two-ulp tolerance confined to the channel that comes out of `OpExp2`: - zero stays exact, so a flush-to-zero, or a zero where a non-zero was expected, is still caught; - the two channels the shader computes itself (the exponent and the column value) stay bit-exact; - `want == 0` requires `got == 0`. `runtime/test/shaders/check.py` only, +15/-1. ### Tested The logic, with synthetic pixels through the patched checker: exact **accepted**, 2 ulps low **accepted**, 3 ulps low **rejected**, a wrong exponent channel **rejected**, a wrong column channel **rejected**. Plus `python3 -m pytest tests/test_runtime_paths.py -q` -> 5 passed, and `py_compile` clean. ### NOT tested **On a MoltenVK device.** This machine is Windows with an RTX 4090, so the actual runner behaviour is unverified by me. The patch is offered as the shape of the fix, and the person who can run that job is the one who can close it. If a maintainer decides the fixture should keep demanding bit-exactness and the job should stay red on that runner, that is a legitimate answer and this can be closed. GPUs tested: RTX 4090 (driver 32.0.16.2124) for the logic only; no MoltenVK. Written with an AI assistant.
lorentsob commented 2026-11-29 20:35:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lorentsob on 2026-11-29T20:35:41Z.


Real-hardware data point for this draft, posted in #2570 before it was opened: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7261438658

In short: on an Apple M5 Max (macOS 27.2.1, MoltenVK 1.4.2), main dd87aa405 passes ps_exp_f32_denorm and ps_exp_f32_denorm_rt bit-exact, 3 of 3. The two-ulp OpExp2 result therefore looks specific to the runner's Apple Paravirtual device, and on real Apple GPUs this tolerance would not be exercised. I read the patch but did not run the patched checker, so the runner remains the one real check.

AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262205026 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2635#issuecomment-7262205026). Originally posted by [lorentsob](https://github.com/lorentsob) on 2026-11-29T20:35:41Z. --- Real-hardware data point for this draft, posted in #2570 before it was opened: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7261438658 In short: on an Apple M5 Max (macOS 27.2.1, MoltenVK 1.4.2), `main` `dd87aa405` passes `ps_exp_f32_denorm` and `ps_exp_f32_denorm_rt` bit-exact, 3 of 3. The two-ulp `OpExp2` result therefore looks specific to the runner's Apple Paravirtual device, and on real Apple GPUs this tolerance would not be exercised. I read the patch but did not run the patched checker, so the runner remains the one real check. AI-assisted: yes.
fiestorra commented 2026-11-29 20:37:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T20:37:35Z.


This draft is the wrong shape, and lorentsob's data point is why. Closing it rather than leaving it in the queue.

What the hardware says: on an Apple M5 Max (macOS 27.2.1, MoltenVK 1.4.2), main dd87aa405 passes ps_exp_f32_denorm and the _rt case. So the fixture is not too strict for
Apple GPUs - it is exact there.

What that means for my patch: a blanket two-ulp tolerance would weaken the check on hardware that passes it bit-exactly, to accommodate one runner. That trades a real assertion for a
green check, which is the wrong direction, and it is exactly the kind of change that should not slip in under "make the job pass".

What the right fix looks like, and why I am not making it here: the failure is specific to the Apple Paravirtual device of the CI runner. The exemption belongs where the device is
known, and it is not check.py: the Python checker only receives pixels (runtime/test/shaders/check.py has no device name, and nothing under runtime/test/shaders/ mentions
Paravirtual). The precedent does exist on the C++ side - runtime/test/vk_gpu_profile_test.cpp keys an exemption on queue.span_ms == 0.0 && strstr(deviceName, "Paravirtual") - so the
shape would be a skip for this case when the device reports itself as Paravirtual, in whatever harness drives ps_exp_f32_denorm_rt.

I do not know that harness well enough to make that change, and I cannot run it: this machine is Windows with an RTX 4090, and the only Apple hardware I have data for is the M5 Max that
passes. Someone with a MoltenVK setup, or the person who owns that test, can do it in one place with the device name in hand.

So: the macos job stays red on the runner, and that is the honest state rather than a relaxed assertion. If a maintainer decides the paravirtual device should be skipped for this case,
the precedent above is the pattern to copy.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262230361 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2635#issuecomment-7262230361). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-29T20:37:35Z. --- This draft is the wrong shape, and `lorentsob`'s data point is why. Closing it rather than leaving it in the queue. **What the hardware says:** on an Apple **M5 Max** (macOS 27.2.1, MoltenVK 1.4.2), `main` `dd87aa405` **passes** `ps_exp_f32_denorm` and the `_rt` case. So the fixture is **not** too strict for Apple GPUs - it is exact there. **What that means for my patch:** a blanket two-ulp tolerance would weaken the check on hardware that passes it bit-exactly, to accommodate one runner. That trades a real assertion for a green check, which is the wrong direction, and it is exactly the kind of change that should not slip in under "make the job pass". **What the right fix looks like, and why I am not making it here:** the failure is specific to the **Apple Paravirtual** device of the CI runner. The exemption belongs where the device is known, and it is not `check.py`: the Python checker only receives pixels (`runtime/test/shaders/check.py` has no device name, and nothing under `runtime/test/shaders/` mentions `Paravirtual`). The precedent does exist on the C++ side - `runtime/test/vk_gpu_profile_test.cpp` keys an exemption on `queue.span_ms == 0.0 && strstr(deviceName, "Paravirtual")` - so the shape would be a skip for this case when the device reports itself as Paravirtual, in whatever harness drives `ps_exp_f32_denorm_rt`. I do not know that harness well enough to make that change, and I cannot run it: this machine is Windows with an RTX 4090, and the only Apple hardware I have data for is the M5 Max that passes. Someone with a MoltenVK setup, or the person who owns that test, can do it in one place with the device name in hand. So: the `macos` job stays red on the runner, and that is the honest state rather than a relaxed assertion. If a maintainer decides the paravirtual device should be skipped for this case, the precedent above is the pattern to copy. Written with an AI assistant.

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