Skip to content

[MLIR][IRDL] Add higher order scoped range constraints #158085

@Moxinilian

Description

@Moxinilian

Once variadic constraints are part of the type system with #158077, we would like to be able to express variadic constraints that do not imply the same types for all the elements of the variadic. The challenge for this purpose is that IRDL constraint variables collapse into a single type: once they are collapsed, they must match the same type or attribute.

To resolve this, we could add a notion of scoped constraints. Constraints defined inside of the scope would be resolved again for each range element. For example:

%0 = irdl.any
%range = irdl.range_scoped {
    %0 = irdl.any
    %result = irdl.parametrized @hashmap<%0, %1>
    irdl.yield %0
}

This constraint matches a range of n @hashmap<Kn, Vn> where all Kn are the same type and Vn can be any type.

Contact points: @Moxinilian @math-fehr

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