[all-commits] [llvm/llvm-project] 293c21: [mlir][tosa] Improve lowering of tosa.conv2d (#74143)
Spenser Bauman via All-commits
all-commits at lists.llvm.org
Sat Dec 2 04:29:24 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 293c21db9381fde27cda46e5c3ff8bf8578e5399
https://github.com/llvm/llvm-project/commit/293c21db9381fde27cda46e5c3ff8bf8578e5399
Author: Spenser Bauman <sbauman at mathworks.com>
Date: 2023-12-02 (Sat, 02 Dec 2023)
Changed paths:
M mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
M mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-named.mlir
Log Message:
-----------
[mlir][tosa] Improve lowering of tosa.conv2d (#74143)
The existing lowering of tosa.conv2d emits a separate linalg.generic
operator to add the bias after computing the computation.
This change eliminates that additional step by using the generated
linalg.conv_2d_* operator by using the bias value as the input to the
linalg.conv_2d operation.
Rather than:
%init = tensor.empty()
%conv = linalg.conv_2d ins(%A, %B) %outs(%init)
%init = tensor.empty()
%bias = linalg.generic ins(%conv, %bias) outs(%init2) {
// perform add operation
}
The lowering now produces:
%init = tensor.empty()
%bias_expanded = linalg.broadcast ins(%bias) outs(%init)
%conv = linalg.conv_2d ins(%A, %B) %outs(%bias)
This is the same strategy as
https://github.com/llvm/llvm-project/pull/73049 applied to convolutions.
More information about the All-commits
mailing list