This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add artih.addui_carry conversion to LLVM
ClosedPublic

Authored by kuhar on Aug 24 2022, 3:24 PM.

Details

Summary

This covers the scalar and 1-D vector case.

I haven't implemented conversion for the multidimensional vector case yet because the current LLVM conversion infrastructure (handleMultidimensionalVectors) does not seem to support ops with multiple results.

Diff Detail

Event Timeline

kuhar created this revision.Aug 24 2022, 3:24 PM
Herald added a reviewer: ftynse. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
kuhar requested review of this revision.Aug 24 2022, 3:24 PM
Mogball added inline comments.Aug 24 2022, 3:27 PM
mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp
205

Please spell out all autos where the type is not explicit in the statement on the right hand side (e.g. from a cast)

kuhar added inline comments.Aug 24 2022, 3:30 PM
mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp
205

I tried to match the style used by the surrounding code in this file. Should I change it despite the existing convention here? Or alternatively, update those autos in a separate patch?

Mogball added inline comments.Aug 24 2022, 3:31 PM
mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp
111
209

operandType cannot be null. Also, since this is a conversion pattern, I believe you don't need the type check.

219

Can the op infer this result type?

The coding style has changed/is inconsistent throughout the code base unfortunately. If you would like to update the surrounding code to conform, that would be lovely but you don't have to do it in this patch

kuhar added a comment.Aug 24 2022, 3:33 PM

The coding style has changed/is inconsistent throughout the code base unfortunately. If you would like to update the surrounding code to conform, that would be lovely but you don't have to do it in this patch

Can you point me to some conversion code that best illustrates the preferred coding conventions?

Mogball added a comment.EditedAug 24 2022, 3:40 PM

Quickly glancing through some of the conversion code, ShapeToStandard.cpp does a relatively decent job. But essentially, auto should be used if the result type is spelled out already on the right hand side or the type is "complicated", i.e. llvm::StringMap<int>::const_iterator should be auto

kuhar updated this revision to Diff 455446.Aug 24 2022, 6:02 PM

Cleanups

kuhar marked 4 inline comments as done.Aug 24 2022, 6:02 PM

Thanks for the feedback, @Mogball!

mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp
219

Not from what I can tell

Mogball accepted this revision.Aug 25 2022, 8:02 AM
Mogball added inline comments.
mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp
219

It probably should be made to, but that's not a big deal.

This revision is now accepted and ready to land.Aug 25 2022, 8:02 AM

nit: "artih.addui_carry" misspelled in the title

This revision was automatically updated to reflect the committed changes.
kuhar marked an inline comment as done.