[Mlir-commits] [mlir] [MLIR] Graceful handling of uninitialized sparse tensor encodings with `sparse-tensor-codegen` (PR #181145)

Arjun Bhamra llvmlistbot at llvm.org
Fri Feb 13 15:13:13 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
----------------
abhamra wrote:

@aartbik sounds good!

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


More information about the Mlir-commits mailing list