This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Macros to clean up StridedMemRefType in the SparseTensorRuntime
ClosedPublic

Authored by wrengr on Nov 14 2022, 6:12 PM.

Details

Summary

In particular, this silences warnings from [-Wsign-compare].

This is a revised version of D137735, which got reverted due to a sign-comparison warning on LLVM's Windows buildbot (which was not on MLIR's Windows buildbot). Differences vs the previous differential:

  • vectorToMemref now uses detail::checkOverflowCast to silence the warning that caused the the previous differential to get reverted.
  • MEMREF_GET_USIZE now uses detail::checkOverflowCast rather than static_cast
  • ASSERT_USIZE_EQ added to abbreviate another common idiom, and to ensure that we use detail::safelyEQ everywhere (to silence a few other warnings)
  • A couple for-loops now use index_type for the induction variable, since their upper bound uses that typedef too. (Namely _mlir_ciface_getSparseTensorReaderDimSizes and _mlir_ciface_outSparseTensorWriterNext)

Depends on D138149

Diff Detail

Event Timeline

wrengr created this revision.Nov 14 2022, 6:12 PM
wrengr requested review of this revision.Nov 14 2022, 6:12 PM
aartbik accepted this revision.Nov 14 2022, 6:16 PM
This revision is now accepted and ready to land.Nov 14 2022, 6:16 PM
wrengr updated this revision to Diff 475906.Nov 16 2022, 1:27 PM

Adding dependency on D138149, and rebasing.

wrengr edited the summary of this revision. (Show Details)Nov 16 2022, 1:37 PM

@stella.stamenova As a heads-up, I'm going to land this now. If you encounter any other issues from LLVM's buildbot, just let me know and I'm more than happy to address them promptly.

@stella.stamenova As a heads-up, I'm going to land this now. If you encounter any other issues from LLVM's buildbot, just let me know and I'm more than happy to address them promptly.

One of your changes did break the bot: https://lab.llvm.org/buildbot/#/builders/13/builds/28417. I'm not sure which one.

Taking a look now

@stella.stamenova That's due to D138154.

I'm not quite sure what the preprocessor is unhappy about though. The __has_builtin(__builtin_mul_overflow) check is the same as the one used by include/mlir/Analysis/Presburger/MPInt.h and I can't find anywhere that defines __has_builtin if it's missing or anything. I'll post a quick change that does that, just in case that's what's going awry.

@stella.stamenova I just posted D138167. Can you check to see if that resolves things on your side?

@stella.stamenova I just posted D138167. Can you check to see if that resolves things on your side?

I can run a local build to see, but it's already past business hours and I'd hate to leave the buildbot broken overnight pending on a response from me.

(I'm guessing you're on the east coast then? I'm on the west coast is why I ask)

I can land the patch right away, if you trust that'll fix things. Otherwise, if you need to revert stuff before heading home can you revert only D138154 and not any of the others?