kroma-network / tachyon

Modular ZK(Zero Knowledge) backend accelerated by GPU
MIT License
7.77k stars 231 forks source link

perf: optimize poseidon2 pt1 #531

Closed ashjeong closed 2 months ago

ashjeong commented 2 months ago

This PR introduces a set of intermediary commits aimed at optimizing Poseidon2. The optimizations have shown significant improvements, particularly on macOS devices. For instance, on a Mac with the M3 chip, Tachyon's runtimes have been greatly enhanced, reducing the additional time compared to Plonky3 from 60% to 30%. Note that not much change has occurred on the Ubuntu side.

To come:

  1. Refactor Poseidon/Poseidon to determine values such as FullRounds and Alpha from the start.
  2. Use Sbox functions with a constexpr Pow()
TomTaehoonKim commented 2 months ago

@ashjeong Can you remove scope in commit message of 5ee2c3a?

chokobole commented 2 months ago

chore: rename functions from ...vector to ...array should be typed with refac, I guess. chore(crypto): remove unneeded deps remove scope crypto. refac(benchmark): add const to vendor loop if you search for (Vendor, there are more places you can change.