Skip to content

[Synth] Add declarative cut rewrite pattern and yield op#10565

Open
okekayode wants to merge 1 commit into
llvm:mainfrom
okekayode:dev/add-op-for-declarative-cut-rewrite
Open

[Synth] Add declarative cut rewrite pattern and yield op#10565
okekayode wants to merge 1 commit into
llvm:mainfrom
okekayode:dev/add-op-for-declarative-cut-rewrite

Conversation

@okekayode
Copy link
Copy Markdown
Contributor

@okekayode okekayode commented May 31, 2026

Concerns #10485

We introduce the declarative operation synth.cut_rewrite_pattern and also the terminator operation synth.yield.

synth.cut_rewrite_pattern denotes cut rewrite patterns for i1 input and result types as function-shaped regions. We also implement a custom printer and parser with attribute support for synth.mapping_cost.

In this PR we only introduce the IR representation; wiring this into consumers, for example TechMapper.cpp, can be added later.

@okekayode okekayode changed the title [Synth] Add an operation for declarative Cut rewrite pattern [Synth] Add declarative cut rewrite pattern and yield op May 31, 2026
@circt-bot
Copy link
Copy Markdown

circt-bot Bot commented May 31, 2026

Results of circt-tests run for 833947f compared to results for 7aa41cc: no change to test results.

Comment thread include/circt/Dialect/Synth/SynthOps.td Outdated
@okekayode okekayode force-pushed the dev/add-op-for-declarative-cut-rewrite branch 2 times, most recently from 5ba04fa to 59ffecd Compare May 31, 2026 05:56
Comment thread lib/Dialect/Synth/SynthOps.cpp Outdated
Comment thread lib/Dialect/Synth/SynthOps.cpp Outdated
@okekayode okekayode force-pushed the dev/add-op-for-declarative-cut-rewrite branch from 59ffecd to aee47a9 Compare May 31, 2026 06:15
@circt-bot
Copy link
Copy Markdown

circt-bot Bot commented May 31, 2026

Results of circt-tests run for aee47a9 compared to results for 7aa41cc: no change to test results.

Comment thread lib/Dialect/Synth/SynthOps.cpp Outdated
Comment thread lib/Dialect/Synth/SynthOps.cpp Outdated
Comment thread lib/Dialect/Synth/SynthOps.cpp Outdated
@okekayode okekayode force-pushed the dev/add-op-for-declarative-cut-rewrite branch from aee47a9 to 2318e6e Compare May 31, 2026 07:51
@circt-bot
Copy link
Copy Markdown

circt-bot Bot commented May 31, 2026

Results of circt-tests run for 2318e6e compared to results for 7aa41cc: no change to test results.


// CHECK-LABEL: synth.cut_rewrite_pattern
// CHECK-SAME: (%{{.*}}: i1, %{{.*}}: i1, %{{.*}}: i1) -> i1
synth.cut_rewrite_pattern (%a: i1, %b: i1, %c: i1) -> i1 attributes {cost = #synth.mapping_cost<area = 1.0 : f64, arcs = [], input_caps = {}>} {
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.

We should also improve changing mapping cost's attribute representation:

  1. arcs currently store input/output names but this op doesn't have input/output names, so I think we should drop names in the attributes.
  2. This is MLIR textual representation for mapping_cost but input_caps should be omitted when empty.

Copy link
Copy Markdown
Contributor Author

@okekayode okekayode May 31, 2026

Choose a reason for hiding this comment

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

Okay, do we prefer to add a custom print/parser for MappingCostAttr to omit empty input_caps, and alter synth.linear_timing_arc to accept nameless/pos args for this op?

I do think also switching to OptionalAttr on the MappingCostAttr args may be cleaner, but this would require more verifications of null/absences in TechMapper.cpp.

WDYT?

Comment thread lib/Dialect/Synth/SynthOps.cpp Outdated
Copy link
Copy Markdown
Member

@uenoku uenoku left a comment

Choose a reason for hiding this comment

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

LGTM

@okekayode okekayode force-pushed the dev/add-op-for-declarative-cut-rewrite branch from 2318e6e to 030d0a0 Compare May 31, 2026 19:12
@circt-bot
Copy link
Copy Markdown

circt-bot Bot commented May 31, 2026

Results of circt-tests run for 030d0a0 compared to results for 7aa41cc: no change to test results.

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