Skip to content

borealis: give M5 mesh shaders without a fragment shader a vertex layer - #1343

Merged
RyanTheTide merged 1 commit into
aurora-silicon:aurora-wipfrom
m0d16l14n1:j815/m5-mesh-default-vertex-layer
Nov 29, 2026
Merged

RyanTheTide merged 1 commit into
aurora-silicon:aurora-wipfrom
m0d16l14n1:j815/m5-mesh-default-vertex-layer

Conversation

@m0d16l14n1

Copy link
Copy Markdown

What: An M5 mesh shader compiled without its fragment shader (pipeline library, unlinked shader object) gets a zero layer so a later fragment shader that reads gl_Layer finds a layer word. It was stored per primitive, which gives every primitive private vertices and pushed some shaders past the native output limits, where they fell back to compiling without the layer. The layer is uniform over the workgroup, so it is now stored per vertex, the form the multiview view index already uses.
Tested: J815 MacBook Air 15" M5 (T8142, G17G), Borealis, kernel 7.3.0-aurora-j815-dev, at 15973cf vs base 8bad0a5: 11,759 mesh cases on the library/shader-object paths: 0 diffs, 0 regressions (the layer is 0 either way); instrumented count over the 5,475 such shaders: per-primitive form added vertices in 348 shaders (+720 vertices) and fell back to no layer in 10; per-vertex form: 30 with added vertices (shaders with their own per-primitive outputs), 0 fallbacks; meson test --suite asahi 223/223; Godot TPS demo 1080p FSR2 voxel GI (FAST=1): 49.4 / 49.4 static, 57.4 route vs 49.5 / 49.7, 57.5 base (neutral). 0 GPU faults. Regression line: 0 SELinux denials (N/A on this image), 0 failed units, 0 new kernel errors.
Risk: two-way door · M5 Macs; only mesh shaders compiled without a fragment shader.
Not yet: M5 Pro/Max (G17S/G17C) hardware; no game on this desktop uses mesh shaders.

Details
  • hk_shader.c (+28/-28): hk_m5_mesh_default_layer() stores a per-vertex zero for every vertex below max_vertices_out (invocation i stores i, i + threads, ...) instead of a per-primitive zero below max_primitives_out, and no longer marks LAYER per primitive; the caller adds VARYING_BIT_LAYER to the mesh vertex outputs.
  • agx_nir_lower_m5_mesh() already handles a workgroup-uniform vertex layer (vertex_layer, used for the multiview view index), so the vertices stay shared.
  • The vertex/fallback counts came from a temporary counter in the mesh lowering over the same 11,759-case list (not part of this PR).
Evidence

Commands (gpu-perf):

CASE_S=60 python3 tools/deqp-ab.py r3-mdl deqp-lists/mdl-20261129.txt a=<base 8bad0a5741b ICD> b=<15973cfa8b8 ICD>
CASE_S=60 python3 tools/deqp-ab.py r3-gate deqp-lists/gate-20261128.txt a=<base> b=<15973cfa8b8> (+ the other PR heads as further arms)
FAST=1 tools/mesa-ab.sh r3-tps a=<base> ... c=<15973cfa8b8> (one arm per PR head)

mdl-20261129.txt: mesh cases of pipeline.{pipeline_library,fast_linked_library,shader_object_*}, shader_object.*, fragment_shading_barycentric.{pipeline_library,fast_linked_library} and all non-query mesh_shader.ext cases

caselist deqp-lists/mdl-20261129.txt (11759 cases)
a (base) 34 s: {'NotSupported': 5505, 'Pass': 6254} new GPU fault lines: 0
b (15973cf) 42 s: {'NotSupported': 5505, 'Pass': 6254} new GPU fault lines: 0
b vs a: 0 diffs, 0 regressions, 0 fixes

Gate (15,958, broad regression list):

caselist deqp-lists/gate-20261128.txt (15958 cases)
a (base) 128 s: {'Pass': 11230, 'NotSupported': 4728} new GPU fault lines: 0
c (15973cf) 128 s: {'Pass': 11230, 'NotSupported': 4728} new GPU fault lines: 0
c vs a: 0 diffs, 0 regressions, 0 fixes

Godot TPS demo, 1080p FSR2 voxel GI, FAST=1 (BENCH lines, a = base, c = this PR):

