[Mlir-commits] [mlir] [MLIR] Graceful handling of uninitialized sparse tensor encodings with `sparse-tensor-codegen` (PR #181145)
Aart Bik
llvmlistbot at llvm.org
Fri Feb 13 11:19:17 PST 2026
================
@@ -0,0 +1,20 @@
+// RUN: mlir-opt %s -sparse-tensor-codegen -verify-diagnostics
+
+#SparseVector = #sparse_tensor.encoding<{
+ map = (d0) -> (d0 : compressed)
+}>
+
+module {
+ func.func @main() -> tensor<8xf32, #SparseVector> {
+ %dense = arith.constant dense<[1.0, 0.0, 0.0, 2.0, 0.0, 3.0, 0.0, 0.0]>
+ : tensor<8xf32>
+
+ // expected-error at +1 {{failed to legalize operation 'sparse_tensor.convert' that was explicitly marked illegal}}
+ %sparse = sparse_tensor.convert %dense
----------------
aartbik wrote:
Every run can test very different passes, as long as you use the "prefix" feature on the CHECK. But I don't think we can use the prefix trick on the expected error indeed, so this is okay.
https://github.com/llvm/llvm-project/pull/181145
More information about the Mlir-commits
mailing list