Skip to content

precomputation fft

When computing precomputed polynomials in prover queries in custom gates, we use the function mul_fft on two polynomials p1 p2 which evaluates both polynomials, multiply the eval together on the correct domain and interpolate them.

Hence, custom gates using the same wires perform redundant evaluations. We could evaluate the wires once on the largest domain needed for each wire and give to the custom gates this map of evaluations. The mul_fft function would then multiply the large wire evaluation with a skip, defined by the degree of the evaluation and the degree of the wire needed.

The more custom gates are used the more this optimization will yield. We will save the cost of all the "small" evaluations of each wire.

  • Make all gate communicate their degree (selector and wires together) to main proto
  • Main proto computes a map with poly -> domain needed
  • Setup precompute evaluation on the needed domain of the selector vectors
  • Pass a map of wires and selectors evaluation + degree + domains as argument for all gates
  • redo mul_all_poly to take domains and eval as args and fetch what he needs (i*k) domain and eval from some arrays
  • remove mul_fft

Edited by Anne-Laure