Different PBS number based on thread number

Why does TFHE-rs produce a different pbs count depending on the number of rayon threads you assign?

Here is the erc20 cargo bench with 1 thread (with additional print statements):

RAYON_NUM_THREADS=1 RUSTFLAGS="-C target-cpu=native" cargo bench --bench hlapi-erc20 --features="pbs-stats,integer,internal-keycache"

🔹 RAYON_NUM_THREADS = 1
🔹 Rayon is running with 1 threads
Gnuplot not found, using plotters backend
ERC20 transfer/whitepaper::FheUint64: 271 PBS
ERC20 transfer/no_cmux::FheUint64: 207 PBS
ERC20 transfer/overflow::FheUint64: 256 PBS
ERC20 transfer/safe::FheUint64: 321 PBS

erc20 cargo bench with 5 threads:

RAYON_NUM_THREADS=5 RUSTFLAGS="-C target-cpu=native" cargo bench --bench hlapi-erc20 --features="pbs-stats,integer,internal-keycache"
RAYON_NUM_THREADS = 5
🔹 Rayon is running with 5 threads
Gnuplot not found, using plotters backend
ERC20 transfer/whitepaper::FheUint64: 345 PBS
ERC20 transfer/no_cmux::FheUint64: 281 PBS
ERC20 transfer/overflow::FheUint64: 331 PBS
ERC20 transfer/safe::FheUint64: 397 PBS

If num threads > 4 then pbs count is different. Is this expected behaviour and is there a reason?

Thanks.

Hello @un5had0w

Some algorithms have different implementations, depending on the available number of threads there is an auto selection trying to optimize for latency

1 Like