rdna2spirv: --explicit-lod-bias applies the S# LOD bias where MoltenVK drops the sampler's; ps_ssharp passes on Macs (SHADER-EXPLICIT-LOD-BIAS-MVK) #1774

Merged
Tauwni merged 26 commits from upstream-pr/1774 into main 2026-12-01 11:45:24 +00:00
Tauwni commented 2026-11-25 11:50:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-25T11:50:20Z.


Update 4 (5c702e2a7, docs only): the M3 on 27.0 and an Apple M5 have run this head

No code has changed since 743eda012. bcf199736 and 5c702e2a7 only update docs/design.md with these results:

Machine macOS Probe (--lod-bias) ps_ssharp* in auto mode Run by
Apple M3 26.5.1 true: "the sampler drops mipLodBias" 6/6 pass (MoltenVK, KosmicKrisp, llvmpipe) me
Apple M3 27.0 (26A5406e) true on MoltenVK, false on KosmicKrisp and llvmpipe 6/6 pass on all three EvgHaze (comment)
Apple M5 26.6.2 false: "the sampler applies mipLodBias" 6/6 pass, flag off cizerter on Discord (comment)

So the measured gate does what it should on real Apple hardware. Where MoltenVK drops the bias (the M3s), the shader applies it. Where MoltenVK applies it (the M5, KosmicKrisp, llvmpipe), the flag stays off, and nothing is counted twice.

Still open: the macOS CI job. Its workflows are awaiting approval, and ps_ssharp stays in EXPECTED_FAILURES until the runner's probe shows which way it goes. An M5 Pro run on 26.7.3 (@GeorgiyDemo) would be one more false data point, but it is no longer needed for the gate.


Update 3 (743eda012): review fixes, and main merged again

From @aslan2142's review:

  • Probe control: tools/vk_lod_bias.py also reads at explicit LOD 1 with no bias, and answers null unless that read is 1.0. Before, a level 1 that was never cleared also read 0.0, which looked like a dropped bias.
  • Clamp order: outside the PS, image_sample_cl / image_sample_c_cl add the S# bias before the clamp, max(0 + bias, minlod), as _b_cl does.
  • design.md: the 27.0 M3 checked the draw probe only, until it's rerun.
  • Dead code in make_game.py dropped, and the tools/vk_subgroup_info.py conflict resolved (3fc618429, b14565930).

After #2098, a tagged module reads its instruction's array only when the table entry's kind names it. vk_sampler_test --cube / --3d now tag the array the texture sits in. Without that, ps_ssharp_cube and ps_ssharp_3d read the fallback.

Still open at the time: the M5 Pro and 27.0 M3 reruns (both answered in Update 4), and the macOS CI job.


Update 2 (631a53832): the probe needs no test programs, every sample form is GPU-checked

