This is an archive of the discontinued LLVM Phabricator instance.

[mlir][arith] Support wide integer constant emulation
ClosedPublic

Authored by kuhar on Sep 1 2022, 12:03 PM.

Diff Detail

Event Timeline

kuhar created this revision.Sep 1 2022, 12:03 PM
Herald added a project: Restricted Project. · View Herald Transcript
kuhar requested review of this revision.Sep 1 2022, 12:03 PM
Mogball added inline comments.Sep 6 2022, 9:21 AM
mlir/lib/Dialect/Arithmetic/Transforms/EmulateWideInt.cpp
44

Why not cast to VectorType?

45
70

Why do you need to cast this to size_t?

mlir/test/Dialect/Arithmetic/emulate-wide-int.mlir
68

I would expect this to be [[0, 1], [0, 1], [0, 1]]

antiagainst requested changes to this revision.Sep 6 2022, 10:58 AM
antiagainst added inline comments.
mlir/lib/Dialect/Arithmetic/Transforms/EmulateWideInt.cpp
82

As commented in the previous patch, I think it's more natural to put these two halves adjacent. (Eventually we'd need to support memory types and load/store ops; putting them adjacent would also mean easier to handle there and better load/store behavior.) Any reason transposing it like this way?

94

Just make this as a static helper function?

mlir/test/Dialect/Arithmetic/emulate-wide-int.mlir
68
This revision now requires changes to proceed.Sep 6 2022, 10:58 AM
kuhar updated this revision to Diff 458307.Sep 6 2022, 4:11 PM
kuhar marked 7 inline comments as done.

Addressed comments

kuhar updated this revision to Diff 458308.Sep 6 2022, 4:13 PM

Removed an unnecessary include

Mogball added inline comments.Sep 6 2022, 8:32 PM
mlir/lib/Dialect/Arithmetic/Transforms/EmulateWideInt.cpp
37

Please add a short doc

kuhar updated this revision to Diff 458465.Sep 7 2022, 8:31 AM

Added documentation for the getHalves helper.

kuhar marked an inline comment as done.Sep 7 2022, 8:32 AM
Mogball added inline comments.Sep 7 2022, 8:37 AM
mlir/lib/Dialect/Arithmetic/Transforms/EmulateWideInt.cpp
37

Can you add code headers?

//===---------------------------------------------===//
// ConvertConstant
//===---------------------------------------------===//
kuhar updated this revision to Diff 458505.Sep 7 2022, 10:33 AM

Added conversion pattern header. Rebased.

kuhar marked an inline comment as done.Sep 7 2022, 8:42 PM
antiagainst accepted this revision.Sep 8 2022, 8:58 AM
This revision is now accepted and ready to land.Sep 8 2022, 8:58 AM
Mogball added inline comments.Sep 8 2022, 9:41 AM
mlir/lib/Dialect/Arithmetic/Transforms/EmulateWideInt.cpp
28–97
85

Can you add a header here as well, something like "Pass Definition"

kuhar updated this revision to Diff 458814.Sep 8 2022, 11:48 AM
kuhar marked an inline comment as done.

Added headers. Rebased.

mlir/lib/Dialect/Arithmetic/Transforms/EmulateWideInt.cpp
85

Done. Are these headers standardized / covered by the coding convention in this part of MLIR, or more of a personal preference?
For me, these don't seem very useful.

Mogball added inline comments.Sep 8 2022, 12:01 PM
mlir/lib/Dialect/Arithmetic/Transforms/EmulateWideInt.cpp
85

They're nice to have when files start getting really long and op/pattern/pass definitions start to blur together. They also clearly indicate where new code should go that belong to the category (e.g. helper functions for patterns, etc.)

Mogball accepted this revision.Sep 8 2022, 12:02 PM

LGTM just nit on the spacing around the headers

This revision was automatically updated to reflect the committed changes.