Repository navigation
asahi: route G18G rounding ops through shared AGX3c unary encoder for FP16 support - #1021
Merged
Merged
Conversation
… FP16 support In agx3_emit_funop() (agx3_pack_binary.c), AGX3_FUNOP_RINT on G18G already fell through to agx3_alu_unary_m5(), which emits the same AGX3_MN_f32rint fields while supporting 16-bit half operands and high registers (0..255). FLOOR, CEIL, and TRUNC on G18G were still routed to agx3_funop_encode_g17g(), which refuses 16-bit rounding operands. Route all four rounding operations (FLOOR, CEIL, TRUNC, RINT) on G18G through agx3_alu_unary_m5() so FP16 ceil/floor/trunc/roundEven encode cleanly and transcode to AGX3D. 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 ed2351e4f06d
Blockers: none
Checked: Full diff, enum agx3_funop ordering and agx3_alu_unary_m5() handling, debug-assert build, full Asahi unit test suite, and live Vulkan CTS on Mac Studio M5 Max (J775c, T6050).
Evidence
- Audited
src/asahi/compiler/agx3_pack_binary.calongsideagx3_funop_core.handagx3_alu_core.c:AGX3_FUNOP_{FLOOR,CEIL,TRUNC,RINT}are contiguous<= AGX3_FUNOP_RINT, so tightening the G18Gagx3_funop_encode_g17g()branch to(op > AGX3_FUNOP_RINT && op <= AGX3_FUNOP_EXP2)routes all four rounding ops toagx3_alu_unary_m5()(which handlesop <= AGX3_FUNOP_RINTwith 16-bit and 0..255 register support) while keepingLOG2,EXP2,RSQRT, andSQRT_STEPon their existing paths. - Built
ed2351e4f06dwith-Db_ndebug=false:meson test --suite asahipassed203/203(0failures). - Verified live Borealis ICD (
libvulkan_asahi.so,sha256:5ea4cdb733c1, confirmed loaded viaLD_DEBUG=libs) on Mac Studio M5 Max (J775c, T6050):dEQP-VK.glsl.builtin.precision_fp16_storage16b.{ceil,floor,trunc,round}.*16/20PASS (4/5each,0failures,4not supported),GPU_FAULT_DELTA=0.
erikwb
added a commit
that referenced
this pull request
Nov 26, 2026
PR #1021 moved G18G floor/ceil/trunc onto agx3_alu_unary_m5() alongside roundeven, leaving only f32log2, f32exp2, f32rsqrt and f32sqrtstep on the agx3_funop_encode_g17g() production route in agx3_emit_funop(). Update the comment in agx3_funop_encode_impl() to match aurora-wip. Signed-off-by: Erik Bourget <erik@ebourget.net>
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
AGX3_FUNOP_FLOOR,AGX3_FUNOP_CEIL, andAGX3_FUNOP_TRUNCon G18G throughagx3_alu_unary_m5()inagx3_emit_funop()(src/asahi/compiler/agx3_pack_binary.c), matchingAGX3_FUNOP_RINT.Root Cause
agx3_emit_funop()sent G18GFLOOR,CEIL, andTRUNCtoagx3_funop_encode_g17g(), which refuses 16-bit operands (dest_16 || src_16), whileAGX3_FUNOP_RINTalready fell through toagx3_alu_unary_m5()(which emits the sameAGX3_MN_f32rintfields with 16-bit and 0..255 register support).Verification
meson test -C /root/mesa/vkcts-b --suite asahi: 203/203 OK (-Db_ndebug=false).mini6), 0 GPU faults indmesg:dEQP-VK.glsl.builtin.precision_fp16_storage16b.{ceil,floor,trunc,round,roundeven}.*: 20/20 Pass, 0 Fail.