Skip to content

Commit 7b0410d

Browse files
committed
Merge remote-tracking branch 'private/master' into gpl-filler-gcell-removal
2 parents 678e11a + 23d8380 commit 7b0410d

163 files changed

Lines changed: 5223 additions & 2381 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,24 @@ test --build_tests_only
7474
# Use a high number of jobs and let the scheduler manage concurrency
7575
build --jobs=200
7676

77-
# Enable local disk caching to supplement the remote cache
78-
build --disk_cache=~/.cache/bazel-disk-cache
77+
# Enable local disk caching to supplement the remote cache.
78+
# The location can be overridden by setting the OPENROAD_BAZEL_CACHE env variable.
79+
build --disk_cache=$(OPENROAD_BAZEL_CACHE:-~/.cache/bazel-disk-cache)
7980

8081
# --- CI Settings (write access) ---
8182
build:ci --remote_cache=https://storage.googleapis.com/openroad-bazel-cache
8283
build:ci --remote_cache_compression=true
8384
build:ci --remote_upload_local_results=true
85+
# CI only needs to know if the build succeeded, not the artifacts themselves.
8486
build:ci --remote_download_minimal
85-
build:ci --remote_download_toplevel
8687
# Disable disk cache for CI builds
8788
build:ci --disk_cache=
8889

8990
# --- OpenROAD Developer Settings (read-only access) ---
9091
build:openroad-dev --remote_cache=https://storage.googleapis.com/openroad-bazel-cache
9192
build:openroad-dev --remote_cache_compression=true
9293
build:openroad-dev --remote_upload_local_results=false
93-
build:openroad-dev --remote_download_minimal
94+
# Developers need the actual output files to run and use them.
9495
build:openroad-dev --remote_download_toplevel
9596
build:openroad-dev --google_default_credentials=true
9697

Jenkinsfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,13 @@ def getParallelTests(String image) {
173173
stage('Bazel Build') {
174174
withCredentials([file(credentialsId: 'bazel-cache-sa', variable: 'GCS_SA_KEY')]) {
175175
timeout(time: 120, unit: 'MINUTES') {
176-
def bazelCommand = 'bazel test --config=ci --keep_going --show_timestamps --test_output=errors --curses=no --force_pic'
176+
def cmd = 'bazelisk test --config=ci --show_timestamps --test_output=errors --curses=no --force_pic'
177177

178178
if (env.BRANCH_NAME != 'master') {
179-
bazelCommand += ' --remote_upload_local_results=false'
179+
cmd += ' --remote_upload_local_results=false'
180180
}
181181

182-
sh label: 'Bazel Build', script: bazelCommand + ' --google_credentials=$GCS_SA_KEY ...'
182+
sh label: 'Bazel Build', script: cmd + ' --google_credentials=$GCS_SA_KEY ...'
183183
}
184184
}
185185
}

docs/user/Bazel-caching.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Bazel Developer Guide: Caching
2+
3+
This document provides instructions for developers on how to use Bazel's caching features to accelerate local builds.
4+
5+
## Caching Strategy Overview
6+
7+
Our Bazel setup uses a multi-layered caching strategy to provide optimal performance for different types of users:
8+
9+
1. **Local Cache (Default):** All builds use a local on-disk cache by default. This provides a speed-up for incremental builds without requiring any special configuration or authentication.
10+
2. **Remote Cache (OpenROAD Developers & CI):** We maintain a remote cache on Google Cloud Storage. This allows team members and CI jobs to share build artifacts, dramatically reducing build times.
11+
12+
---
13+
14+
### 1. Local On-Disk Cache
15+
16+
By default, all builds use a local on-disk cache to speed up incremental builds. The default location is `~/.cache/bazel-disk-cache`.
17+
18+
You can override this location by setting the `OPENROAD_BAZEL_CACHE` environment variable:
19+
20+
```bash
21+
export OPENROAD_BAZEL_CACHE=/path/to/your/cache
22+
bazel build //...
23+
```
24+
25+
No remote cache is accessed, and no authentication is required for the local cache. This provides a seamless experience for external contributors.
26+
Secure VMs already have this set up, so no additional configuration is needed.
27+
28+
---
29+
30+
### 2. OpenROAD Developer Access (for `@openroad.tools` users)
31+
32+
Team members can enable **read-only** access to the remote cache by using the `openroad-dev` configuration. This will dramatically speed up local builds by downloading artifacts already built by CI.
33+
34+
#### On Secure Development VMs
35+
36+
If you are working on a secure development VM provided by OpenROAD, you do **not** need to authenticate. The VM's service account already has the necessary read access to the cache.
37+
38+
#### On a Local Environment
39+
40+
If you are working on your local machine, you must first authenticate with Google Cloud using your @openroad.tools account. All OpenROAD team members have read access to the remote cache.
41+
42+
```bash
43+
gcloud auth application-default login
44+
```
45+
46+
After authenticating (if necessary), run your build with the `--config=openroad-dev` flag:
47+
48+
```bash
49+
bazel build --config=openroad-dev //...
50+
```
51+
52+
This configuration is **read-only** to prevent local, unverified builds from populating the shared cache.
53+
54+
---
55+
56+
### 3. CI Access (Jenkins Pipeline)
57+
58+
The Jenkins pipeline uses a unified caching strategy for all builds. This is primarily for informational purposes, as developers will not typically use the `ci` configuration locally.
59+
60+
* All CI builds use the `--config=ci` profile.
61+
* Builds on the `master` branch have **read/write** access, populating the remote cache with the latest artifacts.
62+
* Builds on PR branches are set to **read-only**.
63+
64+
---
65+
66+
## `.bazelrc` Configurations Summary
67+
68+
The caching behavior is controlled by two new configurations in the `.bazelrc` file:
69+
70+
* **`build:ci` (Write Access):**
71+
* `--remote_upload_local_results=true`: **Enables writing** to the remote cache.
72+
* Uses service account credentials provided by Jenkins.
73+
74+
* **`build:openroad-dev` (Read-Only Access):**
75+
- `--remote_upload_local_results=false`: **Disables writing**, making the cache read-only.
76+
- `--google_default_credentials=true`: Uses the developer's local `gcloud` credentials.
77+
78+
Both configurations include performance optimizations to reduce network traffic and improve build speeds. The primary mechanism for this is the "Build without the Bytes" (BwoB) feature, which minimizes the download of build artifacts from the remote cache.
79+
80+
There are two main BwoB settings:
81+
82+
* `--remote_download_toplevel`: This is the default setting in Bazel. It downloads only the outputs of the top-level targets you specify in your build command. This is ideal for interactive development, where you need to use the final build artifacts (e.g., run a binary or inspect a generated file).
83+
84+
* `--remote_download_minimal`: This is a more aggressive setting that downloads only the artifacts essential for the build to continue. It is primarily intended for CI environments, where you are only concerned with the success or failure of a build, not the artifacts themselves.
85+
86+
Our configurations use `--remote_download_toplevel` for developer builds (`openroad-dev`) and `--remote_download_minimal` for CI builds (`ci`) to provide the best balance of performance and usability for each environment.

etc/DependencyInstaller.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ _installCI() {
688688

689689
curl -Lo bazelisk https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64
690690
chmod +x bazelisk
691-
mv bazelisk /usr/local/bin/bazel
691+
mv bazelisk /usr/local/bin/bazelisk
692692

693693
if command -v docker &> /dev/null; then
694694
# The user can uninstall docker if they want to reinstall it,

include/ord/OpenRoad.hh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ class OpenRoad
191191
// major.minor (avoid including defout.h)
192192
const string& version);
193193

194-
void writeCdl(const char* outFilename,
195-
const std::vector<const char*>& mastersFilenames,
196-
bool includeFillers);
194+
void writeCdl(const char* out_filename,
195+
const std::vector<const char*>& masters_filenames,
196+
bool include_fillers);
197197

198198
void readVerilog(const char* filename);
199199
void linkDesign(const char* design_name,
@@ -208,8 +208,8 @@ class OpenRoad
208208
void writeDb(std::ostream& stream);
209209
void writeDb(const char* filename);
210210

211-
void setThreadCount(int threads, bool printInfo = true);
212-
void setThreadCount(const char* threads, bool printInfo = true);
211+
void setThreadCount(int threads, bool print_info = true);
212+
void setThreadCount(const char* threads, bool print_info = true);
213213
int getThreadCount();
214214

215215
std::string getExePath() const;

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ if (SWIG_VERSION VERSION_GREATER_EQUAL "4.1.0")
144144
endif()
145145
include(UseSWIG)
146146

147-
find_package(Boost REQUIRED)
147+
find_package(Boost CONFIG REQUIRED)
148148
message(STATUS "boost: ${Boost_VERSION}")
149149

150150
if (ENABLE_TESTS)

src/Design.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ utl::Logger* Design::getLogger()
116116

117117
int Design::micronToDBU(double coord)
118118
{
119-
const int dbuPerMicron = getBlock()->getDbUnitsPerMicron();
120-
return round(coord * dbuPerMicron);
119+
const int dbu_per_micron = getBlock()->getDbUnitsPerMicron();
120+
return round(coord * dbu_per_micron);
121121
}
122122

123123
ant::AntennaChecker* Design::getAntennaChecker()

src/Main.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,12 @@ std::string findPathToTclreadlineInit(Tcl_Interp* interp)
343343
//
344344
// Running Docker within a bazel isolated environment introduces lots of
345345
// problems and is not really done.
346-
const char* tclScript = R"(
346+
const char* tcl_script = R"(
347347
namespace eval temp {
348348
foreach dir $::auto_path {
349349
set folder [file join $dir]
350350
set path [file join $folder "tclreadline)" TCLRL_VERSION_STR
351-
R"(" "tclreadlineInit.tcl"]
351+
R"(" "tclreadlineInit.tcl"]
352352
if {[file exists $path]} {
353353
return $path
354354
}
@@ -357,7 +357,7 @@ std::string findPathToTclreadlineInit(Tcl_Interp* interp)
357357
}
358358
)";
359359

360-
if (Tcl_Eval(interp, tclScript) == TCL_ERROR) {
360+
if (Tcl_Eval(interp, tcl_script) == TCL_ERROR) {
361361
std::cerr << "Tcl_Eval failed: " << Tcl_GetStringResult(interp)
362362
<< std::endl;
363363
return "";

src/OpenRoad.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -433,16 +433,16 @@ void OpenRoad::writeLef(const char* filename)
433433
}
434434
}
435435

436-
void OpenRoad::writeCdl(const char* outFilename,
437-
const std::vector<const char*>& mastersFilenames,
438-
bool includeFillers)
436+
void OpenRoad::writeCdl(const char* out_filename,
437+
const std::vector<const char*>& masters_filenames,
438+
bool include_fillers)
439439
{
440440
odb::dbChip* chip = db_->getChip();
441441
if (chip) {
442442
odb::dbBlock* block = chip->getBlock();
443443
if (block) {
444444
odb::cdl::writeCdl(
445-
getLogger(), block, outFilename, mastersFilenames, includeFillers);
445+
getLogger(), block, out_filename, masters_filenames, include_fillers);
446446
}
447447
}
448448
}
@@ -540,7 +540,7 @@ odb::Rect OpenRoad::getCore()
540540
return db_->getChip()->getBlock()->getCoreArea();
541541
}
542542

