forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MLIR] one-shot-bufferize: Add bufferize-bodiless-function-results op…
…tion When bufferizing a bodiless function ``` func.func private @foo() -> tensor<?xf32> ``` we currently fail with `cannot bufferize bodiless function that returns a tensor`. This PR adds the option `bufferize-bodiless-function-results` (off by default), to allow bufferizing this into ``` func.func private @foo() -> memref<?xf32, strided<[?], offset: ?>> ```
- Loading branch information
1 parent
f951d24
commit 151f763
Showing
5 changed files
with
38 additions
and
4 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
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
15 changes: 15 additions & 0 deletions
15
...ialect/Bufferization/Transforms/one-shot-module-bufferize-bodiless-functions-results.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,15 @@ | ||
// RUN: mlir-opt %s -one-shot-bufferize="bufferize-function-boundaries=1 bufferize-bodiless-function-results=1" -split-input-file | FileCheck %s | ||
|
||
func.func private @foo() -> tensor<?xf32> | ||
// CHECK: func.func private @foo() -> memref<?xf32, strided<[?], offset: ?>> | ||
|
||
// ----- | ||
|
||
func.func private @foo(tensor<?xf32>) -> (f32, tensor<?xf32>, f32) | ||
// CHECK: func.func private @foo(memref<?xf32, strided<[?], offset: ?>>) -> (f32, memref<?xf32, strided<[?], offset: ?>>, f32) | ||
|
||
func.func @call_to_unknown_tensor_returning_func(%t : tensor<?xf32>) { | ||
call @foo(%t) : (tensor<?xf32>) -> (f32, tensor<?xf32>, f32) | ||
// CHECK: call @foo(%{{.*}}) : (memref<?xf32, strided<[?], offset: ?>>) -> (f32, memref<?xf32, strided<[?], offset: ?>>, f32) | ||
return | ||
} |