Skip to content

[AIE] Fix sub-register index composition in split instruction rewriter#968

Merged
konstantinschwarz merged 2 commits into
aie-publicfrom
kschwarz.fix.aie.split.instrs
Apr 24, 2026
Merged

[AIE] Fix sub-register index composition in split instruction rewriter#968
konstantinschwarz merged 2 commits into
aie-publicfrom
kschwarz.fix.aie.split.instrs

Conversation

@konstantinschwarz

Copy link
Copy Markdown
Collaborator

When splitting a tuple instruction operand that already has a
sub-register index (e.g., %R.sub_hi_dim), the aie-split-instrs-create
pass was overwriting the existing index with the new split sub-register
(e.g., sub_mod) instead of composing them (sub_hi_dim_then_sub_mod).

This caused downstream passes to reference wrong sub-register lanes.
For example, a PADD_2D_pseudo using the high dimension of an eds
register would have its split operands reference the low dimension
sub-registers, leading to undefined uses that later crashed in
the AIESuperRegRewriter pass with 'Virtual register defs don't
dominate all uses'.

Fix by using TRI.composeSubRegIndices() to properly compose the
existing sub-register index with the new split sub-register index.

Add a test case for when a tuple operand already has a sub-register
index (e.g., %R.sub_hi_dim). The aie-split-instrs-create pass should
compose the indices correctly (e.g., sub_hi_dim_then_sub_mod instead
of sub_mod).

The current CHECK lines reflect the buggy behavior where the existing
sub-register index is overwritten instead of composed.
When splitting a tuple instruction operand that already has a
sub-register index (e.g., %R.sub_hi_dim), the aie-split-instrs-create
pass was overwriting the existing index with the new split sub-register
(e.g., sub_mod) instead of composing them (sub_hi_dim_then_sub_mod).

This caused downstream passes to reference wrong sub-register lanes.
For example, a PADD_2D_pseudo using the high dimension of an eds
register would have its split operands reference the low dimension
sub-registers, leading to undefined uses that later crashed in
the AIESuperRegRewriter pass with 'Virtual register defs don't
dominate all uses'.

Fix by using TRI.composeSubRegIndices() to properly compose the
existing sub-register index with the new split sub-register index.
@konstantinschwarz konstantinschwarz enabled auto-merge (rebase) April 24, 2026 21:40
@konstantinschwarz konstantinschwarz merged commit 6f2f117 into aie-public Apr 24, 2026
8 checks passed
@konstantinschwarz konstantinschwarz deleted the kschwarz.fix.aie.split.instrs branch April 24, 2026 22:10
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