Skip to content

Conversation

@uenoku
Copy link
Member

@uenoku uenoku commented Oct 14, 2025

This commit fixes topological sorting issues and pass ordering problems in the LowerVariadic pass.

The main lowering loop is changed from walk-based iteration to direct iteration using make_early_inc_range over top-level operations only. This is necessary because topologically sorting operations across nested regions is challenging (when a child implicitly captures SSA values, the current MLIR topologically sorting doesn't work well) and the previous approach did not handle this correctly.

The pass now uses MLIR's standard sortTopologically utility with an enhanced predicate that properly handles HW dialect operations, treating hw::InstanceOp as an anchor while allowing Comb and Synth operations to be sorted.

In the synthesis pipeline, LowerVariadic is moved to run after LowerWordToBits for better timing precision and scalability.

@uenoku uenoku force-pushed the dev/hidetou/fix-variadic branch 2 times, most recently from bb08798 to 2790e1f Compare October 14, 2025 21:34
@uenoku uenoku force-pushed the dev/hidetou/fix-variadic branch from 2790e1f to 66d66cc Compare October 14, 2025 21:36
@uenoku uenoku changed the title [Synth][LowerVariaidc] Fix UAF, topological ordering and a pass phase ordering [Synth][LowerVariaidc] Fix topological ordering and a pass phase ordering Oct 14, 2025
@uenoku uenoku merged commit bdbbd4b into main Oct 16, 2025
7 checks passed
@uenoku uenoku deleted the dev/hidetou/fix-variadic branch October 16, 2025 00:18
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