Skip to content

Conversation

@hhkit
Copy link
Contributor

@hhkit hhkit commented May 23, 2025

A re-attempt at merging IRDL-to-CPP (#133982) after a sanitizer check failed in post-merge CI (resolving #138285).


This PR introduces a new tool, mlir-irdl-to-cpp, that converts IRDL to C++ definitions.

The C++ definitions allow use of the IRDL-defined dialect in MLIR C++ infrastructure, enabling the use of conversion patterns with IRDL dialects for example. This PR also adds CMake utilities to easily integrate the IRDL dialects into MLIR projects.

Note that most IRDL features are not supported. In general, we are only able to define simple types and operations.

  • The only type constraint supported is irdl.any.
  • Variadic operands and results are not supported.
  • Verifiers for the IRDL constraints are not generated.
  • Attributes are not supported.

Copy link
Member

@Moxinilian Moxinilian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving per reviews in #133982

mlir::test::registerTestVectorReductionToSPIRVDotProd();
mlir::test::registerTestVulkanRunnerPipeline();
mlir::test::registerTestWrittenToPass();
mlir::test::registerTestIrdlTestDialectConversionPass();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add this in alphabetical order?

::test::registerTestTransformsTransformDialectExtension(registry);
::test::registerTestTilingInterfaceTransformDialectExtension(registry);
::test::registerTestDynDialect(registry);
::test::registerIrdlTestDialect(registry);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're at it could you sort this alphabetically too if that doesn't break anything (just try it and if CI complain let's reverse)?

@Moxinilian Moxinilian merged commit c76e280 into llvm:main May 25, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants