[mlir][sparse] Using non-empty function name suffix for OverheadType::kIndex
authorwren romano <2998727+wrengr@users.noreply.github.com>
Tue, 31 May 2022 22:26:52 +0000 (15:26 -0700)
committerwren romano <2998727+wrengr@users.noreply.github.com>
Wed, 1 Jun 2022 21:18:42 +0000 (14:18 -0700)
commitb364c76683f8ef241025a9556300778c07b590c2
treef651307a765362031c0ef99775f44e495a51e695
parent08482830eb8a038450d36103aa2a3569a9dcea5c
[mlir][sparse] Using non-empty function name suffix for OverheadType::kIndex

The trick of using an empty token in the `FOREVERY_O` x-macro relies on preprocessor behavior which is only standard since C99 6.10.3/4 and C++11 N3290 16.3/4 (whereas it was undefined behavior up through C++03 16.3/10).  Since the `ExecutionEngine/SparseTensorUtils.cpp` file is required to be compile-able under C++98 compatibility mode (unlike the C++11 used elsewhere in MLIR), we shouldn't rely on that behavior.

Also, using a non-empty suffix helps improve uniformity of the API, since all other primary/overhead suffixes are also non-empty.  I'm using the suffix `0` since that's the value used by the `SparseTensorEncoding` attribute for indicating the index overhead-type.

Depends On D126720

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D126724
mlir/include/mlir/ExecutionEngine/SparseTensorUtils.h
mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.cpp
mlir/test/Dialect/SparseTensor/conversion.mlir
mlir/test/Dialect/SparseTensor/sparse_lower.mlir
mlir/test/Dialect/SparseTensor/sparse_lower_col.mlir
mlir/test/Dialect/SparseTensor/sparse_lower_inplace.mlir