diff --git a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp --- a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp +++ b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp @@ -1627,14 +1627,6 @@ 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 @@ // //===----------------------------------------------------------------------===// -// 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 @@ 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 @@ 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( \