[Mlir-commits] [mlir] [mlir][sparse] Add `has_runtime_library` test op (PR #85355)

Matthias Springer llvmlistbot at llvm.org
Thu Mar 14 22:20:26 PDT 2024


================
@@ -1440,4 +1440,15 @@ def SparseTensor_PrintOp : SparseTensor_Op<"print">,
   let assemblyFormat = "$tensor attr-dict `:` type($tensor)";
 }
 
+def SparseTensor_HasRuntimeLibraryOp
+    : SparseTensor_Op<"has_runtime_library", []>, Results<(outs I1:$result)> {
+  string summary = "Indicates whether running in runtime/codegen mode";
+  string description = [{
+    Returns a boolean value that indicates whether the sparse compiler runs in
+    runtime library mode or not. For testing only: This op is useful for writing
+    test cases that require different IR depending on runtime/codegen mode.
+  }];
+  let assemblyFormat = "attr-dict";
+}
----------------
matthias-springer wrote:

I plan to revert this once the buffer deallocation pass is working properly with the sparse compiler. The plan is to fix all memory leaks first, so that I can easily spot issues/regressions while working on the buffer deallocation pass.

I could move the op to `Dialect/Test/TestOps.td` in the mean time and rename it to `test.sparse_tensor.has_runtime_library`. But so far we don't seem to have dialect-specific test ops in there. Alternatively, I could also rename it to `sparse_tensor.test.has_runtime_library`.


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


More information about the Mlir-commits mailing list