Files
concrete/compiler/include/concretelang/Transforms/OneShotBufferizeDPSWrapper.td
Andi Drebes 45577fb79e Rebase onto llvm-project f69328049e9e with local changes
This commit rebases the compiler onto commit f69328049e9e from
llvm-project.

Changes:

* Use of the one-shot bufferizer for improved memory management

* A new pass `OneShotBufferizeDPSWrapper` that converts functions
  returning tensors to destination-passing-style as required by the
  one-shot bufferizer

* A new pass `LinalgGenericOpWithTensorsToLoopsPass` that converts
  `linalg.generic` operations with value semantics to loop nests

* Rebase onto a fork of llvm-project at f69328049e9e with local
  modifications to enable bufferization of `linalg.generic` operations
  with value semantics

* Workaround for the absence of type propagation after type conversion
  via extra patterns in all dialect conversion passes

* Printer, parser and verifier definitions moved from inline
  declarations in ODS to the respective source files as required by
  upstream changes

* New tests for functions with a large number of inputs

* Increase the number of allowed task inputs as required by new tests

* Use upstream function `mlir_configure_python_dev_packages()` to
  locate Python development files for compatibility with various CMake
  versions

Co-authored-by: Quentin Bourgerie <quentin.bourgerie@zama.ai>
Co-authored-by: Ayoub Benaissa <ayoub.benaissa@zama.ai>
Co-authored-by: Antoniu Pop <antoniu.pop@zama.ai>
2022-06-14 14:35:25 +02:00

56 lines
1.6 KiB
TableGen

#ifndef CONCRETELANG_ONE_SHOT_BUFFERIZE_DPS_WRAPPER_PASS
#define CONCRETELANG_ONE_SHOT_BUFFERIZE_DPS_WRAPPER_PASS
include "mlir/Pass/PassBase.td"
def OneShotBufferizeDPSWrapper
: Pass<"one-shot-bufferize-dps-wrapper", "::mlir::ModuleOp"> {
let summary =
"Converts functions to destination-passing and generates a wrapper "
"function allocating and returning memrefs for return values";
let description = [{
The one-shot bufferizer converts all functions returning tensor values
to functions using destination-passing style with one output memref for
each output value. In order to support external callers not using
destination-passing style and expecting memrefs to be returned, this
pass generates a wrapper function that allocates the corresponding
memref for each output tensor of the original function, invokes the
function using destination-passing style and returns the allocated
memrefs to the caller.
Example:
```
func @main(...) -> tensor<3x2049xi64> {
...
}
```
becomes:
```
func private @main(...) -> memref<3x2049xi64> {
%0 = memref.alloc() : memref<3x2049xi64>
call @__dps_main(..., %0) : (..., memref<3x2049xi64>) -> ()
return %0 : memref<3x2049xi64>
}
func @__dps_main(..., tensor<3x2049xi64>) {
...
}
```
}];
let constructor =
"mlir::concretelang::createOneShotBufferizeDPSWrapperPass()";
let options = [];
let dependentDialects = [
"mlir::bufferization::BufferizationDialect", "mlir::memref::MemRefDialect"
];
}
#endif