[libc] [llvm] [libc] Refactor `BigInt` (PR #86137)

Guillaume Chatelet via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 09:18:48 PDT 2024


gchatelet wrote:

> First pass of comments. Can you run benchmarks to check that the generated code is still good ?

I met with @lntue who helped me benchmark the new implementation. I've used the CORE-MATH test suite and made sure to disable all fast paths in the implementations. The following numbers are reverse throughput for 20 trials and count N=10000 (lowered tenfold to keep benchmarking time under control). The results are very reproducible and show a 20% hit so something is wrong. I'll report back as soon as I've pinpointed the issue.
```
Before - c5f839bd58e7f888acc4cb39a18e9e5bbaa9fb0a
exp    Ntrial = 20 ; Min = 668.971 + 10.352 clc/call; Median-Min = 3.276 clc/call; Max = 693.620 clc/call;
exp2   Ntrial = 20 ; Min = 591.189 + 15.880 clc/call; Median-Min = 18.427 clc/call; Max = 628.805 clc/call;
exp10  Ntrial = 20 ; Min = 686.535 + 5.688 clc/call; Median-Min = 2.962 clc/call; Max = 697.168 clc/call;
expm1  Ntrial = 20 ; Min = 845.390 + 9.590 clc/call; Median-Min = 10.446 clc/call; Max = 876.777 clc/call;
log    Ntrial = 20 ; Min = 419.107 + 4.236 clc/call; Median-Min = 3.245 clc/call; Max = 428.442 clc/call;
log2   Ntrial = 20 ; Min = 400.071 + 1.709 clc/call; Median-Min = 0.920 clc/call; Max = 465.417 clc/call;
log10  Ntrial = 20 ; Min = 409.805 + 2.859 clc/call; Median-Min = 2.379 clc/call; Max = 415.131 clc/call;
log1p  Ntrial = 20 ; Min = 657.658 + 9.524 clc/call; Median-Min = 12.002 clc/call; Max = 672.413 clc/call;
After - 60b37004bfeab35af89075269fad8e9bdeaa483b
exp    Ntrial = 20 ; Min = 820.570 + 12.091 clc/call; Median-Min = 12.470 clc/call; Max = 865.002 clc/call;
exp2   Ntrial = 20 ; Min = 697.665 + 9.523 clc/call; Median-Min = 5.665 clc/call; Max = 717.686 clc/call;
exp10  Ntrial = 20 ; Min = 810.953 + 8.040 clc/call; Median-Min = 2.217 clc/call; Max = 829.657 clc/call;
expm1  Ntrial = 20 ; Min = 1006.518 + 17.347 clc/call; Median-Min = 20.243 clc/call; Max = 1039.603 clc/call;
log    Ntrial = 20 ; Min = 515.516 + 11.423 clc/call; Median-Min = 6.194 clc/call; Max = 584.475 clc/call;
log2   Ntrial = 20 ; Min = 496.955 + 6.045 clc/call; Median-Min = 1.590 clc/call; Max = 508.410 clc/call;
log10  Ntrial = 20 ; Min = 505.182 + 11.358 clc/call; Median-Min = 13.359 clc/call; Max = 519.998 clc/call;
log1p  Ntrial = 20 ; Min = 843.250 + 7.807 clc/call; Median-Min = 6.602 clc/call; Max = 858.043 clc/call;
```

https://github.com/llvm/llvm-project/pull/86137


More information about the llvm-commits mailing list