[Mlir-commits] [mlir] 1abcdc6 - [mlir][sparse] add missing types to from/to-MLIR conversion routines
Aart Bik
llvmlistbot at llvm.org
Tue May 3 14:36:45 PDT 2022
Author: Aart Bik
Date: 2022-05-03T14:36:37-07:00
New Revision: 1abcdc677cfd4f14af0a80d86841344c2af5bdb9
URL: https://github.com/llvm/llvm-project/commit/1abcdc677cfd4f14af0a80d86841344c2af5bdb9
DIFF: https://github.com/llvm/llvm-project/commit/1abcdc677cfd4f14af0a80d86841344c2af5bdb9.diff
LOG: [mlir][sparse] add missing types to from/to-MLIR conversion routines
This will enable our usual set of element types in external
environments, such as PyTACO support.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D124875
Added:
Modified:
mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
Removed:
################################################################################
diff --git a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
index 7c59ccc0a739d..e66de519d1864 100644
--- a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
+++ b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
@@ -1339,6 +1339,30 @@ void *convertToMLIRSparseTensorF32(uint64_t rank, uint64_t nse, uint64_t *shape,
return toMLIRSparseTensor<float>(rank, nse, shape, values, indices, perm,
sparse);
}
+void *convertToMLIRSparseTensorI64(uint64_t rank, uint64_t nse, uint64_t *shape,
+ int64_t *values, uint64_t *indices,
+ uint64_t *perm, uint8_t *sparse) {
+ return toMLIRSparseTensor<int64_t>(rank, nse, shape, values, indices, perm,
+ sparse);
+}
+void *convertToMLIRSparseTensorI32(uint64_t rank, uint64_t nse, uint64_t *shape,
+ int32_t *values, uint64_t *indices,
+ uint64_t *perm, uint8_t *sparse) {
+ return toMLIRSparseTensor<int32_t>(rank, nse, shape, values, indices, perm,
+ sparse);
+}
+void *convertToMLIRSparseTensorI16(uint64_t rank, uint64_t nse, uint64_t *shape,
+ int16_t *values, uint64_t *indices,
+ uint64_t *perm, uint8_t *sparse) {
+ return toMLIRSparseTensor<int16_t>(rank, nse, shape, values, indices, perm,
+ sparse);
+}
+void *convertToMLIRSparseTensorI8(uint64_t rank, uint64_t nse, uint64_t *shape,
+ int8_t *values, uint64_t *indices,
+ uint64_t *perm, uint8_t *sparse) {
+ return toMLIRSparseTensor<int8_t>(rank, nse, shape, values, indices, perm,
+ sparse);
+}
/// Converts a sparse tensor to COO-flavored format expressed using C-style
/// data structures. The expected output parameters are pointers for these
@@ -1370,6 +1394,26 @@ void convertFromMLIRSparseTensorF32(void *tensor, uint64_t *pRank,
float **pValues, uint64_t **pIndices) {
fromMLIRSparseTensor<float>(tensor, pRank, pNse, pShape, pValues, pIndices);
}
+void convertFromMLIRSparseTensorI64(void *tensor, uint64_t *pRank,
+ uint64_t *pNse, uint64_t **pShape,
+ int64_t **pValues, uint64_t **pIndices) {
+ fromMLIRSparseTensor<int64_t>(tensor, pRank, pNse, pShape, pValues, pIndices);
+}
+void convertFromMLIRSparseTensorI32(void *tensor, uint64_t *pRank,
+ uint64_t *pNse, uint64_t **pShape,
+ int32_t **pValues, uint64_t **pIndices) {
+ fromMLIRSparseTensor<int32_t>(tensor, pRank, pNse, pShape, pValues, pIndices);
+}
+void convertFromMLIRSparseTensorI16(void *tensor, uint64_t *pRank,
+ uint64_t *pNse, uint64_t **pShape,
+ int16_t **pValues, uint64_t **pIndices) {
+ fromMLIRSparseTensor<int16_t>(tensor, pRank, pNse, pShape, pValues, pIndices);
+}
+void convertFromMLIRSparseTensorI8(void *tensor, uint64_t *pRank,
+ uint64_t *pNse, uint64_t **pShape,
+ int8_t **pValues, uint64_t **pIndices) {
+ fromMLIRSparseTensor<int8_t>(tensor, pRank, pNse, pShape, pValues, pIndices);
+}
} // extern "C"
More information about the Mlir-commits
mailing list