This PR adds a codegen pass to lower the following expression to a fused operator that exploits sparsity
sum(CSRMat * ln(denseLhs @ t(denseRhs))).
It can be run simply by enabling the codegen pipeline (--mlir-codegen) and ensuring the lhs of the elementwise multiplication is a CSRMatrix (currently --select-matrix-repr) with the corresponding cli flags.
By computing the sum directly, the pass not only avoids materializing potentially large dense matrices in the dense, right matrix multiplication, it also only computes the necessary dot products corresponding to non-zero entries in the CSRMatrix. Thus, it uses constant memory and reduces runtime significantly.
An example script to test the results (--explain mlir_codegen is optional to show the generated IR):
This PR adds a codegen pass to lower the following expression to a fused operator that exploits sparsity
sum(CSRMat * ln(denseLhs @ t(denseRhs)))
. It can be run simply by enabling the codegen pipeline (--mlir-codegen
) and ensuring the lhs of the elementwise multiplication is a CSRMatrix (currently--select-matrix-repr
) with the corresponding cli flags. By computing the sum directly, the pass not only avoids materializing potentially large dense matrices in the dense, right matrix multiplication, it also only computes the necessary dot products corresponding to non-zero entries in the CSRMatrix. Thus, it uses constant memory and reduces runtime significantly.An example script to test the results (
--explain mlir_codegen
is optional to show the generated IR):A more thorough description will be given once some tests have been added.