This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] make index type explicit in public API of support library
ClosedPublic

Authored by aartbik on Oct 19 2021, 9:45 PM.

Details

Summary

The current implementation used explicit index->int64_t casts for some, but
not all instances of passing values of type "index" in and from the sparse
support library. This revision makes the situation more consistent by
using new "index_t" type at all such places (which allows for less trivial
casting in the generated MLIR code). Note that the current revision still
assumes that "index" is 64-bit wide. If we want to support targets with
alternative "index" bit widths, we need to build the support library different.
But the current revision is a step forward by making this requirement explicit
and more visible.

Diff Detail

Event Timeline

aartbik created this revision.Oct 19 2021, 9:45 PM
aartbik requested review of this revision.Oct 19 2021, 9:45 PM
wrengr accepted this revision.Oct 20 2021, 12:05 PM
wrengr added inline comments.
mlir/lib/ExecutionEngine/SparseUtils.cpp
526–528

Why use uint32_t for these two enums but unsigned for the Action enum?

621

Why use uint32_t here but unsigned when defining the enum?

This revision is now accepted and ready to land.Oct 20 2021, 12:05 PM
aartbik marked an inline comment as done.Oct 20 2021, 12:11 PM
aartbik added inline comments.
mlir/lib/ExecutionEngine/SparseUtils.cpp
526–528

Wait, L537 is uint32_t too, right? Or are you talking about the defs in sparseconversion.cpp (these are all unsigned, I changed them to uint32_t for consistency)

aartbik updated this revision to Diff 381056.Oct 20 2021, 12:22 PM

unsigned -> uint32_t or uint64_t where it was more consistent