Skip to content

Commit 9f3334e

Browse files
[mlir][SparseTensor] Add missing dependent dialect to pass (#88870)
This commit fixes the following error when stopping the sparse compiler pipeline after bufferization (e.g., with `test-analysis-only`): ``` LLVM ERROR: Building op `vector.print` but it isn't known in this MLIRContext: the dialect may not be loaded or this operation hasn't been added by the dialect. See also https://mlir.llvm.org/getting_started/Faq/#registered-loaded-dependent-whats-up-with-dialects-management ```
1 parent 49b209d commit 9f3334e

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ def SparsificationAndBufferization : Pass<"sparsification-and-bufferization", "M
460460
"memref::MemRefDialect",
461461
"scf::SCFDialect",
462462
"sparse_tensor::SparseTensorDialect",
463+
"vector::VectorDialect"
463464
];
464465
}
465466

mlir/lib/Dialect/SparseTensor/Transforms/SparsificationAndBufferizationPass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "mlir/Dialect/SCF/IR/SCF.h"
2525
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
2626
#include "mlir/Dialect/SparseTensor/Transforms/Passes.h"
27+
#include "mlir/Dialect/Vector/IR/VectorOps.h"
2728
#include "mlir/Pass/PassManager.h"
2829
#include "mlir/Transforms/Passes.h"
2930

mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block3d.mlir

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
// Do the same run, but now with direct IR generation and VLA vectorization.
3131
// RUN: %if mlir_arm_sve_tests %{ %{compile_sve} | %{run_sve} | FileCheck %s %}
3232

33+
// Test that test-bufferization-analysis-only works. This option is useful
34+
// for understanding why buffer copies were inserted.
35+
// RUN: mlir-opt %s --sparsifier="test-bufferization-analysis-only" -o /dev/null
36+
3337
#Sparse1 = #sparse_tensor.encoding<{
3438
map = (i, j, k) -> (
3539
j : compressed,

0 commit comments

Comments
 (0)