This is an archive of the discontinued LLVM Phabricator instance.

[mlir][affinexpr] add parseAffineExpr to parser API
ClosedPublic

Authored by aartbik on Jun 29 2023, 8:20 PM.

Details

Summary

Similar to AffineMap and IntegerSet parsing, this change makes the more fine-grained AffineExpr available for general parsing, using a preset symbol set to recognize variables.

Motivation:
The AffineExpr parser will be used by the new sparse tensor encoding surface syntax. Originally, we planned to duplicate the affine parser completely, but that would be a terrible waste of a good thing. With this minor API change, we prepare the way for the sparse tensor dialect (and others) to reuse the AffineExpr parser outside the context of a more restricted AffineMap parser.

Diff Detail

Event Timeline

aartbik created this revision.Jun 29 2023, 8:20 PM
Herald added a project: Restricted Project. · View Herald Transcript
aartbik requested review of this revision.Jun 29 2023, 8:20 PM
Peiming added inline comments.Jun 29 2023, 8:34 PM
mlir/lib/AsmParser/AffineParser.cpp
60–61

Was it dead code previously?

539

typo, symbols

aartbik updated this revision to Diff 536094.Jun 29 2023, 8:35 PM

fix typos

aartbik marked an inline comment as done.Jun 29 2023, 8:37 PM
aartbik added inline comments.
mlir/lib/AsmParser/AffineParser.cpp
60–61

yeah, not defined anywhere, bit surprising this is not linted somehow

Peiming accepted this revision.Jun 29 2023, 8:37 PM
This revision is now accepted and ready to land.Jun 29 2023, 8:37 PM

Can you add a motivation in the description? Right now it seems like dead code in the repo

mlir/lib/AsmParser/AffineParser.cpp
60–61

Can you just push this ahead of time in a NFC commit? (as well as other NFC things)

aartbik edited the summary of this revision. (Show Details)Jun 29 2023, 8:50 PM
aartbik marked 3 inline comments as done.

Will split out the NFC stuff

mlir/lib/AsmParser/AffineParser.cpp
60–61

sure, also the renaming

aartbik marked an inline comment as done.Jun 29 2023, 8:57 PM

I split out the NFC stuff into https://reviews.llvm.org/D154179
and I added motivation to this revision

aartbik edited the summary of this revision. (Show Details)Jun 29 2023, 8:58 PM
aartbik updated this revision to Diff 536107.Jun 29 2023, 9:52 PM

rebased with main (this removes the NFC part of the original revision)

This revision was automatically updated to reflect the committed changes.