-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reuse input buffer in lowering to krnl (#2939)
* first step Signed-off-by: chentong319 <chentong@us.ibm.com> * cpu Signed-off-by: chentong319 <chentong@us.ibm.com> * options Signed-off-by: chentong319 <chentong@us.ibm.com> * unify Signed-off-by: chentong319 <chentong@us.ibm.com> * simd Signed-off-by: chentong319 <chentong@us.ibm.com> * comments Signed-off-by: chentong319 <chentong@us.ibm.com> * lit test Signed-off-by: chentong319 <chentong@us.ibm.com> * fix test Signed-off-by: chentong319 <chentong@us.ibm.com> * format Signed-off-by: chentong319 <chentong@us.ibm.com> * response Signed-off-by: chentong319 <chentong@us.ibm.com> --------- Signed-off-by: chentong319 <chentong@us.ibm.com>
- Loading branch information
1 parent
02f45b0
commit 97d497f
Showing
4 changed files
with
109 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
test/mlir/conversion/onnx_to_krnl/onnx_lowering_reuse.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// RUN: onnx-mlir-opt --disable-krnl-op-fusion=true --enable-krnl-buffer-reuse=true --shape-inference --convert-onnx-to-krnl --canonicalize %s -split-input-file | FileCheck %s | ||
|
||
// ----- | ||
func.func @test_reuse(%arg0: tensor<1024xf32>, %arg1: tensor<1024xf32>) -> tensor<1024xf32> { | ||
%0 = "onnx.Add"(%arg0, %arg1) : (tensor<1024xf32>, tensor<1024xf32>) -> tensor<1024xf32> | ||
%1 = "onnx.Sqrt"(%0) : (tensor<1024xf32>) -> tensor<1024xf32> | ||
%2 = "onnx.Sqrt"(%1) : (tensor<1024xf32>) -> tensor<1024xf32> | ||
return %2 : tensor<1024xf32> | ||
} | ||
// CHECK-LABEL: func.func @test_reuse | ||
// CHECK-NOT: memref.alloc |