News for hackers. Stuff that matters.
Re:MatX: Efficient C++17 GPU numerical computing library wit... by iamlemec on Tuesday October 03, 2023 @08:49PM (#37759579)
Thanks, looks really interesting. Do functions like matmul support inputs of differing type, like say A=int8 and B=float? Would be nice if you could get memory efficient quantized matmul with operator fusion.
Re:MatX: Efficient C++17 GPU numerical computing library wit... by cburdick13 on Tuesday October 03, 2023 @09:25PM (#37759799)
We typically support whatever the underlying library supports. For int8 the support would come from cuBLASLt currently. I don't believe that or Cutlass supports mixed precision inputs, but I can check.
Re:MatX: Efficient C++17 GPU numerical computing library wit... by gregjm on Wednesday October 04, 2023 @10:45AM (#37765941)
CUTLASS, which is NVIDIA’s C++ template library for writing matrix multiply and convolution kernels parametrized over input/output types, operators, and algorithm block sizes, theoretically supports this. But, each input of the (k, n) shaped matrix B will be read from global memory ceil(n / block dimension) times in an algorithm that computes one (block dimension, block dimension) submatrix of the output matrix D per thread block. It will probably be more efficient to cast your B matrix to FP16 or INT8 lower precision in a preprocessing kernel to reduce memory traffic in the matrix multiply kernel.

On newer GPUs, though, we have this huge L2 cache which makes the calculus a little different if your working set fits into it. e.g. Ampere A100 has 40MB L2$.