543-
void OpenRoad::setThreadCount(int threads, bool printInfo)
543+
void OpenRoad::setThreadCount(int threads, bool print_info)
544544
{
545545
int max_threads = std::thread::hardware_concurrency();
546546
if (max_threads == 0) {
@@ -557,15 +557,15 @@ void OpenRoad::setThreadCount(int threads, bool printInfo)
557557
}
558558
threads_ = threads;
559559

560-
if (printInfo) {
560+
if (print_info) {
561561
logger_->info(ORD, 30, "Using {} thread(s).", threads_);
562562
}
563563

564564
// place limits on tools with threads
565565
sta_->setThreadCount(threads_);
566566
}
567567

568-
void OpenRoad::setThreadCount(const char* threads, bool printInfo)
568+
void OpenRoad::setThreadCount(const char* threads, bool print_info)
569569
{
570570
int max_threads = threads_; // default, make no changes
571571

@@ -580,7 +580,7 @@ void OpenRoad::setThreadCount(const char* threads, bool printInfo)
580580
}
581581
}
582582

583-
setThreadCount(max_threads, printInfo);
583+
setThreadCount(max_threads, print_info);
584584
}
585585

586586
int OpenRoad::getThreadCount()

src/Timing.cc

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ float Timing::getPinSlew(odb::dbBTerm* db_pin, MinMax minmax)
100100
float Timing::getPinSlew(sta::Pin* sta_pin, MinMax minmax)
101101
{
102102
auto vertex_array = vertices(sta_pin);
103-
float pinSlew = (minmax == Max) ? -sta::INF : sta::INF;
103+
float pin_slew = (minmax == Max) ? -sta::INF : sta::INF;
104104
for (auto vertex : vertex_array) {
105105
if (vertex != nullptr) {
106-
float pinSlewTemp = slewAllCorners(vertex, getMinMax(minmax));
107-
pinSlew = (minmax == Max) ? std::max(pinSlew, pinSlewTemp)
108-
: std::min(pinSlew, pinSlewTemp);
106+
const float pin_slew_temp = slewAllCorners(vertex, getMinMax(minmax));
107+
pin_slew = (minmax == Max) ? std::max(pin_slew, pin_slew_temp)
108+
: std::min(pin_slew, pin_slew_temp);
109109
}
110110
}
111-
return pinSlew;
111+
return pin_slew;
112112
}
113113

