Skip to content

refactor(third_party): replace Abseil with STL - #235

Merged
ZhishengZeng merged 1 commit into
mainfrom
refactor_replace_abseil_with_stl
Sep 15, 2026
Merged

ZhishengZeng merged 1 commit into
mainfrom
refactor_replace_abseil_with_stl

Conversation

@ZhishengZeng

Copy link
Copy Markdown
Collaborator

Summary

  • replace active Abseil usage with equivalent C++ standard-library facilities
  • remove the vendored src/third_party/abseil-cpp source tree and its CMake integration
  • update affected Liberty, LEF, Tcl, and CTS build dependencies

Validation

  • cmake --build build --target ecc_bin ecc_py --parallel 8
  • verified no active Abseil include, namespace, or CMake references remain (excluding vendored JSON license comments)

@Emin017

Emin017 commented Sep 15, 2026

Copy link
Copy Markdown
Member

Review summary

PR #235 removes the vendored Abseil dependency and replaces several Abseil containers with STL containers. The larger mapped MiniRV test does not show a measurable slowdown, but the container changes still have a plausible performance risk for large Liberty workloads.

Benchmark comparison

Metric main PR #235 Difference / interpretation
Liberty C API parser microbenchmark (same ics55 Liberty, 5 parses) 2.47 s 2.44 s -1.5%; not statistically significant
Large 81 MB Liberty parser (5 parses) 2.722 s 2.727 s +0.2%; not statistically significant
ecc_bin lib_init (same Liberty, 10-run mean) 418.5 ms 413.1 ms -1.3%; not statistically significant
Full mapped MiniRV initialization (7-run mean) 1.094 s 1.078 s -1.5%; not statistically significant
gperftools samples (5 C API parses) 2621 2599 -0.8%; hotspot distribution is essentially the same
Dominant flamegraph hotspots parseGroupBody / parseGroupMember parseGroupBody / parseGroupMember No new dominant hotspot observed
ecc_bin text+data size 42,275,824 B 42,139,096 B -136,728 B (-0.32%)
Small-container storage absl::InlinedVector<..., 64> std::vector First push_back on small lists may add a heap allocation
Ordered associative containers absl::btree_map/multimap std::map/multimap Same asymptotic complexity, but potentially worse locality/allocation behavior

Findings

  1. Medium - small-container allocation risk

    absl::InlinedVector<T, 64> was replaced with std::vector in Liberty and Tcl data structures. Many of these lists are expected to contain only a few elements, so the PR may introduce one or more heap allocations per parsed object.

  2. Medium - ordered-container locality risk

    absl::btree_map/multimap was replaced with std::map/multimap. The asymptotic complexity remains O(log n), but node-based STL trees generally have worse locality and higher allocation overhead than B-trees.

  3. Medium - API and ABI compatibility

    Public header return types and class layouts change, including LibTable::get_axes() and LibClassifyCell::getClassOfCell(). The package version remains unchanged, so downstream C++ consumers may need a compatibility note or version bump.

Test scope

The mapped MiniRV fixture contains approximately 4,168 standard-cell instances, 4,441 wires, and more than 4,000 processed pins, nets, and components. The benchmark initializes the ics55 LEF/DEF database, loads two large Liberty files, and imports the mapped MiniRV Verilog netlist. It does not run placement, CTS, routing, or STA.

Therefore, the evidence supports no observed regression, but it is not sufficient to claim performance neutrality for a million-cell production flow. The likely impact scales with Liberty complexity, the number of timing objects, and the number of library corners loaded.

Harness code

#include "LibParserCpp.hh"
#include <cstdlib>

int main(int argc, char** argv) {
  if (argc < 2 || argc > 3) return 2;
  int count = argc == 3 ? std::atoi(argv[2]) : 1;
  for (int i = 0; i < count; ++i) {
    void* group = liberty_parse_lib(argv[1]);
    if (!group) return 1;
    liberty_free_lib_group(group);
  }
  return 0;
}

The Tcl cases were:

# Parser-only case
lib_init <ics55-liberty-file>
exit

# Full mapped MiniRV initialization case
idb_init <ics55-database-config>
lib_init {<ics55-liberty-file-1> <ics55-liberty-file-2>}
verilog_init <mapped-minirv-netlist> minirv
exit

Flamegraph image links

C API parser, repeated Liberty parsing

main

ecc-main-5

PR #235

ecc-pr235-5

Liberty parser profile

main

ecc-main-lib

PR #235

ecc-pr235-lib

ecc_bin lib_init

main

ecc-main-tcl

PR #235

ecc-pr235-tcl

Additional PR harness profile

PR #235

ecc-pr235-harness

Across the profiles, the dominant frames remain LibertyDriver::parseGroupBody and LibertyDriver::parseGroupMember; there is no new PR-only hotspot.

@ZhishengZeng
ZhishengZeng merged commit c63838a into main Sep 15, 2026
2 checks passed
@ZhishengZeng
ZhishengZeng deleted the refactor_replace_abseil_with_stl branch September 15, 2026 16:23
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