[Mlir-commits] [mlir] 05c17bc - [mlir][sparse] Moving some functions around

wren romano llvmlistbot at llvm.org
Thu May 26 17:23:45 PDT 2022


Author: wren romano
Date: 2022-05-26T17:23:38-07:00
New Revision: 05c17bc4bb632a3a6080550447b5001736979c2a

URL: https://github.com/llvm/llvm-project/commit/05c17bc4bb632a3a6080550447b5001736979c2a
DIFF: https://github.com/llvm/llvm-project/commit/05c17bc4bb632a3a6080550447b5001736979c2a.diff

LOG: [mlir][sparse] Moving some functions around

This is a followup to D126105 to move functions in SparseTensorUtils.cpp to match their locations in SparseTensorUtils.h

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D126106

Added: 
    

Modified: 
    mlir/lib/ExecutionEngine/SparseTensorUtils.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
index f66b87c1c74d..ccc8c7a19387 100644
--- a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
+++ b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
@@ -1627,14 +1627,6 @@ void _mlir_ciface_lexInsertC32(void *tensor,
 FOREVERY_V(IMPL_EXPINSERT)
 #undef IMPL_EXPINSERT
 
-// TODO: move this into the next section, since it doesn't depend on memrefs.
-#define IMPL_OUTSPARSETENSOR(VNAME, V)                                         \
-  void outSparseTensor##VNAME(void *coo, void *dest, bool sort) {              \
-    return outSparseTensor<V>(coo, dest, sort);                                \
-  }
-FOREVERY_V(IMPL_OUTSPARSETENSOR)
-#undef IMPL_OUTSPARSETENSOR
-
 //===----------------------------------------------------------------------===//
 //
 // Public functions which accept only C-style data structures to interact
@@ -1642,17 +1634,6 @@ FOREVERY_V(IMPL_OUTSPARSETENSOR)
 //
 //===----------------------------------------------------------------------===//
 
-// TODO: move this lower down (after `delSparseTensorCOO`) since it's
-// independent of our sparse-tensor formats.
-char *getTensorFilename(index_type id) {
-  char var[80];
-  sprintf(var, "TENSOR%" PRIu64, id);
-  char *env = getenv(var);
-  if (!env)
-    FATAL("Environment variable %s is not set\n", var);
-  return env;
-}
-
 index_type sparseDimSize(void *tensor, index_type d) {
   return static_cast<SparseTensorStorageBase *>(tensor)->getDimSize(d);
 }
@@ -1661,6 +1642,13 @@ void endInsert(void *tensor) {
   return static_cast<SparseTensorStorageBase *>(tensor)->endInsert();
 }
 
+#define IMPL_OUTSPARSETENSOR(VNAME, V)                                         \
+  void outSparseTensor##VNAME(void *coo, void *dest, bool sort) {              \
+    return outSparseTensor<V>(coo, dest, sort);                                \
+  }
+FOREVERY_V(IMPL_OUTSPARSETENSOR)
+#undef IMPL_OUTSPARSETENSOR
+
 void delSparseTensor(void *tensor) {
   delete static_cast<SparseTensorStorageBase *>(tensor);
 }
@@ -1672,6 +1660,15 @@ void delSparseTensor(void *tensor) {
 FOREVERY_V(IMPL_DELCOO)
 #undef IMPL_DELCOO
 
+char *getTensorFilename(index_type id) {
+  char var[80];
+  sprintf(var, "TENSOR%" PRIu64, id);
+  char *env = getenv(var);
+  if (!env)
+    FATAL("Environment variable %s is not set\n", var);
+  return env;
+}
+
 // TODO: generalize beyond 64-bit indices.
 #define IMPL_CONVERTTOMLIRSPARSETENSOR(VNAME, V)                               \
   void *convertToMLIRSparseTensor##VNAME(                                      \


        


More information about the Mlir-commits mailing list