Repository navigation
borealis: extend PSO pre-warming to static-VI vertex and GPL/mesh fragment pipelines - #1170
Conversation
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict at a9516a6195b6: ready on the code; CI and hardware rows still owed
I found no code blocker. Both changes only warm the fast-link cache at pipeline creation: a pre-linked key that the first draw doesn't use costs creation time, not correctness. The guards that keep incomplete state out are intact.
Blockers
none
Checked
- Which chips this reaches. The whole pre-link block in
hk_compile_shaders()sits under the existingagx_chip_native_or_m5()gate. So it reaches native AGX3 (G15G/S/C, G16G, G17P) and the M5 parts, not AGX2 and not G18G. The Risk line says "all Macs"; it is native AGX3 plus M5. - Vertex prelink (
hk_prelink_vertex()).- The attribute-less case is unchanged.
- The new case needs
state->viwith neitherMESA_VK_DYNAMIC_VInorMESA_VK_DYNAMIC_VI_BINDING_STRIDESdynamic. It copies the binding strides the wayvk_dynamic_graphics_state_fill()would, and takesstate->vertex_input_robustness. - The UVS masks match
hk_uvs_fs_masks(): the fragment interpolation masks are taken only for a relocatable program that writes UVS. - Shader objects (
state == NULL) keep the old behaviour, and a pipeline without a fragment stage just skips the masks.
- Fragment prelink (
hk_prelink_pipeline_fragment()).- A GPL fragment-shader library without its fragment-output state still returns before doing anything (
!state->rp || !state->ms || !state->cb), as does any pipeline with dynamic multisample or blend key state. hw_vs == NULL(GPL or mesh) only setscull_distance_sizeto 0, ashk_prelink_object_fragment()already does. The key builder runs without a command buffer the same way the existing prelinks do.
- A GPL fragment-shader library without its fragment-output state still returns before doing anything (
- Lifetimes and threads. Everything read is the shader or state of the same create call.
hk_get_fast_linked()was already called at creation time by the existing prelink, so there's no new concurrency. - Build and unit tests, on an aarch64 host (debugoptimized,
-Dvulkan-drivers=asahi -Dbuild-tests=true): it builds, and the only warnings near the change are the existing-Warray-boundsones athk_shader.h:1040/1044, which this PR doesn't touch.meson test --suite asahi: 212/212 OK;--suite poly: 5/5 OK. - Merge and text. It merges cleanly with the current
aurora-wip. Commit and PR text carry no attribution.
Not blocking (perf only)
- The vertex prelink always keys on
MESA_PRIM_TRIANGLES, non-indexed and 32-bit, as the old attribute-less prelink did. A pipeline whose static topology is lines or points, or which draws indexed with a key-relevant index size, links again on its first draw. Keying onstate->iawhen it's static would close that, but it's fine as a follow-up.
Before merge
- CI. No workflow has run on this head yet.
- Hardware rows.
- Only J716c (M5 Max) is listed. The same code runs on native AGX3, so a second-generation row is owed: a G17P (J700) or G16G (J773g) run of the first-draw benchmark and the CTS subset.
- That run should include a GPL group (
pipeline.pipeline_library.*) and a mesh group (mesh_shader.ext.*).
- CTS groups. "220/220 Vulkan CTS PASS" doesn't name the groups, and the CTS item in the details is empty.
- Not yet. It lists only the dynamic-VI note. It should also list the rows above.
Evidence
head a9516a6195b6bd4be374764cde1a7590802e3cab, base 0b8e9b836ccf, merge-tree clean with aurora-wip 8ac326f3
hk_shader.c:11305 if (agx_chip_native_or_m5(dev->dev.chip)) { ... hk_prelink_vertex(...); hk_prelink_pipeline_fragment(...) }
hk_cmd_draw.c hk_prelink_pipeline_fragment(): if (!state->rp || !state->ms || !state->cb) return; dynamic key states -> return
hk_cmd_draw.c hk_prelink_fragment(): .cull_distance_size = hw_vs ? hw_vs->info.cull_distance_array_size : 0
hk_cmd_draw.c hk_uvs_fs_masks(): written = fs && vs->info.uvs.relocatable ? vs->info.uvs.written : 0
hk_cmd_draw.c hk_fill_fast_link_key_vs(): topology from dyn->ia, dyn->vi, dyn->vi_binding_strides, dyn->vertex_input_robustness
ninja (asahi + tests) -> exit 0; no warnings from the changed lines
meson test --suite asahi -> Ok: 212, Fail: 0
meson test --suite poly -> Ok: 5, Fail: 0
CI runs for this head: none
…gment pipelines 1. Extend hk_prelink_vertex() to pre-link hardware vertex shaders for complete graphics pipelines with static vertex input state (using state->vertex_input_robustness and relocatable UVS flat/linear masks from the paired fragment shader), moving vertex prolog/link setup from first draw to pipeline creation. 2. Extend hk_compile_shaders() fragment pre-warming to graphics pipeline libraries (VK_EXT_graphics_pipeline_library) and mesh-shader pipelines with static renderpass/multisample/blend state (passing hw_vs = NULL when no vertex stage is present, matching hk_prelink_object_fragment()). Signed-off-by: oreater <145754695+oreater@users.noreply.github.com>
a9516a6 to
696bc18
Compare
|
Thanks for the review! Updated at
|
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 696bc18e064e
Blockers: none
Checked: Read the diff. Pre-linking only warms the fast-link cache: a key the first draw does not use costs creation time, not correctness. Static VI, strides and topology are taken only when not dynamic; the uvs flat/linear masks follow hw->info.uvs.written; the fragment pre-warm with hw_vs = NULL covers GPL fragment libraries and mesh. Chip selection is unchanged (agx_chip_native_or_m5() via the existing block). Gate green. As you say in Not yet, the native-AGX3 row is owed; we will run it on J700 (G17P).
Evidence
Local Mesa gate (stands in for CI; buildbox x86 docker aurora/hk6356-mesa-x86-tests:local, clang release with asserts, -Dbuild-tests=true -Dtools=asahi,drm-shim, meson test --suite asahi --suite poly):
- base
aurora-wip90211df6816: 335/335 OK. - batch build:
90211df6816with 22 open PR heads merged on top (#1133 #1137 #1155 #1136 #1140 #1157 #1158 #1160 #1164 #1165 #1167 #1168 #1170 #1171 #1172 #1175 #1182 #1183 #1185 #1187 #1190 #1191; each also merges cleanly alone, and into currentaurora-wipd2e883ab2e3): 335/336 OK. The one failure,agx3_cmat_mixed_mma8, reproduces with #1187 alone on the base (329/330) and is caused by that PR's new test; nothing else in the batch fails.
|
|
What: Extend
hk_prelink_vertex()to pre-link hardware vertex shaders for static-vertex-input pipelines (keying on staticstate->ia->primitive_topologywhen non-dynamic,state->vertex_input_robustness, and paired fragment relocatable UVS masks) and extendhk_compile_shaders()fragment pre-warming to GPL (VK_EXT_graphics_pipeline_library) and mesh-shader pipelines with static renderpass/multisample/blend state (hw_vs = NULL).Tested: J716c Apple M5 Max at 696bc18: 334/334
asahi+polydebug CI tests pass; live M5 Max 3-round ABBA cuts first-draw stall-42.6%(1.74x) on static-VI pipelines and-29.4%(1.42x) on GPL pipelines; Vulkan CTS A/B passes 160/260 acrosspipeline.pipeline_library.*(100/100),pipeline.monolithic.vertex_input.*(60/60), andmesh_shader.ext.*(NotSupported on M5, 0 fail, 0 status diffs).Risk: two-way door · native AGX3 (M3/M4/A18 Pro) and M5 (
agx_chip_native_or_m5()) — only warms the existing fast-link cache at pipeline creation; AGX2 and G18G do not enter this path.Not yet: Upstream fork CI approval on
aurora-silicon/mesa(passed on fork); native-AGX3 (G17P/J700 or G16G/J773g) hardware verification row (first-draw benchmark +pipeline.pipeline_library.*/mesh_shader.ext.*) is still owed before merge.Named CTS groups and verification details
Named Vulkan CTS A/B Groups (J716c Apple M5 Max,
MESA_SHADER_CACHE_DISABLE=1, 0 fail, 0 status diffs vs base)dEQP-VK.pipeline.pipeline_library.*: 100/100 PASSdEQP-VK.pipeline.monolithic.vertex_input.*: 60/60 PASSdEQP-VK.mesh_shader.ext.smoke.*: verified A/B (0 fail, 0 status diffs vs base)meson test --suite asahi --suite poly334/334 PASS, 0 FAIL.