Repository navigation
GPU tests: exact fallbacks on by themselves where the device lacks the feature; gs_tri as compute on MoltenVK (TEST-481) - #3078
Conversation
|
Apple M2 validation of the automatic fallback selection. Tested head df3fb2d on Apple M2 (Mac14,3), macOS 26.4 (25E246), MoltenVK 1.4.2 (Homebrew, direct), subgroup 4..32, llvm-mc 23.1.6, Python 3.13.18.
Build note: the full build fails on AppleClang 17 at vk_pipeline_check.cpp:567 (BUILD-822, fixed by open PR #2927); all GPU binaries built, so the suite above is valid. Head fetched unchanged into a separate worktree; no rebase/edit/push. Synthetic shaders and counts only; no game files. AI-assisted. |
|
Tested
Tools: llvm-mc 21.1.8 with AMDGPU target, SPIRV-Tools 2026.1, GCC 13.3.0, Python 3.12.3. No code was edited or pushed; only synthetic fixtures were used. AI-assisted. |
…e feature; gs_tri as compute runtime/test/shaders/fallbacks.py decides, from tools/vk_subgroup_info.py, which exact fallbacks run_gpu_tests.py, build.py and check.py use, so a Mac runs the wave64, mesh and geometry tests instead of skipping them: - --wave64-emulate where the compute stage has no 64-wide subgroup; - --mesh-compute where there is no VK_EXT_mesh_shader, and on llvmpipe under --wave64-emulate (llvmpipe draws nothing for the emulated ms_tri/ms_clip as mesh shaders; exact as compute); - gs_tri's geometry shader as a compute capture pass where there is no geometryShader: the VS and GS as compute (spirv_gs_to_compute.py --vs/--draw-vs), the strips drawn as a list (vk_harness VKH_GS_COMPUTE, vk_gs_strips.h); - --f16-interp-fallback where PerVertexKHR doesn't compile (now in build.py/check.py too). LEONIDA_W64_EMULATE / MESH_COMPUTE / GS_COMPUTE / F16_INTERP_FALLBACK = 1 or 0 still force each. vk_subgroup_info.py reports mesh_shader and geometry_shader. CI's native llvmpipe run pins LEONIDA_W64_EMULATE=0 so it stays the native run.
df3fb2d to
978561f
Compare
|
Rebased onto Re-checked on Apple M3 Max against the same
|
Claimed in the coordination issue as: TEST-481 (claim)
What and why
On a Mac,
scripts/run_gpu_tests.pyskipped every test that needs a feature Metal lacks, even though exact fallbacks for most of them were already merged and only needed an environment variable. Now the GPU tests choose those fallbacks by themselves where the device lacks the native feature, the way--f16-interp-fallbackalready did.runtime/test/shaders/fallbacks.py(new) decides forrun_gpu_tests.py,build.pyandcheck.py, so a plainbuild.py+check.pyagree, asdocs/testing.mdasks. It reads whattools/vk_subgroup_info.pyreports.LEONIDA_W64_EMULATE,LEONIDA_MESH_COMPUTE,LEONIDA_GS_COMPUTE(new) andLEONIDA_F16_INTERP_FALLBACKset to1/0still force a fallback on or off. If the device can't be asked, nothing changes. The first output line names what is on and why.--wave64-emulateis on where the compute stage has no 64-wide subgroup.--mesh-computeis on where there is noVK_EXT_mesh_shader.gs_triruns as compute where there is nogeometryShader.--f16-interp-fallbackis on wherePerVertexKHRdoesn't compile.build.pyandcheck.pynow follow this too.tools/vk_subgroup_info.pyreportsmesh_shader(the meshShader feature) andgeometry_shader.gs_triwithout a geometry stage. This wires in SHADER-159'stools/spirv_gs_to_compute.py:--vsrewrites the vertex shader that feeds the GS into a compute pass that fills the GS input buffer (vs_capture).--draw-vswrites the vertex shader that draws the captured records (draw_vs).vk_harnessVKH_GS_COMPUTE/VKH_GS_DRAW/VKH_GS_LAYOUTdispatches both compute passes, reads the strip metadata back and draws the strips as a list in emission order. That assembly lives inruntime/test/vk_gs_strips.hand is checked on the CPU by the new ctestvk_gs_strips.docs/design.mdrow "Geometry shaders as compute in the GPU tests" describes all of it.--wave64-emulatekeeps its mesh shaders on--mesh-compute. Mesa 26.3.1 llvmpipe draws nothing for the emulatedms_triandms_clipwhen they run as mesh shaders. This happens onmaintoo, 3/3 runs withLEONIDA_W64_EMULATE=1, so it is not new.OpSetMeshOutputsEXTcounts are loaded from Workgroup memory after the rounds' barrier loop, no primitives come out. One extraOpControlBarrier, or either count as a constant, makes the frame exact.--mesh-compute.LEONIDA_W64_EMULATE=0, so it is still the native run. The emulated step is unchanged.Overlap: #2394 adds
compute_native64tovk_subgroup_info.py. Here the same test is computed infallbacks.pyfrom the existing keys, and the new keys go elsewhere in the dict. #2127'sgs_w64_*fixtures are untouched.Tested
Apple M3 Max, macOS 27.3. Drivers: MoltenVK 1.4.2 (Homebrew), KosmicKrisp and llvmpipe (Mesa 26.3.1, LLVM 23.1.6) through the Vulkan loader.
scripts/run_gpu_tests.pyper test, before (main4947579) → after (the same base plus this change)._emu=LEONIDA_W64_EMULATE=1 LEONIDA_MESH_COMPUTE=1. P/S/F = pass/skip/fail. Only rows that changed:cs_dpp_w64cs_w64_mask_detectcs_w64_mask_immcs_w64x_andn2_execcs_w64x_ballotcs_w64x_bpermutecs_w64x_branchcs_w64x_chain_barriercs_w64x_lds_rawcs_w64x_lds_warcs_w64x_load_ballot_loadcs_w64x_mask_reusecs_w64x_mask_reuse2cs_w64x_partialcs_w64x_partial_scmpcs_w64x_permutecs_w64x_readfirstlanecs_w64x_readlanecs_w64x_saveexec_b64cs_w64x_sbarriercs_w64x_wg128_branchescs_w64x_writelanecs_wave64_ballotcs_wavemaskcs_wm_bfm64cs_wm_half_cmpcs_wm_half_opscs_wm_scc_rflcs_wqm_w64cs_wqm_w64_halfgs_trims_clipms_f16_packms_trims_v5_workgroupms_w64x_ballotms_wave_info_s3ps_f64_mods(fp64),ps_ij_computed,ps_vcmpx_forms/ps_w64x_readlane, and the "run by" rows. The one FAIL,ps_ssharp(S# LOD bias), fails onmaintoo; Apply the S#'s LOD bias in the shader where samplers take none (SHADER-268) #1845 fixes it.=0the old default comes back. Only the f16 tests differ, becauseF16=0turns off whatmainalready chose automatically.main(607 commits later): mvk 153/35/1, kk 169/20/0, lvp 151/38/0. The one new SKIP,cs_mask_vgpr_exec, is a new exact-32-lane test.gs_trithrough the compute path: 4096/4096 exact on MoltenVK, KosmicKrisp and llvmpipe (LEONIDA_GS_COMPUTE=1), with zero Khronos validation messages on KosmicKrisp and llvmpipe.runtime/build/mac, configured withLLVM_MC): same asmainplusvk_gs_stripspassing.xdxr_build_checkfails on both.build.pynow adds--f16-interp-fallbacktovs_m2/vs_m15on a Mac host, so the D3D12 tests that usebuild.pyshaders were run with the fallbacks on and with all of them forced off.d3d12_buffer_uav,m2_formats,m2_textured,m3_frame,m4_compute.d3d12_translated_drawfails both ways: MoltenVK rejects subgroup builtins in a VS, see rdna2spirv: --no-vertex-subgroups so VS buffer fetches build on MoltenVK (SHADER-302) #1784.pytest tests7401 passed, 0 failed;tests/semanticOK.test_docs_design_rowsfails the same way onmain(the same topics; only line numbers moved). New tests:tests/test_gpu_fallbacks.py,vs_capture/draw_vs/CLI cases intest_spirv_gs_to_compute.py, thegs_triwiring intest_gpu_unsupported_stage.py, andmesh_shader/geometry_shaderintest_vk_subgroup_info.py.LEONIDA_W64_EMULATE=0give the same 35 FAILs, which come from Rosetta. Auto adds 28 PASS and no new failure.AI-assisted (Claude Code).
Checklist
docs/design.md, with how it was confirmed. (No translator rule changes. The new design row documents the test-side GS path.)🤖 Generated with Claude Code