114114
sta::Network* Timing::cmdLinkedNetwork()
@@ -205,7 +205,7 @@ float Timing::getPinArrival(sta::Pin* sta_pin, RiseFall rf, MinMax minmax)
205205
auto vertex_array = vertices(sta_pin);
206206
float delay = (minmax == Max) ? -sta::INF : sta::INF;
207207
float d1, d2;
208-
sta::Clock* defaultArrivalClock = getSta()->sdc()->defaultArrivalClock();
208+
sta::Clock* default_arrival_clock = getSta()->sdc()->defaultArrivalClock();
209209
for (auto vertex : vertex_array) {
210210
if (vertex == nullptr) {
211211
continue;
@@ -214,7 +214,7 @@ float Timing::getPinArrival(sta::Pin* sta_pin, RiseFall rf, MinMax minmax)
214214
const sta::RiseFall* clk_f = sta::RiseFall::fall();
215215
const sta::RiseFall* arrive_hold = (rf == Rise) ? clk_r : clk_f;
216216
d1 = getPinArrivalTime(nullptr, clk_r, vertex, arrive_hold);
217-
d2 = getPinArrivalTime(defaultArrivalClock, clk_r, vertex, arrive_hold);
217+
d2 = getPinArrivalTime(default_arrival_clock, clk_r, vertex, arrive_hold);
218218
delay = (minmax == Max) ? std::max({d1, d2, delay})
219219
: std::min({d1, d2, delay});
220220
for (auto clk : findClocksMatching("*", false, false)) {
@@ -339,15 +339,15 @@ float Timing::getMaxCapLimit(odb::dbMTerm* pin)
339339
sta::Port* port = network->dbToSta(pin);
340340
sta::LibertyPort* lib_port = network->libertyPort(port);
341341
sta::LibertyLibrary* lib = network->defaultLibertyLibrary();
342-
float maxCap = 0.0;
343-
bool maxCapExists = false;
342+
float max_cap = 0.0;
343+
bool max_cap_exists = false;
344344
if (!pin->getSigType().isSupply()) {
345-
lib_port->capacitanceLimit(sta::MinMax::max(), maxCap, maxCapExists);
346-
if (!maxCapExists) {
347-
lib->defaultMaxCapacitance(maxCap, maxCapExists);
345+
lib_port->capacitanceLimit(sta::MinMax::max(), max_cap, max_cap_exists);
346+
if (!max_cap_exists) {
347+
lib->defaultMaxCapacitance(max_cap, max_cap_exists);
348348
}
349349
}
350-
return maxCap;
350+
return max_cap;
351351
}
352352

353353
float Timing::getMaxSlewLimit(odb::dbMTerm* pin)
@@ -357,15 +357,15 @@ float Timing::getMaxSlewLimit(odb::dbMTerm* pin)
357357
sta::Port* port = network->dbToSta(pin);
358358
sta::LibertyPort* lib_port = network->libertyPort(port);
359359
sta::LibertyLibrary* lib = network->defaultLibertyLibrary();
360-
float maxSlew = 0.0;
361-
bool maxSlewExists = false;
360+
float max_slew = 0.0;
361+
bool max_slew_exists = false;
362362
if (!pin->getSigType().isSupply()) {
363-
lib_port->slewLimit(sta::MinMax::max(), maxSlew, maxSlewExists);
364-
if (!maxSlewExists) {
365-
lib->defaultMaxSlew(maxSlew, maxSlewExists);
363+
lib_port->slewLimit(sta::MinMax::max(), max_slew, max_slew_exists);
364+
if (!max_slew_exists) {
365+
lib->defaultMaxSlew(max_slew, max_slew_exists);
366366
}
367367
}
368-
return maxSlew;
368+
return max_slew;
369369
}
370370

371371
float Timing::staticPower(odb::dbInst* inst, sta::Corner* corner)
@@ -405,19 +405,19 @@ std::vector<odb::dbMaster*> Timing::equivCells(odb::dbMaster* master)
405405
sta::dbSta* sta = getSta();
406406
sta::dbNetwork* network = sta->getDbNetwork();
407407
sta::Cell* cell = network->dbToSta(master);
408-
std::vector<odb::dbMaster*> masterSeq;
408+
std::vector<odb::dbMaster*> master_seq;
409409
if (cell) {
410410
sta::LibertyCell* libcell = network->libertyCell(cell);
411411
sta::LibertyCellSeq* equiv_cells = sta->equivCells(libcell);
412412
if (equiv_cells) {
413413
for (sta::LibertyCell* equiv_cell : *equiv_cells) {
414414
odb::dbMaster* equiv_master = network->staToDb(equiv_cell);
415-
masterSeq.emplace_back(equiv_master);
415+
master_seq.emplace_back(equiv_master);
416416
}
417417
} else {
418-
masterSeq.emplace_back(master);
418+
master_seq.emplace_back(master);
419419
}
420420
}
421-
return masterSeq;
421+
return master_seq;
422422
}
423423
} // namespace ord

0 commit comments

Comments
 (0)