Skip to content

Commit 7049515

Browse files
authored
Merge pull request #10655 from oharboe/rsz-deterministic-buffer-sizes
rsz: tie-break buffer size sort for deterministic output
2 parents f5c3c00 + b3a178e commit 7049515

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/rsz/src/Rebuffer.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,12 @@ void Rebuffer::init()
15001500
}
15011501

15021502
std::ranges::sort(buffer_sizes_, [=](BufferSize a, BufferSize b) {
1503-
return bufferCin(a.cell) < bufferCin(b.cell);
1503+
const float cin_a = bufferCin(a.cell);
1504+
const float cin_b = bufferCin(b.cell);
1505+
if (cin_a != cin_b) {
1506+
return cin_a < cin_b;
1507+
}
1508+
return a.cell->id() < b.cell->id();
15041509
});
15051510

15061511
buffer_sizes_index_.clear();

src/rsz/src/RepairDesign.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,12 @@ void RepairDesign::findBufferSizes()
647647
resizer_->buffer_fast_sizes_.end()};
648648
std::ranges::sort(buffer_sizes_,
649649
[=](sta::LibertyCell* a, sta::LibertyCell* b) {
650-
return bufferCin(a) < bufferCin(b);
650+
const float cin_a = bufferCin(a);
651+
const float cin_b = bufferCin(b);
652+
if (cin_a != cin_b) {
653+
return cin_a < cin_b;
654+
}
655+
return a->id() < b->id();
651656
});
652657
}
653658

0 commit comments

Comments
 (0)