Skip to content

v0.30.0

Latest

Choose a tag to compare

@scttfrdmn scttfrdmn released this 28 Nov 08:02
a0c3642

Added

  • precision="dw": an fp64-class FFT from fp32 arithmetic, on the device
    (#172, first arm).
    Power-of-two N from 2 to 4096 run a double-word
    (float-float) Stockham FFT, radix 4 with one leading radix-2 stage: every
    value is hi + lo in fp32, and every butterfly is built from error-free fp32
    transformations (TwoSum, FMA-free Dekker TwoProd, double-word addition and
    multiplication of Joldes, Muller and Popescu 2017; complex double-word
    products after Stloukal and Jézéquel, arXiv:2611.08371). Twiddles are
    computed in fp64 on the host (octant reduction, exact symmetries) and
    split exactly into hi + lo. One NKI launch per call runs every stage in
    SBUF on the Vector engine (trnfft/nki/dw_fft.py; engines="split" puts
    the imaginary-part chains on GpSimd); elsewhere the CPU reference issues
    the same fp32 operations in the same order and gives the same bits. On
    CPU, against an mpmath reference, it gives 48.9 correct bits at N = 4 to
    47.5 at N = 4096 (host fp64: 53.0 to 51.9; fp32: 24.0 to 22.8). Other N
    take the "double" route; there is no autograd. trnfft.dw also exposes
    fft_dw (complex128 out) and fft_dw_raw (double-word in and out, so
    transforms can chain on the device), with add="accurate" (default) or
    "sloppy". The device accuracy and timing against host fp64 come from the
    hardware window (tests/test_dw_neuron.py, scripts/bench_dw_fft.py).
    The error-free primitives are vendored (about 60 lines) rather than taken
    from trnblas.fp64: trnfft does not depend on trnblas, and the kernel
    issues them on its own tile layout; a test pins them bit for bit to
    trnblas.fp64 when it is installed.

Fixed

  • PSUM accumulation groups now open with a matmul write
    (trnsci/trnsci#185).
    The complex GEMM tiles (_complex_gemm_tiles:
    the FP32 and BF16 GEMM kernels, their load-transpose variants and the
    complex linear kernels; and _complex_gemm_tn_kernel),
    the Stockham radix-8 W_8 kernels, the batch-fused four-step kernel and the
    SHT Legendre stages zeroed their fp32 PSUM tiles with
    nl.zeros(..., buffer=nl.psum) and then accumulated with
    nc_matmul(..., accumulate=True). The nc_matmul documentation calls a
    matmul accumulating onto PSUM that a non-matmul instruction initialised
    undefined behaviour on NeuronCore-v3 (Trn2): the first matmul into a PSUM
    location must use accumulate=False. Device results have matched
    references so far, but the pattern could break with a compiler or runtime
    change. Now the first matmul of each group overwrites (accumulate=False,
    or accumulate=k > 0 over a Python range). In the four-step kernel each
    column slice of the step-1 PSUM tile takes exactly one matmul, which now
    overwrites. Simulator outputs are bitwise equal to the previous ones at
    every simulator test shape. tests/test_psum_accumulate_lint.py fails on
    the pattern.

Testing

  • Device conformance runs are signal-only (trnsci/trnsci#35). Under
    --backend nki with a non-CPU --conformance-device, the known platform
    case test_complex_conv1d[1-stride=3,padding=2] (device
    aten::convolution, #155) is marked xfail(strict=False) at run time by a
    rule (length-1 input, stride > 1, padding > 0), so a new failure is the only
    red and a fix shows as XPASS. CPU runs are unchanged. A device run prints
    passed, xfailed / XPASS by category and NEW failures;
    --conformance-json PATH writes it, and scripts/conformance_expect.py
    merges chunked runs (exit 1 on NEW failures).