a BENCH view=1 frames=742 fps=49.5 ms_p50=20.15 ms_p95=22.44 ms_p99=24.37 ms_max=58.0 gpu_p50=19.95 gpu_p95=20.66 cpu_p50=4.06
a BENCH view=1 frames=100 fps=49.7 ms_p50=20.01 ms_p95=22.12 ms_p99=24.18 ms_max=24.2 gpu_p50=20.04 gpu_p95=20.70 cpu_p50=4.53
a BENCH view=play frames=1383 fps=57.5 ms_p50=17.34 ms_p95=20.48 ms_p99=21.85 ms_max=24.3 gpu_p50=17.05 gpu_p95=19.89 cpu_p50=2.15
c BENCH view=1 frames=742 fps=49.4 ms_p50=20.17 ms_p95=22.55 ms_p99=24.55 ms_max=55.9 gpu_p50=19.95 gpu_p95=20.60 cpu_p50=4.05
c BENCH view=1 frames=99 fps=49.4 ms_p50=20.07 ms_p95=23.71 ms_p99=24.28 ms_max=33.7 gpu_p50=20.01 gpu_p95=20.62 cpu_p50=4.56
c BENCH view=play frames=1380 fps=57.4 ms_p50=17.42 ms_p95=20.61 ms_p99=21.93 ms_max=24.9 gpu_p50=17.08 gpu_p95=19.96 cpu_p50=2.06

An M5 mesh shader compiled without its fragment shader (a pipeline
library or an unlinked shader object) gets a zero layer so that a
fragment shader reading gl_Layer finds a layer word. It was stored as a
per-primitive gl_PrimitiveLayerEXT, which gives every primitive private
vertices and can push the shader past the native output limits, where
it fell back to compiling without the layer.

The layer is uniform over the workgroup, so store it per vertex instead,
the form the view index already takes (vertex_layer in
agx_nir_lower_m5_mesh()). The shader keeps its shared vertices.

Signed-off-by: Nick <nekreshen@yandex.ru>
@m0d16l14n1
m0d16l14n1 requested review from a team and DjDeveloperr as code owners November 29, 2026 09:43

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 15973cfa

Blockers: none.

Checked:

  • Audited src/asahi/vulkan/hk_shader.c (+28/-28): hk_m5_mesh_default_layer() now emits per-vertex VARYING_SLOT_LAYER zero stores (nir_store_per_vertex_output, nir_type_uint32) across 0..max_vertices_out-1 (with verts == 0 guard and first + threads > verts partial-tail guard), drops per_primitive_outputs |= VARYING_BIT_LAYER, and marks shader->info.mesh.vertex_outputs |= VARYING_BIT_LAYER in hk_compile_shader_impl(), matching hk_lower_multiview()'s vertex_layer form in agx_nir_lower_m5_mesh().
  • Preserves shared vertices and avoids unnecessary native output-limit fallbacks (instrumented across 5,475 shaders: 348 -> 30 shaders with added vertices, 10 -> 0 fallbacks).
  • Exact-head J815 M5 (G17G) Borealis A/B verification: 11,759 mesh library/shader-object cases 0 diffs / 0 regressions, 15,958-case dEQP gate 0 diffs, meson test --suite asahi 223/223, Godot TPS neutral, 0 GPU faults.
  • DCO Signed-off-by: present; no Apple material or policy issues.
Evidence
  • Diff: src/asahi/vulkan/hk_shader.c (+28/-28).
  • Note (non-blocking): M5 Pro/Max (G17S/G17C) hardware not yet run; same agx_nir_lower_m5_mesh() vertex_layer lowering.

@RyanTheTide

Copy link
Copy Markdown

@DjDeveloperr, code-owner heads-up: App approval at 15973cfa8b82 from a different lane. This PR goes into the merge train's next combined A/B (aurora-wip 8bad0a57 + #1330 #1336 #1337 #1339 #1341 #1342 #1343 #1345 #1346 #1347 #1348) on M1 Pro G13S + M4 G16G. If that row is clean, I plan to land it via --admin under the 6-point rule no earlier than one hour from now, unless you post a hold.

@RyanTheTide

Copy link
Copy Markdown

Merge-train landing at 15973cfa8b82.

Revert: git revert -m 1 <merge commit> on aurora-wip. A regression gets reverted first and fixed after.

@RyanTheTide
RyanTheTide merged commit 58abf3b into aurora-silicon:aurora-wip Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants