Skip to content

[MLIR][IRDL] Add a custom constraint operation #158049

@Moxinilian

Description

@Moxinilian

Currently, it is not possible to define custom constraints in a portable manner. The c_pred escape hatch exists for TableGen portability reasons, but it is not portable at all and should be treated as a last resort solution.

Instead, we should offer a way to expose custom constraints infrastructure that is as portable as possible. One idea to achieve this would be to offer arbitrary imperative MLIR IR regions that take as input a representation of the IR element to verify and that return whether it is a match. This would be portable in the sense that the dialects used in the region can then offer a lowering to whatever the IRDL target is (maybe LLVM IR for an MLIR-based dialect, SMT dialect for the purposes of formal verification, etc.)

This might depend on introducing an in-IR way to interface with IR constructs. Maybe an mlir MLIR dialect that models the existing IR APIs?

Contact points: @Moxinilian

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImproving things as opposed to bug fixing, e.g. new or missing featuremlir:irdl

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions