This is an archive of the discontinued LLVM Phabricator instance.

Improve type conversion error propagation/failure during LLVM lowering
ClosedPublic

Authored by bondhugula on Nov 30 2022, 8:29 PM.

Details

Summary

Improve type conversion error propagation/failure during LLVM lowering.

BEFORE

llvm-mlir/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp:304: SmallVector<mlir::Type, 5> mlir::LLVMTypeConverter::getMemRefDescriptorFields(mlir::MemRefType, bool): Assertion `isStrided(type) && "Non-strided layout maps must have been normalized away"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
...

AFTER

<unknown>:0: error: integer overflow during size computation
<unknown>:0: error: Conversion to strided form failed either due to non-strided layout maps (which should have been normalized away) or other reasons
<unknown>:0: error: failed to legalize operation 'gpu.func' that was explicitly marked illegal
<unknown>:0: note: see current operation:
"gpu.func"() ( {
...

Diff Detail

Event Timeline

bondhugula created this revision.Nov 30 2022, 8:29 PM
bondhugula requested review of this revision.Nov 30 2022, 8:29 PM

Base on upstream commit.

bondhugula edited the summary of this revision. (Show Details)

Update commit summary.

ftynse accepted this revision.Dec 1 2022, 12:38 AM
ftynse added inline comments.
mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
306

Nit: user-visible error messages should not be capitalized.

307

Nit: what other reasons? This error is only emitted when the isStrided condition fails.

This revision is now accepted and ready to land.Dec 1 2022, 12:38 AM
bondhugula updated this revision to Diff 479269.Dec 1 2022, 6:16 AM
bondhugula marked 2 inline comments as done.

Adjust error message.

mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
307

There are two more reasons (including the integer overflow case). Please see getStridesAndOffset failure return paths.

bondhugula updated this revision to Diff 479819.Dec 3 2022, 2:59 AM

Rebase to remove parent dep.

This revision was landed with ongoing or failed builds.Dec 3 2022, 3:06 AM
This revision was automatically updated to reflect the committed changes.