Repository navigation
Releases: nanithefkuc/fgf
Releases · nanithefkuc/fgf
Release list
fgf 3.0.1
3.0.1 is the first supported v3 release. The 3.0.0 published before it went
out by accident and was yanked; 3.0.1 is not API-compatible with that artifact
(see the 3.0.0 entry), and code locked to it must migrate. The supported
upgrade path is from 2.x: follow
Migrating from 2.x
and the breaking entries below.
Added
- The canonical generic field family
FiniteField<const P: u64, const N: u32, R: FiniteFieldRepr<P, N> = Residue>with theResiduepresentation at
degree one over everyu64prime. Each row exposes the full scalar and
constelement surface (from_raw, checkedfrom_residue,to_residue,
arithmetic,pow,canonical),
total arithmetic under the crate-wide conventions (inv(0) == 0,
x / 0 == 0,0^0 == 1, with the explicit inverse-zero branch at
P = 2), a little-endian wire lane sized to the characteristic —
characteristic two uses an eight-byte lane, and an odd characteristic
uses one, two, four, or eight bytes as its residues fit within2^8,
2^16,2^32, andu64— withFieldBuffer::decode/encodeas the
byte API of these rows, the checked packed
operation surface with prepared coefficients, and vector routing on
capable x86-64 hosts — AVX2 single-row kernels, AVX-512 undersimd512—
withScalarrouting elsewhere. Broadcast add/sub take the modular path
for every characteristic, so packed lanes stay canonical atP = 2.
Values live in
field::finite_field, re-exported at the root. - Sealed
PrimeFieldmarker for degree-one fields, the validatedconst
integer reductionsfield::prime::reduceandreduce_wide,RangeError
for out-of-range conversions, and thePrimeIdentitycharacteristic
factsBITS,TWO_ADICITY, andRESIDUE_MOD_8. just compile-failcompiles the negative consumer snippets under
tests/compile_fail/on the crate MSRV, each required to fail with its
declared crate panic fragment, or simply to be rejected for trait-bound
and privacy cases, andjust msrv-acceptruns
those snippets plus thetests/consumers.rscompile-and-run matrix on
the MSRV toolchain.- Wiki source guides cover the generic type model, field presentations,
embeddings, custom towers and scalar fields, packed workflows, preparation,
prime and bit-packed arithmetic, deployment, and migration from 2.x.
wiki/Home.mdand the sidebar organize the reader paths. - Sealed presentations
MersenneFold(labelmersenne-fold) and
GoldilocksFold(labelgoldilocks-fold), re-exported at the root. Both
rows implementPrimeFieldand gainconstfrom_residue(u64) -> Result<Self, RangeError>andto_residue(self) -> Option<u64>. The
defaultResiduerow at either modulus remains a distinct type with its
own lane width; values move between the two by residue conversion. - The binary degree-one rows
FiniteField<2, 1, R>implementPrimeField
and gainconstfrom_residue(u64) -> Result<Self, RangeError>and
to_residue(self) -> Option<u64>; they stay distinct from
FiniteField<2, 1, Residue>, which stores au64residue. just external-checktype-checks every package underexternal/
against the working copy.- The generic extension presentation
FiniteField<P, N, Extension<S, D>>
with data-onlyExtensionSpecproviders, the sealed storage family
(Components,Packed,PackedPadded), the opaque const-constructible
Relation, generic arithmetic under the crate-wide total conventions,
component bytes and the checked packed surface withScalarrouting,
ExtensionFieldcomponent conversions, andBinaryFieldon
characteristic-two rows over binary bases. The surface lives in
field::extension, re-exported at the root.EmbeddingErrorgains the
NoCanonicalMapvariant for dividing degrees with no canonical map. ComplexMersenne31, theExtensionSpec<2>ofQuadMersenne31:
Mersenne31extended byt^2 + 1withComponentsstorage,
re-exported at the root.- An extension row whose base presentation, relation, and storage equal a
shipped instance's runs that instance's specialized scalar arithmetic and
reaches its kernel arms; every other extension row runs the generic body
and reportsScalar. FieldElem::from_residue/to_residueandfrom_index/to_indexon
every row: the prime-subfield value and the presentation index share one
generic body over the crate-private row hooks, and the inherentconst
residue constructors check through the same bound.- The characteristic-independent relation surface in
field::embedding,
re-exported at the root:Embedding<S, T>over every pair of rows of
equal characteristic whose degrees divide, withfrom_images,
to_images,generator_count,generator,then, and
Isomorphism<S, T>withapply, a totalunapply,
inverse, and composition; and theNoCanonicalMapandInvalidImages
variants ofEmbeddingError. Maps come from structural inclusions, the
frozen binary ladder, or validated caller images; every pre-cutover
binary result is unchanged. - Wiki reference for operation suffixes, destination behavior, prepared state,
row addressing, and allocation. - One-time field migration verification is recorded in
Issue #41, rather than a
permanent expanded regression corpus. - Behavioral regressions cover irreducible and reducible extension relations,
relation-field arithmetic, ordered-basis subfield embeddings, rejected
restrictions and degree mismatches, and quadratic prime identity predicates. - Raw kernel dispatch is unreachable outside the crate: every
FieldKernels
kernel entry takes the crate-privateRawDispatchproof argument, so code
holding anF: FieldKernelsbound — including underinternals— cannot
call the raw entries. The negative consumer snippet
tests/compile_fail/raw_dispatch_without_proof.rspins the rejection. - Three examples join the educational set, each running against the library
withstdandallocdisabled:custom_extensionsdefines a custom
ExtensionSpecfield,basis_mapsmoves values throughEmbedding
between basis presentations, andpacked_no_allocruns packed row
operations without an allocator.just examples-portableruns them in
that configuration. just release-acceptruns the crate-specific release acceptance, separate
from the shared pull-request gatejust validate. Its pieces also stand
alone:just test-gather-validation-32runs the gather validation as a
release i686 build with overflow checks disabled — the configuration the
gather fix below required — and CI runs it as its own job;
just benchmark-checkvalidates portable benchmark fixtures and compares
their inventory with compiler-derived public API declarations;
just benchmark-check-nativevalidates the GF16 presentation comparisons
and existing native geometries on capable hosts.just isa-accept EXPECTED
requires the requested process backend and positive execution evidence
before running the full tier matrix. Native release acceptance uses
dedicated Willow Cove (v4x) and Golden Cove (v3_gfni_crypto) hosts.- The
surfacesbenchmark artifact measures the public API end to end:
scalar arithmetic, packed single-row and multi-row operations, prepared
coefficient forms, andEmbedding/Isomorphismmaps, over representative
fields including the AES byte field, the Rijndael sixteen tower, and the
MersenneFold/GoldilocksFoldprime rows.--inventoryprints every
registered measurement without timing,--checkruns each fixture's
correctness check once, and--smokeshortens repetition without
dropping cases. Each timed record names its public callable paths, exact
registered field label, scope, logical byte numerator, lane and
source/destination counts, and the resolved backend; a byte-XOR control
identifies itself withcontrolandphasefields, and zero-work APIs
report latency instead of throughput. - The native GF16 comparison gains
--presentations, a separate output mode
beside the legacy format so existing parsing is unchanged. It covers
representative shipped Rijndael and Fan-Paar fields, custom RS-rooted
fields, normal and Cantor bases, and competitor-matched fields, with
duplicatefgfcontrol arms, interleaved arms and fixed/cycling
coefficients, and every map and fixture validated outside timing;
--presentations --checkvalidates every new geometry without timing,
and--presentations --smokeshortens the sampling budget without
dropping a registered case. Both output modes open with a
BENCHMARK_MODEbanner (full,smoke, orcheck), and each
GF16_SURFACErecord carries its sample count and calibrated batch size
assamplesandbatch_reps. Presentation conversions run public scalar
caller loops. - The capture family
surfacesrecords the artifact and the GF16
--presentationsmode for current v3 in five rounds per host, published
in the v3 record (benchmarks/v3/public-api.md,benchmarks/v3/maps.md,
and the GF16 presentation panels). No released-v2 counterpart is
fabricated for the new public APIs.
Changed
- Breaking: generic residue rows size their byte lane to the
characteristic instead of always storing eight bytes: characteristic
two keeps an eight-byte lane, and an odd characteristic uses one, two,
four, or eight bytes as its residues fit within2^8,2^16,2^32,
andu64— for exampleFiniteField<7, 1>moves one byte per element
andFiniteField<1_000_000_007, 1>moves four.FieldBuffer::decode
andencodeare the byte API of these rows. Migration: the inherent
fixed-arrayfrom_bytes/to_bytesare absent for these rows (every
characteristic,P = 2included), and noconstbyte form exists for
them — size buffers from `FieldBuffer::B...
fgf 3.0.0-rc.1
Added
- Version-independent benchmark labels and separate absolute
benchmarks/v2/
andbenchmarks/v3/records, with matched speed factors under
benchmarks/comparison/. Released v2.1.0 replaces the generic-API baseline. - Reproducible benchmark-only v2 preparation, paired host campaigns, and a
fail-closed publisher with a raw-record cell evidence index. - Custom RS-rooted
gf16done-shot, prepared, and scalar measurements, with
no fabricated released-v2 counterpart. - Explicit binary embeddings:
Embedding<S, T>prepares the canonical
inclusion of one binary field into another whose degree is a multiple of
it, for every supported presentation — polynomial, ordered-basis, and
tower, customTowerSpecinstances included. One frozen reference per
degree (Polynomial<3>,Polynomial<0x7>,Polynomial<0x13>, the AES
field, and the Rijndael towersBinary<16, Tower<Rijndael16>>,
Binary<32, Tower<Rijndael32>>, andBinary<64, Tower<Rijndael64>>) fixes the
consecutive inclusions: the identity into degree two, smallest-raw-root
inclusions below the AES field, and low-component inclusions above it.
newreturnsEmbeddingError::IncompatibleDegreewhen the source degree
does not divide the target degree.embed,contains,restrict,
frobenius,trace, andnormapply the prepared column arrays without
allocating; equal presentation descriptions embed identically, and
Embedding<Binary<1, Polynomial<3>>, T>supplies the absolute trace and norm. - Recursive quadratic towers through degree 64. One open
TowerSpec
suppliesBase,LINEAR_COEFFICIENT,CONSTANT_COEFFICIENT, andNAME
for every quadratic tower at degrees 2, 4, 8, 16, 32, and 64 over a
supported base of half the degree;TowerGeneratorSpecoptionally pins a
multiplicative generator checked to full order against the complete prime
factors of2^N - 1at each degree. Shipped specs root at the AES field
(Rijndael16,Rijndael32,Rijndael64) or nest from GF(2) through the
Wiedemann relation (FanPaar2throughFanPaar64, the degree-two and
degree-four levels joining the ladder). Custom specs validate through the
field description: the base first, excess coefficient bits,A != 0, and
absolutetrace(B/A^2) == 1for the relationt^2 + A*t + B = 0. - Custom tower bulk operations: one dispatch implementation per degree
serves every representation, routing pinned Rijndael and Fan-Paar
descriptions to their vector kernels and every other tower to the typed
scalar fallback withbackend_forreportingScalar; degree-eight
towers join the single degree-eight dispatch. Towers at degrees 8, 16,
32, and 64 implementFieldBuffer. - Ordered-basis byte presentations:
Normal<P, E>wraps a polynomial
element into its conjugate basis (bitiselectsE^(2^i); one is all
bits set) andCantor<P, SEED>builds the chainc_(N-1) = SEED,
c_i = c_(i+1)^2 + c_(i+1)(bitiselectsc_i; validity asserts
c_0 == ONE), at degrees 2, 4, and 8. Basis rank and inverse columns are
checked by bounded enumeration; generators are the transported polynomial
generators, verified to full order. Polynomial presentations extend to
degrees two (Polynomial<0x7>) and four (Polynomial<0x13>,
Polynomial<0x19>,Polynomial<0x1F>); degrees 1, 2, and 4 are
scalar-only. Basis bulk operations run the typed scalar fallback;
polynomial arithmetic never touches basis coordinates. - Open scalar field definitions.
Fieldis implementable downstream;
PrimeCharacteristic<P>supplies a checked prime identity at anyu64
prime through deterministic Miller-Rabin, and the central validation
block — reached from every generic construction — checks the
characteristic identity, a positive degree,ORDER == CHARACTERISTIC^DEGREEwith overflow checking, and the binary degree cap
of 64. Binary fields convert throughBinaryField::to_coordinatesand
from_coordinates, which reject excess bits above the degree through
CoordinateError. just cross-checkcompiles the AArch64 and Wasm library paths, including
the explicit Wasm SIMD configuration, andjust bench-build NAMEbuilds a
portable benchmark artifact without running it.just bench-gf16-compruns an interleaved native GF(2^16) field
comparison against GF-Complete,reed-solomon-erasure,
reed-solomon-simd, and Leopard-RS 1.x; the harness validates basis maps
and region outputs against independent arithmetic, includes
duplicate-operation controls, and reports unavailable primitives
separately.bench-gf-compincludes the same harness in its shuffled
rounds.- The benchmark record is split by field family.
BENCHMARKS.mdindexes
the pages underbenchmarks/and holds the hosts, shared method, number
format, and reproduction commands; each page carries its own setup,
self-timings, and competitor tables. Every value in a table has the same
digit count, so paired Tiger Lake / Golden Cove cells line up down each
column.
Changed
-
Breaking: fields have no public type aliases;
Binary<N, R>is the
only spelling.Gf1,Gf16,Gf32,Gf64, andFanPaar2through
FanPaar64(the field aliases) are not provided: replace each with its
canonical type —Binary<1, Polynomial<3>>,
Binary<16, Tower<Rijndael16>>,Binary<32, Tower<Rijndael32>>,
Binary<64, Tower<Rijndael64>>, andBinary<N, Tower<FanPaarN>>— or
declare a local alias such as
type Gf2P16 = Binary<16, Tower<Rijndael16>>;. The Fan-Paar spec markers
are named likeRijndael16:FanPaar2SpecthroughFanPaar64Specbecome
FanPaar2throughFanPaar64, so Fan-Paar GF(2^16) is
Binary<16, Tower<FanPaar16>>. -
Breaking:
Binary<N, R>replacesGf<N, R>and explicitly names
characteristic-two fields;BinaryFieldremains the capability trait.
Polynomial<P>replacesPoly<P>, andRSreplacesREED_SOLOMON
for the unchanged0x11Dpolynomial convention. TheGf8<R>transition
alias is removed: replace it withBinary<8, R>, including associated
item paths such asBinary::<8, Polynomial<AES>>::ORDER. For example,
Elem<Gf8<Poly<REED_SOLOMON>>>becomes
Elem<Binary<8, Polynomial<RS>>>. No compatibility aliases remain. -
Breaking:
TowerSpec::LINEAR_COEFFICIENTand
TowerSpec::CONSTANT_COEFFICIENTreplaceTowerSpec::Aand
TowerSpec::B. Rename the associated constants in custom specs and their
qualified uses; values remain raw coordinates inBasefor the relation
t^2 + A*t + B = 0.TowerSpecandTowerGeneratorSpecremain separate:
arithmetic requires no selected generator. Field arithmetic, wire bytes,
selected generators, and backend routing are unchanged. - The canonical
$GF(2)$ benchmark label isgf1, denoting extension degree.
Its pages move fromgf2.mdtogf1.mdin the v2, v3, and comparison
directories; the released-v2 API mapping remainsGf2. -
Breaking: one element wrapper,
Elem<F>, replaces every concrete
element path.mersenne31::Elem,goldilocks::Elem,
quad_mersenne31::Elem, the binaryElem<N, R>spelling, the
gf16/gf32/gf64and Fan-Paar element structs, andgf2::Elemare
removed, as are the moduleGENERATORconstants (Elem::<F>::GENERATOR
replaces them all).Gf2becomesBinary<1, Polynomial<3>>, and
bits::dot_productreturnsElem<Binary<1, Polynomial<3>>>. Migrate
gf2::ElemtoElem<Binary<1, Polynomial<3>>>,mersenne31::Elemto
Elem<Mersenne31>,gf16::ElemtoElem<Binary<16, Tower<Rijndael16>>>,
fan_paar::fp16::ElemtoElem<Binary<16, Tower<FanPaar16>>>, and the
binaryElem<8, Poly<POLY>>toElem<Binary<8, Polynomial<POLY>>>;
spell elements of the wider towers and the prime families the same way.
Inherentconstarithmetic sits on theElem<F>types;ZERO,ONE,
GENERATOR, andto_raware the generic items and are not redeclared
per family.Debug
for every element is the genericNAME(raw)format; familyDisplay
formats are unchanged. The scalar-arithmetic traitfield::Elemis
renamedFieldElem(re-exported asfgf::FieldElem): replace
use fgf::field::Elem;trait imports withuse fgf::field::FieldElem;.
Wire bytes, generators, and relations are unchanged. -
Breaking:
Fieldis split into three contracts.Fieldkeeps scalar
algebra and metadata (Raw,Characteristic,NAME,DEGREE,ORDER,
ZERO_RAW,ONE_RAW,VALID, raw arithmetic);FieldBuffercarries the
byte encoding (BYTES,STORAGE_BITS,decode,encode), implemented
by binary degrees 8/16/32/64 and the prime families;HasGenerator
carries the selected generator (GENERATOR_RAW).Field::Elem,
Field::BITS,Field::CHARACTERISTIC,Field::GENERATOR, and
Field::elem_countare removed. Generic code reads the characteristic as
<F::Characteristic as PrimeIdentity>::CHARACTERISTIC, the storage width
asFieldBuffer::STORAGE_BITS, and the generator as
Elem::<F>::GENERATORunder aHasGeneratorbound.FieldKernelsand
everyopsoperation —pack,unpack, andpack_to_vecincluded —
bound onFieldBufferand takeElem<F>.FieldElemis sealed and
implemented only by the blanketimpl<F: Field> FieldElem for Elem<F>;
downstream custom fields implement the newFieldcontract and receive
the trait. The trait exponent isu128(pow(u128)), the inherent
const powon every family takesu128, andQuadMersenne31::pow_u128
is removed in its favour. -
Breaking: prime
from_rawcanonicalizes andto_rawreturns
canonical storage. In 2.x,from_rawanddecoderetained the
unreduced lane andto_rawexposed the stored bits; every safely
constructed element now holds canonical coordinates, so comparison,
hashing, and packing see the reduced lane. Packed prime operations accept
every lane bit pattern a decode accepts and emi...
fgf 2.1.0
Added
- Self-contained, runnable examples cover scalar arithmetic across every field,
parity-shard encoding and erasure recovery, streaming GF(2^16) parity updates,
bit-packed Hamming syndromes, extension-field embeddings and trace/norm, and
canonical prime-field evaluation-vector arithmetic. just example NAME [ARGS]andjust examples [ARGS]run one tutorial or the
complete educational set, including portable builds withalloc.QuadMersenne31dispatchesV4xundersimd512:mul_into,mul_add,
andmul_elementwiserun AVX-512 kernels, andbackend_for::<QuadMersenne31>()
reportsv4xon those hosts. The remaining operations run the AVX2 kernels.
Changed
BENCHMARKS.mdpresents a complete Tiger Lake / Golden Cove snapshot of
public API and interleaved competitor timings. Measurement history and
dispatch-threshold experiments are excluded from the public tables.- Prime-field vector multiplication is faster.
Mersenne31AVX2 and AVX-512
multiplies skip re-folding canonical operands, and the AVX-512 product uses a
masked recombination;QuadMersenne31AVX2 complex products defer reduction
until four partial products are summed.GoldilocksAVX2 addition and
subtraction use fewer compare steps. Outputs remain canonical, and the
raw-destination guarantees ofadd_assign_scalarandsub_assign_scalar
are unchanged. SeeBENCHMARKS.md. bench-m31-compruns only the five-round public snapshot campaign;
theprime_nttthreshold investigation remains a separate benchmark.- The AVX-512 GF(2^8) matrix kernels (
Gf8DandGf8B, contiguous,
scattered-row, provider, and prepared forms) use direct coefficient reads
for short rows and resolve each row group's coefficients into map words
once per chunk of terms for longer rows, folding terms in pairs. Results
are unchanged. - The GFNI and AVX-512 byte-field matrix kernels, contiguous and
scattered-row, process long rows in column blocks when the destination
spans more than one row group, so each source block is reused from cache
across every row group instead of being re-read from memory per group.
Results are unchanged. - The GFNI byte-field matrix kernels prefetch each source ahead of the tile
loop on long rows whose terms fit in one resolve chunk, and run the column
blocks above only for larger term counts. Results are unchanged. - The GFNI byte-field matrix kernels (
Gf8DandGf8B, contiguous,
scattered-row, provider, and prepared forms) split the destination rows
into the fewest width-balanced row groups of up to six rows, or four with
one or two terms, instead of fixed groups of four, two, and one, so the
sources are streamed once per group and fewer groups run. Overwrite seeds
multi-row groups from the first product rather than from zero. Results are
unchanged.BENCHMARKS.mdis refreshed on both hosts for this change. - The GFNI byte-field matrix kernels run a three-row group with three
32-byte lanes per row, folding terms two at a time, when its terms number
from six through one resolve chunk and its rows are cache-resident; other
three-row groups keep two lanes. This covers three-destination calls and
the trailing group of seven-destination calls, contiguous and
scattered-row. Results are unchanged.
Fixed
- The Plonky3 competitor harness aligns packed quadratic-extension fixtures
for native AVX-512 builds and reports the actual packing widths. - CI coverage uses
just cover, including the portable feature run, and
exports LCOV throughjust cover-lcovwith the same exclusion set. The
AVX-512-onlyQuadMersenne31kernel is excluded on incapable coverage
runners; the AVX2 kernel and mixed-ISA dispatch remain included. - NEON and Wasm row-geometry checks compile only on their consumer targets,
rather than appearing as unreachable x86 coverage obligations. - The GFNI and AVX-512 GF(2^8) matrix kernels over a generic
Matrix
provider check the length of each source slice they stage, so a provider
that returns a shorter slice than the one the entry validated panics
instead of reading out of bounds.
fgf 1.0.0
First stable release. The public API — fields, ops, bits, backend reporting, and every stable byte encoding — is now under semantic versioning; the internals feature stays explicitly unstable. MSRV is Rust 1.93. See CHANGELOG.md for the full entry.