-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir][sparse] allow unknown ops in one-shot bufferization in mini-pipeline #77688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…mini-pipeline Rationale: Since this mini-pipeline may be used in alternative pipelines (viz. different from the default "sparsifier" pipeline) where unknown ops are handled by alternative bufferization methods that are downstream of this mini-pipeline, we allow unknown ops by default (failure to bufferize is eventually apparent by failing to convert to LLVM IR).
@llvm/pr-subscribers-mlir @llvm/pr-subscribers-mlir-sparse Author: Aart Bik (aartbik) Changes…mini-pipeline Rationale: Full diff: https://github.com/llvm/llvm-project/pull/77688.diff 1 Files Affected:
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparsificationAndBufferizationPass.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparsificationAndBufferizationPass.cpp
index 6266c63064ffbd..f497be6e48eba1 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparsificationAndBufferizationPass.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparsificationAndBufferizationPass.cpp
@@ -201,6 +201,12 @@ mlir::getBufferizationOptionsForSparsification(bool analysisOnly) {
options.testAnalysisOnly = true;
options.printConflicts = true;
}
+ // Since this mini-pipeline may be used in alternative pipelines (viz.
+ // different from the default "sparsifier" pipeline) where unknown ops
+ // are handled by alternative bufferization methods that are downstream
+ // of this mini-pipeline, we allow unknown ops by default (failure to
+ // bufferize is eventually apparent by failing to convert to LLVM IR).
+ options.allowUnknownOps = true;
return options;
}
|
// are handled by alternative bufferization methods that are downstream | ||
// of this mini-pipeline, we allow unknown ops by default (failure to | ||
// bufferize is eventually apparent by failing to convert to LLVM IR). | ||
options.allowUnknownOps = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just fyi: From a correctness perspective, setting allowUnknownOps = true
is always safe. The main benefit of setting allowUnknownOps = false
is that we get more descriptive error messages in case there are ops that cannot be bufferized (and are not lowered by subsequent passes). Bufferizing the entire IR with One-Shot Bufferize is generally more efficient. If an op is bufferized later, a buffer copy will likely be inserted by that pass (when buffering an op that writes to memory).
…peline (llvm#77688) Rationale: Since this mini-pipeline may be used in alternative pipelines (viz. different from the default "sparsifier" pipeline) where unknown ops are handled by alternative bufferization methods that are downstream of this mini-pipeline, we allow unknown ops by default (failure to bufferize is eventually apparent by failing to convert to LLVM IR). This is part of enabling e2e testing for TORCH-MLIR tests using a sparsifier backend
Rationale:
Since this mini-pipeline may be used in alternative pipelines (viz. different from the default "sparsifier" pipeline) where unknown ops are handled by alternative bufferization methods that are downstream of this mini-pipeline, we allow unknown ops by default (failure to bufferize is eventually apparent by failing to convert to LLVM IR).
This is part of enabling e2e testing for TORCH-MLIR tests using a sparsifier backend