Repository navigation
Speed up device comparisons in netlist compare - #2467
Open
nikosavola wants to merge 2 commits into
Open
nikosavola wants to merge 2 commits into
nikosavola wants to merge 2 commits into
Conversation
- EqualDeviceParameters::less no longer builds a std::set per call, Device::parameter_value is inline - new three-way DeviceClass::compare used by Transition::operator< / ==, sharing one delegate lookup with less and equal - identical-pointer early-out in DeviceCompare::equals | benchmark, 1 thread | before (ms) | after (ms) | |---|---:|---:| | netlist_compare_mos4_params/16384 (n=6) | 2759 ± 14 | 1199 ± 11 | | netlist_compare/2048 (n=20) | 22.00 ± 0.19 | 18.03 ± 0.14 | | vexriscv LVS compare phase (n=10) | 12130 ± 70 | 11200 ± 80 | Measured on 2x Intel Xeon Gold 6148 (40 cores), g++ 13 -O2, mean ± standard deviation. Co-Authored-By: GLM 5.3 <noreply@z.ai>
nikosavola
force-pushed
the
nikosavola/pr-device-compare
branch
from
September 30, 2026 11:02
bb16b00 to
49151a1
Compare
nikosavola
marked this pull request as ready for review
September 30, 2026 11:08
Collaborator
|
Why not simply extending the DeviceCompare functor with a three-way-compare and using that one in ``Transition::operator<`. That would be much less intrusive and there is reuse potential. Replacing a set by a linear search IMHO is not an optimization. Maybe in small cases, but not in general. |
- the three-way compare moves from a new DeviceClass::compare into the DeviceCompare functor where the less/equal predicates live - Transition::make_key uses the functor compare; same single-call win - EqualDeviceParameters::less keeps the std::set membership test
Contributor
Author
|
Good idea, done. DeviceCompare now has a three-way compare and make_key uses it. I removed DeviceClass::compare again. I also put the std::set back in EqualDeviceParameters::less, as you suggested. I will update the numbers in the description. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EqualDeviceParameters::less,DeviceClass::equalviaTransition::operator</==) was about 15% of LVS cycles on the vexriscv testdataDeviceCompare::compare(category first, thenDeviceClass::lessboth ways);Transition::operator<andoperator==use it instead of callingequalsand then the less functorDeviceCompare::equalsandcompare;Transition::operator==checks the id field firstDevice::parameter_valuefast path is inline;DeviceClass::lessandequalshare one delegate lookupDeviceCompare::compareagrees with less / equals for the default delegate, tolerances, ignored and non-primary parametersThe whole vexriscv LVS flow shows no measurable change (per-round ratios 0.93x to 1.07x).
The benchmarks use the Google Benchmark suite from
parallelize-rebasedon my fork, which is not part of this PR. Measured on theparallelizebranch, where the changed code is the same as on master. Numbers: Intel Xeon Gold 6230, both builds alternating on one pinned core, g++ 13 -O2, mean ± standard deviation.Benchmark code
This PR was carried out with AI assistance (open-weight GLM 5.3) and reviewed before submission.