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(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(tensor)->getDimSize(d); } @@ -1661,6 +1642,13 @@ void endInsert(void *tensor) { return static_cast(tensor)->endInsert(); } +#define IMPL_OUTSPARSETENSOR(VNAME, V) \ + void outSparseTensor##VNAME(void *coo, void *dest, bool sort) { \ + return outSparseTensor(coo, dest, sort); \ + } +FOREVERY_V(IMPL_OUTSPARSETENSOR) +#undef IMPL_OUTSPARSETENSOR + void delSparseTensor(void *tensor) { delete static_cast(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( \