Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Jane Street Tech Blog 8 min read Research hardMaster

Accelerating zk-SNARKs - MSM and NTT algorithms on FPGAs with Hardcaml

A Hardcaml-built FPGA implementation of Pippenger's algorithm for multi-scalar multiplication on the BLS12-377 curve won first place in the ZPrize MSM track, computing a 2^26-point MSM in about 5.08s on an AWS f1.2xlarge at 52W. Its core is a 200+ stage pipelined elliptic curve point adder whose controller stalls on bucket data hazards instead of flushing the pipeline, with the host combining partial bucket sums in parallel with the next round. A companion NTT design uses the 4-step algorithm to split a 2^24 NTT into 2^12 Cooley-Tukey transforms that fit in on-chip SRAM, running on clusters of 8 cores matched to the 512-bit HBM bus. It placed second, scaling from 0.23s at 8 cores to 0.045s at 64 cores, with power and resource figures reported for each configuration.

Assumes: elliptic curve arithmeticFPGA pipeliningFFT basicsfinite field arithmetic

Related posts

  • Towards Encrypted Large Language Models with FHE

    Hugging Face hardMaster

    A single attention head of GPT2's first multi-head attention layer can run on encrypted data using TFHE via Zama's Concrete-Python and Concrete-ML, with the rest of the model executing in plaintext on the client. Weights and activations are post-training quantized to integers, nonlinearities become Programmable Bootstrapping table lookups, and the Hugging Face transformers forward pass is overridden with a quantized SingleHeadAttention module. Four-bit quantization keeps about 96% of original top-k accuracy on roughly 80 sentences, and the compiled circuit needs 8-bit width. A 6-token sequence costs 11,622 PBS operations, which takes minutes on CPU; the authors expect future FHE ASICs to bring that under 100 ms.

  • Advent of Hardcaml

    Jane Street Tech Blog hardMaster

    Several Advent of Code 2024 puzzles were solved entirely on a small Lattice ECP5 FPGA (84K LUTs, 4 Mbits RAM) using Hardcaml, Jane Street's OCaml-embedded HDL, with the open-source Yosys + NextPNR toolchain. Day 4's word search becomes a convolution over a shift register holding the last four grid rows, with a higher-order function generating sliding windows of any dimensions. Day 7's operator search becomes a deep pipeline that evaluates one operator combination per clock cycle, testing hundreds of millions of combinations in seconds. OCaml's type system, functors and metaprogramming make unrolled, parametrized hardware concise and reusable, and the post closes by challenging other HDL communities to solve Advent of Code puzzles too.

  • A Gentle Introduction to 8-bit Matrix Multiplication for transformers at scale using transformers, accelerate and bitsandbytes

    Hugging Face mediumAdept

    LLM.int8() makes 8-bit inference of 175B-class transformers possible with no measurable quality loss. It handles the systematic outlier features that emerge beyond about 6B parameters through mixed-precision decomposition: hidden-state columns with values of magnitude 6 or more are multiplied in FP16, and everything else goes through vector-wise int8 quantization before being dequantized and summed. The method is built on FP32/FP16/BF16 trade-offs and absmax and zero-point quantization, and it halves memory relative to half precision. On OPT-175B and BLOOM-176B, lm-eval-harness benchmarks stay within standard error. It is integrated into Hugging Face transformers via bitsandbytes and Accelerate.

  • Arm & ExecuTorch 0.7: Bringing Generative AI to the masses

    Hugging Face easyNovice

    ExecuTorch 0.7 beta enables Arm KleidiAI by default through XNNPack, bringing optimized Int4 matrix multiplication to Arm CPUs with no code changes. New kernels use the Armv8.2 SDOT instruction, which computes four int32 dot products from groups of int8 elements and is present in roughly 72% of devices. That lets quantized Llama 3.2 1B run on older Android phones and the Raspberry Pi 5, not just flagships with I8MM. On a Galaxy S24+, the earlier I8MM-based kernels reached over 350 tokens/s prefill and 40 tokens/s decode, about 20% faster prefill than non-KleidiAI kernels.

  • FlashAttention-4: Algorithm and Kernel Pipelining Co-Design for Asymmetric Hardware Scaling

    Together AI hardMaster

    FlashAttention-4 is an attention kernel co-designed for Blackwell GPUs, where tensor core throughput grew much faster than the exponential (SFU) units and shared memory bandwidth. A feeds-and-speeds analysis shows the forward pass is bottlenecked by softmax exponentials and the backward pass by shared memory traffic, not by MMA speed. The forward pass addresses this with ping-pong Q tiles, a dedicated correction warpgroup, conditional online-softmax rescaling, and exp2 computed partly in software through Cody-Waite range reduction and a cubic polynomial on FMA units. The backward pass keeps intermediates in tensor memory, uses 2-CTA MMA with a DSMEM exchange of dS to cut shared memory traffic and halve dQ atomics, and adds an LPT tile scheduler and a deterministic mode. On B200 with BF16 it reaches up to 1605 TFLOPs/s (71% utilization), up to 1.3× faster than cuDNN 9.13 and 2.7× faster than Triton, and is written in CuTe-DSL.

The quest for software engineering knowledge.

Look:
Layout: