MLIR: lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
21
22
23
24
25
28
29 pm.addNestedPassfunc::FuncOp(createLinalgGeneralizeNamedOpsPass());
30 pm.addNestedPassfunc::FuncOp(createLinalgElementwiseOpFusionPass());
31
32
35 options.testBufferizationAnalysisOnly),
36 options.sparsificationOptions(), options.createSparseDeallocs,
37 options.enableRuntimeLibrary, options.enableBufferInitialization,
39 options.armSVE,
40 options.force32BitVectorIndices,
42 options.sparsificationOptions().sparseEmitStrategy,
43 options.sparsificationOptions().parallelizationStrategy));
44
45
46 if (options.testBufferizationAnalysisOnly)
47 return;
48
49
52
53
54 const bool gpuCodegen = options.gpuTriple.hasValue();
55 if (gpuCodegen) {
58 pm.addNestedPassgpu::GPUModuleOp(createSCFToControlFlowPass());
59 pm.addNestedPassgpu::GPUModuleOp(createConvertGpuOpsToNVVMOps());
60 }
61
62
63
64
65
66 pm.addNestedPassfunc::FuncOp(createConvertLinalgToLoopsPass());
68 pm.addNestedPassfunc::FuncOp(memref::createExpandReallocPass());
69 pm.addNestedPassfunc::FuncOp(createSCFToControlFlowPass());
70 pm.addPass(memref::createExpandStridedMetadataPass());
71 pm.addPass(createLowerAffinePass());
73 createConvertVectorToLLVMPass(options.convertVectorToLLVMOptions()));
74 pm.addPass(createFinalizeMemRefToLLVMConversionPass());
75 pm.addNestedPassfunc::FuncOp(createConvertComplexToStandardPass());
76 pm.addNestedPassfunc::FuncOp(arith::createArithExpandOpsPass());
77 pm.addNestedPassfunc::FuncOp(createConvertMathToLLVMPass());
78 pm.addPass(createConvertMathToLibmPass());
79 pm.addPass(createConvertComplexToLibm());
81 createConvertVectorToLLVMPass(options.convertVectorToLLVMOptions()));
82 pm.addPass(createConvertComplexToLLVMPass());
84 createConvertVectorToLLVMPass(options.convertVectorToLLVMOptions()));
85 pm.addPass(createConvertFuncToLLVMPass());
86 pm.addPass(createArithToLLVMConversionPass());
87 pm.addPass(createConvertControlFlowToLLVMPass());
88
89
90 if (gpuCodegen) {
91 GpuNVVMAttachTargetOptions nvvmTargetOptions;
92 nvvmTargetOptions.triple = options.gpuTriple;
93 nvvmTargetOptions.chip = options.gpuChip;
94 nvvmTargetOptions.features = options.gpuFeatures;
95 pm.addPass(createGpuNVVMAttachTarget(nvvmTargetOptions));
96 pm.addPass(createGpuToLLVMConversionPass());
97 GpuModuleToBinaryPassOptions gpuModuleToBinaryPassOptions;
98 gpuModuleToBinaryPassOptions.compilationTarget = options.gpuFormat;
99 pm.addPass(createGpuModuleToBinaryPass(gpuModuleToBinaryPassOptions));
100 }
101
102
103 pm.addPass(createUBToLLVMConversionPass());
104
105
106 pm.addPass(createReconcileUnrealizedCastsPass());
107 }
108
109
110
111
112
115 "sparsifier",
116 "The standard pipeline for taking sparsity-agnostic IR using the"
117 " sparse-tensor type, and lowering it to LLVM IR with concrete"
118 " representations and algorithms for sparse tensors.",
120 }
static llvm::ManagedStatic< PassManagerOptions > options
This class represents a pass manager that runs passes on either a specific operation type,...
void addPass(std::unique_ptr< Pass > pass)
Add the given pass to this pass manager.
void addNestedPass(std::unique_ptr< Pass > pass)
Add the given pass to a nested pass manager for the given operation kind OpT.
void buildSparsifier(OpPassManager &pm, const SparsifierOptions &options)
Adds the "sparsifier" pipeline to the OpPassManager.
void registerSparseTensorPipelines()
Registers all pipelines for the sparse_tensor dialect.
std::unique_ptr< Pass > createSparseGPUCodegenPass()
bufferization::OneShotBufferizationOptions getBufferizationOptionsForSparsification(bool analysisOnly)
std::unique_ptr< Pass > createStripDebugInfoPass()
Creates a pass to strip debug information from a function.
std::unique_ptr< Pass > createSparsificationAndBufferizationPass()
std::unique_ptr< Pass > createStorageSpecifierToLLVMPass()
std::unique_ptr< Pass > createCanonicalizerPass()
Creates an instance of the Canonicalizer pass, configured with default settings (which can be overrid...
std::unique_ptr< Pass > createConvertVectorToSCFPass(const VectorTransferToSCFOptions &options=VectorTransferToSCFOptions())
Create a pass to convert a subset of vector ops to SCF.
PassPipelineRegistration provides a global initializer that registers a Pass pipeline builder routine...
Options for the "sparsifier" pipeline.