32
32
void mlir::sparse_tensor::buildSparsifier (OpPassManager &pm,
33
33
const SparsifierOptions &options) {
34
34
// Rewrite named linalg ops into generic ops.
35
-
36
35
pm.addNestedPass <func::FuncOp>(createLinalgGeneralizationPass ());
37
36
38
37
// Sparsification and bufferization mini-pipeline.
@@ -65,6 +64,8 @@ void mlir::sparse_tensor::buildSparsifier(OpPassManager &pm,
65
64
pm.addNestedPass <gpu::GPUModuleOp>(createConvertGpuOpsToNVVMOps ());
66
65
}
67
66
67
+ // Progressively lower to LLVM. Note that the convert-vector-to-llvm
68
+ // pass is repeated on purpose.
68
69
// TODO(springerm): Add sparse support to the BufferDeallocation pass and add
69
70
// it to this pipeline.
70
71
pm.addNestedPass <func::FuncOp>(createConvertLinalgToLoopsPass ());
@@ -80,10 +81,7 @@ void mlir::sparse_tensor::buildSparsifier(OpPassManager &pm,
80
81
pm.addNestedPass <func::FuncOp>(createConvertMathToLLVMPass ());
81
82
pm.addPass (createConvertMathToLibmPass ());
82
83
pm.addPass (createConvertComplexToLibmPass ());
83
-
84
- // Repeat convert-vector-to-llvm.
85
84
pm.addPass (createConvertVectorToLLVMPass (options.lowerVectorToLLVMOptions ()));
86
-
87
85
pm.addPass (createConvertComplexToLLVMPass ());
88
86
pm.addPass (createConvertVectorToLLVMPass (options.lowerVectorToLLVMOptions ()));
89
87
pm.addPass (createConvertFuncToLLVMPass ());
@@ -101,6 +99,7 @@ void mlir::sparse_tensor::buildSparsifier(OpPassManager &pm,
101
99
pm.addPass (createGpuModuleToBinaryPass (gpuModuleToBinaryPassOptions));
102
100
}
103
101
102
+ // Ensure all casts are realized.
104
103
pm.addPass (createReconcileUnrealizedCastsPass ());
105
104
}
106
105
0 commit comments