sonic-cpp icon indicating copy to clipboard operation
sonic-cpp copied to clipboard

arm: Implement SVE2 str2int

Open supermartian opened this issue 1 year ago • 0 comments

This patch implements a SVE2 version of str2int which improves number decoding on ARM SVE2 CPUs.

The algorithm utilizes SVMATCH to count valid digits in the string, and SDOT for calculating the value. With this change the naive byte-by-byte method for ARM is substituted. Note that these instructions are SVE2 only.

Enable it by compiling with adding cmake option "-DENABLE_SVE2_128=ON".

Numbers were tested on NVIDIA Grace.

| Benchmark                      | Original     | SVE2       | Improvement |
|--------------------------------|--------------|------------|-------------|
| testdata/gsoc-2018.json        | 3406307500   | 3407847500 | 0.05%       |
| testdata/twitter.json          | 2040162500   | 2039502500 | -0.03%      |
| testdata/fgo.json              | 992470750    | 988730000  | -0.38%      |
| testdata/citm_catalog.json     | 2209855000   | 2205997500 | -0.17%      |
| testdata/twitterescaped.json   | 1767812500   | 1814302500 | 2.63%       |
| testdata/github_events.json    | 2142690000   | 2147452500 | 0.22%       |
| testdata/lottie.json           | 625985250    | 602068500  | -3.82%      |
| testdata/poet.json             | 2867745000   | 2880562500 | 0.45%       |
| testdata/otfcc.json            | 685481500    | 683760750  | -0.25%      |
| testdata/book.json             | 687309000    | 674716000  | -1.83%      |
| testdata/canada.json           | 775475000    | 1051945000 | 35.65%      |

This PR is contributed by NVIDIA

supermartian avatar Sep 11 '24 16:09 supermartian