This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Harden verifiers for DMA ops
ClosedPublic

Authored by ftynse on May 5 2020, 5:09 AM.

Details

Summary

DMA operation classes in the Standard dialect (DmaStartOp and DmaWaitOp)
provide helper functions that make numerous assumptions about the number and
order of operands, and about their types. However, these assumptions were not
checked in the verifier, leading to assertion failures or crashes when helper
functions were used on ill-formed ops. Some of the assuptions were checked in
the custom parser (and thus could not check assumption violations in ops
constructed programmatically, e.g., during rewrites) and others were not
checked at all. Introduce the verifiers for all these assumptions and drop
unnecessary checks in the parser that are now covered by the verifier.

Addresses PR45560.

Diff Detail

Event Timeline

ftynse created this revision.May 5 2020, 5:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2020, 5:09 AM
andydavis1 accepted this revision.May 5 2020, 10:18 AM

Thanks for doing this Alex. The test coverage is great. Thanks!

mlir/lib/Dialect/StandardOps/IR/Ops.cpp
1509

Maybe comment that both optional operands need to be present (or none). You have that reflected in the code, but a comment would help explain the + 2.

This revision is now accepted and ready to land.May 5 2020, 10:18 AM
ftynse marked an inline comment as done.May 5 2020, 11:38 AM
This revision was automatically updated to reflect the committed changes.