Repository navigation
feat(shader): lower vertex-stage subgroup use to lane-local code on devices without it - #6
Merged
Merged
Conversation
…evices without it MoltenVK has no subgroup operations in vertex and tessellation-evaluation shaders, so every vertex program whose SPIR-V declared GroupNonUniform stopped the title at validation, without saying which construct needed it. The device's subgroupSupportedStages now reaches the recompiler target, every cache key and the request serializer (version 17). For a vertex, local or tessellation-evaluation program on a target that lacks the stage, LaneLocalLowering rewrites what is exact for each invocation on its own: lane-index values equal in every lane of the wave s3 describes, own-lane bit tests of ballot words, first-lane reads of wave-uniform values, and execz/vccz regions proven EXEC-masked with unchanged merge phis. What is left stops the program with its guest addresses; the SPIR-V emitter and the driver's validator refuse any leftover use with the program named. APS5_SUBGROUP_STAGES=<hex> and agc_shader_replay --subgroup-stages test this on any GPU. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Handover 1 of #5, phases 1 and 2: MoltenVK has no subgroup operations in vertex and tessellation-evaluation shaders (
subgroupSupportedStages = 0x32), so every vertex program whose SPIR-V declaredGroupNonUniformstopped PvZ and Hades II at their first draws withsubgroup capability 61 is unsupported for shader stage 1, without saying which construct needed it.SpirvTarget::subgroupStagescarries the device's stage mask into every cache key and the request serializer (version 17).APS5_SUBGROUP_STAGES=<hex>removes stages from any device (theSelected GPUline now showsstages=andoperations=), andagc_shader_replay --subgroup-stages=<hex>replays a dumped request as MoltenVK.LaneLocalLowering, after the static interface is applied) for vertex, local and tessellation-evaluation programs on a target that lacks the stage: lane-index values that are the same for every lane of the waves3describes (the NGGv_mbcntprologue), own-lane bit tests of ballot words (VOPC into VCC/SGPRs,v_cndmask, carry chains,s_*_saveexec, EXEC restores,s_cselectof masks), first-lane reads of wave-uniform values, andexecz/execnz/vccz/vccnzregions proven EXEC-masked with merge phis unchanged for the lanes that skip them. Wave-uniform and constant branch conditions become plain branches.vertex program 0x… (wave64, s3 counts 32) needs subgroup operations, which the device does not support in vertex shaders (subgroup stages 0x32); exact lowering left: <construct> at 0x…-0x…, replayable through the appended request. The SPIR-V emitter refuses any leftover subgroup use for such a stage, and the driver's validator names the program, stage, wave and device masks.APS5_DUMP_IRnow prints block terminators.Rank 3 of the design (
APS5_ONE_LANE_WAVES) is not included; neither title needed it.Tested
macOS 27.0.1, M5 Pro, MoltenVK from the LunarG SDK:
agc_shader_memory_tests(newverifyStagesWithoutSubgroups: lowered modules carry no subgroup capability, instruction or built-in; the same programs keep them on a device with vertex subgroups;s_bcnt1of EXEC, an SGPR written in anexeczregion and read after the join, a waterfall loop and DPP are refused with the construct named; serializer round trip; separate sources per stage mask),agc_shader_disk_cache_tests,agc_driver_graphics_tests.agc_driver_vertex_lane_local_tests(new): 189 vertices through a wave32 and a wave64 program withv_cmp/v_cndmask, a VCC carry chain, ans_cbranch_execzregion andv_mbcntagainst thes3count write the CPU-expected values on MoltenVK.agc_driver_exec_host_lanes_tests: the waterfall vertex program is refused witha wave-mask branch controls a loop. Both are also registered withAPS5_SUBGROUP_STAGES=0x32for Linux and Windows.APS5_MSAA_SINGLE_SAMPLE=1): no longer stops; runs at 60 fps with sound. Its next stop was a rect-list draw rejected every frame (black screen), fixed in the follow-up PR.Content/Packages/1080p/GUI.pkg(log line ~1070, crash reporteboot-2026-10-11-215305.ips). Withmain's driver it still stops at the subgroup error at line 834, so this is its next stop, not a regression of the lowering; all 117 of its registered programs replay cleanly with--subgroup-stages=0x32.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code