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 @@ -1625,14 +1625,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 @@ -1640,17 +1632,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); } @@ -1659,6 +1640,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); } @@ -1670,6 +1658,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( \