[Matrix] Add special case dot product lowering
authorVir Narula <virnarula@outlook.com>
Fri, 31 Mar 2023 11:40:04 +0000 (12:40 +0100)
committerFlorian Hahn <flo@fhahn.com>
Fri, 31 Mar 2023 11:40:20 +0000 (12:40 +0100)
commite7281c6f614230860cd18a9d1f24612c5c38e9ca
tree9063e44a2b5e45485e026b540240ff93761b112f
parentaa32490bfe0b957c4f5583e14304f5e34b2b9bce
[Matrix] Add special case dot product lowering

Add special case to matrix lowering for dot products. Normal matrix lowering if optimized for either row-major or column-major, which results in many `shufflevector` instructions being generated for one vector. We work around this in our special case. We can also use vector-reduce adds instead of sequential adds to sum the result of the element-wise multiplication, which takes advantage of SIMD instructions.

Reviewed By: fhahn, thegameg

Differential Revision: https://reviews.llvm.org/D131125
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
llvm/test/Transforms/LowerMatrixIntrinsics/dot-product-int.ll