ReACT is a set of compiler techniques that generate optimized code for dense and sparse tensor expressions. Check out our paper: ReACT: Redundancy-Aware Code Generation for Tensor Expressions.
A Python-based version of ReACT is available to try online: https://tongzhou80.github.io/react-web/index.html!
An MLIR-based (C++) implementation of ReACT has also been included in the COMET compiler.