Skip to content

Conversation

@maerhart
Copy link
Member

@maerhart maerhart commented Nov 5, 2025

Allows aggregate constants like hw.aggregate_constant, but using attributes instead of a dedicated op.

@maerhart maerhart added the RTG Involving the `rtg` dialect label Nov 5, 2025
Copy link
Contributor

@fabianschuiki fabianschuiki left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +18 to +35

// CHECK-NEXT: rtg.constant #rtg.set<> : !rtg.set<i32>
rtg.constant #rtg.set<> : !rtg.set<i32>

// Test that set elements are printed in lexicographic order
// CHECK-NEXT: rtg.constant #rtg.set<#rtgtest.a0 : !rtgtest.ireg, #rtgtest.a1 : !rtgtest.ireg, #rtgtest.a2 : !rtgtest.ireg> : !rtg.set<!rtgtest.ireg>
rtg.constant #rtg.set<#rtgtest.a1, #rtgtest.a0, #rtgtest.a2> : !rtg.set<!rtgtest.ireg>

// Test set type inference
// CHECK-NEXT: rtg.constant #rtg.set<0 : i32, 1 : i32, 2 : i32> : !rtg.set<i32>
rtg.constant #rtg.set<1 : i32, 0 : i32, 2 : i32>

// CHECK-NEXT: rtg.constant #rtg.tuple<0 : i32, 1 : index> : !rtg.tuple<i32, index>
rtg.constant #rtg.tuple<0 : i32, 1 : index> : !rtg.tuple<i32, index>

// Test set type inference
// CHECK-NEXT: rtg.constant #rtg.tuple<0 : i32, 1 : index> : !rtg.tuple<i32, index>
rtg.constant #rtg.tuple<0 : i32, 1 : index>
Copy link
Contributor

Choose a reason for hiding this comment

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

Really nice! 🥳 Maybe we should do something like this in HW at some point, too?

Copy link
Member Author

Choose a reason for hiding this comment

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

IMO this is the cleaner solution 😉

@maerhart maerhart merged commit 41d4ebc into main Nov 5, 2025
7 checks passed
@maerhart maerhart deleted the maerhart-rtg-set-tuple-attr branch November 5, 2025 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RTG Involving the `rtg` dialect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants