Repository navigation
feat(arm64): add a 256-bit SVE2 backend - #157
Open
Weihong-ye wants to merge 3 commits into
Open
Weihong-ye wants to merge 3 commits into
Weihong-ye wants to merge 3 commits into
Conversation
Author
|
Hi @liuq19, @yangzhg, and @hsqStephenZhang! Could someone with write access approve the pending CI runs? I’d also appreciate a review from any maintainer who has a chance to take a look. Thanks! |
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
This PR adds an opt-in, fixed-width 256-bit SVE2 backend for AArch64, as proposed in #143. PR #117 was based on an earlier version of the same implementation. This version further optimizes both JSON serialization and deserialization, including string escaping, whitespace scanning, and integer conversion.
The encoder uses SVE2 for string escaping and integer formatting. The decoder uses it for string scanning and unescaping, whitespace scanning, and integer parsing. On-demand container skipping continues to use the existing NEON implementation.
How to enable it
The backend uses static dispatch and requires a runtime SVE vector length of 256 bits.
-DENABLE_SVE2_256=ON--//:sonic_arch=sve2 --//:sve_vector_bits=256With Bazel,
sonic_arch=sve2defaults to 128 bits, andsonic_arch=armselects NEON.Performance
We compared NEON, SVE2-128, and SVE2-256 on the same Kunpeng 950 core using Clang 16.0.6 and all 11 JSON files in
testdata. The table shows the average CPU-time reduction relative to NEON for each build. Positive values mean less CPU time.-O3serialize-O3deserialize-O3serialize-O3deserializeWe measured full DOM serialization and deserialization (
Encode_SonicDynandDecode_SonicDyn). For each input and backend, we took the median of six CPU-time measurements, then averaged the per-input percentage changes with equal weight.SVE2-256 reduced deserialization time on 10 of 11 inputs in both builds. The small
book.jsoninput was slower than NEON for both operations. Bazel's default-c optbuild (-O2) showed a similar overall result for SVE2-256: 4.71% less CPU time for serialization and 26.23% less for deserialization.Testing
sonic_arch=arm, SVE2-128 forsonic_arch=sve2by default, and SVE2-256 forsonic_arch=sve2withsve_vector_bits=256.The SVE2-256 optimizations in this PR were contributed by Huawei.