diff options
| author | Matthias Springer <mspringer@nvidia.com> | 2024-10-28 03:46:58 +0100 |
|---|---|---|
| committer | Matthias Springer <mspringer@nvidia.com> | 2024-10-28 05:44:53 +0100 |
| commit | f6b15963995594d4ea61f56d7473e38b2583fe53 (patch) | |
| tree | 4865fb72dde4494a4707392845449d8eaa768f1a /mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp | |
| parent | 5621929f7f4878c318deecb592cd03f5ecbb83ba (diff) | |
[mlir][memref] Make `finalize-memref-to-llvm` the last MemRef passusers/matthias-springer/finalize_memref
This commit updates all test cases and pass pipelines such that `finalize-memref-to-llvm` is the last pass that deals with MemRef types. (As the name already suggests.) This is now also mentioned in the pass documentation.
This change is preparation of merging the 1:1 and 1:N dialect conversions. As part of that change, argument materializations are going to disappear.
To understand why `finalize-memref-to-llvm` should be the final MemRef pass, consider this example:
```mlir
// RUN: mlir-opt -convert-func-to-llvm
func.func @foo(%m: memref<5xf32>) {
%r = vector.transfer_read %m[...] ...
...
}
```
The output (assuming bare pointer calling convention) will be as follows:
```mlir
func.func @foo(%ptr: !llvm.ptr) {
%m = builtin.unrealized_conversion_cast %ptr : !llvm.ptr to memref<5xf32>
}
```
Diffstat (limited to 'mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp')
| -rw-r--r-- | mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp b/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp index abc4a4c25284..973695134b27 100644 --- a/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp +++ b/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp @@ -79,7 +79,6 @@ void mlir::sparse_tensor::buildSparsifier(OpPassManager &pm, pm.addPass(createLowerAffinePass()); pm.addPass( createConvertVectorToLLVMPass(options.convertVectorToLLVMOptions())); - pm.addPass(createFinalizeMemRefToLLVMConversionPass()); pm.addNestedPass<func::FuncOp>(createConvertComplexToStandardPass()); pm.addNestedPass<func::FuncOp>(arith::createArithExpandOpsPass()); pm.addNestedPass<func::FuncOp>(createConvertMathToLLVMPass()); @@ -105,6 +104,8 @@ void mlir::sparse_tensor::buildSparsifier(OpPassManager &pm, pm.addPass(createGpuModuleToBinaryPass(gpuModuleToBinaryPassOptions)); } + pm.addPass(createFinalizeMemRefToLLVMConversionPass()); + // Ensure all casts are realized. pm.addPass(createReconcileUnrealizedCastsPass()); } |
