[Mlir-commits] [mlir] aab46c7 - [mlir][sparse][NFC] Disallow writing into sparse_tensor.to_... results
Matthias Springer
llvmlistbot at llvm.org
Fri Jan 27 08:56:37 PST 2023
Author: Matthias Springer
Date: 2023-01-27T17:52:02+01:00
New Revision: aab46c7579c29b2ce44fc0febeb46c2df300780e
URL: https://github.com/llvm/llvm-project/commit/aab46c7579c29b2ce44fc0febeb46c2df300780e
DIFF: https://github.com/llvm/llvm-project/commit/aab46c7579c29b2ce44fc0febeb46c2df300780e.diff
LOG: [mlir][sparse][NFC] Disallow writing into sparse_tensor.to_... results
Writing into the memrefs returned by `sparse_tensor.to_values` etc. can cause additional copies during bufferization.
Differential Revision: https://reviews.llvm.org/D142728
Added:
Modified:
mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
index 6404dc1eb5f15..4690643709143 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
+++ b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
@@ -119,6 +119,8 @@ def SparseTensor_ToPointersOp : SparseTensor_Op<"pointers", [Pure]>,
lowers into code that extracts the pointers array from the sparse storage
scheme (either by calling a support library or through direct code).
+ Writing into the result of this operation is undefined behavior.
+
Example:
```mlir
@@ -143,6 +145,8 @@ def SparseTensor_ToIndicesOp : SparseTensor_Op<"indices", [Pure]>,
lowers into code that extracts the indices array from the sparse storage
scheme (either by calling a support library or through direct code).
+ Writing into the result of this operation is undefined behavior.
+
Example:
```mlir
@@ -171,6 +175,8 @@ def SparseTensor_ToIndicesBufferOp : SparseTensor_Op<"indices_buffer", [Pure]>,
stored in a linear buffer as (1, 4, 3, 6) instead of two buffer as (1, 4)
and (3, 6).
+ Writing into the result of this operation is undefined behavior.
+
Example:
```mlir
@@ -195,6 +201,8 @@ def SparseTensor_ToValuesOp : SparseTensor_Op<"values", [Pure]>,
lowers into code that extracts the values array from the sparse storage
scheme (either by calling a support library or through direct code).
+ Writing into the result of this operation is undefined behavior.
+
Example:
```mlir
More information about the Mlir-commits
mailing list