Skip to content

[Synth] Make FunctionalReduction runnable on any op#10230

Open
SmitVaishnav wants to merge 2 commits intollvm:mainfrom
SmitVaishnav:synth-fr-any-op
Open

[Synth] Make FunctionalReduction runnable on any op#10230
SmitVaishnav wants to merge 2 commits intollvm:mainfrom
SmitVaishnav:synth-fr-any-op

Conversation

@SmitVaishnav
Copy link
Copy Markdown
Contributor

Remove the hw::HWModuleOp anchor from the FunctionalReduction pass so it can be inserted into pipelines operating at any level.

The solver is updated to accept any Operation*. collectValues() iterates direct regions/blocks for primary inputs, and scans for any i1 operands defined outside the op's scope, treating them as unknown primary inputs.

Add a func.func test to verify the pass works on non-hw ops.
Part of #10133.

Remove the `hw::HWModuleOp` anchor from the MaximumAndCover pass so it
can be inserted into pipelines operating at any level (e.g. mlir::ModuleOp).

No code change is needed since applyPatternsGreedily already traverses
nested ops generically.

Add a test that runs the pass on a func.func to verify it works on
non-hw ops.

Part of llvm#10133.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please drop this change.

Remove the `hw::HWModuleOp` anchor from the FunctionalReduction pass so
it can be inserted into pipelines operating at any level.

The FunctionalReductionSolver is updated to accept any Operation* instead
of hw::HWModuleOp. collectValues() now iterates the direct regions/blocks
of the given op for primary inputs, and additionally scans for any i1
operands of simulatable ops that are defined outside the op's scope,
treating them as unknown primary inputs. This ensures correct simulation
regardless of what op the pass is anchored to.

Add a func.func test to verify the pass works on non-hw ops.

Part of llvm#10133.
@SmitVaishnav
Copy link
Copy Markdown
Contributor Author

hey @uenoku lets connect on linkedin!

class FunctionalReductionSolver {
public:
FunctionalReductionSolver(hw::HWModuleOp module, unsigned numPatterns,
FunctionalReductionSolver(Operation *module, unsigned numPatterns,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you change this to pass Block* block instead of Operaton* module, since it's very tedious to run this transformation across different blocks.

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