Improve SVE2 optimizations of SimdFloat32ToBFloat16 - #908
Merged
Conversation
Replace the software rounding path with hardware BFCVT/BFCVTNT conversion (svcvt_bf16_f32_x + svcvtnt_bf16_f32_x) and unroll the main loop. Co-authored-by: igor.ermolaev <igor.ermolaev@altezza.org>
ermig1979
marked this pull request as ready for review
August 24, 2026 12:57
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.
Replace the SVE2 software rounding path of
SimdFloat32ToBFloat16with hardware BFloat16 conversion.Changes
svcvt_bf16_f32_x+svcvtnt_bf16_f32_x(BFCVT / BFCVTNT) inSimdSve2BFloat16.cppinstead of shift/add rounding.f32vectors withsvuzp1_f32/svuzp2_f32so the convert pair writes sequentialbf16values.docs/2026.html.Test results
SimdSve2BFloat16.cppemitsbfcvt/bfcvtnt.svcvt/svcvtntmatchesBase::Float32ToBFloat16for 39 sizes per VL, including tails.uzp1/uzp2+ even/odd convert matches Base for F=4/8/16 and aligned/tail sizes../Test "-r=.." -fi=Float32ToBFloat16 -tt=1 -ts=1 -w=640 -h=480: ALL TESTS ARE FINISHED SUCCESSFULLY (Base / SSE4.1 / AVX2 / AVX-512BW / AMX).Test log
To show artifacts inline, enable in settings.