Skip to content

[FIRRTL] Remove convention verification for InstanceChoice#10066

Merged
uenoku merged 4 commits intollvm:mainfrom
uenoku:dev/hidotu/choice
Mar 28, 2026
Merged

[FIRRTL] Remove convention verification for InstanceChoice#10066
uenoku merged 4 commits intollvm:mainfrom
uenoku:dev/hidotu/choice

Conversation

@uenoku
Copy link
Copy Markdown
Member

@uenoku uenoku commented Mar 27, 2026

  • Remove verification that requires referred modules have same conventions in InstanceChoice
  • Force scalarized convention in LowerTypes/LowerSignatures for referred modules of InstanceChoice

@uenoku uenoku changed the title [FIRRTL] Remove convention verification [FIRRTL] Remove convention verification for InstanceChoice Mar 27, 2026
std::vector<FModuleLike> ops;
auto &instanceGraph = getAnalysis<InstanceGraph>();
// Symbol Table
auto &symTbl = getAnalysis<SymbolTable>();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

considered to replace symTbl with instanceGraph but it was challenging due to parallelization and instance op mutation.

Copy link
Copy Markdown
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

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

General approach looks good. Could the name be changed to be more explicit about what this is actually checking?

I have a longer suggestion about integrating this with InstanceInfo. However, that is not blocking and can be handled in a follow-up as appropriate.

Comment on lines +94 to +95
/// Return true if the module instance graph node requires scalarization.
bool isScalarizeRequired(InstanceGraphNode *node);
Copy link
Copy Markdown
Member

@seldridge seldridge Mar 27, 2026

Choose a reason for hiding this comment

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

This is really a "is this instantiated by instance choice" which then means, only elsewhere, this should be scalarized.

At minimum, this would be better if renamed.

Going further, this feels like something that would be better handled in the InstanceInfo analysis which it could then just return. This would also be more efficient for repeated calls (though I don't think we do have repeated calls).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fair point. In that case I think it's better not to expose it to a header so I simply inlined the logic with comment.

Copy link
Copy Markdown
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! I'm not very familiar with the convention mechanism, but allowing certain modules to enforce a scalarized convention feels reasonable.

@uenoku uenoku merged commit a3b2878 into llvm:main Mar 28, 2026
6 of 8 checks passed
@uenoku uenoku deleted the dev/hidotu/choice branch March 28, 2026 04:15
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.

3 participants