[Mlir-commits] [mlir] [mlir][sparse] introduce sparse_tensor.lvl	operation. (PR #69978)
    Aart Bik 
    llvmlistbot at llvm.org
       
    Mon Oct 23 15:28:04 PDT 2023
    
    
  
================
@@ -521,9 +521,65 @@ def SparseTensor_SetStorageSpecifierOp : SparseTensor_Op<"storage_specifier.set"
 }
 
 //===----------------------------------------------------------------------===//
-// Sparse Tensor Coordinate Translation Operation.
+// Sparse Tensor Coordinate Operations.
 //===----------------------------------------------------------------------===//
 
+def SparseTensor_LvlOp : SparseTensor_Op<"lvl", [ConditionallySpeculatable, NoMemoryEffect]>,
+    Arguments<(ins AnySparseTensor:$source, Index:$index)>,
+    Results<(outs Index:$result)> {
+  let summary = "dimension index operation";
+  let description = [{
+    The `sparse_tensor.lvl` behaves similar to `tensor.dim` operation.
+    It takes a sparse tensor and a level operand of type `index` and returns
+    the size of the requested level of the given sparse tensor.
+    If the level index is out of bounds, the behavior is undefined.
----------------
aartbik wrote:
Perhaps make a comment that for ID mappings, dim/level return the same result
https://github.com/llvm/llvm-project/pull/69978
    
    
More information about the Mlir-commits
mailing list