135 releases

0.21.7 Sep 23, 2024
0.21.6 Jul 24, 2024
0.21.5 May 11, 2024
0.21.2 Mar 29, 2024
0.2.9 Mar 28, 2019

#457 in Machine learning

Download history 11102/week @ 2024-07-23 4853/week @ 2024-07-30 6462/week @ 2024-08-06 2719/week @ 2024-08-13 7144/week @ 2024-08-20 3799/week @ 2024-08-27 6204/week @ 2024-09-03 6488/week @ 2024-09-10 6373/week @ 2024-09-17 7185/week @ 2024-09-24 7399/week @ 2024-10-01 7526/week @ 2024-10-08 9684/week @ 2024-10-15 10360/week @ 2024-10-22 5197/week @ 2024-10-29 3535/week @ 2024-11-05

30,740 downloads per month
Used in 38 crates (2 directly)

MIT/Apache

1MB
23K SLoC

Rust 14K SLoC // 0.0% comments Templ 9K SLoC // 0.1% comments GNU Style Assembly 13 SLoC // 0.3% comments

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

~10–18MB
~251K SLoC