PROOF-OF-CONCEPT Replace x86_64 asm by CryptOpt output #1254

pull real-or-random wants to merge 2 commits into bitcoin-core:master from real-or-random:202303-dderjoel-cryptopt changing 6 files +372 −505
  1. real-or-random commented at 3:28 pm on March 30, 2023: contributor

    @dderjoel

    It managed to convince autotools to compile your asm. It seems slower than our C code, at least on my machine:

    12th Gen Intel(R) Core(TM) i7-1260P, TurboBoost disabled

     0./bench_internal field
     1
     2Benchmark                     ,    Min(us)    ,    Avg(us)    ,    Max(us)
     3
     4this PR (e2684293b1b72a1ab5974a2864549cea2788cf95), --with-asm=x86_64 (which is the default)
     5field_sqr                     ,     0.0296    ,     0.0297    ,     0.0297 
     6field_mul                     ,     0.0339    ,     0.0341    ,     0.0344 
     7
     8master (464a9115b4eda46b464d22829ece4f51985944bf), --with-asm=x86_64 (which is the default)
     9field_sqr                     ,     0.0270    ,     0.0271    ,     0.0272 
    10field_mul                     ,     0.0359    ,     0.0359    ,     0.0360 
    11
    12master, --with-asm=no (464a9115b4eda46b464d22829ece4f51985944bf), gcc 12.2.1 -02:
    13Benchmark                     ,    Min(us)    ,    Avg(us)    ,    Max(us)
    14field_sqr                     ,     0.0236    ,     0.0238    ,     0.0240 
    15field_mul                     ,     0.0283    ,     0.0284    ,     0.0286
    

    By the way, we should really get rid of our current ASM in the short term, at least for the field. GCC beats it significantly.

  2. Replace x86_64 field asm by CryptOpt output
    Co-authored-by: Tim Ruffing <crypto@timruffing.de>
    e2684293b1
  3. dderjoel commented at 4:44 am on March 31, 2023: none
    1. What are the magic incantations to convince Autotools?
    2. I’ve added the fiat-dettman-c code the benchmark is attached (but probably not too representative, as I cant compare against the asm, as I don’t have the magic words for auto tools)
  4. dderjoel commented at 6:36 am on March 31, 2023: none

    original C

    $ ./bench_ecmult Benchmark , Min(us) , Avg(us) , Max(us)

    ecmult_gen , 18.4 , 18.6 , 18.8
    ecmult_const , 36.3 , 36.7 , 39.0
    ecmult_1p , 28.9 , 29.3 , 29.8
    ecmult_0p_g , 20.2 , 20.6 , 23.7
    ecmult_1p_g , 16.9 , 17.0 , 17.2
    ecmult_multi_0p_g , 20.0 , 20.3 , 20.7

  5. dderjoel commented at 6:38 am on March 31, 2023: none

    cryptopt asm

    $ ./bench_ecmult
    Benchmark , Min(us) , Avg(us) , Max(us)

    ecmult_gen , 17.7 , 18.1 , 19.2
    ecmult_const , 34.1 , 35.1 , 37.9
    ecmult_1p , 27.2 , 28.1 , 29.4
    ecmult_0p_g , 18.7 , 19.5 , 21.4
    ecmult_1p_g , 16.2 , 16.9 , 18.6
    ecmult_multi_0p_g , 18.8 , 19.4 , 20.2

  6. dderjoel commented at 7:09 am on March 31, 2023: none

    fiat-dettman c ./bench_ecmult Benchmark , Min(us) , Avg(us) , Max(us)

    ecmult_gen , 19.5 , 20.1 , 21.5
    ecmult_const , 38.9 , 40.4 , 41.4
    ecmult_1p , 30.3 , 31.2 , 33.5
    ecmult_0p_g , 20.8 , 21.3 , 24.0
    ecmult_1p_g , 17.5 , 18.1 , 18.7
    ecmult_multi_0p_g , 22.1 , 23.2 , 25.3

  7. fixup! Replace x86_64 field asm by CryptOpt output 7e00a589eb
  8. real-or-random commented at 5:39 am on April 6, 2023: contributor
    Tracked in #1261.
  9. real-or-random closed this on Apr 6, 2023


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-30 05:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me