The open points of the Update below are done, with @EvgHaze's two suggestions:

  • Probe without test programs. tools/vk_subgroup_info.py --lod-bias measures it in Python (tools/vk_lod_bias.py): a two-level R32_SFLOAT image cleared to 0.0 / 1.0, sampled at explicit LOD 0 through samplers with mipLodBias 0 and +1 in one compute dispatch. true when +1 still reads level 0, false when it reads level 1, null otherwise. It needs no built test programs, llvm-mc or SPIR-V tools. tools/lod_bias_probe.py returns that answer and only falls back to the ps_ssharp draw when it has none. build.py and make_game.py now measure too, so check.py alone takes the flag and make_game.py no longer waits for the test programs. The option is off by default, so nothing else that runs vk_subgroup_info.py dispatches anything.
  • llvm-mc message. When the draw fallback can't start llvm-mc, it gives mc_command.install_hint() (the Homebrew LLVM_MC="$(brew --prefix llvm)/bin/llvm-mc" line) instead of a bare "could not be started".
  • Every form GPU-checked, each with the same 10 SAMPLER_CASES (check.py's SAMPLER_FIXTURES). vk_sampler_test gains --cube, --3d and --dref; its 2D default is unchanged.
Fixture Forms Texture
ps_ssharp image_sample_lz, image_sample 2D (as before)
ps_ssharp_ld (new) image_sample_l, image_sample_d (the Grad scale) 2D
ps_ssharp_b (new) image_sample_lz, image_sample_b 2D
ps_ssharp_cube (new) image_sample_lz, image_sample 6-layer cube, images_arr
ps_ssharp_3d (new) image_sample_lz, image_sample 128x128x2 volume, images_3d
ps_ssharp_c (new) image_sample_c_lz, image_sample_c D32, 0.25 / 0.75, LESS_EQUAL S#
ps_ssharp_o (new) image_sample_lz_o, image_sample_o 2D, under LEONIDA_TEXOFF_FALLBACK=1 (a SKIP without it)

Tested at 631a53832 on the Apple M3 (macOS 26.5.1):

All 7 fixtures flag off flag on auto
MoltenVK 1.4.2 FAIL (bias +1) on all 7 PASS 7/7 PASS 7/7 (probe true)
KosmicKrisp (Mesa 26.3.1) PASS 7/7 FAIL bias +0.3 (counted twice) on all 7 PASS 7/7 (probe false)
llvmpipe (Mesa 26.3.1) PASS 7/7 FAIL bias +0.3 on all 7 PASS 7/7 (probe false)
  • The Python probe answered the same 10 times out of 10 on MoltenVK and on KosmicKrisp.
  • ctest 88/88 on this branch. The translator suite (6294 tests) and the docs tests pass.
  • With the open fixes merged (#1444, #1518, #1724, #822, #1212, #1673, #1657, #1412, #1375; and the generated/ fix below, locally) on main db1a22d29, test programs rebuilt:
    • MoltenVK: no failure in run_gpu_tests.py (200/270 native, 233/270 emulated) or check.py (192/237, 45 skipped, flag measured by build.py itself).
    • llvmpipe: no failure.
    • KosmicKrisp: only what this PR doesn't touch (cs_fma_fused from #1724; ps_cndmask_sign_mods and ps_valu16_mad_sel, fixed by the KosmicKrisp branch below; cs_fmt_all, see below).
    • ctest 99/99; translator suite 6324 tests, 0 failed; pytest 1919 passed. The standard-library loop has 2 failures that main has too: test_tool_stdout_encoding (#1837, #1673 and the stage_timeline branch below) and test_calibrated_texture_extra, a Windows MoveFileExW test that fails on macOS on main alone.

Still open after Update 2

  • The macOS CI runner is a paravirtual device I can't test. ps_ssharp stays in its EXPECTED_FAILURES; the job prints a notice if it passes there, and it can be dropped then.
  • An M5 Pro run of this head. @GeorgiyDemo: python -I tools/vk_subgroup_info.py --lod-bias should answer "explicit_lod_bias": false there, and --filter ps_ssharp should pass all 7 with the flag off.

Found while testing and split off, since they're not this PR's topic:

  • #2096: the generated/ directory for vk_null_descriptor_test (the macOS/Linux build fails on main).
  • Tauwni:fix/stage-timeline-stdout (pull request to follow): stage_timeline.py's stdout guard.
  • Tauwni:fix/kosmickrisp-nan-canonicalization (pull request to follow): KosmicKrisp's canonical NaN in exact-word pixel tests.
  • cs_fmt_all on KosmicKrisp isn't one fix. Word 293 is an f16 signalling NaN stored quiet (0x7c01 -> 0x7e00), and word 312, an 11/11/10 float, reads a different finite G and a NaN B (0xf83efde0 -> 0xfc1efde0). That looks like a driver bug, not the canonicalization, so it stays a finding (#1608) rather than a tolerance.

Update (66b27ac6e): the flag is now measured per device, not keyed on MoltenVK's driver ID

The reviews showed the driver-ID gate was wrong: the same MoltenVK 1.4.2 applies mipLodBias on an Apple M5 Pro, so the auto flag counted the bias twice there and turned a passing ps_ssharp red. It isn't an OS-version rule either:

Machine macOS MoltenVK 1.4.2 applies mipLodBias? Reported by
Apple M3 26.5.1 (25F80) no, ps_ssharp fails on main this PR
Apple M5 Pro 26.7.3 (25G342) yes, passes on main GeorgiyDemo
Apple M3 27.0 (26A5406e) no, fails on main EvgHaze

What changed:

  • New tools/lod_bias_probe.py: translates vs_ids and ps_ssharp without the flag, draws them with vk_sampler_test at LOD_BIAS 0, +1 and -1, and answers true only when +1 and -1 read the no-bias levels. It answers false when both move as check.py expects, and null otherwise (wrong no-bias draw, mixed answer, failed draw, no test programs). null never turns the flag on.
  • scripts/run_gpu_tests.py and make_game.py take the probe's answer. make_game.py runs it on the test programs in runtime/build/linux or runtime/build if present; otherwise it keeps a recorded flag, like the other fallbacks.
  • runtime/test/shaders/build.py only follows LEONIDA_EXPLICIT_LOD_BIAS: it also runs inside the CMake build, before the test programs exist, so it must not probe.
  • tools/vk_subgroup_info.py and its test are back as on main, with no explicit_lod_bias field.
  • tools/lod_bias_probe.py is in runtime.yml's path filters. New tests/test_lod_bias_probe.py (7 tests with fake draws: applied, dropped, mixed, wrong base, failed draw, no programs, translated without the flag).

Tested at 66b27ac6e on the Apple M3:

  • Probe: MoltenVK true, KosmicKrisp false, llvmpipe false, no test programs null.
  • ps_ssharp in auto mode: 10/10 on all three. KosmicKrisp plays the part of a driver that applies the bias, like the M5 Pro: the probe leaves the flag off there. Forced checks unchanged: MoltenVK off fails bias +1, KosmicKrisp on fails bias +0.3.
  • With the open fixes merged (#1444, #1518, #1724, #822, #1212, #1673, #1657, #1412, #1375) on main 71a769d7d, test programs rebuilt:
    • MoltenVK: no failure in run_gpu_tests.py (195/264 native, 228/264 emulated) or in check.py with LEONIDA_EXPLICIT_LOD_BIAS=1, as the probe answers (187/231, 44 skipped).
    • llvmpipe: no failure.
    • KosmicKrisp: the same failures as without this PR.
    • ctest 95/95; translator suite 6300 tests, 0 failed; pytest 1913 passed.

Still open

  • This PR:
    • check.py alone doesn't take the flag (done in Update 2): after build.py, a Mac that needs it has to set LEONIDA_EXPLICIT_LOD_BIAS=1, which python -I tools/lod_bias_probe.py --build <test programs> answers. A lead: let build.py probe when it is given the test programs' folder, but never inside the CMake build.
    • Not GPU-checked: _d, the _c* forms, cube and 3D samples, and the texel-offset gradients. (done in Update 2) A lead: a ps_ssharp-style fixture per form.
    • The macOS CI runner is a paravirtual device I can't test, so ps_ssharp stays in its EXPECTED_FAILURES; the job prints a notice if it passes there.
    • make_game.py can only probe once the test programs are built (done in Update 2); before that the flag stays off unless it was recorded.
    • Not rerun on an M5 Pro since the change: @GeorgiyDemo, a --filter ps_ssharp run and python -I tools/lod_bias_probe.py --build <your build> would confirm the probe answers false there.
  • Found while testing, not caused by this PR:
    • On main since ba626820e, the macOS/Linux build of vk_null_descriptor_test fails: its add_custom_command writes generated/cs_null_descriptors.spv without creating generated/ ("Failed to open file"). Adding COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/generated before glslangValidator fixes it locally (ctest 95/95).
    • tests/test_tool_stdout_encoding.py fails on main for two new tools, tools/game_run_summary.py and tools/stage_timeline.py (no errors='replace' on stdout).
    • On KosmicKrisp, ps_cndmask_sign_mods, ps_valu16_mad_sel and cs_fmt_all (NaN canonicalization, finding in #1608) and cs_fma_fused with #1724 (comment there) still fail.

I'll try to fix the open points of this PR this evening, or as soon as I have time, and post the results here. Done: see Update 2.


Claimed in the coordination issue as: SHADER-EXPLICIT-LOD-BIAS-MVK (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161563852)

What and why

ps_ssharp fails on every Mac some Macs (see Update) with MoltenVK 1.4.2 (point bias +1: (0,0): (1.0, 0.0, 0.502, 0.502) != (0.502, 0.502, 0.502, 0.502)) and sits in the macOS job's EXPECTED_FAILURES. Measured on an Apple M3: MoltenVK drops VkSamplerCreateInfo::mipLodBias from both explicit-LOD samples (image_sample_lz with +0.6 / +1 stays on level 0) and the derivative-LOD image_sample (-0.6 / -1 stays on level 1). The test stopped at its first failing case, so only the explicit half showed. KosmicKrisp and llvmpipe (Mesa 26.3.1) on the same machine apply the bias.

This adds a device fallback, rdna2spirv.py --explicit-lod-bias, in the same shape as --f16-interp-fallback: the shader applies the S#'s LOD_BIAS (word 2 [13:0], signed 5.8, read from the S# SGPRs; a literal S# folds to a constant, a zero bias adds nothing):

  • added to the Lod of _lz, _l, _c_lz, _c_l and of the implicit forms outside the PS;
  • added to the bias of _b / _c_b;
  • a Bias operand on implicit samples in the PS;
  • a 2^bias scale of Grad derivatives (the typed 2D implicit read, _d, and the --texel-offset-fallback gradients).

The sampler still clamps to MIN_LOD..MAX_LOD. It is chosen per device, since on a driver that applies the bias it would count twice: explicit_lod_bias in tools/vk_subgroup_info.py (MoltenVK's driver ID), read by scripts/run_gpu_tests.py, runtime/test/shaders/build.py and make_game.py (replaced, see Update) (recorded with the other fallback flags); LEONIDA_EXPLICIT_LOD_BIAS=1/0 forces it in the test runners.

check.py's SAMPLER_CASES gain point bias +0.3 and -0.3: with two levels, an integer bias can't tell a bias applied once from twice, these can (they fail on KosmicKrisp and llvmpipe when the flag is forced there).

Docs: a contract row in docs/design.md (with what is and isn't GPU-checked) and a Known problems row in docs/testing.md. ps_ssharp stays in the macOS job's EXPECTED_FAILURES for now: that runner is a paravirtual device I can't test here; if it passes there, the job prints its "drop it from the expected failures" notice and it can go in a follow-up.

Tested

Apple M3, macOS 26.5.1, test programs built from main:

ps_ssharp (10 cases) flag off flag on default (auto)
MoltenVK 1.4.2 FAIL (bias +1; also +-0.6, -1) PASS PASS (on)
KosmicKrisp (Mesa 26.3.1) PASS FAIL bias +0.3 (counted twice) PASS (off)
llvmpipe (Mesa 26.3.1) PASS FAIL bias +0.3 (counted twice) PASS (off)
  • tests/semantic/test_explicit_lod_bias.py (new, 7 tests: literal, negative, zero and run-time S#, Grad scaling, Bias operand, _b, compute); tests/test_vk_subgroup_info.py, tests/test_make_game_translator_flags.py (probe mocked, new case), tests/test_make_game_argparse.py (probe mocked), tests/test_shader_checks.py (the two new cases).
  • On this branch: translator suite 6294 tests, 0 failed; docs tests OK.
  • With the open fixes merged together (#1444, #1518, #1724, #822, #1212, #1673, #1657, #1412, #1375; #822 and #1444 conflict with each other in build.py, resolution in #822's thread, none with this branch), test programs rebuilt: MoltenVK has no failure left: run_gpu_tests.py 195/263, 68 skipped (228/263 with LEONIDA_W64_EMULATE=1), check.py 187/231, 44 skipped. KosmicKrisp keeps exactly the failures it had without this branch (cs_fma_fused from #1724, ps_cndmask_sign_mods, ps_valu16_mad_sel, cs_fmt_all; see #1608); llvmpipe none. ctest 88/88; translator suite 6299 tests, standard-library loop 499 files, pytest 1912 passed, all 0 failed.
  • Not GPU-checked: _d, the _c* forms, cube and 3D samples, and the texel-offset gradients (covered by the semantic test only).

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

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • The new translator rule is in the contract table of docs/design.md, with how it was confirmed.

🤖 Generated with Claude Code

Red checks: from main, not this change (updated for head bf458bbcb)

The failing jobs (check, macos-python, semantic-tests, stdlib-tests-linux, translator-tests, linux-gpu-tools, macos) also fail on main: the CI and Runtime workflows of main ef3299584 fail the same jobs (READ from both CI runs). windows, no-game-data and viewer-tests pass. This change's own tests (test_explicit_lod_bias, test_lod_bias_probe, test_vk_lod_bias, test_make_game_argparse, test_make_game_translator_flags) pass, MEASURED on macOS, 3 runs.

Failing on main Where Fixed by
test_make_game_pipelines, test_sampler_source_census, test_spirv_metal_set0_*, test_tool_stdout_encoding, test_bcpack_history_calib, test_build_runtime_fallback, test_make_game_preflight, test_progress_dashboard, tests/semantic/test_valu_cvt_f16_int16_mods, cs_imgatomic_ext check, macos-python, stdlib-tests-linux, semantic-tests, linux-gpu-tools #2593
test_docs_cli_flags (-Game in the README) check not claimed yet
tests/semantic/test_interp_computed_ij_fallback semantic-tests not claimed yet (fails the same way on main, MEASURED on macOS, 1 run)
test_mesh_serial_waves (6 mesh fixtures) translator-tests not claimed yet (READ from main's CI)
vk_bindless_dimensions (macOS) macos #2441

Not checked by a second agent or human yet.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5490762500 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-25T11:50:20Z. --- ## Update 4 (`5c702e2a7`, docs only): the M3 on 27.0 and an Apple M5 have run this head No code has changed since `743eda012`. `bcf199736` and `5c702e2a7` only update `docs/design.md` with these results: | Machine | macOS | Probe (`--lod-bias`) | `ps_ssharp*` in auto mode | Run by | |---|---|---|---|---| | Apple M3 | 26.5.1 | true: "the sampler drops mipLodBias" | 6/6 pass (MoltenVK, KosmicKrisp, llvmpipe) | me | | Apple M3 | 27.0 (26A5406e) | true on MoltenVK, false on KosmicKrisp and llvmpipe | 6/6 pass on all three | EvgHaze ([comment](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7183811428)) | | Apple M5 | 26.6.2 | false: "the sampler applies mipLodBias" | 6/6 pass, flag off | cizerter on Discord ([comment](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7194185558)) | So the measured gate does what it should on real Apple hardware. Where MoltenVK drops the bias (the M3s), the shader applies it. Where MoltenVK applies it (the M5, KosmicKrisp, llvmpipe), the flag stays off, and nothing is counted twice. Still open: the macOS CI job. Its workflows are awaiting approval, and `ps_ssharp` stays in `EXPECTED_FAILURES` until the runner's probe shows which way it goes. An M5 Pro run on 26.7.3 (@GeorgiyDemo) would be one more false data point, but it is no longer needed for the gate. --- ## Update 3 (`743eda012`): review fixes, and `main` merged again From @aslan2142's review: - **Probe control:** `tools/vk_lod_bias.py` also reads at explicit LOD 1 with no bias, and answers `null` unless that read is 1.0. Before, a level 1 that was never cleared also read 0.0, which looked like a dropped bias. - **Clamp order:** outside the PS, `image_sample_cl` / `image_sample_c_cl` add the S# bias before the clamp, `max(0 + bias, minlod)`, as `_b_cl` does. - **design.md:** the 27.0 M3 checked the draw probe only, until it's rerun. - Dead code in `make_game.py` dropped, and the `tools/vk_subgroup_info.py` conflict resolved (`3fc618429`, `b14565930`). After #2098, a tagged module reads its instruction's array only when the table entry's kind names it. `vk_sampler_test --cube` / `--3d` now tag the array the texture sits in. Without that, `ps_ssharp_cube` and `ps_ssharp_3d` read the fallback. Still open at the time: the M5 Pro and 27.0 M3 reruns (both answered in Update 4), and the macOS CI job. --- ## Update 2 (`631a53832`): the probe needs no test programs, every sample form is GPU-checked The open points of the Update below are done, with @EvgHaze's two suggestions: - **Probe without test programs.** `tools/vk_subgroup_info.py --lod-bias` measures it in Python (`tools/vk_lod_bias.py`): a two-level R32_SFLOAT image cleared to 0.0 / 1.0, sampled at explicit LOD 0 through samplers with `mipLodBias` 0 and +1 in one compute dispatch. `true` when +1 still reads level 0, `false` when it reads level 1, `null` otherwise. It needs no built test programs, llvm-mc or SPIR-V tools. `tools/lod_bias_probe.py` returns that answer and only falls back to the `ps_ssharp` draw when it has none. `build.py` and `make_game.py` now measure too, so `check.py` alone takes the flag and `make_game.py` no longer waits for the test programs. The option is off by default, so nothing else that runs `vk_subgroup_info.py` dispatches anything. - **`llvm-mc` message.** When the draw fallback can't start `llvm-mc`, it gives `mc_command.install_hint()` (the Homebrew `LLVM_MC="$(brew --prefix llvm)/bin/llvm-mc"` line) instead of a bare "could not be started". - **Every form GPU-checked**, each with the same 10 `SAMPLER_CASES` (`check.py`'s `SAMPLER_FIXTURES`). `vk_sampler_test` gains `--cube`, `--3d` and `--dref`; its 2D default is unchanged. | Fixture | Forms | Texture | |---|---|---| | `ps_ssharp` | `image_sample_lz`, `image_sample` | 2D (as before) | | `ps_ssharp_ld` (new) | `image_sample_l`, `image_sample_d` (the `Grad` scale) | 2D | | `ps_ssharp_b` (new) | `image_sample_lz`, `image_sample_b` | 2D | | `ps_ssharp_cube` (new) | `image_sample_lz`, `image_sample` | 6-layer cube, `images_arr` | | `ps_ssharp_3d` (new) | `image_sample_lz`, `image_sample` | 128x128x2 volume, `images_3d` | | `ps_ssharp_c` (new) | `image_sample_c_lz`, `image_sample_c` | D32, 0.25 / 0.75, LESS_EQUAL S# | | `ps_ssharp_o` (new) | `image_sample_lz_o`, `image_sample_o` | 2D, under `LEONIDA_TEXOFF_FALLBACK=1` (a SKIP without it) | Tested at `631a53832` on the Apple M3 (macOS 26.5.1): | All 7 fixtures | flag off | flag on | auto | |---|---|---|---| | MoltenVK 1.4.2 | FAIL (`bias +1`) on all 7 | PASS 7/7 | PASS 7/7 (probe `true`) | | KosmicKrisp (Mesa 26.3.1) | PASS 7/7 | FAIL `bias +0.3` (counted twice) on all 7 | PASS 7/7 (probe `false`) | | llvmpipe (Mesa 26.3.1) | PASS 7/7 | FAIL `bias +0.3` on all 7 | PASS 7/7 (probe `false`) | - The Python probe answered the same 10 times out of 10 on MoltenVK and on KosmicKrisp. - ctest 88/88 on this branch. The translator suite (6294 tests) and the docs tests pass. - With the open fixes merged (#1444, #1518, #1724, #822, #1212, #1673, #1657, #1412, #1375; and the `generated/` fix below, locally) on `main` `db1a22d29`, test programs rebuilt: - **MoltenVK: no failure** in `run_gpu_tests.py` (200/270 native, 233/270 emulated) or `check.py` (192/237, 45 skipped, flag measured by `build.py` itself). - llvmpipe: no failure. - KosmicKrisp: only what this PR doesn't touch (`cs_fma_fused` from #1724; `ps_cndmask_sign_mods` and `ps_valu16_mad_sel`, fixed by the KosmicKrisp branch below; `cs_fmt_all`, see below). - ctest 99/99; translator suite 6324 tests, 0 failed; pytest 1919 passed. The standard-library loop has 2 failures that `main` has too: `test_tool_stdout_encoding` (#1837, #1673 and the `stage_timeline` branch below) and `test_calibrated_texture_extra`, a Windows `MoveFileExW` test that fails on macOS on `main` alone. ### Still open after Update 2 - The macOS CI runner is a paravirtual device I can't test. `ps_ssharp` stays in its `EXPECTED_FAILURES`; the job prints a notice if it passes there, and it can be dropped then. - An M5 Pro run of this head. @GeorgiyDemo: `python -I tools/vk_subgroup_info.py --lod-bias` should answer `"explicit_lod_bias": false` there, and `--filter ps_ssharp` should pass all 7 with the flag off. Found while testing and split off, since they're not this PR's topic: - #2096: the `generated/` directory for `vk_null_descriptor_test` (the macOS/Linux build fails on `main`). - `Tauwni:fix/stage-timeline-stdout` (pull request to follow): `stage_timeline.py`'s stdout guard. - `Tauwni:fix/kosmickrisp-nan-canonicalization` (pull request to follow): KosmicKrisp's canonical NaN in exact-word pixel tests. - `cs_fmt_all` on KosmicKrisp isn't one fix. Word 293 is an f16 signalling NaN stored quiet (`0x7c01` -> `0x7e00`), and word 312, an 11/11/10 float, reads a different finite G and a NaN B (`0xf83efde0` -> `0xfc1efde0`). That looks like a driver bug, not the canonicalization, so it stays a finding (#1608) rather than a tolerance. --- ## Update (`66b27ac6e`): the flag is now measured per device, not keyed on MoltenVK's driver ID The reviews showed the driver-ID gate was wrong: the same MoltenVK 1.4.2 applies `mipLodBias` on an Apple M5 Pro, so the auto flag counted the bias twice there and turned a passing `ps_ssharp` red. It isn't an OS-version rule either: | Machine | macOS | MoltenVK 1.4.2 applies `mipLodBias`? | Reported by | |---|---|---|---| | Apple M3 | 26.5.1 (25F80) | no, `ps_ssharp` fails on `main` | this PR | | Apple M5 Pro | 26.7.3 (25G342) | yes, passes on `main` | GeorgiyDemo | | Apple M3 | 27.0 (26A5406e) | no, fails on `main` | EvgHaze | What changed: - New `tools/lod_bias_probe.py`: translates `vs_ids` and `ps_ssharp` **without** the flag, draws them with `vk_sampler_test` at LOD_BIAS 0, +1 and -1, and answers `true` only when +1 and -1 read the no-bias levels. It answers `false` when both move as `check.py` expects, and `null` otherwise (wrong no-bias draw, mixed answer, failed draw, no test programs). `null` never turns the flag on. - `scripts/run_gpu_tests.py` and `make_game.py` take the probe's answer. `make_game.py` runs it on the test programs in `runtime/build/linux` or `runtime/build` if present; otherwise it keeps a recorded flag, like the other fallbacks. - `runtime/test/shaders/build.py` only follows `LEONIDA_EXPLICIT_LOD_BIAS`: it also runs inside the CMake build, before the test programs exist, so it must not probe. - `tools/vk_subgroup_info.py` and its test are back as on `main`, with no `explicit_lod_bias` field. - `tools/lod_bias_probe.py` is in `runtime.yml`'s path filters. New `tests/test_lod_bias_probe.py` (7 tests with fake draws: applied, dropped, mixed, wrong base, failed draw, no programs, translated without the flag). Tested at `66b27ac6e` on the Apple M3: - Probe: MoltenVK `true`, KosmicKrisp `false`, llvmpipe `false`, no test programs `null`. - `ps_ssharp` in auto mode: 10/10 on all three. KosmicKrisp plays the part of a driver that applies the bias, like the M5 Pro: the probe leaves the flag off there. Forced checks unchanged: MoltenVK off fails `bias +1`, KosmicKrisp on fails `bias +0.3`. - With the open fixes merged (#1444, #1518, #1724, #822, #1212, #1673, #1657, #1412, #1375) on `main` `71a769d7d`, test programs rebuilt: - MoltenVK: no failure in `run_gpu_tests.py` (195/264 native, 228/264 emulated) or in `check.py` with `LEONIDA_EXPLICIT_LOD_BIAS=1`, as the probe answers (187/231, 44 skipped). - llvmpipe: no failure. - KosmicKrisp: the same failures as without this PR. - ctest 95/95; translator suite 6300 tests, 0 failed; pytest 1913 passed. ### Still open - **This PR:** - ~~`check.py` alone doesn't take the flag~~ (done in Update 2): after `build.py`, a Mac that needs it has to set `LEONIDA_EXPLICIT_LOD_BIAS=1`, which `python -I tools/lod_bias_probe.py --build <test programs>` answers. A lead: let `build.py` probe when it is given the test programs' folder, but never inside the CMake build. - ~~Not GPU-checked: `_d`, the `_c*` forms, cube and 3D samples, and the texel-offset gradients.~~ (done in Update 2) A lead: a `ps_ssharp`-style fixture per form. - The macOS CI runner is a paravirtual device I can't test, so `ps_ssharp` stays in its `EXPECTED_FAILURES`; the job prints a notice if it passes there. - ~~`make_game.py` can only probe once the test programs are built~~ (done in Update 2); before that the flag stays off unless it was recorded. - Not rerun on an M5 Pro since the change: @GeorgiyDemo, a `--filter ps_ssharp` run and `python -I tools/lod_bias_probe.py --build <your build>` would confirm the probe answers `false` there. - **Found while testing, not caused by this PR:** - On `main` since `ba626820e`, the macOS/Linux build of `vk_null_descriptor_test` fails: its `add_custom_command` writes `generated/cs_null_descriptors.spv` without creating `generated/` ("Failed to open file"). Adding `COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/generated` before `glslangValidator` fixes it locally (ctest 95/95). - `tests/test_tool_stdout_encoding.py` fails on `main` for two new tools, `tools/game_run_summary.py` and `tools/stage_timeline.py` (no `errors='replace'` on stdout). - On KosmicKrisp, `ps_cndmask_sign_mods`, `ps_valu16_mad_sel` and `cs_fmt_all` (NaN canonicalization, finding in #1608) and `cs_fma_fused` with #1724 (comment there) still fail. ~~I'll try to fix the open points of this PR this evening, or as soon as I have time, and post the results here.~~ Done: see Update 2. --- Claimed in the coordination issue as: SHADER-EXPLICIT-LOD-BIAS-MVK (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161563852) ### What and why `ps_ssharp` fails on ~~every Mac~~ some Macs (see Update) with MoltenVK 1.4.2 (`point bias +1: (0,0): (1.0, 0.0, 0.502, 0.502) != (0.502, 0.502, 0.502, 0.502)`) and sits in the macOS job's `EXPECTED_FAILURES`. Measured on an Apple M3: MoltenVK drops `VkSamplerCreateInfo::mipLodBias` from **both** explicit-LOD samples (`image_sample_lz` with +0.6 / +1 stays on level 0) and the derivative-LOD `image_sample` (-0.6 / -1 stays on level 1). The test stopped at its first failing case, so only the explicit half showed. KosmicKrisp and llvmpipe (Mesa 26.3.1) on the same machine apply the bias. This adds a device fallback, `rdna2spirv.py --explicit-lod-bias`, in the same shape as `--f16-interp-fallback`: the shader applies the S#'s `LOD_BIAS` (word 2 [13:0], signed 5.8, read from the S# SGPRs; a literal S# folds to a constant, a zero bias adds nothing): - added to the `Lod` of `_lz`, `_l`, `_c_lz`, `_c_l` and of the implicit forms outside the PS; - added to the bias of `_b` / `_c_b`; - a `Bias` operand on implicit samples in the PS; - a 2^bias scale of `Grad` derivatives (the typed 2D implicit read, `_d`, and the `--texel-offset-fallback` gradients). The sampler still clamps to `MIN_LOD`..`MAX_LOD`. It is chosen per device, since on a driver that applies the bias it would count twice: ~~`explicit_lod_bias` in `tools/vk_subgroup_info.py` (MoltenVK's driver ID), read by `scripts/run_gpu_tests.py`, `runtime/test/shaders/build.py` and `make_game.py`~~ (replaced, see Update) (recorded with the other fallback flags); `LEONIDA_EXPLICIT_LOD_BIAS=1`/`0` forces it in the test runners. `check.py`'s `SAMPLER_CASES` gain `point bias +0.3` and `-0.3`: with two levels, an integer bias can't tell a bias applied once from twice, these can (they fail on KosmicKrisp and llvmpipe when the flag is forced there). Docs: a contract row in `docs/design.md` (with what is and isn't GPU-checked) and a Known problems row in `docs/testing.md`. `ps_ssharp` stays in the macOS job's `EXPECTED_FAILURES` for now: that runner is a paravirtual device I can't test here; if it passes there, the job prints its "drop it from the expected failures" notice and it can go in a follow-up. ### Tested Apple M3, macOS 26.5.1, test programs built from `main`: | `ps_ssharp` (10 cases) | flag off | flag on | default (auto) | |---|---|---|---| | MoltenVK 1.4.2 | FAIL (`bias +1`; also +-0.6, -1) | PASS | PASS (on) | | KosmicKrisp (Mesa 26.3.1) | PASS | FAIL `bias +0.3` (counted twice) | PASS (off) | | llvmpipe (Mesa 26.3.1) | PASS | FAIL `bias +0.3` (counted twice) | PASS (off) | - `tests/semantic/test_explicit_lod_bias.py` (new, 7 tests: literal, negative, zero and run-time S#, Grad scaling, Bias operand, `_b`, compute); `tests/test_vk_subgroup_info.py`, `tests/test_make_game_translator_flags.py` (probe mocked, new case), `tests/test_make_game_argparse.py` (probe mocked), `tests/test_shader_checks.py` (the two new cases). - On this branch: translator suite 6294 tests, 0 failed; docs tests OK. - With the open fixes merged together (#1444, #1518, #1724, #822, #1212, #1673, #1657, #1412, #1375; #822 and #1444 conflict with each other in `build.py`, resolution in #822's thread, none with this branch), test programs rebuilt: **MoltenVK has no failure left**: `run_gpu_tests.py` 195/263, 68 skipped (228/263 with `LEONIDA_W64_EMULATE=1`), `check.py` 187/231, 44 skipped. KosmicKrisp keeps exactly the failures it had without this branch (`cs_fma_fused` from #1724, `ps_cndmask_sign_mods`, `ps_valu16_mad_sel`, `cs_fmt_all`; see #1608); llvmpipe none. ctest 88/88; translator suite 6299 tests, standard-library loop 499 files, pytest 1912 passed, all 0 failed. - Not GPU-checked: `_d`, the `_c*` forms, cube and 3D samples, and the texel-offset gradients (covered by the semantic test only). GPUs tested: Apple M3 (10-core GPU), MoltenVK 1.4.2 and KosmicKrisp (Mesa 26.3.1), macOS 26.5.1 (25F80); llvmpipe (Mesa 26.3.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] The new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) ### Red checks: from `main`, not this change (updated for head `bf458bbcb`) The failing jobs (`check`, `macos-python`, `semantic-tests`, `stdlib-tests-linux`, `translator-tests`, `linux-gpu-tools`, `macos`) also fail on `main`: the CI and Runtime workflows of `main` `ef3299584` fail the same jobs (READ from both CI runs). `windows`, `no-game-data` and `viewer-tests` pass. This change's own tests (`test_explicit_lod_bias`, `test_lod_bias_probe`, `test_vk_lod_bias`, `test_make_game_argparse`, `test_make_game_translator_flags`) pass, MEASURED on macOS, 3 runs. | Failing on `main` | Where | Fixed by | |---|---|---| | `test_make_game_pipelines`, `test_sampler_source_census`, `test_spirv_metal_set0_*`, `test_tool_stdout_encoding`, `test_bcpack_history_calib`, `test_build_runtime_fallback`, `test_make_game_preflight`, `test_progress_dashboard`, `tests/semantic/test_valu_cvt_f16_int16_mods`, `cs_imgatomic_ext` | check, macos-python, stdlib-tests-linux, semantic-tests, linux-gpu-tools | #2593 | | `test_docs_cli_flags` (`-Game` in the README) | check | not claimed yet | | `tests/semantic/test_interp_computed_ij_fallback` | semantic-tests | not claimed yet (fails the same way on `main`, MEASURED on macOS, 1 run) | | `test_mesh_serial_waves` (6 mesh fixtures) | translator-tests | not claimed yet (READ from `main`'s CI) | | `vk_bindless_dimensions` (macOS) | macos | #2441 | Not checked by a second agent or human yet.
Mby159 commented 2026-11-25 12:11:33 +00:00 (Migrated from github.com)

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


Checked 1d19671eb on AMD: Radeon 780M Graphics (RDNA3 iGPU, gfx1103), AMD proprietary 26.10.2 (32.0.32015.12012, LLPC), Vulkan 1.4.359, Windows 11 10.0.29712, subgroup 32..64. This branch changes no C++, so we ran the branch's translator, fixtures and checker against the C++ test programs built from main bcaa13dad (the merge-base); nothing was merged.

  • tools/vk_subgroup_info.py on this GPU answers "explicit_lod_bias": false (driver_id: 1), so the fallback stays off here, consistent with this driver applying the sampler's own bias.
  • --filter ps_ssharp with the flag unset: PASS, "10 S#/T# cases, 4096 pixels each exact" - the two new point bias +0.3 and point bias -0.3 cases included.
  • With LEONIDA_EXPLICIT_LOD_BIAS=1 forced on, the new case fails: "point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502)" - the bias counted twice, matching the PR's own description (design.md / testing.md) of forcing the flag on a driver that already applies the sampler bias.
  • With LEONIDA_EXPLICIT_LOD_BIAS=0 forced off: PASS, all ten cases.

So on this AMD Windows device the ±0.3 cases also tell a bias counted once from twice, and the per-device selection keeps this GPU on the sampler's bias.

The whole suite with this branch and the flag unset gives the same result as main on this GPU: 273/273 shaders translated and spirv-val clean, 243/263 passed, 18 skipped, and the same two failures (cs_imgatomic_ext, which open PR #1518 fixes, and cs_texture_uav, which needs the D3D12 test program this machine cannot build).

Still not GPU-checked here: the _d, _c*, cube and 3D forms and the texel-offset gradients.

AI-assisted (MiniMax Code). No game files.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7162041590 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7162041590). Originally posted by [Mby159](https://github.com/Mby159) on 2026-11-25T12:11:33Z. --- Checked `1d19671eb` on AMD: Radeon 780M Graphics (RDNA3 iGPU, gfx1103), AMD proprietary 26.10.2 (32.0.32015.12012, LLPC), Vulkan 1.4.359, Windows 11 10.0.29712, subgroup 32..64. This branch changes no C++, so we ran the branch's translator, fixtures and checker against the C++ test programs built from `main` `bcaa13dad` (the merge-base); nothing was merged. - `tools/vk_subgroup_info.py` on this GPU answers `"explicit_lod_bias": false` (`driver_id: 1`), so the fallback stays off here, consistent with this driver applying the sampler's own bias. - `--filter ps_ssharp` with the flag unset: PASS, "10 S#/T# cases, 4096 pixels each exact" - the two new `point bias +0.3` and `point bias -0.3` cases included. - With `LEONIDA_EXPLICIT_LOD_BIAS=1` forced on, the new case fails: "point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502)" - the bias counted twice, matching the PR's own description (design.md / testing.md) of forcing the flag on a driver that already applies the sampler bias. - With `LEONIDA_EXPLICIT_LOD_BIAS=0` forced off: PASS, all ten cases. So on this AMD Windows device the ±0.3 cases also tell a bias counted once from twice, and the per-device selection keeps this GPU on the sampler's bias. The whole suite with this branch and the flag unset gives the same result as `main` on this GPU: 273/273 shaders translated and spirv-val clean, 243/263 passed, 18 skipped, and the same two failures (`cs_imgatomic_ext`, which open PR #1518 fixes, and `cs_texture_uav`, which needs the D3D12 test program this machine cannot build). Still not GPU-checked here: the `_d`, `_c*`, cube and 3D forms and the texel-offset gradients. AI-assisted (MiniMax Code). No game files.
GeorgiyDemo commented 2026-11-25 12:13:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-25T12:13:33Z.


Tested 1d19671eb on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main 0d80bc5df:

  • tests/semantic/test_explicit_lod_bias.py: OK at this head; on main 7 errors. The wiring tests (test_make_game_argparse, test_make_game_translator_flags, test_shader_checks, test_vk_subgroup_info): 219 passed, 1 skipped, 485 subtests.
  • But on this machine the premise does not reproduce, and the auto-enabled flag regresses ps_ssharp:
    • main (no flag): ps_ssharp 8 S#/T# cases PASS on MoltenVK 1.4.2 — the sampler applies mipLodBias to the explicit-LOD sample here.
    • this head (auto flag; vk_subgroup_info reports explicit_lod_bias: true for driver_id 14): FAIL point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502) — exactly the fixture's doubled-bias case: the translator's +0.3 on top of the sampler's +0.3 = +0.6 reads level 1. Reproduced 3/3.
    • LEONIDA_EXPLICIT_LOD_BIAS=0 at this head: PASS 10/10; KosmicKrisp (flag off by detection): PASS 10/10.
  • So on M5 Pro + MoltenVK 1.4.2 the M3 measurement ("MoltenVK drops mipLodBias") does not hold: a driver-id gate alone turns a passing fixture red. It needs a behavioural probe (or a narrower condition) before enabling --explicit-lod-bias automatically.
  • Not run: the Apple M3 the measurement came from.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7162085824 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7162085824). Originally posted by [GeorgiyDemo](https://github.com/GeorgiyDemo) on 2026-11-25T12:13:33Z. --- Tested `1d19671eb` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `0d80bc5df`: - `tests/semantic/test_explicit_lod_bias.py`: **OK** at this head; on `main` **7 errors**. The wiring tests (`test_make_game_argparse`, `test_make_game_translator_flags`, `test_shader_checks`, `test_vk_subgroup_info`): **219 passed, 1 skipped, 485 subtests**. - **But on this machine the premise does not reproduce, and the auto-enabled flag regresses `ps_ssharp`:** - `main` (no flag): `ps_ssharp` **8 S#/T# cases PASS** on MoltenVK 1.4.2 — the sampler applies `mipLodBias` to the explicit-LOD sample here. - this head (auto flag; `vk_subgroup_info` reports `explicit_lod_bias: true` for driver_id 14): **FAIL** `point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502)` — exactly the fixture's doubled-bias case: the translator's +0.3 on top of the sampler's +0.3 = +0.6 reads level 1. Reproduced 3/3. - `LEONIDA_EXPLICIT_LOD_BIAS=0` at this head: **PASS 10/10**; KosmicKrisp (flag off by detection): **PASS 10/10**. - So on M5 Pro + MoltenVK 1.4.2 the M3 measurement ("MoltenVK drops `mipLodBias`") does not hold: a driver-id gate alone turns a passing fixture red. It needs a behavioural probe (or a narrower condition) before enabling `--explicit-lod-bias` automatically. - Not run: the Apple M3 the measurement came from. AI-assisted; synthetic fixtures only, no game data.
EvgHaze commented 2026-11-25 12:45:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-25T12:45:06Z.


Independent Apple check, including the per-device choice this PR introduces.

Machine:  Apple M3, 10-core (MacBook Air 13", Mac15,13), macOS 27.0 (26A5406e), arm64
Drivers:  MoltenVK 1.4.2 (Homebrew), ICD loaded directly, driver id 14, subgroup 4..32
          KosmicKrisp, Mesa 26.3.1 (Homebrew), through the Vulkan loader, driver id 28, subgroup 32..32
Base:     main `0d80bc5` + this diff applied cleanly
Tools:    Homebrew llvm-mc 23.1.4, SPIRV-Tools 1.4.363.0, AppleClang 21.0.0, CMake 4.4.4

The auto-selection reports what it should:

MoltenVK     {"device": "Apple M3", "driver_id": 14, "explicit_lod_bias": True,  "per_vertex_inputs": False}
KosmicKrisp  {"device": "Apple M3", "driver_id": 28, "explicit_lod_bias": False, "per_vertex_inputs": False}

ps_ssharp, with the choice made per device:

Driver --explicit-lod-bias Result
MoltenVK 1.4.2 on (auto) PASS, 10 S#/T# cases, 4096 pixels each exact
KosmicKrisp 26.3.1 off (auto) PASS, 10 S#/T# cases, 4096 pixels each exact

On main, MoltenVK fails this fixture on this machine (point bias +1: (0,0): (1.0, 0.0, 0.502, 0.502)), so the flag is what fixes it.

Negative control, the risk your design row names: forcing LEONIDA_EXPLICIT_LOD_BIAS=1 on KosmicKrisp fails exactly as documented —

FAIL  ps_ssharp  point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502)

so the per-device probe is load-bearing, not cosmetic: without it KosmicKrisp would count the bias twice and lose the ±0.3 cases.

Both drivers translate the two modules with spirv-val clean.

AI-assisted. No game data: the fixture is hand-written and every number above is test output.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7162804266 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7162804266). Originally posted by [EvgHaze](https://github.com/EvgHaze) on 2026-11-25T12:45:06Z. --- Independent Apple check, including the per-device choice this PR introduces. ```text Machine: Apple M3, 10-core (MacBook Air 13", Mac15,13), macOS 27.0 (26A5406e), arm64 Drivers: MoltenVK 1.4.2 (Homebrew), ICD loaded directly, driver id 14, subgroup 4..32 KosmicKrisp, Mesa 26.3.1 (Homebrew), through the Vulkan loader, driver id 28, subgroup 32..32 Base: main `0d80bc5` + this diff applied cleanly Tools: Homebrew llvm-mc 23.1.4, SPIRV-Tools 1.4.363.0, AppleClang 21.0.0, CMake 4.4.4 ``` **The auto-selection reports what it should:** ```text MoltenVK {"device": "Apple M3", "driver_id": 14, "explicit_lod_bias": True, "per_vertex_inputs": False} KosmicKrisp {"device": "Apple M3", "driver_id": 28, "explicit_lod_bias": False, "per_vertex_inputs": False} ``` **`ps_ssharp`, with the choice made per device:** | Driver | `--explicit-lod-bias` | Result | |---|---|---| | MoltenVK 1.4.2 | on (auto) | **PASS**, 10 S#/T# cases, 4096 pixels each exact | | KosmicKrisp 26.3.1 | off (auto) | **PASS**, 10 S#/T# cases, 4096 pixels each exact | On main, MoltenVK fails this fixture on this machine (`point bias +1: (0,0): (1.0, 0.0, 0.502, 0.502)`), so the flag is what fixes it. **Negative control, the risk your design row names:** forcing `LEONIDA_EXPLICIT_LOD_BIAS=1` on KosmicKrisp fails exactly as documented — ```text FAIL ps_ssharp point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502) ``` so the per-device probe is load-bearing, not cosmetic: without it KosmicKrisp would count the bias twice and lose the ±0.3 cases. Both drivers translate the two modules with `spirv-val` clean. AI-assisted. No game data: the fixture is hand-written and every number above is test output.
GeorgiyDemo commented 2026-11-25 14:14:20 +00:00 (Migrated from github.com)

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


Adding a datapoint that makes the driver-id gate look OS-version-dependent: an Apple M5 Pro on macOS 26.7.3 (25G342) with the same MoltenVK 1.4.2 (driver id 14), base main 0d80bc5df, binaries from the build at 66d4f5aa3, Homebrew llvm-mc 23.1.4 / SPIRV-Tools 1.4.363:

  • vk_subgroup_info reports driver_id: 14, explicit_lod_bias: true — i.e. the auto path enables the flag.
  • main without the flag: ps_ssharp 8/8 PASS — on this macOS the sampler applies mipLodBias to the explicit-LOD sample, so the M3/macOS 27 premise does not hold here.
  • this head, auto flag on: FAIL point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502) — the same doubled-bias failure as the forced-on negative controls (KosmicKrisp here, and Mby159's forced-on AMD run). Reproduced 3/3.
  • LEONIDA_EXPLICIT_LOD_BIAS=0 at this head: PASS 10/10; KosmicKrisp, flag off by detection: PASS 10/10.

So "MoltenVK drops mipLodBias" is true on the macOS 27.0/M3 run above but false on macOS 26.7.3 with the identical MoltenVK version; driver_id == MOLTENVK alone turns a passing fixture red on 26.7.3. The auto choice needs a behavioural probe (or an OS/Metal-version condition) rather than the driver id.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7164969713 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7164969713). Originally posted by [GeorgiyDemo](https://github.com/GeorgiyDemo) on 2026-11-25T14:14:20Z. --- Adding a datapoint that makes the driver-id gate look OS-version-dependent: an Apple M5 Pro on **macOS 26.7.3 (25G342)** with the same **MoltenVK 1.4.2** (driver id 14), base `main` `0d80bc5df`, binaries from the build at `66d4f5aa3`, Homebrew llvm-mc 23.1.4 / SPIRV-Tools 1.4.363: - `vk_subgroup_info` reports `driver_id: 14`, `explicit_lod_bias: true` — i.e. the auto path enables the flag. - `main` **without** the flag: `ps_ssharp` **8/8 PASS** — on this macOS the sampler applies `mipLodBias` to the explicit-LOD sample, so the M3/macOS 27 premise does not hold here. - this head, **auto flag on**: **FAIL** `point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502)` — the same doubled-bias failure as the forced-on negative controls (KosmicKrisp here, and Mby159's forced-on AMD run). Reproduced 3/3. - `LEONIDA_EXPLICIT_LOD_BIAS=0` at this head: **PASS 10/10**; KosmicKrisp, flag off by detection: **PASS 10/10**. So "MoltenVK drops `mipLodBias`" is true on the macOS 27.0/M3 run above but false on macOS 26.7.3 with the identical MoltenVK version; `driver_id == MOLTENVK` alone turns a passing fixture red on 26.7.3. The auto choice needs a behavioural probe (or an OS/Metal-version condition) rather than the driver id. AI-assisted; synthetic fixtures only, no game data.
EvgHaze commented 2026-11-25 14:35:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-25T14:35:34Z.


Confirming the other half of what @GeorgiyDemo describes, from the macOS 27.0 side, and agreeing the gate has to be behavioural.

My run, which the comment above quotes as "the macOS 27.0/M3 run": Apple M3, macOS 27.0 (26A5406e), MoltenVK 1.4.2 (Homebrew), driver_id: 14, base 0d80bc5df:

Result
main without the flag FAIL ps_ssharp — point bias +1: (0,0): (1.0, 0.0, 0.502, 0.502)
this head, auto flag on PASS 10 S#/T# cases, 4096 pixels each exact
KosmicKrisp, flag off by detection PASS 10/10
KosmicKrisp, LEONIDA_EXPLICIT_LOD_BIAS=1 forced FAIL point bias +0.3, the doubled bias

So the same driver_id 14 gives opposite answers on 26.7.3 and 27.0, and both directions are reproducible. driver_id == MOLTENVK is necessary but not sufficient.

For the probe, the cheapest shape that cannot lie is to sample with a known bias and read the returned LOD, the way ps_ssharp does, with a 1×1 chain: build a 2-mip texture, sample with image_sample_lz at Lod = 0 and mipLodBias = +1, and compare the returned texel against level 1. That is one vk_compute_test-sized program, no game data, and it answers the question on whichever macOS/Metal combination the user actually has, instead of encoding a version table.

If you want, I can write that probe into tools/vk_subgroup_info.py and test it on both sides — 27.0 here, and I can ask for a 26.7.3 run from the comment above.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7165514474 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7165514474). Originally posted by [EvgHaze](https://github.com/EvgHaze) on 2026-11-25T14:35:34Z. --- Confirming the other half of what @GeorgiyDemo describes, from the macOS 27.0 side, and agreeing the gate has to be behavioural. My run, which the comment above quotes as "the macOS 27.0/M3 run": Apple M3, **macOS 27.0 (26A5406e)**, MoltenVK 1.4.2 (Homebrew), `driver_id: 14`, base `0d80bc5df`: | | Result | |---|---| | `main` without the flag | **FAIL** `ps_ssharp` — `point bias +1: (0,0): (1.0, 0.0, 0.502, 0.502)` | | this head, auto flag on | **PASS** 10 S#/T# cases, 4096 pixels each exact | | KosmicKrisp, flag off by detection | **PASS** 10/10 | | KosmicKrisp, `LEONIDA_EXPLICIT_LOD_BIAS=1` forced | **FAIL** `point bias +0.3`, the doubled bias | So the same `driver_id 14` gives opposite answers on 26.7.3 and 27.0, and both directions are reproducible. `driver_id == MOLTENVK` is necessary but not sufficient. For the probe, the cheapest shape that cannot lie is to sample with a known bias and read the returned LOD, the way `ps_ssharp` does, with a 1×1 chain: build a 2-mip texture, sample with `image_sample_lz` at `Lod = 0` and `mipLodBias = +1`, and compare the returned texel against level 1. That is one `vk_compute_test`-sized program, no game data, and it answers the question on whichever macOS/Metal combination the user actually has, instead of encoding a version table. If you want, I can write that probe into `tools/vk_subgroup_info.py` and test it on both sides — 27.0 here, and I can ask for a 26.7.3 run from the comment above. AI-assisted.
Tauwni commented 2026-11-25 14:38:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-25T14:38:26Z.


Thanks, this is the key datapoint, and you're right that the driver-ID gate is wrong.

It doesn't look like an OS-version condition either, though. My M3 is on an older macOS than your M5 Pro and still drops the bias:

Machine macOS MoltenVK 1.4.2 applies mipLodBias?
Apple M3 (this PR) 26.5.1 (25F80) no, ps_ssharp fails on main
Apple M5 Pro (yours) 26.7.3 (25G342) yes, passes on main
Apple M3 (EvgHaze) 27.0 (26A5406e) no, fails on main

So it follows the GPU (or its Metal family) more than the OS, and any static rule (driver ID, OS version, chip list) will be wrong somewhere. I'm working on replacing the gate with the behavioural probe you suggested: a small tool that translates vs_ids and ps_ssharp without the flag, draws them with vk_sampler_test at LOD_BIAS 0, +1 and -1, and turns the flag on only when +1 and -1 read the no-bias levels. An inconclusive probe leaves it off.

It's still being tested here. I'll push it and post the results in this thread when it's done, and it would help if you could rerun --filter ps_ssharp on your M5 Pro then. Until then, please don't merge this PR as it is: the current head turns ps_ssharp red on your machine.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7165591245 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7165591245). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-25T14:38:26Z. --- Thanks, this is the key datapoint, and you're right that the driver-ID gate is wrong. It doesn't look like an OS-version condition either, though. My M3 is on an *older* macOS than your M5 Pro and still drops the bias: | Machine | macOS | MoltenVK 1.4.2 applies `mipLodBias`? | |---|---|---| | Apple M3 (this PR) | 26.5.1 (25F80) | no, `ps_ssharp` fails on `main` | | Apple M5 Pro (yours) | 26.7.3 (25G342) | yes, passes on `main` | | Apple M3 (EvgHaze) | 27.0 (26A5406e) | no, fails on `main` | So it follows the GPU (or its Metal family) more than the OS, and any static rule (driver ID, OS version, chip list) will be wrong somewhere. I'm working on replacing the gate with the behavioural probe you suggested: a small tool that translates `vs_ids` and `ps_ssharp` without the flag, draws them with `vk_sampler_test` at LOD_BIAS 0, +1 and -1, and turns the flag on only when +1 and -1 read the no-bias levels. An inconclusive probe leaves it off. It's still being tested here. I'll push it and post the results in this thread when it's done, and it would help if you could rerun `--filter ps_ssharp` on your M5 Pro then. Until then, please don't merge this PR as it is: the current head turns `ps_ssharp` red on your machine. AI-assisted (Claude Code).
Tauwni commented 2026-11-25 15:03:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-25T15:03:21Z.


Thanks! The probe you describe is in the update I just pushed (66b27ac6e, see the Update section above): tools/lod_bias_probe.py draws ps_ssharp without the flag at LOD_BIAS 0, +1 and -1 on the two-level texture and turns the flag on only when +1 and -1 read the no-bias levels. On my M3 (26.5.1) it answers true on MoltenVK and false on KosmicKrisp and llvmpipe. A rerun on your 27.0 M3 would be very welcome.

Your idea of putting it in tools/vk_subgroup_info.py has a real advantage over mine: it wouldn't need the built test programs, so make_game.py and build.py could probe too (two of the "Still open" points). If you'd like to write that version, go ahead and I'll test it here; otherwise I'll look at it this evening. Either way, let's say who does it here so we don't both write it.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7166232432 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7166232432). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-25T15:03:21Z. --- Thanks! The probe you describe is in the update I just pushed (`66b27ac6e`, see the Update section above): `tools/lod_bias_probe.py` draws `ps_ssharp` without the flag at LOD_BIAS 0, +1 and -1 on the two-level texture and turns the flag on only when +1 and -1 read the no-bias levels. On my M3 (26.5.1) it answers `true` on MoltenVK and `false` on KosmicKrisp and llvmpipe. A rerun on your 27.0 M3 would be very welcome. Your idea of putting it in `tools/vk_subgroup_info.py` has a real advantage over mine: it wouldn't need the built test programs, so `make_game.py` and `build.py` could probe too (two of the "Still open" points). If you'd like to write that version, go ahead and I'll test it here; otherwise I'll look at it this evening. Either way, let's say who does it here so we don't both write it. AI-assisted (Claude Code).
EvgHaze commented 2026-11-25 15:46:29 +00:00 (Migrated from github.com)

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


Rerun on the 27.0 M3, as asked.

Machine:  Apple M3, 10-core, macOS 27.0 (26A5406e), arm64
Tree:     `0d80bc5` + this head (`66b27ac6e`), runtime built at `runtime/build`
Tools:    Homebrew llvm-mc 23.1.4 on PATH, SPIRV-Tools 1.4.363.0, Python 3.13.7
MoltenVK 1.4.2   {"explicit_lod_bias": true,  "reason": "the sampler drops LOD_BIAS: +1 and -1 read the no-bias levels"}
KosmicKrisp      {"explicit_lod_bias": false, "reason": "the sampler applies LOD_BIAS +1 and -1"}

So the probe answers true on this 27.0 M3 too, which is what ps_ssharp needs here (main fails without the flag, 10/10 with it). Together with @GeorgiyDemo's 26.7.3 run, that is the two sides the driver-id gate got wrong, and the behavioural probe now gets both right.

One thing to keep in mind if the probe ships: lod_bias_probe.py needs llvm-mc on PATH, and Homebrew's llvm is keg-only, so a Mac user hitting it first sees the raw 'llvm-mc' could not be started message. Cheap fix in the tool's error text (point at llvm/tools/mc_command.py's message, which already says LLVM_MC="$(brew --prefix llvm)/bin/llvm-mc"), and worth doing so the probe is not blamed for being broken.

On ownership: you take the vk_subgroup_info.py version this evening — I would rather not start it and have us both write it. I will test whatever you push on this 27.0 M3 and on KosmicKrisp, and I can ask the 26.7.3 machine in the comment above to run it too. If you would rather I write it, say so and I will start, but the split above is the safer one.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7167304819 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7167304819). Originally posted by [EvgHaze](https://github.com/EvgHaze) on 2026-11-25T15:46:29Z. --- Rerun on the 27.0 M3, as asked. ```text Machine: Apple M3, 10-core, macOS 27.0 (26A5406e), arm64 Tree: `0d80bc5` + this head (`66b27ac6e`), runtime built at `runtime/build` Tools: Homebrew llvm-mc 23.1.4 on PATH, SPIRV-Tools 1.4.363.0, Python 3.13.7 ``` ```text MoltenVK 1.4.2 {"explicit_lod_bias": true, "reason": "the sampler drops LOD_BIAS: +1 and -1 read the no-bias levels"} KosmicKrisp {"explicit_lod_bias": false, "reason": "the sampler applies LOD_BIAS +1 and -1"} ``` So the probe answers `true` on this 27.0 M3 too, which is what `ps_ssharp` needs here (main fails without the flag, 10/10 with it). Together with @GeorgiyDemo's 26.7.3 run, that is the two sides the driver-id gate got wrong, and the behavioural probe now gets both right. One thing to keep in mind if the probe ships: `lod_bias_probe.py` needs `llvm-mc` on `PATH`, and Homebrew's `llvm` is keg-only, so a Mac user hitting it first sees the raw `'llvm-mc' could not be started` message. Cheap fix in the tool's error text (point at `llvm/tools/mc_command.py`'s message, which already says `LLVM_MC="$(brew --prefix llvm)/bin/llvm-mc"`), and worth doing so the probe is not blamed for being broken. **On ownership:** you take the `vk_subgroup_info.py` version this evening — I would rather not start it and have us both write it. I will test whatever you push on this 27.0 M3 and on KosmicKrisp, and I can ask the 26.7.3 machine in the comment above to run it too. If you would rather I write it, say so and I will start, but the split above is the safer one. AI-assisted.
Tauwni commented 2026-11-25 18:31:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-25T18:31:05Z.


Thanks for the 27.0 rerun, and agreed on the split: I'll write the vk_subgroup_info.py version, so the probe no longer needs the built test programs, plus the clear llvm-mc message you suggest. I'll post here when it's pushed, with the M3 results, so you can run it on your 27.0 M3 and on KosmicKrisp.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7171015542 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7171015542). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-25T18:31:05Z. --- Thanks for the 27.0 rerun, and agreed on the split: I'll write the `vk_subgroup_info.py` version, so the probe no longer needs the built test programs, plus the clear `llvm-mc` message you suggest. I'll post here when it's pushed, with the M3 results, so you can run it on your 27.0 M3 and on KosmicKrisp. AI-assisted (Claude Code).
Tauwni commented 2026-11-25 20:18:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-25T20:18:20Z.


Update 2 is pushed (631a53832), see the top of the description. As discussed:

  • tools/vk_subgroup_info.py --lod-bias measures it in Python with one compute dispatch (tools/vk_lod_bias.py), with no built test programs, llvm-mc or SPIR-V tools. build.py and make_game.py use it too.
  • The draw fallback gives the Homebrew LLVM_MC hint when llvm-mc is missing.
  • Every sample form now has a GPU fixture (ps_ssharp_ld, _b, _cube, _3d, _c, _o), through new vk_sampler_test --cube/--3d/--dref modes.

On the M3 (26.5.1), all 7 ps_ssharp* pass on MoltenVK (probe true), KosmicKrisp and llvmpipe (probe false), and forcing the flag on the last two fails bias +0.3 as it should. With the open fixes merged, MoltenVK has no failure left.

@EvgHaze: a run on your 27.0 M3 (MoltenVK and KosmicKrisp) would be great. @GeorgiyDemo: on the M5 Pro, python -I tools/vk_subgroup_info.py --lod-bias should answer "explicit_lod_bias": false, and --filter ps_ssharp should pass all 7 with the flag off. Thanks both.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7173471928 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7173471928). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-25T20:18:20Z. --- Update 2 is pushed (`631a53832`), see the top of the description. As discussed: - `tools/vk_subgroup_info.py --lod-bias` measures it in Python with one compute dispatch (`tools/vk_lod_bias.py`), with no built test programs, llvm-mc or SPIR-V tools. `build.py` and `make_game.py` use it too. - The draw fallback gives the Homebrew `LLVM_MC` hint when `llvm-mc` is missing. - Every sample form now has a GPU fixture (`ps_ssharp_ld`, `_b`, `_cube`, `_3d`, `_c`, `_o`), through new `vk_sampler_test --cube/--3d/--dref` modes. On the M3 (26.5.1), all 7 `ps_ssharp*` pass on MoltenVK (probe `true`), KosmicKrisp and llvmpipe (probe `false`), and forcing the flag on the last two fails `bias +0.3` as it should. With the open fixes merged, MoltenVK has no failure left. @EvgHaze: a run on your 27.0 M3 (MoltenVK and KosmicKrisp) would be great. @GeorgiyDemo: on the M5 Pro, `python -I tools/vk_subgroup_info.py --lod-bias` should answer `"explicit_lod_bias": false`, and `--filter ps_ssharp` should pass all 7 with the flag off. Thanks both. AI-assisted (Claude Code).
aslan2142 commented 2026-11-25 21:47:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T21:47:25Z.


Thanks for Update 2! Three things before this can merge:

  • Conflict: it now conflicts with main in tools/vk_subgroup_info.py, after #624 landed. Please merge main in.
  • Dead code: in make_game.py, runtime_gpu_explicit_lod_bias() has a second try block after the first, which always returns. It's unreachable and uses an undefined build; please drop it.
  • Reruns: waiting for the M3 (27.0) and M5 Pro runs you asked for.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7175541475 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7175541475). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T21:47:25Z. --- Thanks for Update 2! Three things before this can merge: - **Conflict:** it now conflicts with `main` in `tools/vk_subgroup_info.py`, after #624 landed. Please merge `main` in. - **Dead code:** in `make_game.py`, `runtime_gpu_explicit_lod_bias()` has a second `try` block after the first, which always returns. It's unreachable and uses an undefined `build`; please drop it. - **Reruns:** waiting for the M3 (27.0) and M5 Pro runs you asked for. AI-assisted (Claude Code, Claude Opus 5.5).
Tauwni commented 2026-11-25 23:22:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-25T23:22:22Z.


@aslan2142 thanks, both done, in your order:

  • Conflict: main is merged in (b14565930, up to 21d3662ad). #624 had added chosen_d / chosen_extensions for what my chosen_dev did, so I kept main's and the --lod-bias measurement now uses them. It looks the extensions up itself rather than through exts, which is only set when per_vertex is true.
  • Dead code: the unreachable second try in runtime_gpu_explicit_lod_bias() is removed (3fc618429), and nothing else in make_game.py changes.

Rerun at 3fc618429 on the Apple M3 (macOS 26.5.1):

  • The probe answers true on MoltenVK and false on KosmicKrisp and llvmpipe.
  • The ps_ssharp* fixtures pass in auto mode on all three, and forcing the flag off or on fails as documented.
  • ctest 101/101; translator suite 6325 tests, 0 failed; docs tests OK.
  • No failure that main doesn't also have. ctest needs #2096 today: without it, the build stops at vk_null_descriptor_test's missing generated/.

The 27.0 M3 and M5 Pro reruns are still pending.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7177470404 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7177470404). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-25T23:22:22Z. --- @aslan2142 thanks, both done, in your order: - **Conflict:** `main` is merged in (`b14565930`, up to `21d3662ad`). #624 had added `chosen_d` / `chosen_extensions` for what my `chosen_dev` did, so I kept `main`'s and the `--lod-bias` measurement now uses them. It looks the extensions up itself rather than through `exts`, which is only set when `per_vertex` is true. - **Dead code:** the unreachable second `try` in `runtime_gpu_explicit_lod_bias()` is removed (`3fc618429`), and nothing else in `make_game.py` changes. Rerun at `3fc618429` on the Apple M3 (macOS 26.5.1): - The probe answers `true` on MoltenVK and `false` on KosmicKrisp and llvmpipe. - The `ps_ssharp*` fixtures pass in auto mode on all three, and forcing the flag off or on fails as documented. - ctest 101/101; translator suite 6325 tests, 0 failed; docs tests OK. - No failure that `main` doesn't also have. ctest needs #2096 today: without it, the build stops at `vk_null_descriptor_test`'s missing `generated/`. The 27.0 M3 and M5 Pro reruns are still pending. AI-assisted (Claude Code).
aslan2142 commented 2026-11-26 00:57:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-26T00:57:44Z.


Thanks, the merge and the dead-code fix both look good: it merges cleanly and the translator suite passes.

Before merging:

  • Reruns: the M5 Pro (vk_subgroup_info.py --lod-bias should answer false) and the 27.0 M3 with the compute probe. The 27.0 result in the thread is from the draw probe.
  • macOS CI: EXPECTED_FAILURES in runtime.yml still lists ps_ssharp. Once the job runs, drop it if the runner's probe answers true, or add the new ps_ssharp_* fixtures if they fail there.
  • Probe control: vk_lod_bias.py answers true whenever the biased read is 0.0, which a level 1 that was never cleared also gives. Could you add a plain read at explicit LOD 1 that must return 1.0, and answer null otherwise?
  • Clamp order: outside the PS, image_sample_cl / image_sample_c_cl get max(0, minlod) + bias. Vulkan clamps after the bias, max(bias, minlod), as _b_cl already does.
  • design.md: "Confirmed on two Apple M3s" should say that 27.0 checked the draw probe, until it's rerun.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7179287145 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7179287145). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-26T00:57:44Z. --- Thanks, the merge and the dead-code fix both look good: it merges cleanly and the translator suite passes. Before merging: - **Reruns:** the M5 Pro (`vk_subgroup_info.py --lod-bias` should answer `false`) and the 27.0 M3 with the compute probe. The 27.0 result in the thread is from the draw probe. - **macOS CI:** `EXPECTED_FAILURES` in `runtime.yml` still lists `ps_ssharp`. Once the job runs, drop it if the runner's probe answers `true`, or add the new `ps_ssharp_*` fixtures if they fail there. - **Probe control:** `vk_lod_bias.py` answers `true` whenever the biased read is 0.0, which a level 1 that was never cleared also gives. Could you add a plain read at explicit LOD 1 that must return 1.0, and answer `null` otherwise? - **Clamp order:** outside the PS, `image_sample_cl` / `image_sample_c_cl` get `max(0, minlod) + bias`. Vulkan clamps after the bias, `max(bias, minlod)`, as `_b_cl` already does. - **design.md:** "Confirmed on two Apple M3s" should say that 27.0 checked the draw probe, until it's rerun. AI-assisted (Claude Code, Claude Opus 5.5).
Tauwni commented 2026-11-26 01:45:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T01:45:17Z.


@aslan2142 thanks, done in your order:

  • Reruns: still pending: the M5 Pro (vk_subgroup_info.py --lod-bias should answer false) and the 27.0 M3 with the compute probe. @GeorgiyDemo @EvgHaze, when you have a moment, please rerun at the new head.
  • macOS CI: the macOS job hasn't run on this PR yet, because its workflows are awaiting a maintainer's approval. Once it runs, I'll drop ps_ssharp from EXPECTED_FAILURES if the runner's probe answers true, or add the ps_ssharp_* fixtures that fail there.
  • Probe control (1787a81c7): the shader also reads at explicit LOD 1 with no bias, and verdict() answers null unless that read is 1.0. On this M3, skipping the level 1 clear now gives null on all three drivers ("control read at LOD 1 gave 0.0"), where it used to give true on MoltenVK. New test: test_the_lod1_control_must_read_one.
  • Clamp order (85eac6b54): outside the PS, image_sample_cl / image_sample_c_cl now add the S# bias before the clamp, max(0 + bias, minlod), as _b_cl does. New semantic test: test_compute_cl_clamps_after_the_bias. It fails on the previous head.
  • design.md (eb464f2fc): it now says the 27.0 M3 checked the draw probe until it's rerun, and it describes the LOD 1 control and the clamp order.

I also merged main again (a88bb83e0, up to ad41fd517), because #2098 changed something this PR depends on: a tagged module now reads its instruction's array only when the table entry's kind names it. vk_sampler_test tagged the T# 2D only, so after the merge ps_ssharp_cube and ps_ssharp_3d read the magenta fallback. 743eda012 tags the array the texture sits in for --cube / --3d.

Rerun at 743eda012 on the Apple M3 (macOS 26.5.1):

  • The probe answers true on MoltenVK and false on KosmicKrisp and llvmpipe.
  • The ps_ssharp* fixtures pass in auto mode on all three, and forcing the flag off or on fails as documented.
  • ctest 106/106; translator suite 6341 tests, 0 failed; docs tests OK.
  • run_gpu_tests.py: no failure that main doesn't also have. ps_array_resinfo and ps_get_lod_array fail on main too since #2098, on every driver; #2169 fixes them.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7180092060 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7180092060). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-26T01:45:17Z. --- @aslan2142 thanks, done in your order: - **Reruns:** still pending: the M5 Pro (`vk_subgroup_info.py --lod-bias` should answer `false`) and the 27.0 M3 with the compute probe. @GeorgiyDemo @EvgHaze, when you have a moment, please rerun at the new head. - **macOS CI:** the macOS job hasn't run on this PR yet, because its workflows are awaiting a maintainer's approval. Once it runs, I'll drop `ps_ssharp` from `EXPECTED_FAILURES` if the runner's probe answers `true`, or add the `ps_ssharp_*` fixtures that fail there. - **Probe control** (`1787a81c7`): the shader also reads at explicit LOD 1 with no bias, and `verdict()` answers `null` unless that read is 1.0. On this M3, skipping the level 1 clear now gives `null` on all three drivers ("control read at LOD 1 gave 0.0"), where it used to give `true` on MoltenVK. New test: `test_the_lod1_control_must_read_one`. - **Clamp order** (`85eac6b54`): outside the PS, `image_sample_cl` / `image_sample_c_cl` now add the S# bias before the clamp, `max(0 + bias, minlod)`, as `_b_cl` does. New semantic test: `test_compute_cl_clamps_after_the_bias`. It fails on the previous head. - **design.md** (`eb464f2fc`): it now says the 27.0 M3 checked the draw probe until it's rerun, and it describes the LOD 1 control and the clamp order. I also merged `main` again (`a88bb83e0`, up to `ad41fd517`), because #2098 changed something this PR depends on: a tagged module now reads its instruction's array only when the table entry's kind names it. `vk_sampler_test` tagged the T# 2D only, so after the merge `ps_ssharp_cube` and `ps_ssharp_3d` read the magenta fallback. `743eda012` tags the array the texture sits in for `--cube` / `--3d`. Rerun at `743eda012` on the Apple M3 (macOS 26.5.1): - The probe answers `true` on MoltenVK and `false` on KosmicKrisp and llvmpipe. - The `ps_ssharp*` fixtures pass in auto mode on all three, and forcing the flag off or on fails as documented. - ctest 106/106; translator suite 6341 tests, 0 failed; docs tests OK. - `run_gpu_tests.py`: no failure that `main` doesn't also have. `ps_array_resinfo` and `ps_get_lod_array` fail on `main` too since #2098, on every driver; #2169 fixes them. AI-assisted (Claude Code).
EvgHaze commented 2026-11-26 04:28:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-26T04:28:10Z.


Rerun at 743eda012, the head that merged main again, on the 27.0 M3 — so the "checked until it is rerun" note in design.md can go.

Machine:  Apple M3, 10-core, macOS 27.0 (26A5406e), arm64
Tree:     Tauwni/leonida `fix/explicit-lod-bias-moltenvk` @ 743eda012, clean clone, `runtime/build` (35 `vk_*` tools)
Tools:    Homebrew llvm-mc 23.1.6, SPIRV-Tools 1.4.363.0, AppleClang 21.0.0, CMake 4.4.4

vk_subgroup_info.py --lod-bias, MoltenVK 1.4.2 — the new flag answers and explains:

"driver_id": 14, "explicit_lod_bias": true,
"explicit_lod_bias_reason": "the sampler drops mipLodBias (+1 still reads level 0)"

tools/lod_bias_probe.py, three drivers on the same machine:

Driver Verdict Reason
MoltenVK 1.4.2 true the sampler drops mipLodBias (+1 still reads level 0)
KosmicKrisp 26.3.1 false the sampler applies mipLodBias (+1 reads level 1)
llvmpipe (Mesa 26.3.1) false the sampler applies mipLodBias (+1 reads level 1)

run_gpu_tests.py --filter ps_ssharp, auto mode, all three drivers: 6/6 PASS on each — ps_ssharp, _3d, _b, _c, _cube, _ld, 10 S#/T# cases each, 4096 pixels each exact.

So this head reproduces your 26.5.1 M3 result on 27.0, and the cube/3d tagging fix (743eda012) holds here — ps_ssharp_cube and ps_ssharp_3d read the real arrays rather than the magenta fallback.

That is the full set you asked for from this machine; I did not rerun the whole GPU suite or ctest, since your run already covers those and this head changes no C++ that the probe and the fixtures do not exercise.

@GeorgiyDemo the 26.7.3 side is still the one missing — that is the pair that decides the gate, since 26.7.3 is where main passes without the flag.

AI-assisted. No game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7182622191 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7182622191). Originally posted by [EvgHaze](https://github.com/EvgHaze) on 2026-11-26T04:28:10Z. --- Rerun at `743eda012`, the head that merged `main` again, on the 27.0 M3 — so the "checked until it is rerun" note in `design.md` can go. ```text Machine: Apple M3, 10-core, macOS 27.0 (26A5406e), arm64 Tree: Tauwni/leonida `fix/explicit-lod-bias-moltenvk` @ 743eda012, clean clone, `runtime/build` (35 `vk_*` tools) Tools: Homebrew llvm-mc 23.1.6, SPIRV-Tools 1.4.363.0, AppleClang 21.0.0, CMake 4.4.4 ``` **`vk_subgroup_info.py --lod-bias`**, MoltenVK 1.4.2 — the new flag answers and explains: ```text "driver_id": 14, "explicit_lod_bias": true, "explicit_lod_bias_reason": "the sampler drops mipLodBias (+1 still reads level 0)" ``` **`tools/lod_bias_probe.py`**, three drivers on the same machine: | Driver | Verdict | Reason | |---|---|---| | MoltenVK 1.4.2 | **true** | the sampler drops `mipLodBias` (+1 still reads level 0) | | KosmicKrisp 26.3.1 | **false** | the sampler applies `mipLodBias` (+1 reads level 1) | | llvmpipe (Mesa 26.3.1) | **false** | the sampler applies `mipLodBias` (+1 reads level 1) | **`run_gpu_tests.py --filter ps_ssharp`**, auto mode, all three drivers: **6/6 PASS on each** — `ps_ssharp`, `_3d`, `_b`, `_c`, `_cube`, `_ld`, 10 S#/T# cases each, 4096 pixels each exact. So this head reproduces your 26.5.1 M3 result on 27.0, and the cube/3d tagging fix (`743eda012`) holds here — `ps_ssharp_cube` and `ps_ssharp_3d` read the real arrays rather than the magenta fallback. That is the full set you asked for from this machine; I did not rerun the whole GPU suite or ctest, since your run already covers those and this head changes no C++ that the probe and the fixtures do not exercise. @GeorgiyDemo the 26.7.3 side is still the one missing — that is the pair that decides the gate, since 26.7.3 is where `main` passes without the flag. AI-assisted. No game data.
Tauwni commented 2026-11-26 05:47:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T05:47:42Z.


@EvgHaze thanks for the rerun. bcf199736 drops the "until it is rerun" note: design.md now says the compute probe answers true on both M3s (26.5.1 and 27.0, MoltenVK 1.4.2) and false on KosmicKrisp and llvmpipe, and that ps_ssharp and its five variants pass in auto mode on all three drivers on the 27.0 machine. Docs only, no code change.

What is still open is the M5 Pro on 26.7.3, as you said.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7183811428 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7183811428). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-26T05:47:42Z. --- @EvgHaze thanks for the rerun. `bcf199736` drops the "until it is rerun" note: `design.md` now says the compute probe answers true on both M3s (26.5.1 and 27.0, MoltenVK 1.4.2) and false on KosmicKrisp and llvmpipe, and that `ps_ssharp` and its five variants pass in auto mode on all three drivers on the 27.0 machine. Docs only, no code change. What is still open is the M5 Pro on 26.7.3, as you said.
Tauwni commented 2026-11-26 10:56:30 +00:00 (Migrated from github.com)

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


@GeorgiyDemo When you have a moment on the M5 Pro (macOS 26.7.3), could you run this head (bcf199736)? It is the last result this PR is waiting for. Both M3s, on macOS 26.5.1 and 27.0, are done.

python3 -I tools/vk_subgroup_info.py --lod-bias
python3 -I scripts/run_gpu_tests.py --filter ps_ssharp

On your machine the probe should answer "explicit_lod_bias": false, since MoltenVK applies mipLodBias there. The six ps_ssharp* fixtures should pass in auto mode. If the probe answers true instead, its explicit_lod_bias_reason line is the useful part. Thanks!

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7190043072 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7190043072). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-26T10:56:30Z. --- @GeorgiyDemo When you have a moment on the M5 Pro (macOS 26.7.3), could you run this head (`bcf199736`)? It is the last result this PR is waiting for. Both M3s, on macOS 26.5.1 and 27.0, are done. ```bash python3 -I tools/vk_subgroup_info.py --lod-bias python3 -I scripts/run_gpu_tests.py --filter ps_ssharp ``` On your machine the probe should answer `"explicit_lod_bias": false`, since MoltenVK applies `mipLodBias` there. The six `ps_ssharp*` fixtures should pass in auto mode. If the probe answers true instead, its `explicit_lod_bias_reason` line is the useful part. Thanks! AI-assisted (Claude Code).
Tauwni commented 2026-11-26 14:02:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T14:02:12Z.


Apple M5 result for this head, run by cizerter (on Discord) on their machine. I'm relaying it, and thanks to cizerter for the run.

Machine:  Apple M5, macOS 26.6.2
Tree:     bcf199736 (this PR's head)
Driver:   the default one (MoltenVK, loaded directly)

tools/vk_subgroup_info.py --lod-bias

"explicit_lod_bias": false
"explicit_lod_bias_reason": "the sampler applies mipLodBias (+1 reads level 1)"

scripts/run_gpu_tests.py --filter ps_ssharp, auto mode

8 shaders: 8 translated, 8 pass spirv-val
  PASS  ps_ssharp             10 S#/T# cases, 4096 pixels each exact
  PASS  ps_ssharp_3d          10 S#/T# cases, 4096 pixels each exact
  PASS  ps_ssharp_b           10 S#/T# cases, 4096 pixels each exact
  PASS  ps_ssharp_c           10 S#/T# cases, 4096 pixels each exact
  PASS  ps_ssharp_cube        10 S#/T# cases, 4096 pixels each exact
  PASS  ps_ssharp_ld          10 S#/T# cases, 4096 pixels each exact
  SKIP  ps_ssharp_o           SKIP (needs LEONIDA_TEXOFF_FALLBACK=1: vk_sampler_test enables no VK_KHR_maintenance8)
6/7 passed, 1 skipped

So the measured answer is false on the M5, as on the M5 Pro without the flag: MoltenVK applies mipLodBias there. The fixtures pass without --explicit-lod-bias, and only the M3s, where the probe answers true, get the in-shader bias. That is the false half of the gate on real Apple hardware.

The M5 Pro on 26.7.3 (@GeorgiyDemo) would still be a second false data point, but this one already covers the case that decides the gate.

AI-assisted (Claude Code). No game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7194185558 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7194185558). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-26T14:02:12Z. --- Apple M5 result for this head, run by cizerter (on Discord) on their machine. I'm relaying it, and thanks to cizerter for the run. ```text Machine: Apple M5, macOS 26.6.2 Tree: bcf199736 (this PR's head) Driver: the default one (MoltenVK, loaded directly) ``` **`tools/vk_subgroup_info.py --lod-bias`** ```text "explicit_lod_bias": false "explicit_lod_bias_reason": "the sampler applies mipLodBias (+1 reads level 1)" ``` **`scripts/run_gpu_tests.py --filter ps_ssharp`**, auto mode ```text 8 shaders: 8 translated, 8 pass spirv-val PASS ps_ssharp 10 S#/T# cases, 4096 pixels each exact PASS ps_ssharp_3d 10 S#/T# cases, 4096 pixels each exact PASS ps_ssharp_b 10 S#/T# cases, 4096 pixels each exact PASS ps_ssharp_c 10 S#/T# cases, 4096 pixels each exact PASS ps_ssharp_cube 10 S#/T# cases, 4096 pixels each exact PASS ps_ssharp_ld 10 S#/T# cases, 4096 pixels each exact SKIP ps_ssharp_o SKIP (needs LEONIDA_TEXOFF_FALLBACK=1: vk_sampler_test enables no VK_KHR_maintenance8) 6/7 passed, 1 skipped ``` So the measured answer is false on the M5, as on the M5 Pro without the flag: MoltenVK applies `mipLodBias` there. The fixtures pass without `--explicit-lod-bias`, and only the M3s, where the probe answers true, get the in-shader bias. That is the false half of the gate on real Apple hardware. The M5 Pro on 26.7.3 (@GeorgiyDemo) would still be a second false data point, but this one already covers the case that decides the gate. AI-assisted (Claude Code). No game data.
Tauwni commented 2026-11-26 23:51:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T23:51:03Z.


Merged main (d1dff7949) for the needs rebase label: 0dcf650d1. The only conflict was the global line in rdna2spirv.py's main(), where main added ADDRESS_GUARD next to this PR's EXPLICIT_LOD_BIAS. Both are kept.

Retested at 0dcf650d1 on an Apple M3 (macOS 26.5.1), test programs rebuilt from this tree:

  • --lod-bias probe: true on MoltenVK 1.4.2, false on KosmicKrisp and llvmpipe (Mesa 26.3.1), as before.
  • run_gpu_tests.py --filter ps_ssharp: 6/6 pass on all three (ps_ssharp_o skips without LEONIDA_TEXOFF_FALLBACK=1).
  • The full MoltenVK suite: 202/275 passed, 71 skipped. The two failures are cs_fma_fused (#1724) and cs_imgatomic_ext (#1518).
  • Semantic suite: 501 files, 6382 tests, 0 failed. test_vk_lod_bias.py, test_vk_subgroup_info.py and test_make_game_translator_flags.py pass.

No change to the PR's own code.

AI-assisted (Claude Code). No game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7205921167 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1774#issuecomment-7205921167). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-26T23:51:03Z. --- Merged `main` (`d1dff7949`) for the *needs rebase* label: `0dcf650d1`. The only conflict was the `global` line in `rdna2spirv.py`'s `main()`, where `main` added `ADDRESS_GUARD` next to this PR's `EXPLICIT_LOD_BIAS`. Both are kept. Retested at `0dcf650d1` on an Apple M3 (macOS 26.5.1), test programs rebuilt from this tree: - `--lod-bias` probe: true on MoltenVK 1.4.2, false on KosmicKrisp and llvmpipe (Mesa 26.3.1), as before. - `run_gpu_tests.py --filter ps_ssharp`: 6/6 pass on all three (`ps_ssharp_o` skips without `LEONIDA_TEXOFF_FALLBACK=1`). - The full MoltenVK suite: 202/275 passed, 71 skipped. The two failures are `cs_fma_fused` (#1724) and `cs_imgatomic_ext` (#1518). - Semantic suite: 501 files, 6382 tests, 0 failed. `test_vk_lod_bias.py`, `test_vk_subgroup_info.py` and `test_make_game_translator_flags.py` pass. No change to the PR's own code. AI-assisted (Claude Code). No game data.
lixonik commented 2026-11-28 08:49:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T08:49:39Z.

Review: APPROVED


Reviewed the diff and tested merged onto main (493867366) with Ninja Release (MSVC).

The --explicit-lod-bias translator pass, Vulkan sampler mipLodBias probe, and semantic/unit test coverage are clean and well structured.

Tests run

  • cmake --build <build> --target vk_sampler_test: built cleanly with MSVC Release.
  • python -I tools/vk_subgroup_info.py --lod-bias on real Vulkan hardware: exited 0 with "explicit_lod_bias": false, "explicit_lod_bias_reason": "the sampler applies mipLodBias (+1 reads level 1)".
  • python -m unittest across test_lod_bias_probe.py, test_vk_lod_bias.py, test_vk_subgroup_info.py, test_make_game_argparse.py, test_make_game_translator_flags.py, and test_shader_checks.py: 236 passed (1 skipped).
  • python -m unittest discover -s tests/semantic -p test_explicit_lod_bias.py -v: 8/8 passed (0.239 s).
  • Note: llvm-mc / spirv-val are not installed locally, so the ps_ssharp_*.asm GPU shader assembly checks were not executed locally.

GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341; VK_LAYER_KHRONOS_validation not installed locally).

AI-assisted (Antigravity, Gemini).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6096830614 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#pullrequestreview-6096830614). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-28T08:49:39Z. **Review:** APPROVED --- Reviewed the diff and tested merged onto `main` (`493867366`) with Ninja Release (MSVC). The `--explicit-lod-bias` translator pass, Vulkan sampler `mipLodBias` probe, and semantic/unit test coverage are clean and well structured. ### Tests run - `cmake --build <build> --target vk_sampler_test`: built cleanly with MSVC Release. - `python -I tools/vk_subgroup_info.py --lod-bias` on real Vulkan hardware: exited 0 with `"explicit_lod_bias": false, "explicit_lod_bias_reason": "the sampler applies mipLodBias (+1 reads level 1)"`. - `python -m unittest` across `test_lod_bias_probe.py`, `test_vk_lod_bias.py`, `test_vk_subgroup_info.py`, `test_make_game_argparse.py`, `test_make_game_translator_flags.py`, and `test_shader_checks.py`: **236 passed** (1 skipped). - `python -m unittest discover -s tests/semantic -p test_explicit_lod_bias.py -v`: **8/8 passed** (0.239 s). - Note: `llvm-mc` / `spirv-val` are not installed locally, so the `ps_ssharp_*.asm` GPU shader assembly checks were not executed locally. GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341; VK_LAYER_KHRONOS_validation not installed locally). AI-assisted (Antigravity, Gemini).
timbot103 commented 2026-11-28 13:23:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T13:23:07Z.

Review: APPROVED


Independently verified 3a7dc6126 merged cleanly onto main (d48a957bb) on Windows 11 across two Vulkan GPUs (zero game files):

  • NVIDIA GeForce RTX 5080 (driver 32.0.16.1664)
  • AMD Radeon(TM) Graphics (gfx1036) (driver 32.0.21030.2001)

(Note: MoltenVK/macOS itself was not exercised on this Windows host; the --explicit-lod-bias lowering and probe logic are verified via the semantic/unit suites, and the non-MoltenVK Vulkan auto-probe and GPU sampler paths are verified live on both desktop drivers.)

Red on main (d48a957bb) control:

  • tests/semantic/test_explicit_lod_bias.py fails (8 tests / 9 errors: AttributeError: module 'rdna2spirv' has no attribute 'EXPLICIT_LOD_BIAS').
  • python -B -m unittest tests/test_lod_bias_probe.py tests/test_vk_lod_bias.py tests/test_vk_subgroup_info.py tests/test_make_game_argparse.py tests/test_make_game_translator_flags.py fails (132 tests / 20 errors: make_game lacks runtime_gpu_explicit_lod_bias).

Green on #1774 (3a7dc6126):

  • scripts/run_semantic_tests.py tests/semantic -p test_explicit_lod_bias.py: 8/8 passed.
  • Unit suite (test_lod_bias_probe.py, test_vk_lod_bias.py, test_vk_subgroup_info.py, test_shader_checks.py, test_make_game_argparse.py, test_make_game_translator_flags.py): 237/237 passed (OK).
  • Live tools/lod_bias_probe.py on both RTX 5080 and AMD Radeon gfx1036: returns {"explicit_lod_bias": false, "reason": "the sampler applies mipLodBias (+1 reads level 1)"}.
  • Live scripts/run_gpu_tests.py --filter ps_ssharp --require-pass (auto mode, LEONIDA_TEXOFF_FALLBACK=1): 7/7 passed (ps_ssharp, ps_ssharp_3d, ps_ssharp_b, ps_ssharp_c, ps_ssharp_cube, ps_ssharp_ld, ps_ssharp_o, 10 S#/T# cases, 4096 pixels each exact) on both RTX 5080 and AMD Radeon gfx1036.
  • Forced-on negative check (LEONIDA_EXPLICIT_LOD_BIAS=1): 0/7 passed, 1 skipped (point bias +0.3 double-applied on both GPUs, confirming both drivers apply sampler mipLodBias natively and the auto-probe correctly keeps --explicit-lod-bias disabled on both).

LGTM.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6098008562 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#pullrequestreview-6098008562). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-28T13:23:07Z. **Review:** APPROVED --- Independently verified `3a7dc6126` merged cleanly onto `main` (`d48a957bb`) on Windows 11 across two Vulkan GPUs (zero game files): - **NVIDIA GeForce RTX 5080** (driver `32.0.16.1664`) - **AMD Radeon(TM) Graphics (`gfx1036`)** (driver `32.0.21030.2001`) *(Note: MoltenVK/macOS itself was not exercised on this Windows host; the `--explicit-lod-bias` lowering and probe logic are verified via the semantic/unit suites, and the non-MoltenVK Vulkan auto-probe and GPU sampler paths are verified live on both desktop drivers.)* **Red on `main` (`d48a957bb`) control:** - `tests/semantic/test_explicit_lod_bias.py` fails (`8` tests / `9` errors: `AttributeError: module 'rdna2spirv' has no attribute 'EXPLICIT_LOD_BIAS'`). - `python -B -m unittest tests/test_lod_bias_probe.py tests/test_vk_lod_bias.py tests/test_vk_subgroup_info.py tests/test_make_game_argparse.py tests/test_make_game_translator_flags.py` fails (`132` tests / `20` errors: `make_game` lacks `runtime_gpu_explicit_lod_bias`). **Green on `#1774` (`3a7dc6126`):** - `scripts/run_semantic_tests.py tests/semantic -p test_explicit_lod_bias.py`: **8/8 passed**. - Unit suite (`test_lod_bias_probe.py`, `test_vk_lod_bias.py`, `test_vk_subgroup_info.py`, `test_shader_checks.py`, `test_make_game_argparse.py`, `test_make_game_translator_flags.py`): **237/237 passed (`OK`)**. - Live `tools/lod_bias_probe.py` on **both RTX 5080 and AMD Radeon `gfx1036`**: returns `{"explicit_lod_bias": false, "reason": "the sampler applies mipLodBias (+1 reads level 1)"}`. - Live `scripts/run_gpu_tests.py --filter ps_ssharp --require-pass` (auto mode, `LEONIDA_TEXOFF_FALLBACK=1`): **7/7 passed** (`ps_ssharp`, `ps_ssharp_3d`, `ps_ssharp_b`, `ps_ssharp_c`, `ps_ssharp_cube`, `ps_ssharp_ld`, `ps_ssharp_o`, `10 S#/T# cases, 4096 pixels each exact`) on **both RTX 5080 and AMD Radeon `gfx1036`**. - Forced-on negative check (`LEONIDA_EXPLICIT_LOD_BIAS=1`): **0/7 passed, 1 skipped** (`point bias +0.3` double-applied on both GPUs, confirming both drivers apply sampler `mipLodBias` natively and the auto-probe correctly keeps `--explicit-lod-bias` disabled on both). LGTM.
EvgHaze commented 2026-11-28 13:53:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-28T13:53:36Z.


Apple check — M3, both drivers, head 3a7dc612 (current main merged in).

Machine:  Apple M3 (Mac15,13), 8 cores
OS:       macOS 27.0 (26A5406e), arm64
Drivers:  MoltenVK 1.4.2, Mesa 26.3.1 (KosmicKrisp)
Commit:   3a7dc612 Merge remote-tracking branch 'origin/main' into fix/explicit-lod-bias-moltenvk
Tools:    llvm-mc 23.1.6, spirv-val 2026.4, cmake 4.4.4, python 3.13.7

Build:    ok
Semantic: 519 files, 6479 tests, 1 file failed: test_valu_cvt_f16_int16_mods
GPU:      MoltenVK   206/280 passed, 73 skipped
          KosmicKrisp 198/280 passed, 76 skipped

Versus main (fcbe97b9a) on the same machine:

main this head
Semantic 518 files / 6 471 tests / 1 failed 519 / 6 479 / the same one
MoltenVK 200/274 passed, 72 skipped — cs_imgatomic_ext and ps_ssharp 206/280 passed, 73 skipped — only cs_imgatomic_ext
KosmicKrisp 193/274 passed, 75 skipped — six failures 198/280 passed, 76 skipped — the same six

So the device probe picks up the M3/MoltenVK case on its own and ps_ssharp passes in auto mode, without LEONIDA_EXPLICIT_LOD_BIAS: the point bias +1 case that read (1.0, 0.0, 0.502, 0.502) on main now reads (0.502, 0.502, 0.502, 0.502). KosmicKrisp keeps the same six failures as main (cs_bvh, cs_bvh32, cs_fma_fused, cs_imgatomic_ext, ps_cndmask_sign_mods, ps_valu16_mad_sel), so the flag is not being forced where the sampler already applies the bias.

The semantic failure is not from this PR. test_valu_cvt_f16_int16_mods fails identically on main fcbe97b9a, and git bisect over 5b6ffd5a8..fcbe97b9a puts the first failing merge at b79595ecc (#435, "accept VOP3 clamp/omod as hardware no-op on v_cvt_{i16,u16}_f16"): it updated tests/semantic/test_alu_cvt_16.py but not the older test_valu_cvt_f16_int16_mods.py, which still expects Unsupported for those ops. 5b6ffd5a8 passes that file, fcbe97b9a fails it.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7240260046 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#issuecomment-7240260046). Originally posted by [EvgHaze](https://github.com/EvgHaze) on 2026-11-28T13:53:36Z. --- Apple check — M3, both drivers, head `3a7dc612` (current `main` merged in). ```text Machine: Apple M3 (Mac15,13), 8 cores OS: macOS 27.0 (26A5406e), arm64 Drivers: MoltenVK 1.4.2, Mesa 26.3.1 (KosmicKrisp) Commit: 3a7dc612 Merge remote-tracking branch 'origin/main' into fix/explicit-lod-bias-moltenvk Tools: llvm-mc 23.1.6, spirv-val 2026.4, cmake 4.4.4, python 3.13.7 Build: ok Semantic: 519 files, 6479 tests, 1 file failed: test_valu_cvt_f16_int16_mods GPU: MoltenVK 206/280 passed, 73 skipped KosmicKrisp 198/280 passed, 76 skipped ``` Versus `main` (`fcbe97b9a`) on the same machine: | | `main` | this head | |---|---|---| | Semantic | 518 files / 6 471 tests / 1 failed | 519 / 6 479 / the same one | | MoltenVK | 200/274 passed, 72 skipped — `cs_imgatomic_ext` **and `ps_ssharp`** | **206/280 passed, 73 skipped — only `cs_imgatomic_ext`** | | KosmicKrisp | 193/274 passed, 75 skipped — six failures | 198/280 passed, 76 skipped — the same six | So the device probe picks up the M3/MoltenVK case on its own and `ps_ssharp` passes in auto mode, without `LEONIDA_EXPLICIT_LOD_BIAS`: the `point bias +1` case that read `(1.0, 0.0, 0.502, 0.502)` on `main` now reads `(0.502, 0.502, 0.502, 0.502)`. KosmicKrisp keeps the same six failures as `main` (`cs_bvh`, `cs_bvh32`, `cs_fma_fused`, `cs_imgatomic_ext`, `ps_cndmask_sign_mods`, `ps_valu16_mad_sel`), so the flag is not being forced where the sampler already applies the bias. The semantic failure is **not from this PR**. `test_valu_cvt_f16_int16_mods` fails identically on `main` `fcbe97b9a`, and `git bisect` over `5b6ffd5a8..fcbe97b9a` puts the first failing merge at `b79595ecc` (#435, "accept VOP3 clamp/omod as hardware no-op on v_cvt_{i16,u16}_f16"): it updated `tests/semantic/test_alu_cvt_16.py` but not the older `test_valu_cvt_f16_int16_mods.py`, which still expects `Unsupported` for those ops. `5b6ffd5a8` passes that file, `fcbe97b9a` fails it. AI-assisted.
zmasi commented 2026-11-29 01:34:52 +00:00 (Migrated from github.com)

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


Independent Windows 11 + NVIDIA GeForce RTX 3090 Verification (05a0f7f2a3 merged onto main 53b77df14f)

Environment: Windows 11 (10.0.26200), MSVC 19.44.35228, Python 3.12.10 (-I), llvm-mc (gfx1030), SPIRV-Tools / VK_LAYER_KHRONOS_validation 1.4.363.1, physical NVIDIA GeForce RTX 3090 (Ampere, driver 610.88, Vulkan 1.4, fixed subgroup 32..32). Synthetic fixtures only; no game files.

1. Probe, Translator, and Unit Suites — PASS

  • Live GPU probes on RTX 3090 (LEONIDA_VK_VALIDATION=1, 0 validation errors):
    • python -I tools/vk_subgroup_info.py --lod-bias: {"explicit_lod_bias": false, "explicit_lod_bias_reason": "the sampler applies mipLodBias (+1 reads level 1)"}
    • python -I tools/lod_bias_probe.py --build <build> and direct lod_bias_probe.draw_probe(<build>): (False, 'the sampler applies LOD_BIAS +1 and -1')
  • Python / semantic suites (251/251 passed):
    • tests/semantic/test_explicit_lod_bias.py: 8/8 OK (Red on main: unrecognized arguments: --explicit-lod-bias)
    • tests/test_vk_lod_bias.py: 5/5 OK (including spirv-val --target-env vulkan1.0)
    • tests/test_lod_bias_probe.py: 10/10 OK
    • tests/test_vk_subgroup_info.py: 59/59 OK
    • tests/test_make_game_translator_flags.py: 38/38 OK
    • tests/test_make_game_argparse.py: 38/38 OK
    • tests/test_shader_checks.py: 88/88 OK
    • tests/test_cmake_translator_deps.py: 5/5 OK

2. Hardware Finding on NVIDIA (point bias +0.3 Exceeds NVIDIA's NEAREST Mip Threshold) + Verified +-0.26 Fix

  • Running python -I scripts/run_gpu_tests.py --build <build> --filter ps_ssharp on RTX 3090 in auto mode (--explicit-lod-bias off, verified 0 OpBitFieldSExtract in ps_ssharp.spv) fails all 6 active ps_ssharp* fixtures on the new point bias +0.3 case:
    FAIL  ps_ssharp       point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502)
    FAIL  ps_ssharp_3d    point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502)
    FAIL  ps_ssharp_b     point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502)
    FAIL  ps_ssharp_c     point bias +0.3: (0,0): (1.0, 1.0, 1.0, 1.0) != (0.0, 0.0, 1.0, 1.0)
    FAIL  ps_ssharp_cube  point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502)
    FAIL  ps_ssharp_ld    point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502)
    
  • Root cause (measured at 1/256 S# LOD_BIAS resolution via vk_sampler_test on RTX 3090):
    • Vulkan permits VK_SAMPLER_MIPMAP_MODE_NEAREST level selection to transition within [0.25, 0.5] (the same tolerance vulkan_sampler() in runtime/src/gfx10_descriptors.h relies on when setting maxLod = 0.25f for MipFilter::none).
    • On NVIDIA Ampere (610.88), the hardware sampler transitions from mip 0 to mip 1 at q = +74/256 = +0.2890625 (+73/256 = +0.28515625 stays on mip 0; likewise at implicit LOD 1, bias = -182/256 => q = +0.2890625 stays on mip 1 while bias = -183/256 => q = +0.28515625 switches to mip 0, matching 1 - 1/sqrt(2) = 0.2929).
    • Because +0.3 encodes as +77/256 = +0.30078125 > +0.2890625, a single hardware mipLodBias of +0.3 already selects mip 1 on NVIDIA.
  • Verified fix (bias = +-0.26, i.e. +-67/256 = +-0.26171875):
    • Single bias 0.2617 < 0.2891 stays on (0, 1) on both NVIDIA (0.289) and 0.5-rounding drivers (AMD/Mesa/Apple), while a double-counted bias 2 * 0.2617 = +0.5234 > 0.5 crosses 0.5 on all drivers.
    • Tested locally on RTX 3090 with bias = +-0.26 in SAMPLER_CASES (LEONIDA_VK_VALIDATION=1, 0 validation errors):
      • Auto mode: 6/7 PASS (ps_ssharp, _3d, _b, _c, _cube, _ld — 10 S#/T# cases x 4,096 pixels each exact; ps_ssharp_o skipped as expected).
      • LEONIDA_TEXOFF_FALLBACK=1: 7/7 PASS (including ps_ssharp_o, 286,720 total pixels exact).
      • LEONIDA_EXPLICIT_LOD_BIAS=1 (forced negative control): 6/6 FAIL on +0.26 (+0.5234 moves explicit LOD 0 -> 1), preserving the exact double-bias check.

Lowering the two SAMPLER_CASES probe points in runtime/test/shaders/check.py (and tests/test_shader_checks.py / docs) from +-0.3 to +-0.26 will keep all 7 fixtures green on NVIDIA while still catching any double-applied bias on 0.5-threshold drivers.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248877198 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#issuecomment-7248877198). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T01:34:52Z. --- ### Independent Windows 11 + NVIDIA GeForce RTX 3090 Verification (`05a0f7f2a3` merged onto `main` `53b77df14f`) **Environment**: Windows 11 (`10.0.26200`), MSVC `19.44.35228`, Python `3.12.10` (`-I`), `llvm-mc` (`gfx1030`), SPIRV-Tools / `VK_LAYER_KHRONOS_validation` `1.4.363.1`, physical **NVIDIA GeForce RTX 3090** (Ampere, driver `610.88`, Vulkan `1.4`, fixed subgroup `32..32`). Synthetic fixtures only; no game files. #### 1. Probe, Translator, and Unit Suites — **PASS** - **Live GPU probes on RTX 3090** (`LEONIDA_VK_VALIDATION=1`, `0` validation errors): - `python -I tools/vk_subgroup_info.py --lod-bias`: `{"explicit_lod_bias": false, "explicit_lod_bias_reason": "the sampler applies mipLodBias (+1 reads level 1)"}` - `python -I tools/lod_bias_probe.py --build <build>` and direct `lod_bias_probe.draw_probe(<build>)`: `(False, 'the sampler applies LOD_BIAS +1 and -1')` - **Python / semantic suites (`251/251` passed)**: - `tests/semantic/test_explicit_lod_bias.py`: `8/8 OK` (Red on `main`: `unrecognized arguments: --explicit-lod-bias`) - `tests/test_vk_lod_bias.py`: `5/5 OK` (including `spirv-val --target-env vulkan1.0`) - `tests/test_lod_bias_probe.py`: `10/10 OK` - `tests/test_vk_subgroup_info.py`: `59/59 OK` - `tests/test_make_game_translator_flags.py`: `38/38 OK` - `tests/test_make_game_argparse.py`: `38/38 OK` - `tests/test_shader_checks.py`: `88/88 OK` - `tests/test_cmake_translator_deps.py`: `5/5 OK` #### 2. Hardware Finding on NVIDIA (`point bias +0.3` Exceeds NVIDIA's `NEAREST` Mip Threshold) + Verified `+-0.26` Fix - Running `python -I scripts/run_gpu_tests.py --build <build> --filter ps_ssharp` on RTX 3090 in auto mode (`--explicit-lod-bias` **off**, verified `0` `OpBitFieldSExtract` in `ps_ssharp.spv`) **fails all 6 active `ps_ssharp*` fixtures** on the new `point bias +0.3` case: ```text FAIL ps_ssharp point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502) FAIL ps_ssharp_3d point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502) FAIL ps_ssharp_b point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502) FAIL ps_ssharp_c point bias +0.3: (0,0): (1.0, 1.0, 1.0, 1.0) != (0.0, 0.0, 1.0, 1.0) FAIL ps_ssharp_cube point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502) FAIL ps_ssharp_ld point bias +0.3: (0,0): (0.502, 0.502, 0.502, 0.502) != (1.0, 0.0, 0.502, 0.502) ``` - **Root cause (measured at `1/256` S# `LOD_BIAS` resolution via `vk_sampler_test` on RTX 3090)**: - Vulkan permits `VK_SAMPLER_MIPMAP_MODE_NEAREST` level selection to transition within `[0.25, 0.5]` (the same tolerance `vulkan_sampler()` in `runtime/src/gfx10_descriptors.h` relies on when setting `maxLod = 0.25f` for `MipFilter::none`). - On NVIDIA Ampere (`610.88`), the hardware sampler transitions from mip `0` to mip `1` at **`q = +74/256 = +0.2890625`** (`+73/256 = +0.28515625` stays on mip `0`; likewise at implicit `LOD 1`, `bias = -182/256 => q = +0.2890625` stays on mip `1` while `bias = -183/256 => q = +0.28515625` switches to mip `0`, matching `1 - 1/sqrt(2) = 0.2929`). - Because `+0.3` encodes as `+77/256 = +0.30078125 > +0.2890625`, a **single** hardware `mipLodBias` of `+0.3` already selects mip `1` on NVIDIA. - **Verified fix (`bias = +-0.26`, i.e. `+-67/256 = +-0.26171875`)**: - Single bias `0.2617 < 0.2891` stays on `(0, 1)` on both NVIDIA (`0.289`) and `0.5`-rounding drivers (AMD/Mesa/Apple), while a double-counted bias `2 * 0.2617 = +0.5234 > 0.5` crosses `0.5` on **all** drivers. - Tested locally on RTX 3090 with `bias = +-0.26` in `SAMPLER_CASES` (`LEONIDA_VK_VALIDATION=1`, `0` validation errors): - **Auto mode**: **`6/7` PASS** (`ps_ssharp`, `_3d`, `_b`, `_c`, `_cube`, `_ld` — `10` S#/T# cases x `4,096` pixels each exact; `ps_ssharp_o` skipped as expected). - **`LEONIDA_TEXOFF_FALLBACK=1`**: **`7/7` PASS** (including `ps_ssharp_o`, `286,720` total pixels exact). - **`LEONIDA_EXPLICIT_LOD_BIAS=1` (forced negative control)**: **`6/6` FAIL** on `+0.26` (`+0.5234` moves explicit LOD `0 -> 1`), preserving the exact double-bias check. Lowering the two `SAMPLER_CASES` probe points in `runtime/test/shaders/check.py` (and `tests/test_shader_checks.py` / docs) from `+-0.3` to `+-0.26` will keep all 7 fixtures green on NVIDIA while still catching any double-applied bias on `0.5`-threshold drivers. AI-assisted.
OreoFR commented 2026-11-29 02:59:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T02:59:58Z.


Verified by OreoFR

  • Base: main 48bae6cad + PR head 05a0f7f2a (tested as a merge; it also merges without conflict on the newer main 5825b02ff)
  • Test: test_explicit_lod_bias.py (tests/semantic), tests/test_lod_bias_probe.py, test_make_game_argparse.py, test_make_game_translator_flags.py, test_shader_checks.py, test_vk_lod_bias.py, test_vk_subgroup_info.py; translator suite; vk_sampler_test built
  • Red on main: rdna2spirv.EXPLICIT_LOD_BIAS missing (ERRORs), lod_bias_probe / vk_lod_bias modules missing, make_game argparse and translator-flag tests ERROR; test_shader_checks already passes on main; translator suite on main: 526 files, 6506 tests, 1 file failing (test_valu_cvt_f16_int16_mods, a known main failure)
  • Green with the PR: all 7 files OK (8, 10, 38, 38, 88, 5, 59 tests); vk_sampler_test compiles; translator suite 527 files, 6514 tests, same single known failure, no new one
  • gta6rt link: OK (gta6rt.exe builds and links; dumpbin /dependents shows the same DLLs as main, no network DLL)
  • Verdict: READY (the make_game tests give the same red/green on the newer main 5825b02ff; ps_ssharp* GPU checks and the macOS/MoltenVK path not run here)
  • 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:7249776203 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#issuecomment-7249776203). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T02:59:58Z. --- **Verified by OreoFR** - Base: main `48bae6cad` + PR head `05a0f7f2a` (tested as a merge; it also merges without conflict on the newer main `5825b02ff`) - Test: `test_explicit_lod_bias.py` (tests/semantic), `tests/test_lod_bias_probe.py`, `test_make_game_argparse.py`, `test_make_game_translator_flags.py`, `test_shader_checks.py`, `test_vk_lod_bias.py`, `test_vk_subgroup_info.py`; translator suite; `vk_sampler_test` built - Red on main: `rdna2spirv.EXPLICIT_LOD_BIAS` missing (ERRORs), `lod_bias_probe` / `vk_lod_bias` modules missing, `make_game` argparse and translator-flag tests ERROR; `test_shader_checks` already passes on main; translator suite on main: 526 files, 6506 tests, 1 file failing (`test_valu_cvt_f16_int16_mods`, a known main failure) - Green with the PR: all 7 files OK (8, 10, 38, 38, 88, 5, 59 tests); `vk_sampler_test` compiles; translator suite 527 files, 6514 tests, same single known failure, no new one - gta6rt link: OK (`gta6rt.exe` builds and links; `dumpbin /dependents` shows the same DLLs as main, no network DLL) - Verdict: READY (the make_game tests give the same red/green on the newer main `5825b02ff`; `ps_ssharp*` GPU checks and the macOS/MoltenVK path not run here) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
EvgHaze commented 2026-11-29 03:43:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-29T03:43:56Z.


Re-checked the current head 05a0f7f2 (two main merges since 3a7dc612). Same result — the flag still goes in automatically and ps_ssharp passes on MoltenVK; nothing regressed in between.

Machine:  Apple M3 (Mac15,13), 8 cores
OS:       macOS 27.0 (26A5406e), arm64
Drivers:  MoltenVK 1.4.2, Mesa 26.3.1 (KosmicKrisp)
Commit:   05a0f7f2 Merge remote-tracking branch 'refs/remotes/origin/main' into fix/explicit-lod-bias-moltenvk

Build:    ok
Semantic: 521 files, 6488 tests, 1 file failed: test_valu_cvt_f16_int16_mods
GPU:      MoltenVK   206/280 passed, 73 skipped
          KosmicKrisp 198/280 passed, 76 skipped

The single semantic failure is the one main carries since b79595ecc (#435) and is fixed by #2593, not by this change: at f6cbdb938 (#2593) this file passes and cs_imgatomic_ext stops failing on both drivers. The earlier report at 3a7dc612 (comment-7240260046) stands.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7250225553 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#issuecomment-7250225553). Originally posted by [EvgHaze](https://github.com/EvgHaze) on 2026-11-29T03:43:56Z. --- Re-checked the current head `05a0f7f2` (two `main` merges since `3a7dc612`). Same result — the flag still goes in automatically and `ps_ssharp` passes on MoltenVK; nothing regressed in between. ```text Machine: Apple M3 (Mac15,13), 8 cores OS: macOS 27.0 (26A5406e), arm64 Drivers: MoltenVK 1.4.2, Mesa 26.3.1 (KosmicKrisp) Commit: 05a0f7f2 Merge remote-tracking branch 'refs/remotes/origin/main' into fix/explicit-lod-bias-moltenvk Build: ok Semantic: 521 files, 6488 tests, 1 file failed: test_valu_cvt_f16_int16_mods GPU: MoltenVK 206/280 passed, 73 skipped KosmicKrisp 198/280 passed, 76 skipped ``` The single semantic failure is the one `main` carries since `b79595ecc` (#435) and is fixed by #2593, not by this change: at `f6cbdb938` (#2593) this file passes and `cs_imgatomic_ext` stops failing on both drivers. The earlier report at `3a7dc612` (comment-7240260046) stands. AI-assisted.
lorentsob commented 2026-11-29 19:34:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lorentsob on 2026-11-29T19:34:59Z.


One more Apple data point: Apple M5 Max, macOS 27.2.1, MoltenVK 1.4.2 (Homebrew), driver id 14

  • Base: PR head bf458bbcb with current main dd87aa405 merged in (clean merge), runtime rebuilt; Homebrew llvm-mc 23.
  • Probe: tools/vk_subgroup_info.py --lod-bias and tools/lod_bias_probe.py both answer false, the sampler applies mipLodBias (+1 reads level 1), as on the M5 (26.6.2) in the table.
  • scripts/run_gpu_tests.py --filter ps_ssharp:
LEONIDA_EXPLICIT_LOD_BIAS result
unset (auto, flag off from the probe) 6/6 pass, 10 S#/T# cases, 4096 pixels each exact; ps_ssharp_o SKIP without the fallback
0 6/6 pass
1 (forced on) 0/6: each fails on point bias +0.3 (the bias counted twice), e.g. ps_ssharp (0,0): (0.502, ...) != (1.0, 0.0, ...); ps_ssharp_c likewise
unset + LEONIDA_TEXOFF_FALLBACK=1 ps_ssharp_o pass, 10 cases exact

So on this machine the measured gate is what keeps it green: the forced flag breaks exactly the +-0.3 cases that tell once from twice.

  • tests/semantic/test_explicit_lod_bias.py OK; full ctest 132/132.
  • Semantic suite: 6534 tests, one file red, test_interp_computed_ij_fallback (2 failures, f16 off by one ulp). It is red on plain main too, so not from this PR.

AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261394151 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#issuecomment-7261394151). Originally posted by [lorentsob](https://github.com/lorentsob) on 2026-11-29T19:34:59Z. --- **One more Apple data point: Apple M5 Max, macOS 27.2.1, MoltenVK 1.4.2 (Homebrew), driver id 14** - Base: PR head `bf458bbcb` with current `main` `dd87aa405` merged in (clean merge), runtime rebuilt; Homebrew llvm-mc 23. - Probe: `tools/vk_subgroup_info.py --lod-bias` and `tools/lod_bias_probe.py` both answer `false`, `the sampler applies mipLodBias (+1 reads level 1)`, as on the M5 (26.6.2) in the table. - `scripts/run_gpu_tests.py --filter ps_ssharp`: | `LEONIDA_EXPLICIT_LOD_BIAS` | result | |---|---| | unset (auto, flag off from the probe) | 6/6 pass, `10 S#/T# cases, 4096 pixels each exact`; `ps_ssharp_o` SKIP without the fallback | | `0` | 6/6 pass | | `1` (forced on) | 0/6: each fails on `point bias +0.3` (the bias counted twice), e.g. `ps_ssharp (0,0): (0.502, ...) != (1.0, 0.0, ...)`; `ps_ssharp_c` likewise | | unset + `LEONIDA_TEXOFF_FALLBACK=1` | `ps_ssharp_o` pass, 10 cases exact | So on this machine the measured gate is what keeps it green: the forced flag breaks exactly the +-0.3 cases that tell once from twice. - `tests/semantic/test_explicit_lod_bias.py` OK; full `ctest` 132/132. - Semantic suite: 6534 tests, one file red, `test_interp_computed_ij_fallback` (2 failures, f16 off by one ulp). It is red on plain `main` too, so not from this PR. AI-assisted: yes.
OreoFR commented 2026-11-29 19:39:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T19:39:42Z.


Re-verified by OreoFR at head bf458bbcb on main eedd72e30 (still merges cleanly on 0e8737f2a): READY — red 32 fail → green 250 OK; ctest/link: vk_sampler_test (the only C++ file changed) builds, nothing gta6rt links changes; head changed since the earlier verification https://github.com/ProjectLeonida/mandy/pull/1774#issuecomment-7249776203 (that was 05a0f7f2a; this head is a merge of main into the branch). Windows 11, RTX 4070 Laptop 8 GB, NVIDIA 621.40. AI-assisted (Claude Code, Claude Opus 5.5).

  • Red (main + only the PR's seven test files): all seven fail on main (test_explicit_lod_bias 9 errors, test_make_game_translator_flags 17, test_vk_subgroup_info 2, one import or argparse error each in test_lod_bias_probe, test_make_game_argparse, test_shader_checks, test_vk_lod_bias).
  • Green (main + this PR, git merge --no-ff, no conflict): 8, 10, 38, 38, 92, 5 and 59 tests, all OK.
  • Full translator suite (scripts/run_semantic_tests.py tests/semantic, on main 91bab934d, the main of the start of this run): merge 530 files, 6534 tests, only test_interp_computed_ij_fallback fails; main alone 529 files, 6526 tests, the same single failure. No new failure.
  • Not run here: the ps_ssharp* GPU checks and the MoltenVK path (the auto probe answers false on NVIDIA, as reported before).

Ready to merge per the maintainers' plan.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261455152 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#issuecomment-7261455152). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T19:39:42Z. --- **Re-verified by OreoFR** at head `bf458bbcb` on main `eedd72e30` (still merges cleanly on `0e8737f2a`): READY — red 32 fail → green 250 OK; ctest/link: `vk_sampler_test` (the only C++ file changed) builds, nothing gta6rt links changes; head changed since the earlier verification https://github.com/ProjectLeonida/mandy/pull/1774#issuecomment-7249776203 (that was `05a0f7f2a`; this head is a merge of main into the branch). Windows 11, RTX 4070 Laptop 8 GB, NVIDIA 621.40. AI-assisted (Claude Code, Claude Opus 5.5). - Red (main + only the PR's seven test files): all seven fail on main (`test_explicit_lod_bias` 9 errors, `test_make_game_translator_flags` 17, `test_vk_subgroup_info` 2, one import or argparse error each in `test_lod_bias_probe`, `test_make_game_argparse`, `test_shader_checks`, `test_vk_lod_bias`). - Green (main + this PR, `git merge --no-ff`, no conflict): 8, 10, 38, 38, 92, 5 and 59 tests, all OK. - Full translator suite (`scripts/run_semantic_tests.py tests/semantic`, on main `91bab934d`, the main of the start of this run): merge 530 files, 6534 tests, only `test_interp_computed_ij_fallback` fails; main alone 529 files, 6526 tests, the same single failure. No new failure. - Not run here: the `ps_ssharp*` GPU checks and the MoltenVK path (the auto probe answers false on NVIDIA, as reported before). Ready to merge per the maintainers' plan.
Tauwni commented 2026-11-30 09:55:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-30T09:55:28Z.


@zmasi Thanks, your +0.3 finding on the RTX 3090 was right and I had missed it. Head 07905380d now uses +-0.26 in SAMPLER_CASES, as you suggested (check.py, tests/test_shader_checks.py, the semantic test, and the two docs rows).

MEASURED, 3 runs each, Apple M3, macOS 27.0, --filter ps_ssharp:

  • MoltenVK 1.4.2, auto (flag on from the probe): 6/7 pass, ps_ssharp_o SKIP. The same with LEONIDA_EXPLICIT_LOD_BIAS=1.
  • KosmicKrisp (Mesa 26.3.1), auto (flag off): 6/7 pass.
  • KosmicKrisp, LEONIDA_EXPLICIT_LOD_BIAS=1 (negative control): 0/6, each fails on point bias +0.26. So the bias counted twice (+0.52) is still caught.
  • Python: test_shader_checks, test_vk_lod_bias, test_lod_bias_probe OK. Semantic suite: 6533 tests, only test_interp_computed_ij_fallback and test_valu_cvt_f16_int16_mods fail, both red on main.

Not run here: NVIDIA. A re-run of ps_ssharp on an NVIDIA card at this head would confirm the fix.

Not checked by a second agent or human yet. AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7274870694 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#issuecomment-7274870694). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-30T09:55:28Z. --- @zmasi Thanks, your `+0.3` finding on the RTX 3090 was right and I had missed it. Head `07905380d` now uses `+-0.26` in `SAMPLER_CASES`, as you suggested (`check.py`, `tests/test_shader_checks.py`, the semantic test, and the two docs rows). MEASURED, 3 runs each, Apple M3, macOS 27.0, `--filter ps_ssharp`: - MoltenVK 1.4.2, auto (flag on from the probe): 6/7 pass, `ps_ssharp_o` SKIP. The same with `LEONIDA_EXPLICIT_LOD_BIAS=1`. - KosmicKrisp (Mesa 26.3.1), auto (flag off): 6/7 pass. - KosmicKrisp, `LEONIDA_EXPLICIT_LOD_BIAS=1` (negative control): 0/6, each fails on `point bias +0.26`. So the bias counted twice (+0.52) is still caught. - Python: `test_shader_checks`, `test_vk_lod_bias`, `test_lod_bias_probe` OK. Semantic suite: 6533 tests, only `test_interp_computed_ij_fallback` and `test_valu_cvt_f16_int16_mods` fail, both red on `main`. Not run here: NVIDIA. A re-run of `ps_ssharp` on an NVIDIA card at this head would confirm the fix. Not checked by a second agent or human yet. AI-assisted: yes.
lixonik commented 2026-11-30 10:03:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-30T10:03:11Z.


@Tauwni I ran the requested NVIDIA retest at 07905380dcef2bc524abf074a0420525c6e342c1 merged locally with main 4014af7fe9a479caee2946c1814c11935b24bf60. RTX 5070 (NVIDIA 610.88), Windows 10 22H2, MSVC 19.44.35230, Ninja Release. I rebuilt the stock GPU test binaries and ran python -I scripts/run_gpu_tests.py --filter ps_ssharp --require-pass with a fresh work directory for each arm.

  • Auto: the probe reports explicit_lod_bias=false. Six GPU fixtures pass with ten S#/T# cases and 4,096 exact pixels per case. ps_ssharp_o skips because this harness does not enable VK_KHR_maintenance8.
  • Auto with LEONIDA_TEXOFF_FALLBACK=1: all seven GPU fixtures pass, including ps_ssharp_o.
  • Same texture-offset fallback, forcing LEONIDA_EXPLICIT_LOD_BIAS=1: all seven fail at point bias +0.26, so the new threshold still catches double application on this adapter.

All eight synthetic shaders passed spirv-val in each arm. test_explicit_lod_bias.py passed 8/8. This run covers native NVIDIA sampler behavior and the forced-bias negative control using synthetic inputs.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7275049376 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#issuecomment-7275049376). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-30T10:03:11Z. --- @Tauwni I ran the requested NVIDIA retest at `07905380dcef2bc524abf074a0420525c6e342c1` merged locally with `main` `4014af7fe9a479caee2946c1814c11935b24bf60`. RTX 5070 (NVIDIA 610.88), Windows 10 22H2, MSVC 19.44.35230, Ninja Release. I rebuilt the stock GPU test binaries and ran `python -I scripts/run_gpu_tests.py --filter ps_ssharp --require-pass` with a fresh work directory for each arm. - Auto: the probe reports `explicit_lod_bias=false`. Six GPU fixtures pass with ten S#/T# cases and 4,096 exact pixels per case. `ps_ssharp_o` skips because this harness does not enable `VK_KHR_maintenance8`. - Auto with `LEONIDA_TEXOFF_FALLBACK=1`: all seven GPU fixtures pass, including `ps_ssharp_o`. - Same texture-offset fallback, forcing `LEONIDA_EXPLICIT_LOD_BIAS=1`: all seven fail at `point bias +0.26`, so the new threshold still catches double application on this adapter. All eight synthetic shaders passed `spirv-val` in each arm. `test_explicit_lod_bias.py` passed 8/8. This run covers native NVIDIA sampler behavior and the forced-bias negative control using synthetic inputs. AI-assisted.
EvgHaze commented 2026-11-30 10:42:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-30T10:42:16Z.


Apple check at head 07905380d (ps_ssharp: probe the bias at +-0.26).

Tree: 07905380d merged with main 4014af7f → 9ca26fa3a (the same tree lixonik tested on the RTX 5070).

Environment: Apple M3 (Mac15,13), macOS 27.0 (26A5406e), MoltenVK 1.4.2, KosmicKrisp (Mesa 26.3.1), llvm-mc 23.1.6, spirv-val 2026.4.

run_gpu_tests.py --filter ps_ssharp (8 shaders, 10 S#/T# cases, 4096 exact pixels each):

Arm Result
MoltenVK, auto 6/7 pass, ps_ssharp_o SKIP (harness enables no VK_KHR_maintenance8)
MoltenVK + LEONIDA_TEXOFF_FALLBACK=1 7/7 pass
MoltenVK + TEXOFF + LEONIDA_EXPLICIT_LOD_BIAS=1 7/7 pass (the forced bias does not disturb the harness here)
KosmicKrisp, auto 6/7 pass, same SKIP
KosmicKrisp + LEONIDA_EXPLICIT_LOD_BIAS=1 0/7 — every fixture fails on point bias +0.26

spirv-val: 8/8 clean in every arm. So the ±0.26 threshold is independently confirmed on Apple, and the double application is still caught (negative control).

One note: the head no longer merges cleanly with the current main (012b79a67) — conflict in tools/rdna2spirv.py. A rebase will be needed before merge; I used 4014af7f to match the NVIDIA run.

AI-assisted.


Full suite at the same tree (9ca26fa3a, 20:55–21:05):

  • semantic: 530 files, 6 534 tests, 0 files failed (191 s, 8 jobs).
  • MoltenVK full set: 208/280 pass, 0 fail, 72 skip.
  • KosmicKrisp full set: 199/280 pass, 5 fail, 76 skip. The five are cs_bvh, cs_bvh32, cs_fma_fused, ps_cndmask_sign_mods, ps_valu16_mad_sel — each fails identically on the base 4014af7f rebuilt and rerun separately, so they are pre-existing, not caused by this PR.
  • spirv-val: 289/289 shaders clean on both drivers.

For reference, the last full Apple run at 3a7dc612 (28.11) was 206/280 and 198/280.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7275962570 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#issuecomment-7275962570). Originally posted by [EvgHaze](https://github.com/EvgHaze) on 2026-11-30T10:42:16Z. --- Apple check at head `07905380d` (`ps_ssharp: probe the bias at +-0.26`). Tree: `07905380d` merged with `main` `4014af7f` → `9ca26fa3a` (the same tree lixonik tested on the RTX 5070). Environment: Apple M3 (Mac15,13), macOS 27.0 (26A5406e), MoltenVK 1.4.2, KosmicKrisp (Mesa 26.3.1), llvm-mc 23.1.6, spirv-val 2026.4. `run_gpu_tests.py --filter ps_ssharp` (8 shaders, 10 S#/T# cases, 4096 exact pixels each): | Arm | Result | |---|---| | MoltenVK, auto | 6/7 pass, `ps_ssharp_o` SKIP (harness enables no `VK_KHR_maintenance8`) | | MoltenVK + `LEONIDA_TEXOFF_FALLBACK=1` | 7/7 pass | | MoltenVK + TEXOFF + `LEONIDA_EXPLICIT_LOD_BIAS=1` | 7/7 pass (the forced bias does not disturb the harness here) | | KosmicKrisp, auto | 6/7 pass, same SKIP | | KosmicKrisp + `LEONIDA_EXPLICIT_LOD_BIAS=1` | 0/7 — every fixture fails on `point bias +0.26` | `spirv-val`: 8/8 clean in every arm. So the `±0.26` threshold is independently confirmed on Apple, and the double application is still caught (negative control). One note: the head no longer merges cleanly with the current `main` (`012b79a67`) — conflict in `tools/rdna2spirv.py`. A rebase will be needed before merge; I used `4014af7f` to match the NVIDIA run. AI-assisted. --- Full suite at the same tree (`9ca26fa3a`, 20:55–21:05): - semantic: 530 files, 6 534 tests, **0 files failed** (191 s, 8 jobs). - MoltenVK full set: **208/280 pass, 0 fail, 72 skip**. - KosmicKrisp full set: **199/280 pass, 5 fail, 76 skip**. The five are `cs_bvh`, `cs_bvh32`, `cs_fma_fused`, `ps_cndmask_sign_mods`, `ps_valu16_mad_sel` — each fails identically on the base `4014af7f` rebuilt and rerun separately, so they are pre-existing, not caused by this PR. - `spirv-val`: 289/289 shaders clean on both drivers. For reference, the last full Apple run at `3a7dc612` (28.11) was 206/280 and 198/280.
Tauwni commented 2026-11-30 10:50:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-30T10:50:39Z.


@EvgHaze Thanks. Head ab09fd1f8 merges main 012b79a67. Two conflicts were more than both sides adding a line:

  • make_game.py / scripts/run_gpu_tests.py: --no-ftz32 and --integer-dot-fallback from main are kept next to --explicit-lod-bias.
  • tools/rdna2spirv.py: main's new float-only typed implicit sample (OpImageSampleImplicitLod) is used only without --explicit-lod-bias. With the flag, the Grad path still scales the derivatives by the S# bias, as before. READ IN CODE.

MEASURED on an Apple M3, macOS 27.0, --filter ps_ssharp, 3 runs each:

  • MoltenVK 1.4.2, auto: 6/7, ps_ssharp_o SKIP; with LEONIDA_TEXOFF_FALLBACK=1: 7/7. With LEONIDA_EXPLICIT_LOD_BIAS=0 (the fix off): 0/7, 1 run.
  • KosmicKrisp (Mesa 26.3.1), auto: 6/7; forced =1: 0/7 on point bias +0.26.
  • Semantic suite: 550 files, 6683 tests, 0 failed. test_make_game_argparse test_custom_jobs_forwarded_to_shaders fails, 3/3 on plain main 012b79a67 too: it does not mock main's new --no-ftz32 probe, which adds --no-ftz32 on this Mac.

Not checked by a second agent or human yet. AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7276156592 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#issuecomment-7276156592). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-30T10:50:39Z. --- @EvgHaze Thanks. Head `ab09fd1f8` merges `main` `012b79a67`. Two conflicts were more than both sides adding a line: - `make_game.py` / `scripts/run_gpu_tests.py`: `--no-ftz32` and `--integer-dot-fallback` from `main` are kept next to `--explicit-lod-bias`. - `tools/rdna2spirv.py`: `main`'s new float-only typed implicit sample (`OpImageSampleImplicitLod`) is used only without `--explicit-lod-bias`. With the flag, the `Grad` path still scales the derivatives by the S# bias, as before. READ IN CODE. MEASURED on an Apple M3, macOS 27.0, `--filter ps_ssharp`, 3 runs each: - MoltenVK 1.4.2, auto: 6/7, `ps_ssharp_o` SKIP; with `LEONIDA_TEXOFF_FALLBACK=1`: 7/7. With `LEONIDA_EXPLICIT_LOD_BIAS=0` (the fix off): 0/7, 1 run. - KosmicKrisp (Mesa 26.3.1), auto: 6/7; forced `=1`: 0/7 on `point bias +0.26`. - Semantic suite: 550 files, 6683 tests, 0 failed. `test_make_game_argparse` `test_custom_jobs_forwarded_to_shaders` fails, 3/3 on plain `main` `012b79a67` too: it does not mock `main`'s new `--no-ftz32` probe, which adds `--no-ftz32` on this Mac. Not checked by a second agent or human yet. AI-assisted: yes.
Tauwni commented 2026-11-30 11:00:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-30T11:00:40Z.


CORRECTION to my last comment: after the main merge, CI's check job failed on tests/test_shader_build_fallbacks.py (test_ftz32_flag_follows_the_probed_device_even_with_a_barycentric_override, 4 × StopIteration). This one comes from this PR, not from main, and I had not run it.

Cause (READ IN CODE): the new test from main mocks exactly two subprocess.run calls, the --no-ftz32 probe and the translator. With LEONIDA_EXPLICIT_LOD_BIAS unset, this PR's --lod-bias probe in build.py runs first and uses one of them. The test now pins LEONIDA_EXPLICIT_LOD_BIAS=0; build.py is unchanged.

MEASURED, Apple M3: the file passes 3/3 (it fails 3/3 before the change; plain main passes). Every standalone test file, run once: the 33 that fail on this Mac fail on plain main 012b79a67 too, and none fails only with this PR.

Not checked by a second agent or human yet. AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7276404627 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#issuecomment-7276404627). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-30T11:00:40Z. --- CORRECTION to my last comment: after the `main` merge, CI's `check` job failed on `tests/test_shader_build_fallbacks.py` (`test_ftz32_flag_follows_the_probed_device_even_with_a_barycentric_override`, 4 × `StopIteration`). This one comes from this PR, not from `main`, and I had not run it. Cause (READ IN CODE): the new test from `main` mocks exactly two `subprocess.run` calls, the `--no-ftz32` probe and the translator. With `LEONIDA_EXPLICIT_LOD_BIAS` unset, this PR's `--lod-bias` probe in `build.py` runs first and uses one of them. The test now pins `LEONIDA_EXPLICIT_LOD_BIAS=0`; `build.py` is unchanged. MEASURED, Apple M3: the file passes 3/3 (it fails 3/3 before the change; plain `main` passes). Every standalone test file, run once: the 33 that fail on this Mac fail on plain `main` `012b79a67` too, and none fails only with this PR. Not checked by a second agent or human yet. AI-assisted: yes.
EvgHaze commented 2026-11-30 11:13:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-30T11:13:26Z.


Independent check at ab09fd1f8 (tested as-is; parents 07905380d + main 012b79a67). Apple M3 (Mac15,13), macOS 27.0, MoltenVK 1.4.2, KosmicKrisp (Mesa 26.3.1), llvm-mc 23.1.6, spirv-val 2026.4. Your numbers reproduce exactly:

Arm Result
MoltenVK, auto 6/7, ps_ssharp_o SKIP
MoltenVK + LEONIDA_TEXOFF_FALLBACK=1 7/7
MoltenVK + LEONIDA_EXPLICIT_LOD_BIAS=0 0/7 (first failure on point bias +1)
KosmicKrisp, auto 6/7
KosmicKrisp + LEONIDA_EXPLICIT_LOD_BIAS=1 0/7 on point bias +0.26

Full set at this head: semantic 550 files, 6 683 tests, 0 files failed (261 s, 8 jobs); MoltenVK 208/281 pass, 0 fail, 73 skip; KosmicKrisp 199/281 pass, 5 fail, 77 skip. The five KosmicKrisp failures (cs_bvh, cs_bvh32, cs_fma_fused, ps_cndmask_sign_mods, ps_valu16_mad_sel) also fail on plain main 012b79a67, rebuilt and rerun here separately — pre-existing, not from this PR.

Your make_game diagnosis reproduces too: JobsHandlingTest.test_custom_jobs_forwarded_to_shaders fails identically at ab09fd1f8 and on plain 012b79a67; the actual call carries fallbacks=('--no-ftz32',), so the new probe adds the flag on this Mac and the test does not mock it.

Code read, as asked: the merge keeps both sides — FALLBACK_FLAGS still lists --no-ftz32 and --integer-dot-fallback next to --explicit-lod-bias; run_gpu_tests.py still appends --no-ftz32 and then --explicit-lod-bias; in tools/rdna2spirv.py the typed float-only implicit sample is gated with and not EXPLICIT_LOD_BIAS, so with the flag on the Grad path scales the derivatives by 2^bias as described.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7276718239 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#issuecomment-7276718239). Originally posted by [EvgHaze](https://github.com/EvgHaze) on 2026-11-30T11:13:26Z. --- Independent check at `ab09fd1f8` (tested as-is; parents `07905380d` + main `012b79a67`). Apple M3 (Mac15,13), macOS 27.0, MoltenVK 1.4.2, KosmicKrisp (Mesa 26.3.1), llvm-mc 23.1.6, spirv-val 2026.4. Your numbers reproduce exactly: | Arm | Result | |---|---| | MoltenVK, auto | 6/7, `ps_ssharp_o` SKIP | | MoltenVK + `LEONIDA_TEXOFF_FALLBACK=1` | 7/7 | | MoltenVK + `LEONIDA_EXPLICIT_LOD_BIAS=0` | 0/7 (first failure on `point bias +1`) | | KosmicKrisp, auto | 6/7 | | KosmicKrisp + `LEONIDA_EXPLICIT_LOD_BIAS=1` | 0/7 on `point bias +0.26` | Full set at this head: semantic **550 files, 6 683 tests, 0 files failed** (261 s, 8 jobs); MoltenVK **208/281 pass, 0 fail, 73 skip**; KosmicKrisp **199/281 pass, 5 fail, 77 skip**. The five KosmicKrisp failures (`cs_bvh`, `cs_bvh32`, `cs_fma_fused`, `ps_cndmask_sign_mods`, `ps_valu16_mad_sel`) also fail on plain `main` `012b79a67`, rebuilt and rerun here separately — pre-existing, not from this PR. Your `make_game` diagnosis reproduces too: `JobsHandlingTest.test_custom_jobs_forwarded_to_shaders` fails identically at `ab09fd1f8` and on plain `012b79a67`; the actual call carries `fallbacks=('--no-ftz32',)`, so the new probe adds the flag on this Mac and the test does not mock it. Code read, as asked: the merge keeps both sides — `FALLBACK_FLAGS` still lists `--no-ftz32` and `--integer-dot-fallback` next to `--explicit-lod-bias`; `run_gpu_tests.py` still appends `--no-ftz32` and then `--explicit-lod-bias`; in `tools/rdna2spirv.py` the typed float-only implicit sample is gated with `and not EXPLICIT_LOD_BIAS`, so with the flag on the Grad path scales the derivatives by `2^bias` as described. AI-assisted.
aslan2142 commented 2026-12-01 11:43:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:43:03Z.

Review: APPROVED


Reviewed the --explicit-lod-bias translator pass (tools/rdna2spirv.py), pure-Python Vulkan compute probe (tools/vk_lod_bias.py, tools/lod_bias_probe.py, tools/vk_subgroup_info.py), make_game.py / scripts/run_gpu_tests.py wiring, runtime/test/vk_sampler_test.cpp mode extensions, and semantic/unit tests on head d99ba5c. Clean-room, standard-library-only, independently verified across Apple M3 (MoltenVK/KosmicKrisp/llvmpipe), Apple M5, NVIDIA RTX 5070/5080, and AMD gfx1036, and mergeable cleanly with all 9 CI checks green. Approving and merging.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130539617 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1774#pullrequestreview-6130539617). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:43:03Z. **Review:** APPROVED --- Reviewed the `--explicit-lod-bias` translator pass (`tools/rdna2spirv.py`), pure-Python Vulkan compute probe (`tools/vk_lod_bias.py`, `tools/lod_bias_probe.py`, `tools/vk_subgroup_info.py`), `make_game.py` / `scripts/run_gpu_tests.py` wiring, `runtime/test/vk_sampler_test.cpp` mode extensions, and semantic/unit tests on head `d99ba5c`. Clean-room, standard-library-only, independently verified across Apple M3 (MoltenVK/KosmicKrisp/llvmpipe), Apple M5, NVIDIA RTX 5070/5080, and AMD `gfx1036`, and mergeable cleanly with all 9 CI checks green. Approving and merging. *(AI-assisted review.)*
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!1774
No description provided.