Running erc20 benchmarks

Hi, I’m using with hpc7a.96xlarge instance with ubuntu 22.04. I have several questions:

  1. I’m looking to reproduce table 4.1 of erc20 benchmark operations on CPU. I’ve seen there is a erc20 code:
~/tfhe-rs/tfhe/benches/high_level_api$ ls
bench.rs  erc20.rs

bench which I’ve ran with:

cargo bench --bench hlapi-erc20 --features="integer internal-keycache"

but it doesnt reproduce the table of operations. Is this something the user needs to do themselves and how would I be able to do this? I assume the euint8 and so on relates to Fheunit8 and so on.

  1. Same, how would I be able to reproduce table 4.2? I assume its adding up the individual operations from table 4.1 for the use case (erc20 transfer)?

  2. More rust related question but how would I be able to modify and just compile erc20.rs on its own without cargo bench?

Thanks :slight_smile:

Hello, from which documents are the tables you are referring to ?

hlapi-erc20 benches a full erc20 transfer not individual operations

make bench_integer will run the benches for the integers operations at different sizes, but it wont produce a table, you’d have to do it yourself

Why do you want to compile erc20.rs on its own ?

Apologies, table’s 4 from paper here: https://github.com/zama-ai/fhevm/blob/main/fhevm-whitepaper-v2.pdf

make bench_integer will run the benches for the integers operations at different sizes, but it wont produce a table, you’d have to do it yourself

Thanks.

Why do you want to compile erc20.rs on its own ?

Playing about with the test making some modifications to the code,

Apologies, table’s 4 from paper here: https://github.com/zama-ai/fhevm/blob/main/fhevm-whitepaper-v2.pdf

A yes that is what I though, but I was looking at the v1 which did not have these tables

so make bench_integer will print results for individual ops (table 4.1)

and cargo +nightly bench --bench hlapi-erc20 --features="nightly-avx512,integer,internal-keycache" will print bench result for erc20 (table 4.2) (note the +nightly toolchain and nightly-avx512 feature which improves performances, also RUSTFLAGS="-C target-cpu=native" should also be used)

Why do you want to compile erc20.rs on its own ?

Playing about with the test making some modifications to the code,

Then either modify the file in place and use cargo bench or move the file into your own rust project but you will still have to use cargo and it will probably require more modifications