132 releases

new 0.21.4 Apr 23, 2024
0.21.2 Mar 29, 2024
0.20.22 Nov 28, 2023
0.20.7 Jun 14, 2023
0.2.9 Mar 28, 2019

#580 in Machine learning

Download history 2248/week @ 2024-01-07 4875/week @ 2024-01-14 4979/week @ 2024-01-21 6412/week @ 2024-01-28 6667/week @ 2024-02-04 6716/week @ 2024-02-11 7868/week @ 2024-02-18 15395/week @ 2024-02-25 6715/week @ 2024-03-03 5841/week @ 2024-03-10 4488/week @ 2024-03-17 7885/week @ 2024-03-24 5323/week @ 2024-03-31 7980/week @ 2024-04-07 8324/week @ 2024-04-14 9290/week @ 2024-04-21

31,071 downloads per month
Used in 39 crates (2 directly)

MIT/Apache

540KB
12K SLoC

tract-linalg

linalg stands for "linear algebra". This is a misnamer. This crates contains low-level, architecture dependant optimisations used by tract-core.

Functions

  • MatMatMul: Extended matrix*matrix product:
    • inspired by Gotoblass and BLIS micro kernel approach
    • extended for convolution friendly addressing (fused img2col)
    • fused output pipeline (min, max, and a few more simple, fast ops)
    • f32*f32 -> f32 (à la sgemm)
    • i8*i8 -> i32 accumulator -> i32 storage
    • i8*i8 -> i32 accumulator -> i8 (with channel zeropoint and scale, and re-quantization pipeline)
  • f32 sigmoid and f32 tanh: at f32 precision, by a rationale function (no exponentiation)
  • byte-to-byte lookup table

Implementations

generic fallback armv6, vfp armv7 neon armv8 simd x64 FMA
MatMatMul f32 4x4 8x4 8x8 16x6
MatMatMul i8->i8 8x4 8x8
MatMatMul i8->i32 8x8
sigmoid f32 4n 4n
tanh f32 4n 4n
byte lookup

Dependencies

~8–11MB
~200K SLoC