Repository navigation
borealis: take float image atomics, colour pruning and position order to G16G - #923
Conversation
G16G advertises shaderImageFloat32Atomics, shaderImageFloat32AtomicAdd and shaderImageFloat32AtomicMinMax through the shared HAL200 block of hk_create_drm_physical_device(), but hk_get_image_plane_format_features() offered VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT on R32_SFLOAT only on G17P and M5. Vulkan requires that bit on R32_SFLOAT when shaderImageFloat32Atomics is supported, and without it an application cannot use the advertised feature on an optimal-tiled image. Take the bit from the advertised feature instead of a chip list. The storage texel buffer bit gets the same rule; it already covered every chip that advertises the feature, so it does not change. The image atomics go through the same code on every native AGX3 part: nir_lower_image_atomics_to_global(), then agx_nir_lower_atomics(), which keeps a native 32-bit global fadd on the AGX3B encoding and turns fmin/fmax into compare-and-swap loops. G16G and G17P share that encoding. G16G already exposes R32_SFLOAT texel buffer atomics and R32_UINT/SINT image atomics through the same lowering. Signed-off-by: Diljit Singh <hey@djdev.me>
hk_populate_fs_key() sets discard_color_outputs only on G17P and M5. With the key set, hk_prune_unused_fragment_colors() removes a fragment shader's colour stores before linking, when the complete pipeline state proves there are no colour attachments and alpha-to-coverage is statically off. Output reads, depth, sample masks, discard and memory effects are kept. The pass is plain NIR and uses no encoding or command-stream feature, so nothing in it is specific to G17P or M5. Take it on G16G too. Its depth-only and shadow passes then stop computing colours that no attachment stores. The gate now names the HAL200 native parts and M5 explicitly. It still leaves out G15 and the AGX2 parts, which have not run it. Signed-off-by: Diljit Singh <hey@djdev.me>
… G16G agx_nir_preserve_position_order() keeps NIR from reassociating or algebraically rewriting what vertex Position depends on. Without it, a depth-only link and a colour link of the same vertex shader can round the same position expression differently when an intermediate value also feeds a live varying. A depth pre-pass with LESS_OR_EQUAL then rejects samples of the colour pass. The pass runs only on G17P and M5. The difference comes from NIR optimisation of the two links, not from the hardware, so G16G links can differ in the same way. Run the pass on G16G vertex shaders too. Multiply-add contraction and unrelated outputs are still optimised. Signed-off-by: Diljit Singh <hey@djdev.me>
|
Live hardware verification on Apple M4 Mac mini (G16G B0, J773g), Linux
|
satchlj
left a comment
There was a problem hiding this comment.
Verdict at f18253a63b8e
Approve.
Blockers
None.
Checked
- Audited all 3 changed files (
src/asahi/vulkan/hk_buffer_view.c,src/asahi/vulkan/hk_image.c,src/asahi/vulkan/hk_shader.c,+7/-6) againstorigin/aurora-wip(789cbde2d1f1). - Verified
hk_physical_device.ctiesvk.supported_features.shaderImageFloat32Atomicsdirectly toEXT_shader_atomic_float, so gatingR32_FLOATstorage texel-buffer and storage-image atomic format features onpdev->vk.supported_features.shaderImageFloat32Atomicskeeps Vulkan format features in lockstep with the advertised device feature across every chip. - Verified
agx_chip_native_hal200(chip)matches onlyG16GandG17P, extending colour-output pruning (hk_shader.c:712) andagx_nir_preserve_position_order(hk_shader.c:5493) from{G17P, M5}to{G16G, G17P, M5}with no behavioural change on M5 or AGX2. - Built in an isolated worktree and ran the non-layout
asahi+drm-shimunit test suite:236/236passed (0failed). - Verified live Borealis Vulkan execution on Apple M5 Max (
G17C B1, Linux 7.3,MESA_SHADER_CACHE_DISABLE=1):382passed,0failed,342not supported acrossdEQP-VK.api.info.format_properties.r32_sfloat,dEQP-VK.glsl.atomic_operations.*float*,dEQP-VK.spirv_assembly.instruction.compute.float_controls.fp32.input_args.*,dEQP-VK.compute.pipeline.basic.*, anddEQP-VK.pipeline.monolithic.vertex_input.single_attribute.mat4.*, with0GPU faults indmesg. - Untested scope: Live
G16G(M4) hardware execution was not run (only Apple M5 Max hardware is available here;G16Gchanges were audited statically and verified viadrm-shimtests).asahi_layout_testswas excluded due to a pre-existing GCC 16 designator-order build error insrc/asahi/layout/tests/test-layout.cpp:374.
Evidence
- Unit & drm-shim suite (non-layout
asahi):236/236 OK,0 FAIL. - Live Borealis Vulkan CTS on Apple M5 Max (
G17C B1,MESA_SHADER_CACHE_DISABLE=1,0GPU faults):dEQP-VK.api.info.format_properties.r32_sfloat:1/1passeddEQP-VK.glsl.atomic_operations.*float*:52/240passed,0failed,188not supporteddEQP-VK.spirv_assembly.instruction.compute.float_controls.fp32.input_args.*:207/356passed,0failed,149not supporteddEQP-VK.compute.pipeline.basic.*:80/81passed,0failed,1not supporteddEQP-VK.pipeline.monolithic.vertex_input.single_attribute.mat4.*:42/46passed,0failed,4not supported
|
Verdict at Blockers: none. Checked: the diff against aurora-wip (3 files, +7/-6); the M4 (J773g, G16G B0) row at this head in the comment above (culling 43/43, image atomics 705 pass and 0 fail, unit tests 178/178, 0 GPU faults); fork CI at this head passes ( Notes (not blocking)
|
What: Borealis on G16G (M4) now prunes unused fragment colours from depth-only pipelines and keeps vertex position arithmetic the same across pass variants, as G17P and M5 already do. The R32_SFLOAT image and texel-buffer atomic bits follow the advertised float-atomics feature (that hunk is already on aurora-wip).
Tested: M4 Mac mini (J773g, G16G B0) at
f18253a63b8e:dEQP-VK.rasterization.culling.*43/43,dEQP-VK.image.atomic_operations.*705 pass and 0 fail, asahi unit tests 178/178, 0 failed units, 0 GPU faults. Fork CIasahi254/254 atf18253a63b8e.Risk: two-way · M4 (G16G) Borealis; G17P and M5 unchanged
Not yet: nothing for the two shader-pass changes. R32_SFLOAT image atomics on M4 come from aurora-wip itself, which already advertises float atomics; the row's older base did not, so those cases were NotSupported there.
Details (original description)
Summary
Three Borealis paths were enabled only on G17P and M5, although nothing in them depends on the G17P or M5 encoding or command stream. This enables them on G16G (M4).
Changes
shaderImageFloat32Atomics,shaderImageFloat32AtomicAddandshaderImageFloat32AtomicMinMax, butVK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BITonR32_SFLOATwas offered only on G17P and M5. Vulkan requires that bit wherevershaderImageFloat32Atomicsis supported.hk_prune_unused_fragment_colors()is plain NIR. It now also runs on HAL200 native parts, so G16G depth-only and shadow pipelines stop computing colours that no attachment stores. G15 and AGX2 are still excluded, because the pass has not run on them.agx_nir_preserve_position_order()keeps the depth-only and colour links of the same vertex shader from rounding Position differently, which otherwise makes a LESS_OR_EQUAL depth pre-pass reject samples in the colour pass.The two shader-pass changes widen an existing chip condition rather than adding a new one.
Testing
f18253a63b8(DjDeveloperr/mesa):asahi254/254 pass (run 45377804983),aurora-agent-policypass (run 45377804902).git diff --checkclean, andagent-policy.sh prclean againstaurora-wip.aurora-wipwithout conflicts.