Polynomial multiply engines¶
Prereqs: Polynomials Part A · Polynomial wrap-around · Modular multiplier
Next: NTT butterfly · KEM accelerator anatomy · Track: PQC hardware
Tracks: pqc-hardware
Learning goals. Name the main ways hardware multiplies polynomials mod \((X^n\pm 1)\) (or similar), say when schoolbook vs Karatsuba vs NTT appear, and see memory / scheduling as part of the “engine,” not just ALUs.
Why this card exists¶
A modular multiplier multiplies coefficients. Lattice KEMs multiply polynomials (or modules of them). The engine is the organization: how many modmuls fire, in what order, with what memory ports.
What “poly mul” means here¶
Given \(f,g\) of degree \(< n\) with coefficients mod \(q\), compute \(h = f\cdot g\) reduced modulo a fixed polynomial (often \(X^n+1\) in ML-KEM-shaped rings — see wrap-around).
Every coefficient of \(h\) is a sum of products of coefficients of \(f\) and \(g\) — so the engine is mostly scheduling modular multiplies and adds.
Engine families (slogans)¶
| Engine | Slogan | HW feel |
|---|---|---|
| Schoolbook | All \(n^2\) coefficient products (with wrap folding) | Simple control; many muls; fine for tiny \(n\) demos |
| Karatsuba / Toom / TMVP / Winograd | Divide-and-conquer or structured formulas; fewer muls, more adds | Attractive when mul is expensive; control + wiring grow |
| NTT-based | Transform → pointwise mul → inverse transform | Dominant for ML-KEM-scale \(n\); needs butterflies + twiddles + memory |
Pointwise multiply (PWM): after NTT, multiply matching coefficients with your modular multiplier — often the easy middle step.
Coefficient-wise multiply (CWM) — Kyber vocabulary¶
Some Kyber / ML-KEM hardware papers write CWM for the middle step of NTT-based poly mul. Careful: in Kyber’s NTT convention, CWM is often binomial, not a single \(a_i\cdot b_i\) product.
Slogan picture (pairs of NTT-domain coefficients):
Hardware may need about four modular muls per binomial product (vs one mul for naive pointwise PWM). That is why Kyber CWM latency can approach an NTT stage count — and why a reconfigurable Bi-Core rewires butterfly mul arrays into a 4-mul CWM datapath.
Hold three modes of one engine:
| Mode | Job |
|---|---|
| NTT | Transform coefficients (CT butterflies + twiddles) |
| CWM | Binomial (Kyber) coefficient products in NTT domain |
| INTT | Inverse transform (often GS butterflies) |
A “reconfigurable poly-mul accelerator” often means one datapath that switches among these modes (shared modular multiplier, shared memory banks) rather than three separate ASICs. See NTT parallel memory for how banks feed those modes.
Tiny schoolbook sketch (\(n=2\), ignore wrap for a moment)¶
\(f = f_0 + f_1 X\), \(g = g_0 + g_1 X\):
Then fold \(h_2\) using the ring modulus (\(X^2\equiv \ldots\)). Hardware reuses one modmul over cycles or instantiates several in parallel.
Mid-page self-check¶
Why is “poly mul engine” more than “wire up one modmul”?
Answer
You must sequence many coefficient products, accumulate, fold wrap-around, and feed memories — control and ports dominate real designs.Memory and scheduling (architecture keywords)¶
IEEE accelerator papers often innovate here even when the modmul is standard:
- Ping-pong / double buffers — one bank feeds the butterfly while another is written
- In-place NTT layouts — coefficient addresses follow bit-reversed or constant-geometry patterns
- Parallel lanes — \(p\) butterflies or PWM / CWM lanes per cycle
- Conflict-free banking — \(n\) coefficients striped across banks so a stage’s butterflies all get ports — see NTT parallel memory
- Ping between hash and poly domains — later, in accelerator anatomy
When a paper says “new architecture,” ask: new arithmetic leaf, or new schedule / memory / parallelism?
Link to Module-LWE¶
Module-LWE packages secrets as short vectors of polynomials. Encaps/Decaps are full of poly muls — so engines here are the computational heart of lattice PQC hardware.
Story recap¶
- Poly mul = many coefficient muls + adds + wrap.
- Schoolbook / Karatsuba-style / NTT are different engines.
- Memory ports and schedules are first-class architecture.
- Next cliff: the NTT butterfly itself.
Check yourself¶
- What is PWM in an NTT engine?
Answer
Pointwise multiply of transformed coefficients using modular multipliers.- Name one reason Karatsuba might still lose to NTT at Kyber-scale \(n\).
Answer
Asymptotics / practical counts: NTT-based mul is typically far cheaper at cryptographic sizes despite setup cost.- Is a new ping-pong memory schedule a “new modmul”?
Answer
No — it is a datapath / memory architecture; the leaf mul unit might be unchanged.- What does CWM mean in a Kyber poly-mul paper?