[mlir][sparse] Add new option (enable-runtime-library) to sparse compiler pipeline
Add new option (enable-runtime-library) to sparse compiler pipeline, it allows us to decide whether we need to rewrite operations (e.g., concatenate, reshape) within sparsification (when using codegen) or convert them after sparsification (when using runtime library). Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D133597
This commit is contained in:
@@ -47,17 +47,19 @@ struct SparsificationPass
|
||||
vectorLength = options.vectorLength;
|
||||
enableSIMDIndex32 = options.enableSIMDIndex32;
|
||||
enableVLAVectorization = options.enableVLAVectorization;
|
||||
enableRuntimeLibrary = options.enableRuntimeLibrary;
|
||||
}
|
||||
|
||||
void runOnOperation() override {
|
||||
auto *ctx = &getContext();
|
||||
// Apply pre-rewriting.
|
||||
RewritePatternSet prePatterns(ctx);
|
||||
populateSparseTensorRewriting(prePatterns);
|
||||
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(prePatterns));
|
||||
// Translate strategy flags to strategy options.
|
||||
SparsificationOptions options(parallelization, vectorization, vectorLength,
|
||||
enableSIMDIndex32, enableVLAVectorization);
|
||||
enableSIMDIndex32, enableVLAVectorization,
|
||||
enableRuntimeLibrary);
|
||||
// Apply pre-rewriting.
|
||||
populateSparseTensorRewriting(prePatterns, options.enableRuntimeLibrary);
|
||||
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(prePatterns));
|
||||
// Apply sparsification and vector cleanup rewriting.
|
||||
RewritePatternSet patterns(ctx);
|
||||
populateSparsificationPatterns(patterns, options);
|
||||
|
||||
Reference in New Issue
Block a user