OSDN Git Service

[mlir] [VectorOps] Replace zero fma with mult for vector.contract
authoraartbik <ajcbik@google.com>
Tue, 30 Jun 2020 16:04:16 +0000 (09:04 -0700)
committeraartbik <ajcbik@google.com>
Tue, 30 Jun 2020 16:04:20 +0000 (09:04 -0700)
commit63b3933d0c3381447a706193d3c0d84927a0fbed
tree9728664aa0c2d97af4de29c0e17752101c05909e
parent69b2d9f42f6adbd0c06264dc42b4be5760689eac
[mlir] [VectorOps] Replace zero fma with mult for vector.contract

More efficient implementation of the multiply-reduce pair,
no need to add in a zero vector. Microbenchmarking on AVX2
yields the following difference in vector.contract speedup
(over strict-order scalar reduction).

SPEEDUP     SIMD-fma SIMD-mul
4x4     1.45   2.00
8x8     1.40   1.90
32x32     5.32   5.80

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D82833
mlir/lib/Dialect/Vector/VectorTransforms.cpp
mlir/test/Dialect/Vector/vector-contract-transforms.mlir