This is an archive of the discontinued LLVM Phabricator instance.

[mlir][tools] Introduce tblgen-to-irdl tool
AbandonedPublic

Authored by Groverkss on Jul 27 2023, 11:14 AM.

Details

Summary

This patch adds a new tool, tblgen-to-irdl, which is an IRDL backend to MLIR
ODS.

Currently, the tool only covers operation and dialect definitions and
generates verifiers constraints as "irdl::CPred", which is the constraint as a
C++ string. The tool currently does not support
traits/interfaces/regions/variadics as they are not added in IRDL yet, so the
generated definitions would not be correct for operations using them. Support
for these things will be added as they are implemented in IRDL.

This tool acts as a bridge to convert TableGen-defined dialects into IRDL
definitions, making operation definitions more easily introspectable. This
introspectablility allows for tools like fuzzers, mutators, and reducers to
work on ODS definitions as a MLIR dialect instead of trying to navigate through
TableGen.

co-author: @math-fehr

Diff Detail

Event Timeline

Groverkss created this revision.Jul 27 2023, 11:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2023, 11:14 AM
Groverkss requested review of this revision.Jul 27 2023, 11:14 AM
Groverkss edited the summary of this revision. (Show Details)Jul 27 2023, 11:17 AM
Mogball requested changes to this revision.Jul 27 2023, 11:19 AM

Really excited to see this happen! That being said, I think this deserves an RFC, given that it is adding a new tool to the MLIR toolset. It is important to formalize the relationship between IRDL and TableGen and the limitations of the system.

This revision now requires changes to proceed.Jul 27 2023, 11:19 AM
Groverkss abandoned this revision.Sep 20 2023, 12:04 AM

Sent on github instead.