Skip to content

Commit 62d70f5

Browse files
committed
revert new attribute and add TODO for mapping cost attr
1 parent a4a11d2 commit 62d70f5

5 files changed

Lines changed: 13 additions & 50 deletions

File tree

include/circt/Dialect/Synth/SynthAttributes.td

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,6 @@ def LinearTimingArcAttr : AttrDef<Synth_Dialect, "LinearTimingArc"> {
7171
"$polarity `>`";
7272
}
7373

74-
def PositionalLinearTimingArcAttr : AttrDef<Synth_Dialect, "PositionalLinearTimingArc"> {
75-
let mnemonic = "positional_linear_timing_arc";
76-
let summary = "A simplified linear timing arc using positional input index";
77-
let parameters = (ins
78-
"uint64_t":$inputIndex,
79-
"int64_t":$intrinsic,
80-
"int64_t":$sensitivity,
81-
"PolarityAttr":$polarity
82-
);
83-
let assemblyFormat =
84-
"`<` $inputIndex `,` $intrinsic `,` $sensitivity `,` $polarity `>`";
85-
}
86-
8774
def MappingCostAttr : AttrDef<Synth_Dialect, "MappingCost"> {
8875
let mnemonic = "mapping_cost";
8976
let summary = "Simplified timing and area cost for tech mapping";

lib/Dialect/Synth/SynthAttributes.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ MappingCostAttr::verify(llvm::function_ref<InFlightDiagnostic()> emitError,
2525
DictionaryAttr inputCaps) {
2626
if (arcs)
2727
for (auto attr : arcs)
28-
if (!isa<LinearTimingArcAttr, PositionalLinearTimingArcAttr>(attr))
29-
return emitError() << "expected arcs to contain timing arc attributes";
28+
if (!isa<LinearTimingArcAttr>(attr))
29+
return emitError()
30+
<< "expected arcs to contain synth.linear_timing_arc";
3031

3132
if (inputCaps)
3233
for (auto entry : inputCaps)

lib/Dialect/Synth/SynthOps.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -712,19 +712,16 @@ LogicalResult CutRewritePatternOp::verify() {
712712
<< blockArg.getType();
713713

714714
auto cost = getCost();
715-
if (auto arcs = cost.getArcs()) {
715+
if (auto arcs = cost.getArcs())
716716
for (auto attr : arcs) {
717-
auto arc = dyn_cast<PositionalLinearTimingArcAttr>(attr);
718-
if (!arc)
717+
// TODO: LinearTimingArcAttr pin names are currently ignored for cut
718+
// rewrite patterns. In the future MappingCostAttr should use a 2D
719+
// ArrayAttr container for arcs. Names may be dropped from
720+
// LinearTimingArcAttr in a future cleanup.
721+
if (!isa<LinearTimingArcAttr>(attr))
719722
return emitError()
720-
<< "mapping cost arcs for cut rewrite patterns must use "
721-
"synth.positional_linear_timing_arc";
722-
723-
if (arc.getInputIndex() >= functionType.getNumInputs())
724-
return emitError()
725-
<< "mapping cost arc input index exceeds number of arguments";
723+
<< "mapping cost arcs must use synth.linear_timing_arc";
726724
}
727-
}
728725

729726
if (auto inputCaps = cost.getInputCaps())
730727
if (inputCaps.size() != functionType.getNumInputs())

test/Dialect/Synth/errors.mlir

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,3 @@ synth.cut_rewrite_pattern (%a: i1) -> i1 attributes {cost = #synth.mapping_cost<
4343
%0 = hw.constant 0 : i2
4444
synth.yield %0 : i2
4545
}
46-
47-
// -----
48-
49-
// expected-error @below {{mapping cost arcs for cut rewrite patterns must use synth.positional_linear_timing_arc}}
50-
synth.cut_rewrite_pattern (%a: i1) -> i1 attributes {
51-
cost = #synth.mapping_cost<area = 1.0 : f64, arcs = [
52-
#synth.linear_timing_arc<"result", "a", 1, 0, #synth.polarity<positive>>
53-
]>
54-
} {
55-
synth.yield %a : i1
56-
}
57-
58-
// -----
59-
60-
// expected-error @below {{mapping cost arc input index exceeds number of arguments}}
61-
synth.cut_rewrite_pattern (%a: i1) -> i1 attributes {
62-
cost = #synth.mapping_cost<area = 1.0 : f64, arcs = [
63-
#synth.positional_linear_timing_arc<1, 1, 0, #synth.polarity<positive>>
64-
]>
65-
} {
66-
synth.yield %a : i1
67-
}

test/Dialect/Synth/round-trip.mlir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ hw.module @gamble(in %x: i1, in %y: i1, in %z: i1) {
5757

5858
// CHECK-LABEL: synth.cut_rewrite_pattern
5959
// CHECK-SAME: (%{{.*}}: i1, %{{.*}}: i1, %{{.*}}: i1) -> i1
60-
// CHECK-SAME: attributes {cost = #synth.mapping_cost<area =
61-
// CHECK-SAME: #synth.positional_linear_timing_arc<1, 1, 0, <positive>>
60+
// CHECK-SAME: attributes {cost = #synth.mapping_cost<area =
61+
// CHECK-SAME: #synth.linear_timing_arc<"result", "b", 1, 0, <positive>>
6262
synth.cut_rewrite_pattern (%a: i1, %b: i1, %c: i1) -> i1 attributes {
6363
cost = #synth.mapping_cost<area = 1.0 : f64, arcs = [
64-
#synth.positional_linear_timing_arc<1, 1, 0, #synth.polarity<positive>>
64+
#synth.linear_timing_arc<"result", "b", 1, 0, #synth.polarity<positive>>
6565
]>
6666
} {
6767
%0 = synth.aig.and_inv %a, not %b, %c : i1

0 commit comments

Comments
 (0)