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
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1774"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 headNo code has changed since
743eda012.bcf199736and5c702e2a7only updatedocs/design.mdwith these results:--lod-bias)ps_ssharp*in auto modeSo 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_ssharpstays inEXPECTED_FAILURESuntil 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, andmainmerged againFrom @aslan2142's review:
tools/vk_lod_bias.pyalso reads at explicit LOD 1 with no bias, and answersnullunless that read is 1.0. Before, a level 1 that was never cleared also read 0.0, which looked like a dropped bias.image_sample_cl/image_sample_c_cladd the S# bias before the clamp,max(0 + bias, minlod), as_b_cldoes.make_game.pydropped, and thetools/vk_subgroup_info.pyconflict 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/--3dnow tag the array the texture sits in. Without that,ps_ssharp_cubeandps_ssharp_3dread 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-checkedThe open points of the Update below are done, with @EvgHaze's two suggestions:
tools/vk_subgroup_info.py --lod-biasmeasures 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 withmipLodBias0 and +1 in one compute dispatch.truewhen +1 still reads level 0,falsewhen it reads level 1,nullotherwise. It needs no built test programs, llvm-mc or SPIR-V tools.tools/lod_bias_probe.pyreturns that answer and only falls back to theps_ssharpdraw when it has none.build.pyandmake_game.pynow measure too, socheck.pyalone takes the flag andmake_game.pyno longer waits for the test programs. The option is off by default, so nothing else that runsvk_subgroup_info.pydispatches anything.llvm-mcmessage. When the draw fallback can't startllvm-mc, it givesmc_command.install_hint()(the HomebrewLLVM_MC="$(brew --prefix llvm)/bin/llvm-mc"line) instead of a bare "could not be started".SAMPLER_CASES(check.py'sSAMPLER_FIXTURES).vk_sampler_testgains--cube,--3dand--dref; its 2D default is unchanged.ps_ssharpimage_sample_lz,image_sampleps_ssharp_ld(new)image_sample_l,image_sample_d(theGradscale)ps_ssharp_b(new)image_sample_lz,image_sample_bps_ssharp_cube(new)image_sample_lz,image_sampleimages_arrps_ssharp_3d(new)image_sample_lz,image_sampleimages_3dps_ssharp_c(new)image_sample_c_lz,image_sample_cps_ssharp_o(new)image_sample_lz_o,image_sample_oLEONIDA_TEXOFF_FALLBACK=1(a SKIP without it)Tested at
631a53832on the Apple M3 (macOS 26.5.1):bias +1) on all 7true)bias +0.3(counted twice) on all 7false)bias +0.3on all 7false)generated/fix below, locally) onmaindb1a22d29, test programs rebuilt:run_gpu_tests.py(200/270 native, 233/270 emulated) orcheck.py(192/237, 45 skipped, flag measured bybuild.pyitself).cs_fma_fusedfrom #1724;ps_cndmask_sign_modsandps_valu16_mad_sel, fixed by the KosmicKrisp branch below;cs_fmt_all, see below).mainhas too:test_tool_stdout_encoding(#1837, #1673 and thestage_timelinebranch below) andtest_calibrated_texture_extra, a WindowsMoveFileExWtest that fails on macOS onmainalone.Still open after Update 2
ps_ssharpstays in itsEXPECTED_FAILURES; the job prints a notice if it passes there, and it can be dropped then.python -I tools/vk_subgroup_info.py --lod-biasshould answer"explicit_lod_bias": falsethere, and--filter ps_ssharpshould pass all 7 with the flag off.Found while testing and split off, since they're not this PR's topic:
generated/directory forvk_null_descriptor_test(the macOS/Linux build fails onmain).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_allon 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 IDThe reviews showed the driver-ID gate was wrong: the same MoltenVK 1.4.2 applies
mipLodBiason an Apple M5 Pro, so the auto flag counted the bias twice there and turned a passingps_ssharpred. It isn't an OS-version rule either:mipLodBias?ps_ssharpfails onmainmainmainWhat changed:
tools/lod_bias_probe.py: translatesvs_idsandps_ssharpwithout the flag, draws them withvk_sampler_testat LOD_BIAS 0, +1 and -1, and answerstrueonly when +1 and -1 read the no-bias levels. It answersfalsewhen both move ascheck.pyexpects, andnullotherwise (wrong no-bias draw, mixed answer, failed draw, no test programs).nullnever turns the flag on.scripts/run_gpu_tests.pyandmake_game.pytake the probe's answer.make_game.pyruns it on the test programs inruntime/build/linuxorruntime/buildif present; otherwise it keeps a recorded flag, like the other fallbacks.runtime/test/shaders/build.pyonly followsLEONIDA_EXPLICIT_LOD_BIAS: it also runs inside the CMake build, before the test programs exist, so it must not probe.tools/vk_subgroup_info.pyand its test are back as onmain, with noexplicit_lod_biasfield.tools/lod_bias_probe.pyis inruntime.yml's path filters. Newtests/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
66b27ac6eon the Apple M3:true, KosmicKrispfalse, llvmpipefalse, no test programsnull.ps_ssharpin 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 failsbias +1, KosmicKrisp on failsbias +0.3.main71a769d7d, test programs rebuilt:run_gpu_tests.py(195/264 native, 228/264 emulated) or incheck.pywithLEONIDA_EXPLICIT_LOD_BIAS=1, as the probe answers (187/231, 44 skipped).Still open
(done in Update 2): aftercheck.pyalone doesn't take the flagbuild.py, a Mac that needs it has to setLEONIDA_EXPLICIT_LOD_BIAS=1, whichpython -I tools/lod_bias_probe.py --build <test programs>answers. A lead: letbuild.pyprobe when it is given the test programs' folder, but never inside the CMake build.Not GPU-checked:(done in Update 2) A lead: a_d, the_c*forms, cube and 3D samples, and the texel-offset gradients.ps_ssharp-style fixture per form.ps_ssharpstays in itsEXPECTED_FAILURES; the job prints a notice if it passes there.(done in Update 2); before that the flag stays off unless it was recorded.make_game.pycan only probe once the test programs are built--filter ps_ssharprun andpython -I tools/lod_bias_probe.py --build <your build>would confirm the probe answersfalsethere.mainsinceba626820e, the macOS/Linux build ofvk_null_descriptor_testfails: itsadd_custom_commandwritesgenerated/cs_null_descriptors.spvwithout creatinggenerated/("Failed to open file"). AddingCOMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/generatedbeforeglslangValidatorfixes it locally (ctest 95/95).tests/test_tool_stdout_encoding.pyfails onmainfor two new tools,tools/game_run_summary.pyandtools/stage_timeline.py(noerrors='replace'on stdout).ps_cndmask_sign_mods,ps_valu16_mad_selandcs_fmt_all(NaN canonicalization, finding in #1608) andcs_fma_fusedwith #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_ssharpfails onevery Macsome 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'sEXPECTED_FAILURES. Measured on an Apple M3: MoltenVK dropsVkSamplerCreateInfo::mipLodBiasfrom both explicit-LOD samples (image_sample_lzwith +0.6 / +1 stays on level 0) and the derivative-LODimage_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#'sLOD_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):Lodof_lz,_l,_c_lz,_c_land of the implicit forms outside the PS;_b/_c_b;Biasoperand on implicit samples in the PS;Gradderivatives (the typed 2D implicit read,_d, and the--texel-offset-fallbackgradients).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:(replaced, see Update) (recorded with the other fallback flags);explicit_lod_biasintools/vk_subgroup_info.py(MoltenVK's driver ID), read byscripts/run_gpu_tests.py,runtime/test/shaders/build.pyandmake_game.pyLEONIDA_EXPLICIT_LOD_BIAS=1/0forces it in the test runners.check.py'sSAMPLER_CASESgainpoint bias +0.3and-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 indocs/testing.md.ps_ssharpstays in the macOS job'sEXPECTED_FAILURESfor 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)bias +1; also +-0.6, -1)bias +0.3(counted twice)bias +0.3(counted twice)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).build.py, resolution in #822's thread, none with this branch), test programs rebuilt: MoltenVK has no failure left:run_gpu_tests.py195/263, 68 skipped (228/263 withLEONIDA_W64_EMULATE=1),check.py187/231, 44 skipped. KosmicKrisp keeps exactly the failures it had without this branch (cs_fma_fusedfrom #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._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
mainand merges cleanly.docs/design.md, with how it was confirmed.🤖 Generated with Claude Code
Red checks: from
main, not this change (updated for headbf458bbcb)The failing jobs (
check,macos-python,semantic-tests,stdlib-tests-linux,translator-tests,linux-gpu-tools,macos) also fail onmain: the CI and Runtime workflows ofmainef3299584fail the same jobs (READ from both CI runs).windows,no-game-dataandviewer-testspass. 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.maintest_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_exttest_docs_cli_flags(-Gamein the README)tests/semantic/test_interp_computed_ij_fallbackmain, MEASURED on macOS, 1 run)test_mesh_serial_waves(6 mesh fixtures)main's CI)vk_bindless_dimensions(macOS)Not checked by a second agent or human yet.
Imported from ubiquitarianism/leonida. Originally posted by Mby159 on 2026-11-25T12:11:33Z.
Checked
1d19671ebon 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 frommainbcaa13dad(the merge-base); nothing was merged.tools/vk_subgroup_info.pyon 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_ssharpwith the flag unset: PASS, "10 S#/T# cases, 4096 pixels each exact" - the two newpoint bias +0.3andpoint bias -0.3cases included.LEONIDA_EXPLICIT_LOD_BIAS=1forced 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.LEONIDA_EXPLICIT_LOD_BIAS=0forced 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
mainon 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, andcs_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.
Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-25T12:13:33Z.
Tested
1d19671ebon Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), againstmain0d80bc5df:tests/semantic/test_explicit_lod_bias.py: OK at this head; onmain7 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.ps_ssharp:main(no flag):ps_ssharp8 S#/T# cases PASS on MoltenVK 1.4.2 — the sampler appliesmipLodBiasto the explicit-LOD sample here.vk_subgroup_inforeportsexplicit_lod_bias: truefor driver_id 14): FAILpoint 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=0at this head: PASS 10/10; KosmicKrisp (flag off by detection): PASS 10/10.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-biasautomatically.AI-assisted; synthetic fixtures only, no game data.
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.
The auto-selection reports what it should:
ps_ssharp, with the choice made per device:--explicit-lod-biasOn 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=1on KosmicKrisp fails exactly as documented —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-valclean.AI-assisted. No game data: the fixture is hand-written and every number above is test output.
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
main0d80bc5df, binaries from the build at66d4f5aa3, Homebrew llvm-mc 23.1.4 / SPIRV-Tools 1.4.363:vk_subgroup_inforeportsdriver_id: 14,explicit_lod_bias: true— i.e. the auto path enables the flag.mainwithout the flag:ps_ssharp8/8 PASS — on this macOS the sampler appliesmipLodBiasto the explicit-LOD sample, so the M3/macOS 27 premise does not hold here.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=0at 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 == MOLTENVKalone 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.
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, base0d80bc5df:mainwithout the flagps_ssharp—point bias +1: (0,0): (1.0, 0.0, 0.502, 0.502)LEONIDA_EXPLICIT_LOD_BIAS=1forcedpoint bias +0.3, the doubled biasSo the same
driver_id 14gives opposite answers on 26.7.3 and 27.0, and both directions are reproducible.driver_id == MOLTENVKis 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_ssharpdoes, with a 1×1 chain: build a 2-mip texture, sample withimage_sample_lzatLod = 0andmipLodBias = +1, and compare the returned texel against level 1. That is onevk_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.pyand test it on both sides — 27.0 here, and I can ask for a 26.7.3 run from the comment above.AI-assisted.
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:
mipLodBias?ps_ssharpfails onmainmainmainSo 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_idsandps_ssharpwithout the flag, draws them withvk_sampler_testat 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_ssharpon your M5 Pro then. Until then, please don't merge this PR as it is: the current head turnsps_ssharpred on your machine.AI-assisted (Claude Code).
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.pydrawsps_ssharpwithout 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 answerstrueon MoltenVK andfalseon KosmicKrisp and llvmpipe. A rerun on your 27.0 M3 would be very welcome.Your idea of putting it in
tools/vk_subgroup_info.pyhas a real advantage over mine: it wouldn't need the built test programs, somake_game.pyandbuild.pycould 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).
Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-25T15:46:29Z.
Rerun on the 27.0 M3, as asked.
So the probe answers
trueon this 27.0 M3 too, which is whatps_ssharpneeds 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.pyneedsllvm-mconPATH, and Homebrew'sllvmis keg-only, so a Mac user hitting it first sees the raw'llvm-mc' could not be startedmessage. Cheap fix in the tool's error text (point atllvm/tools/mc_command.py's message, which already saysLLVM_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.pyversion 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.
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.pyversion, so the probe no longer needs the built test programs, plus the clearllvm-mcmessage 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).
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-biasmeasures it in Python with one compute dispatch (tools/vk_lod_bias.py), with no built test programs, llvm-mc or SPIR-V tools.build.pyandmake_game.pyuse it too.LLVM_MChint whenllvm-mcis missing.ps_ssharp_ld,_b,_cube,_3d,_c,_o), through newvk_sampler_test --cube/--3d/--drefmodes.On the M3 (26.5.1), all 7
ps_ssharp*pass on MoltenVK (probetrue), KosmicKrisp and llvmpipe (probefalse), and forcing the flag on the last two failsbias +0.3as 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-biasshould answer"explicit_lod_bias": false, and--filter ps_ssharpshould pass all 7 with the flag off. Thanks both.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T21:47:25Z.
Thanks for Update 2! Three things before this can merge:
mainintools/vk_subgroup_info.py, after #624 landed. Please mergemainin.make_game.py,runtime_gpu_explicit_lod_bias()has a secondtryblock after the first, which always returns. It's unreachable and uses an undefinedbuild; please drop it.AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-25T23:22:22Z.
@aslan2142 thanks, both done, in your order:
mainis merged in (b14565930, up to21d3662ad). #624 had addedchosen_d/chosen_extensionsfor what mychosen_devdid, so I keptmain's and the--lod-biasmeasurement now uses them. It looks the extensions up itself rather than throughexts, which is only set whenper_vertexis true.tryinruntime_gpu_explicit_lod_bias()is removed (3fc618429), and nothing else inmake_game.pychanges.Rerun at
3fc618429on the Apple M3 (macOS 26.5.1):trueon MoltenVK andfalseon KosmicKrisp and llvmpipe.ps_ssharp*fixtures pass in auto mode on all three, and forcing the flag off or on fails as documented.maindoesn't also have. ctest needs #2096 today: without it, the build stops atvk_null_descriptor_test's missinggenerated/.The 27.0 M3 and M5 Pro reruns are still pending.
AI-assisted (Claude Code).
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:
vk_subgroup_info.py --lod-biasshould answerfalse) and the 27.0 M3 with the compute probe. The 27.0 result in the thread is from the draw probe.EXPECTED_FAILURESinruntime.ymlstill listsps_ssharp. Once the job runs, drop it if the runner's probe answerstrue, or add the newps_ssharp_*fixtures if they fail there.vk_lod_bias.pyanswerstruewhenever 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 answernullotherwise?image_sample_cl/image_sample_c_clgetmax(0, minlod) + bias. Vulkan clamps after the bias,max(bias, minlod), as_b_clalready does.AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T01:45:17Z.
@aslan2142 thanks, done in your order:
vk_subgroup_info.py --lod-biasshould answerfalse) and the 27.0 M3 with the compute probe. @GeorgiyDemo @EvgHaze, when you have a moment, please rerun at the new head.ps_ssharpfromEXPECTED_FAILURESif the runner's probe answerstrue, or add theps_ssharp_*fixtures that fail there.1787a81c7): the shader also reads at explicit LOD 1 with no bias, andverdict()answersnullunless that read is 1.0. On this M3, skipping the level 1 clear now givesnullon all three drivers ("control read at LOD 1 gave 0.0"), where it used to givetrueon MoltenVK. New test:test_the_lod1_control_must_read_one.85eac6b54): outside the PS,image_sample_cl/image_sample_c_clnow add the S# bias before the clamp,max(0 + bias, minlod), as_b_cldoes. New semantic test:test_compute_cl_clamps_after_the_bias. It fails on the previous head.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
mainagain (a88bb83e0, up toad41fd517), 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_testtagged the T# 2D only, so after the mergeps_ssharp_cubeandps_ssharp_3dread the magenta fallback.743eda012tags the array the texture sits in for--cube/--3d.Rerun at
743eda012on the Apple M3 (macOS 26.5.1):trueon MoltenVK andfalseon KosmicKrisp and llvmpipe.ps_ssharp*fixtures pass in auto mode on all three, and forcing the flag off or on fails as documented.run_gpu_tests.py: no failure thatmaindoesn't also have.ps_array_resinfoandps_get_lod_arrayfail onmaintoo since #2098, on every driver; #2169 fixes them.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-26T04:28:10Z.
Rerun at
743eda012, the head that mergedmainagain, on the 27.0 M3 — so the "checked until it is rerun" note indesign.mdcan go.vk_subgroup_info.py --lod-bias, MoltenVK 1.4.2 — the new flag answers and explains:tools/lod_bias_probe.py, three drivers on the same machine:mipLodBias(+1 still reads level 0)mipLodBias(+1 reads level 1)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_cubeandps_ssharp_3dread 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
mainpasses without the flag.AI-assisted. No game data.
Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T05:47:42Z.
@EvgHaze thanks for the rerun.
bcf199736drops the "until it is rerun" note:design.mdnow 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 thatps_ssharpand 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.
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.On your machine the probe should answer
"explicit_lod_bias": false, since MoltenVK appliesmipLodBiasthere. The sixps_ssharp*fixtures should pass in auto mode. If the probe answers true instead, itsexplicit_lod_bias_reasonline is the useful part. Thanks!AI-assisted (Claude Code).
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.
tools/vk_subgroup_info.py --lod-biasscripts/run_gpu_tests.py --filter ps_ssharp, auto modeSo the measured answer is false on the M5, as on the M5 Pro without the flag: MoltenVK applies
mipLodBiasthere. 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.
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 thegloballine inrdna2spirv.py'smain(), wheremainaddedADDRESS_GUARDnext to this PR'sEXPLICIT_LOD_BIAS. Both are kept.Retested at
0dcf650d1on an Apple M3 (macOS 26.5.1), test programs rebuilt from this tree:--lod-biasprobe: 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_oskips withoutLEONIDA_TEXOFF_FALLBACK=1).cs_fma_fused(#1724) andcs_imgatomic_ext(#1518).test_vk_lod_bias.py,test_vk_subgroup_info.pyandtest_make_game_translator_flags.pypass.No change to the PR's own code.
AI-assisted (Claude Code). No game data.
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-biastranslator pass, Vulkan samplermipLodBiasprobe, 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-biason real Vulkan hardware: exited 0 with"explicit_lod_bias": false, "explicit_lod_bias_reason": "the sampler applies mipLodBias (+1 reads level 1)".python -m unittestacrosstest_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, andtest_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).llvm-mc/spirv-valare not installed locally, so theps_ssharp_*.asmGPU 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).
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T13:23:07Z.
Review: APPROVED
Independently verified
3a7dc6126merged cleanly ontomain(d48a957bb) on Windows 11 across two Vulkan GPUs (zero game files):32.0.16.1664)gfx1036) (driver32.0.21030.2001)(Note: MoltenVK/macOS itself was not exercised on this Windows host; the
--explicit-lod-biaslowering 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.pyfails (8tests /9errors: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.pyfails (132tests /20errors:make_gamelacksruntime_gpu_explicit_lod_bias).Green on
#1774(3a7dc6126):scripts/run_semantic_tests.py tests/semantic -p test_explicit_lod_bias.py: 8/8 passed.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).tools/lod_bias_probe.pyon both RTX 5080 and AMD Radeongfx1036: returns{"explicit_lod_bias": false, "reason": "the sampler applies mipLodBias (+1 reads level 1)"}.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 Radeongfx1036.LEONIDA_EXPLICIT_LOD_BIAS=1): 0/7 passed, 1 skipped (point bias +0.3double-applied on both GPUs, confirming both drivers apply samplermipLodBiasnatively and the auto-probe correctly keeps--explicit-lod-biasdisabled on both).LGTM.
Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-28T13:53:36Z.
Apple check — M3, both drivers, head
3a7dc612(currentmainmerged in).Versus
main(fcbe97b9a) on the same machine:maincs_imgatomic_extandps_ssharpcs_imgatomic_extSo the device probe picks up the M3/MoltenVK case on its own and
ps_ssharppasses in auto mode, withoutLEONIDA_EXPLICIT_LOD_BIAS: thepoint bias +1case that read(1.0, 0.0, 0.502, 0.502)onmainnow reads(0.502, 0.502, 0.502, 0.502). KosmicKrisp keeps the same six failures asmain(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_modsfails identically onmainfcbe97b9a, andgit bisectover5b6ffd5a8..fcbe97b9aputs the first failing merge atb79595ecc(#435, "accept VOP3 clamp/omod as hardware no-op on v_cvt_{i16,u16}_f16"): it updatedtests/semantic/test_alu_cvt_16.pybut not the oldertest_valu_cvt_f16_int16_mods.py, which still expectsUnsupportedfor those ops.5b6ffd5a8passes that file,fcbe97b9afails it.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:34:52Z.
Independent Windows 11 + NVIDIA GeForce RTX 3090 Verification (
05a0f7f2a3merged ontomain53b77df14f)Environment: Windows 11 (
10.0.26200), MSVC19.44.35228, Python3.12.10(-I),llvm-mc(gfx1030), SPIRV-Tools /VK_LAYER_KHRONOS_validation1.4.363.1, physical NVIDIA GeForce RTX 3090 (Ampere, driver610.88, Vulkan1.4, fixed subgroup32..32). Synthetic fixtures only; no game files.1. Probe, Translator, and Unit Suites — PASS
LEONIDA_VK_VALIDATION=1,0validation 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 directlod_bias_probe.draw_probe(<build>):(False, 'the sampler applies LOD_BIAS +1 and -1')251/251passed):tests/semantic/test_explicit_lod_bias.py:8/8 OK(Red onmain:unrecognized arguments: --explicit-lod-bias)tests/test_vk_lod_bias.py:5/5 OK(includingspirv-val --target-env vulkan1.0)tests/test_lod_bias_probe.py:10/10 OKtests/test_vk_subgroup_info.py:59/59 OKtests/test_make_game_translator_flags.py:38/38 OKtests/test_make_game_argparse.py:38/38 OKtests/test_shader_checks.py:88/88 OKtests/test_cmake_translator_deps.py:5/5 OK2. Hardware Finding on NVIDIA (
point bias +0.3Exceeds NVIDIA'sNEARESTMip Threshold) + Verified+-0.26Fixpython -I scripts/run_gpu_tests.py --build <build> --filter ps_ssharpon RTX 3090 in auto mode (--explicit-lod-biasoff, verified0OpBitFieldSExtractinps_ssharp.spv) fails all 6 activeps_ssharp*fixtures on the newpoint bias +0.3case:1/256S#LOD_BIASresolution viavk_sampler_teston RTX 3090):VK_SAMPLER_MIPMAP_MODE_NEARESTlevel selection to transition within[0.25, 0.5](the same tolerancevulkan_sampler()inruntime/src/gfx10_descriptors.hrelies on when settingmaxLod = 0.25fforMipFilter::none).610.88), the hardware sampler transitions from mip0to mip1atq = +74/256 = +0.2890625(+73/256 = +0.28515625stays on mip0; likewise at implicitLOD 1,bias = -182/256 => q = +0.2890625stays on mip1whilebias = -183/256 => q = +0.28515625switches to mip0, matching1 - 1/sqrt(2) = 0.2929).+0.3encodes as+77/256 = +0.30078125 > +0.2890625, a single hardwaremipLodBiasof+0.3already selects mip1on NVIDIA.bias = +-0.26, i.e.+-67/256 = +-0.26171875):0.2617 < 0.2891stays on(0, 1)on both NVIDIA (0.289) and0.5-rounding drivers (AMD/Mesa/Apple), while a double-counted bias2 * 0.2617 = +0.5234 > 0.5crosses0.5on all drivers.bias = +-0.26inSAMPLER_CASES(LEONIDA_VK_VALIDATION=1,0validation errors):6/7PASS (ps_ssharp,_3d,_b,_c,_cube,_ld—10S#/T# cases x4,096pixels each exact;ps_ssharp_oskipped as expected).LEONIDA_TEXOFF_FALLBACK=1:7/7PASS (includingps_ssharp_o,286,720total pixels exact).LEONIDA_EXPLICIT_LOD_BIAS=1(forced negative control):6/6FAIL on+0.26(+0.5234moves explicit LOD0 -> 1), preserving the exact double-bias check.Lowering the two
SAMPLER_CASESprobe points inruntime/test/shaders/check.py(andtests/test_shader_checks.py/ docs) from+-0.3to+-0.26will keep all 7 fixtures green on NVIDIA while still catching any double-applied bias on0.5-threshold drivers.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T02:59:58Z.
Verified by OreoFR
48bae6cad+ PR head05a0f7f2a(tested as a merge; it also merges without conflict on the newer main5825b02ff)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_testbuiltrdna2spirv.EXPLICIT_LOD_BIASmissing (ERRORs),lod_bias_probe/vk_lod_biasmodules missing,make_gameargparse and translator-flag tests ERROR;test_shader_checksalready passes on main; translator suite on main: 526 files, 6506 tests, 1 file failing (test_valu_cvt_f16_int16_mods, a known main failure)vk_sampler_testcompiles; translator suite 527 files, 6514 tests, same single known failure, no new onegta6rt.exebuilds and links;dumpbin /dependentsshows the same DLLs as main, no network DLL)5825b02ff;ps_ssharp*GPU checks and the macOS/MoltenVK path not run here)AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-29T03:43:56Z.
Re-checked the current head
05a0f7f2(twomainmerges since3a7dc612). Same result — the flag still goes in automatically andps_ssharppasses on MoltenVK; nothing regressed in between.The single semantic failure is the one
maincarries sinceb79595ecc(#435) and is fixed by #2593, not by this change: atf6cbdb938(#2593) this file passes andcs_imgatomic_extstops failing on both drivers. The earlier report at3a7dc612(comment-7240260046) stands.AI-assisted.
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
bf458bbcbwith currentmaindd87aa405merged in (clean merge), runtime rebuilt; Homebrew llvm-mc 23.tools/vk_subgroup_info.py --lod-biasandtools/lod_bias_probe.pyboth answerfalse,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_BIAS10 S#/T# cases, 4096 pixels each exact;ps_ssharp_oSKIP without the fallback01(forced on)point bias +0.3(the bias counted twice), e.g.ps_ssharp (0,0): (0.502, ...) != (1.0, 0.0, ...);ps_ssharp_clikewiseLEONIDA_TEXOFF_FALLBACK=1ps_ssharp_opass, 10 cases exactSo 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.pyOK; fullctest132/132.test_interp_computed_ij_fallback(2 failures, f16 off by one ulp). It is red on plainmaintoo, so not from this PR.AI-assisted: yes.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T19:39:42Z.
Re-verified by OreoFR at head
bf458bbcbon maineedd72e30(still merges cleanly on0e8737f2a): 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 was05a0f7f2a; 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).test_explicit_lod_bias9 errors,test_make_game_translator_flags17,test_vk_subgroup_info2, one import or argparse error each intest_lod_bias_probe,test_make_game_argparse,test_shader_checks,test_vk_lod_bias).git merge --no-ff, no conflict): 8, 10, 38, 38, 92, 5 and 59 tests, all OK.scripts/run_semantic_tests.py tests/semantic, on main91bab934d, the main of the start of this run): merge 530 files, 6534 tests, onlytest_interp_computed_ij_fallbackfails; main alone 529 files, 6526 tests, the same single failure. No new failure.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.
Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-30T09:55:28Z.
@zmasi Thanks, your
+0.3finding on the RTX 3090 was right and I had missed it. Head07905380dnow uses+-0.26inSAMPLER_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:ps_ssharp_oSKIP. The same withLEONIDA_EXPLICIT_LOD_BIAS=1.LEONIDA_EXPLICIT_LOD_BIAS=1(negative control): 0/6, each fails onpoint bias +0.26. So the bias counted twice (+0.52) is still caught.test_shader_checks,test_vk_lod_bias,test_lod_bias_probeOK. Semantic suite: 6533 tests, onlytest_interp_computed_ij_fallbackandtest_valu_cvt_f16_int16_modsfail, both red onmain.Not run here: NVIDIA. A re-run of
ps_ssharpon an NVIDIA card at this head would confirm the fix.Not checked by a second agent or human yet. AI-assisted: yes.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-30T10:03:11Z.
@Tauwni I ran the requested NVIDIA retest at
07905380dcef2bc524abf074a0420525c6e342c1merged locally withmain4014af7fe9a479caee2946c1814c11935b24bf60. RTX 5070 (NVIDIA 610.88), Windows 10 22H2, MSVC 19.44.35230, Ninja Release. I rebuilt the stock GPU test binaries and ranpython -I scripts/run_gpu_tests.py --filter ps_ssharp --require-passwith a fresh work directory for each arm.explicit_lod_bias=false. Six GPU fixtures pass with ten S#/T# cases and 4,096 exact pixels per case.ps_ssharp_oskips because this harness does not enableVK_KHR_maintenance8.LEONIDA_TEXOFF_FALLBACK=1: all seven GPU fixtures pass, includingps_ssharp_o.LEONIDA_EXPLICIT_LOD_BIAS=1: all seven fail atpoint bias +0.26, so the new threshold still catches double application on this adapter.All eight synthetic shaders passed
spirv-valin each arm.test_explicit_lod_bias.pypassed 8/8. This run covers native NVIDIA sampler behavior and the forced-bias negative control using synthetic inputs.AI-assisted.
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:
07905380dmerged withmain4014af7f→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):ps_ssharp_oSKIP (harness enables noVK_KHR_maintenance8)LEONIDA_TEXOFF_FALLBACK=1LEONIDA_EXPLICIT_LOD_BIAS=1LEONIDA_EXPLICIT_LOD_BIAS=1point bias +0.26spirv-val: 8/8 clean in every arm. So the±0.26threshold 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 intools/rdna2spirv.py. A rebase will be needed before merge; I used4014af7fto match the NVIDIA run.AI-assisted.
Full suite at the same tree (
9ca26fa3a, 20:55–21:05):cs_bvh,cs_bvh32,cs_fma_fused,ps_cndmask_sign_mods,ps_valu16_mad_sel— each fails identically on the base4014af7frebuilt 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.Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-30T10:50:39Z.
@EvgHaze Thanks. Head
ab09fd1f8mergesmain012b79a67. Two conflicts were more than both sides adding a line:make_game.py/scripts/run_gpu_tests.py:--no-ftz32and--integer-dot-fallbackfrommainare 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, theGradpath 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:ps_ssharp_oSKIP; withLEONIDA_TEXOFF_FALLBACK=1: 7/7. WithLEONIDA_EXPLICIT_LOD_BIAS=0(the fix off): 0/7, 1 run.=1: 0/7 onpoint bias +0.26.test_make_game_argparsetest_custom_jobs_forwarded_to_shadersfails, 3/3 on plainmain012b79a67too: it does not mockmain's new--no-ftz32probe, which adds--no-ftz32on this Mac.Not checked by a second agent or human yet. AI-assisted: yes.
Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-30T11:00:40Z.
CORRECTION to my last comment: after the
mainmerge, CI'scheckjob failed ontests/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 frommain, and I had not run it.Cause (READ IN CODE): the new test from
mainmocks exactly twosubprocess.runcalls, the--no-ftz32probe and the translator. WithLEONIDA_EXPLICIT_LOD_BIASunset, this PR's--lod-biasprobe inbuild.pyruns first and uses one of them. The test now pinsLEONIDA_EXPLICIT_LOD_BIAS=0;build.pyis unchanged.MEASURED, Apple M3: the file passes 3/3 (it fails 3/3 before the change; plain
mainpasses). Every standalone test file, run once: the 33 that fail on this Mac fail on plainmain012b79a67too, and none fails only with this PR.Not checked by a second agent or human yet. AI-assisted: yes.
Imported from ubiquitarianism/leonida. Originally posted by EvgHaze on 2026-11-30T11:13:26Z.
Independent check at
ab09fd1f8(tested as-is; parents07905380d+ main012b79a67). 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:ps_ssharp_oSKIPLEONIDA_TEXOFF_FALLBACK=1LEONIDA_EXPLICIT_LOD_BIAS=0point bias +1)LEONIDA_EXPLICIT_LOD_BIAS=1point bias +0.26Full 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 plainmain012b79a67, rebuilt and rerun here separately — pre-existing, not from this PR.Your
make_gamediagnosis reproduces too:JobsHandlingTest.test_custom_jobs_forwarded_to_shadersfails identically atab09fd1f8and on plain012b79a67; the actual call carriesfallbacks=('--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_FLAGSstill lists--no-ftz32and--integer-dot-fallbacknext to--explicit-lod-bias;run_gpu_tests.pystill appends--no-ftz32and then--explicit-lod-bias; intools/rdna2spirv.pythe typed float-only implicit sample is gated withand not EXPLICIT_LOD_BIAS, so with the flag on the Grad path scales the derivatives by2^biasas described.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:43:03Z.
Review: APPROVED
Reviewed the
--explicit-lod-biastranslator 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.pywiring,runtime/test/vk_sampler_test.cppmode extensions, and semantic/unit tests on headd99ba5c. Clean-room, standard-library-only, independently verified across Apple M3 (MoltenVK/KosmicKrisp/llvmpipe), Apple M5, NVIDIA RTX 5070/5080, and AMDgfx1036, and mergeable cleanly with all 9 CI checks green. Approving and merging.(AI-assisted review.)