This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] refactoring SparseTensorUtils: (2 of 4) reordering
ClosedPublic

Authored by wrengr on Sep 13 2022, 9:10 PM.

Details

Summary

Previously, the SparseTensorUtils.cpp library contained a C++ core implementation, but hid it in an anonymous namespace and only exposed a C-API for accessing it. Now we are factoring out that C++ core into a standalone C++ library so that it can be used directly by downstream clients (per request of one such client). This refactoring has been decomposed into a stack of differentials in order to simplify the code review process, however the full stack of changes should be considered together.

  • D133462: Part 1: split one file into several
  • (this): Part 2: Reorder chunks within files
  • D133831: Part 3: General code cleanup
  • D133833: Part 4: Update documentation

This part moves chunks of code within files, but again aims to make no other changes. Many of these movements are part of a stylistic shift to reorder the components of class definitions as follows: data members, ctors/factories, getters, other public methods, private methods.

Depends On D133462

Diff Detail

Event Timeline

wrengr created this revision.Sep 13 2022, 9:10 PM
wrengr requested review of this revision.Sep 13 2022, 9:10 PM
aartbik added inline comments.Sep 14 2022, 9:23 AM
mlir/include/mlir/ExecutionEngine/SparseTensor/COO.h
58

Why did you move the private fields up? Don't we typically keep the order to data after methods in classes?

mlir/include/mlir/ExecutionEngine/SparseTensor/File.h
49 ↗(On Diff #459972)

same question? and repeated below

I am okay with all changes in this revision, except for the moving up of data members. Let's keep those at the end in explicit private: section to be consistent with original style and the style found in the llvm/mlir codebase at large.

wrengr marked 2 inline comments as done.Sep 15 2022, 5:46 PM
wrengr updated this revision to Diff 460576.Sep 15 2022, 5:46 PM

addressing nits, and rebasing

aartbik accepted this revision.Sep 19 2022, 5:26 PM
This revision is now accepted and ready to land.Sep 19 2022, 5:26 PM
wrengr updated this revision to Diff 463982.Sep 29 2022, 11:56 AM

Rebasing to parent D133462 at Diff 463979.