[Mlir-commits] [mlir] [mlir][sparse] allow unknown ops in one-shot bufferization in mini-pipeline (PR #77688)

Matthias Springer llvmlistbot at llvm.org
Thu Jan 11 01:56:51 PST 2024


================
@@ -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;
----------------
matthias-springer wrote:

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).


https://github.com/llvm/llvm-project/pull/77688


More information about the Mlir-commits mailing list