Repository navigation
borealis: enable per-raygen RT kernel specialization on G17P - #1529
Conversation
|
Exact-head M5 Max (
Quick PR hygiene note before merge: per |
satchlj
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at ddebd59dfbf3306d84767ca65fb2941d6a92aae5
Blockers:
- Remove the AI attribution trailer from the PR description (commit
ddebd59dfbf3itself is clean). - Update the PR title prefix to
borealis:(and replace the legacy driver name in the touched comment atsrc/asahi/vulkan/hk_ray_tracing_pipeline.c:4165). - Add explicit
two-way/one-waydoor phrasing in## Risk.
Code audit and exact-head hardware / test verification (G17P J616C targeted RT CTS + 3.94x ABBA, and M5 Max J775c #issuecomment-7343979240 with 243/243 arm64 meson test + bit-identical M5 ray-query control) are clean with no blocking correctness issues; ready to flip to APPROVE as soon as the PR text / naming items are fixed.
Checked: no Apple material, chip-profile selection (AGX_CHIP_G17P / M5), hk_rt_per_raygen_kernels() gating, hk_rt_cont_split() raygen-only filtering, zero-raygen binary serialization round-trip, draws.cl launch guards, RT unit tests, J616C and J775c exact-head receipts, PR text
Evidence
src/asahi/lib/agx_chip.h(AGX_CHIP_G17P): confirmed the shared G17 runtime HAL200/AGX3b profile covers A18 Pro, M4 Pro, and M4 Max, soagx_chip_g17p_or_m5()selects the intended hardware family by chip profile rather than board name.src/asahi/vulkan/hk_ray_tracing_pipeline.c:hk_rt_cont_split()appliesonly_raygenfiltering consistently across both thehit_object_execute_shaderscan and the continuation-split pass; library pipelines (VK_PIPELINE_CREATE_2_LIBRARY_BIT_KHR) bypass per-raygen dispatch cleanly.hk_rt_binary_serialize()/hk_rt_binary_load()handlekernel_count == 0round-trips cleanly (allocating/reading zero entries without dereferencing or rejecting empty tables).- Policy/naming: touched comment at line 4165 still uses the legacy driver name; please rename to Borealis.
src/asahi/vulkan/cl/draws.cl:select_setup()andselect_launch()guard zero-dimension dispatches (groups_xy.x && groups_xy.y && depth) and zero-pointer SBT records (record[0]) before indexing the per-raygen table.src/asahi/vulkan/tests/test_rt.cpp: 3 extended unit tests cover G17P/M5 vs non-target gating, raygen-only splitting, and zero-raygen serialization.- Tests & hardware rows at exact head
ddebd59dfbf3:x86_64--suite asahi(236/236) and exact-head J616C (G17P, M4 Max) targeted RT CTS (1,368/1,368) + 3.94x ABBA benchmark passed; exact-head J775c (M5 Max,#issuecomment-7343979240) passed 243/243 arm64meson testand live M5VK_KHR_ray_queryABBA (0 faults;VK_KHR_ray_tracing_pipelinedisabled on M5, RT pipeline CTS 1,397/1,397 NotSupported DIFF=0).
Extend per-raygen kernel specialization from M5-only to G17P (agx_chip_g17p_or_m5) in hk_compile_ray_tracing_pipeline() and hk_rt_binary_load() so multi-raygen RT pipelines compile one compute kernel per ray-generation group instead of inlining every raygen stage into one megakernel. Single-raygen pipelines (kernel_count == 1) continue to dispatch directly via hk_rt_single_kernel() with zero selection overhead. Multi-raygen pipelines on G17P select the active kernel on the GPU via libagx_trace_rays_select_setup() and indirect dispatch (keeping the M5-only single-kick ICB path M5-gated). Also tighten three edge cases across G17P and M5: - Skip unreachable raygen stages in hk_rt_cont_split() when compiling a per-raygen continuation kernel so depth > 3 pipelines specialize code and stack size per raygen group as well. - Distinguish library vs executable RT binaries by pipeline library flag in hk_rt_binary_serialize() and allow kernel_count == 0 in hk_rt_binary_load() for executable pipelines containing no raygen groups. - Guard the raygen SBT handle dereference in libagx_trace_rays_select_* when launch dimensions or raygenShaderRecordAddress are zero. Extend test-hk-rt-cache-control, test-hk-rt-pipeline-binary, and test-hk-rt-pipeline-executable to cover G17P per-raygen specialization, cache restoration, binary round-trips, executable properties/statistics, and the legacy G13G megakernel control.
ddebd59 to
7718068
Compare
|
Addressed all 3 hygiene items at
Ready for re-review / flip to |
satchlj
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 771806817047c7da92d75ee8a866a6367310c3db
Blockers: none
Checked: exact interdiff ddebd59dfbf3..771806817047, PR title/body/Risk hygiene, J616C (G17P) and J775c (M5 Max) receipts still valid
Evidence
- Verified exact interdiff
ddebd59dfbf3..771806817047: strictly 1 file (src/asahi/vulkan/hk_ray_tracing_pipeline.c),+3/-3comment-only lines (0 compiled code changes). Both exact-head hardware / test receipts fromddebd59dfbf3— J616C (G17P, M4 Max) targeted RT CTS (1,368/1,368) + 3.94x ABBA benchmark and J775c (M5 Max#issuecomment-7343979240) 243/243 arm64meson test+ bit-identical M5 ray-query control — remain valid. - All three hygiene blockers are resolved: PR title now uses the
borealis:prefix (borealis: enable per-raygen RT kernel specialization on G17P), the PR description attribution trailer is removed, the touched comment athk_ray_tracing_pipeline.c:4165usesBorealis, and## Riskspecifiestwo-way · M4 Pro, M4 Max, M5.
|
Local CI for head Hosted Actions is still off on this repo, so I ran the
No test fails on either tree. Every timeout is An earlier round on Since Receipt: |
|
Local CI rerun for head
Both timeouts are load-related and already happen on the tip: the |
J700 row: mesa#1529 at head
|
| Arm | Commit | Role |
|---|---|---|
| stock | - |
installed Fedora mesa-aurora-vulkan-drivers (admission control only) |
| tip | 8b30f41493cac6916a8d43e744cd50b6cc2b110b |
aurora-wip tip at kit seal (base arm) |
| merge | 69b8d3edd95d0530e72232363a5c52f90b30354b |
local merge of mesa#1529 head 7718068 into the tip, tree c186103c50cb, merge base 689b2fe (head arm) |
trace=pipeline scene (gpubench-rt-vk 7a0dfcf, rt.scene preset=medium, GB_VERIFY=1)
| Arm | Verdict | check | CRC / image CRC | fps | gpu_rt_us | driver |
|---|---|---|---|---|---|---|
| tip | PASS | valid=True rays_ok=True | 7242d0b0 / d2eef667 |
68.24 | 7745.65 | Mesa 26.3.0-devel (git-8b30f41493), Borealis, derived from Honeykrisp |
| merge | PASS | valid=True rays_ok=True | 7242d0b0 / d2eef667 |
68.22 | 7745.25 | Mesa 26.3.0-devel (git-69b8d3edd9), Borealis, derived from Honeykrisp |
CTS chunks (serial, tip then merge)
| Chunk | What | Cases | Ran both | Compared | Diffs | s tip/merge | tip | merge |
|---|---|---|---|---|---|---|---|---|
| c00 | trace_rays_cmds, trace_rays_cmds_maintenance_1, trace_rays_indirect2, callable_shader, pipeline_binary RT (J616C suites 1-5) | 101 | yes | 101 | 0 | 2/3 | {'Pass': 101} | {'Pass': 101} |
| c01 | shader_binding_table, pipeline_library, data_spill, complexcontrolflow, pipeline_no_null_shaders_flag (J616C suites 6-10) | 1151 | yes | 1151 | 0 | 20/21 | {'Pass': 1130, 'NotSupported': 21} | {'Pass': 1130, 'NotSupported': 21} |
| c02 | large_shader_set, misc (J616C suites 11-12) | 143 | yes | 143 | 0 | 100/100 | {'Pass': 135, 'NotSupported': 8} | {'Pass': 135, 'NotSupported': 8} |
| c03 | smoke slice 1 of 4: other ray_tracing_pipeline groups + no_queues pipeline_binary raygen | 435 | yes | 435 | 0 | 6/6 | {'Pass': 415, 'NotSupported': 20} | {'Pass': 415, 'NotSupported': 20} |
| c04 | smoke slice 2 of 4: other ray_tracing_pipeline groups + no_queues pipeline_binary raygen | 435 | yes | 435 | 0 | 15/16 | {'Pass': 416, 'NotSupported': 19} | {'Pass': 416, 'NotSupported': 19} |
| c05 | smoke slice 3 of 4: other ray_tracing_pipeline groups + no_queues pipeline_binary raygen | 435 | yes | 435 | 0 | 7/6 | {'NotSupported': 14, 'Pass': 421} | {'NotSupported': 14, 'Pass': 421} |
| c06 | smoke slice 4 of 4: other ray_tracing_pipeline groups + no_queues pipeline_binary raygen | 435 | yes | 435 | 0 | 6/5 | {'Pass': 422, 'NotSupported': 13} | {'Pass': 422, 'NotSupported': 13} |
The row ran on a merge into the current aurora-wip tip (8b30f41493ca), the same as the PR's base when this was posted. gpu_rt_us is flat (7745.65 → 7745.25), so G17P shows no performance change in this one-run scene; the row confirms correctness only.
What
hk_rt_per_raygen_kernels()viaagx_chip_g17p_or_m5()) on G17P (AGX_CHIP_G17P, Apple M4 Pro/Max) inVK_KHR_ray_tracing_pipeline, matching M5 while keepinghk_trace_rays_single_kick()M5-only.hk_rt_single_kernel().libagx_trace_rays_select_setup()(AGX_BARRIER_ALLstrong flush on G17P) + per-kernel indirect dispatch path (hk_cmd_dispatch_rays()).hk_rt_binary_serialize()/hk_rt_binary_load(): key library binary kind onVK_PIPELINE_CREATE_2_LIBRARY_BIT_KHRand allowkernel_count == 0forHK_RT_BINARY_RAYGEN_KERNELSso executable RT pipelines with zero raygen groups round-trip cleanly.hk_rt_cont_split(): skip unreachable raygen stages when compiling a per-raygen kernel (raygen_group != NULL) so continuation-mode (depth > 3) pipelines also specialize code size and stack frame per raygen group.draws.cl: guardlibagx_trace_rays_select_setup()/libagx_trace_rays_select_launch()against zero dispatch dimensions or null raygen SBT handles (record[0] == 0).test-hk-rt-cache-control,test-hk-rt-pipeline-binary, andtest-hk-rt-pipeline-executableto cover G17P per-raygen specialization (depth 1 & continuation depth 4), warm cache restore, 2-raygen binary round-trip, and executable properties/stats/IR.Tested
x86_64,ddebd59dfbf3;771806817047is a 2-line comment-only edit with 0 compiled code changes):236/236 PASSacross--suite asahi(includingagx_tests,hk_rt_cache_control,hk_rt_pipeline_binary,hk_rt_pipeline_executable,hk_ray_tracing_core,hk_rt_on_demand,hk_rt_inlining; 0 failures, 0 skipped).J616C,G17P, kernel7.3.0-j616c-272-v5h+,ddebd59dfbf3/ comment-only head771806817047,MESA_SHADER_CACHE_DISABLE=true, 0 GPU faults indmesg):deqp-vk, 12 suites): 1,368 / 1,368 PASS, 0 FAIL (29 NotSupported):dEQP-VK.pipeline.monolithic.pipeline_binary.dedicated.ray_tracing_pipeline*: 7/7 PASSdEQP-VK.ray_tracing_pipeline.trace_rays_cmds.*: 30/30 PASSdEQP-VK.ray_tracing_pipeline.trace_rays_cmds_maintenance_1.*: 20/20 PASSdEQP-VK.ray_tracing_pipeline.trace_rays_indirect2.*: 32/32 PASSdEQP-VK.ray_tracing_pipeline.callable_shader.*: 12/12 PASSdEQP-VK.ray_tracing_pipeline.large_shader_set.*: 32/32 PASSdEQP-VK.ray_tracing_pipeline.shader_binding_table.*: 262/268 PASS (0 fail, 6 NS)dEQP-VK.ray_tracing_pipeline.pipeline_library.*: 301/301 PASSdEQP-VK.ray_tracing_pipeline.data_spill.*: 187/202 PASS (0 fail, 15 NS)dEQP-VK.ray_tracing_pipeline.complexcontrolflow.*: 80/80 PASSdEQP-VK.ray_tracing_pipeline.misc.*: 105/113 PASS (0 fail, 8 NS)dEQP-VK.ray_tracing_pipeline.pipeline_no_null_shaders_flag.*: 300/300 PASS689b2fe3dbfbbase vsddebd59dfbf3/771806817047, 2-raygen RT PSO with 1 lightweight primary raygen + 1 heavy 4-bounce GI raygen tracing1024x1024rays over an 8,192-triangle BLAS, 6 interleaved roundsA1 B1 B2 A2 A3 B3, 40 GPU-timestamped iterations per round,MESA_SHADER_CACHE_DISABLE=true):VK_KHR_pipeline_executable_properties):689b2fe3dbfb, 1 megakernel):2,072 insns,18,056 B,103 GPRs,304 B scratch,156 spills / 142 fills.ddebd59dfbf3/771806817047, 2 per-raygen kernels):rgen_light:527 insns(-74.6%),5,062 B(-72.0%),71 GPRs(-32 GPRs),0 B scratch, 0 spills / 0 fills.rgen_heavy:1,612 insns(-22.2%),13,796 B(-23.6%),103 GPRs,304 B scratch,142 spills / 136 fills.rgen_lightdispatch):689b2fe3dbfb):A1=1003.62 us(p10 600.04 / p90 1620.21),A2=1051.96 us(p10 719.58 / p90 1529.83),A3=897.71 us(p10 687.75 / p90 1599.83) — mean median 984.43 us.ddebd59dfbf3/771806817047):B1=249.62 us(p10 245.17 / p90 254.54),B2=248.92 us(p10 245.42 / p90 253.08),B3=251.17 us(p10 245.46 / p90 253.75) — mean median 249.90 us (3.94x faster / -74.6% GPU time).light_hash=c04e0e500d289fea,heavy_hash=474faf7b4d70d5bc), 0 GPU faults indmesg.J775c,G17C B1,ddebd59dfbf3): 243/243 native arm64meson testPASS + live M5VK_KHR_ray_queryABBA bit-identical CRCs, 0 GPU faults (see review comment).J616C (M4 Max, G17P) 771806817047: PASS (comment-only edit atop ddebd59dfbf3; 236/236 host tests, 1368/1368 targeted RT CTS, 3.94x multi-raygen ABBA speedup, 0 GPU faults)Risk
Risk: two-way · M4 Pro, M4 Max, M5 (a plain revert restores the previous G17P megakernel path and M5 RT helpers).
AGX_CHIP_G17P): switches multi-raygen RT pipelines from monolithic megakernel to per-raygen specialized kernels + existinglibagx_trace_rays_select_setup()indirect dispatch, keepinghk_trace_rays_single_kick()M5-only.AGX_CHIP_G17_M5): preserves existing behavior plus zero-raygen binary round-trip, continuation-mode per-raygen filtering, and null/zero-dimdraws.clguards.Not yet