Repository navigation
borealis: align SSBO address format with Gen10 descriptor lowering on G18G - #1006
Merged
Merged
Conversation
… G18G hk_nir_lower_descriptors() selects the 5-component SSBO address format (with the sparse map slot) whenever ctx.descriptor_generation == 10, which includes both M5 (G17G/G17S/G17C) and G18G. However, hk_get_spirv_options(), hk_lower_nir(), and hk_maybe_build_byte_stencil() checked agx_chip_g17_m5(), which is false on G18G and selected the 4-component address format instead. On G18G, that mismatch caused spirv_to_nir and nir_lower_explicit_io() to expect 4-component SSBO derefs while hk_nir_lower_descriptors() emitted 5-component SSBO descriptor values, tripping the assertion addr->num_components == deref->def.num_components in lower_explicit_io_deref() on every SSBO shader in assertion-enabled builds. Factor the Gen10 check into hk_ssbo_addr_has_map() in hk_shader.h and use it across all four sites, matching hk_nir_lower_descriptors(). Add a unit test covering Gen7, Gen9, M5, and G18G chips in test-hk-binding-base.c. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
satchlj
approved these changes
Nov 25, 2026
satchlj
left a comment
Member
There was a problem hiding this comment.
Verdict: MERGE at 0c5a2c233226
Blockers: none
Checked: full diff across hk_shader.h, hk_shader.c, hk_nir_lower_descriptors.c, and the binding-base unit test; all hk_buffer_addr_format() callers in src/asahi/vulkan/; -Db_ndebug=false Meson asahi test suite and Borealis Vulkan CTS on M5 Max (J775c / G17C)
Evidence
hk_ssbo_addr_has_map(enum agx_chip chip)aligns SPIR-V lowering (hk_get_spirv_options()), explicit I/O lowering (hk_lower_nir()), and byte-stencil lowering (hk_maybe_build_byte_stencil()) withhk_nir_lower_descriptors()viaagx_chip_descriptor_generation(chip) == AGX_DESCRIPTOR_GENERATION_10.- Audited every
hk_buffer_addr_format()call site insrc/asahi/vulkan/; the remaining call athk_nir_lower_descriptors.c:2182is only the pre-loop struct initializer overwritten at line 2199 oncectx.descriptor_generationis resolved. check_ssbo_addr_format_matches_descriptor_gen()covers Gen10 parts (G17G/G17S/G17C/G18G) vs non-Gen10 (G17P/G16G/G13G) and verifies the 5-component map-carrying format onG18G.- Local verification at
0c5a2c233226on M5 Max (J775c / G17C,-Db_ndebug=false,MESA_SHADER_CACHE_DISABLE=1):meson test --suite asahi: 201/201 OK (hk_binding_baseOK, 0 failures).- Vulkan CTS 1.4.7.1
dEQP-VK.ssbo.layout.single_basic_type.std430.*: 303/303 passed (100.0%), 0 failed, 0 warnings, 0 GPU/MMU faults.
This was referenced Nov 25, 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.
Summary
Fixes an SSBO NIR address-format mismatch on G18G that triggered
Assertion 'addr->num_components == deref->def.num_components' failedinlower_explicit_io_deref()(src/compiler/nir/nir_lower_explicit_io.c:1779) on every SSBO shader in-Db_ndebug=falsebuilds (~1,930 crashes across the 22,222-case Vulkan CTS sweep on J873g).Root Cause
hk_nir_lower_descriptors()selects the 5-component map-carrying SSBO address format wheneverctx.descriptor_generation == AGX_DESCRIPTOR_GENERATION_10(which covers M5 and G18G). Meanwhile,hk_get_spirv_options(),hk_lower_nir(), andhk_maybe_build_byte_stencil()gated the same flag onagx_chip_g17_m5(), which returnsfalseforAGX_CHIP_G18G, producing 4-component SSBO derefs against 5-component lowered SSBO descriptors.Fix
hk_ssbo_addr_has_map(enum agx_chip chip)insrc/asahi/vulkan/hk_shader.hkeyed onagx_chip_descriptor_generation(chip) == AGX_DESCRIPTOR_GENERATION_10.hk_ssbo_addr_has_map()inhk_get_spirv_options(),hk_lower_nir(), andhk_maybe_build_byte_stencil()(andAGX_DESCRIPTOR_GENERATION_10inhk_nir_lower_descriptors.c).check_ssbo_addr_format_matches_descriptor_gen()insrc/asahi/vulkan/tests/test-hk-binding-base.c.Verification
-Db_ndebug=false,aarch64on J873g):meson test --suite asahi201/201 OK.J873g,T8152,Apple M6 (G18G B1), Linux7.3.0-aurora-j873-main+,-Db_ndebug=false,MESA_SHADER_CACHE_DISABLE=true):a0fd8033571): 6/6 representative SSBO CTS cases (ssbo.readonly.*,glsl.builtin.precision_fp16_storage32b.*,compute.shader_object_binary.*,synchronization.*buffer_16384,api.buffer_view.*,rasterization.depth_bias.d16_unorm_slope) aborted withSIGABRT(rc=134) atnir_lower_explicit_io.c:1779.0c5a2c23322): 0/6lower_explicit_io_derefaborts (SSBO/compute/GLSL cases pass;depth_bias.d16_unorm_slopeadvances past NIR lowering into the separateagx_ilp_schedulebug fixed in asahi/compiler: allocate size16 for G18G compute sample hoisting in agx_ilp_schedule #1005; 0 GPU kernel faults).G17G/G17S/G17C) already haddescriptor_generation == 10andagx_chip_g17_m5() == true; G17P and AGX2 are unchanged.