Skip to content

Instantly share code, notes, and snippets.

@animetosho
Last active February 2, 2024 11:53
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save animetosho/d3ca95da2131b5813e16b5bb1b137ca0 to your computer and use it in GitHub Desktop.
Save animetosho/d3ca95da2131b5813e16b5bb1b137ca0 to your computer and use it in GitHub Desktop.
A list of articles documenting uses of the GF2P8AFFINE instruction

Unexpected Uses for the Galois Field Affine Transformation Instruction

Intel added the Galois Field instruction set (GFNI) extensions to their Sunny Cove and Tremont cores. What’s particularly interesting is that GFNI is the only new SIMD extension that came with SSE and VEX/AVX encodings (in addition to EVEX/AVX512), to allow it to be supported on all future Intel cores, including those which don’t support AVX512 (such as the Atom line, as well as Celeron/Pentium branded “big” cores).

I suspect GFNI was aimed at accelerating SM4 encryption, however, one of the instructions can be used for many other purposes. The extension includes three instructions, but of particular interest here is the Affine Transformation (GF2P8AFFINEQB), aka bit-matrix multiply, instruction.

There have been various articles which discuss out-of-band use-cases where the instruction can be used, however, they’re somewhat spread around, so rather than re-explain it all, this will just be a listing of these.

Articles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment