Skip to content

Commit 51c017c

Browse files
committed
Merge branch 'master' into secure-rsz-time-borrow-opt
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
2 parents 8b4264b + 89bf707 commit 51c017c

55 files changed

Lines changed: 3000 additions & 1396 deletions

Some content is hidden

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

.github/workflows/github-actions-clang-tidy-bazel-post.yml

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,20 @@ jobs:
8181
done < pr-meta.txt
8282
8383
- name: Synthesize pull_request event payload
84-
id: event
8584
env:
8685
PR_NUMBER: ${{ steps.meta.outputs.pr_number }}
8786
HEAD_SHA: ${{ steps.meta.outputs.head_sha }}
8887
BASE_SHA: ${{ steps.meta.outputs.base_sha }}
8988
HEAD_REPO: ${{ steps.meta.outputs.head_repo }}
9089
BASE_REPO: ${{ steps.meta.outputs.base_repo }}
9190
run: |
92-
# Reviewdog's `github-pr-review` reporter reads GITHUB_EVENT_PATH
93-
# expecting a pull_request payload. The real event here is
94-
# workflow_run, so we synthesize the minimum payload reviewdog
95-
# needs and point GITHUB_EVENT_PATH at it for the next step.
96-
EVENT_PATH="${RUNNER_TEMP}/pr-event.json"
97-
python3 - <<'PY' > "$EVENT_PATH"
91+
# reviewdog reads pull_request.number from the event file at
92+
# GITHUB_EVENT_PATH; the workflow_run event has none (its
93+
# pull_requests[] is empty for fork PRs), so it bails with "this is
94+
# not PullRequest build". GITHUB_EVENT_PATH is runner-protected, so
95+
# an env: override is silently ignored — overwrite the event file in
96+
# place instead. Safe: nothing downstream reads the original event.
97+
python3 - <<'PY' > "${GITHUB_EVENT_PATH}"
9898
import json, os
9999
payload = {
100100
"action": "synchronize",
@@ -118,57 +118,34 @@ jobs:
118118
}
119119
print(json.dumps(payload))
120120
PY
121-
echo "event_path=${EVENT_PATH}" >> "$GITHUB_OUTPUT"
122121
123122
- name: Set up reviewdog
124123
uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0
125124
with:
126125
reviewdog_version: latest
127126

128127
- name: Dump reviewdog-visible env and event payload
129-
# Gated on debug re-runs. Reviewdog emits "this is not PullRequest
130-
# build" and posts nothing for fork PRs even though the synthesized
131-
# pull_request payload is well-formed (verified locally against
132-
# reviewdog v0.21.0). Suspect: step-level `env:` cannot override
133-
# runner-protected GITHUB_EVENT_PATH / GITHUB_EVENT_NAME, so reviewdog
134-
# reads the runner's workflow_run event payload instead of our synth.
135-
# This step proves what reviewdog actually sees on the next debug
136-
# re-run.
128+
# Debug-gated: confirm the event file now holds the synthesized
129+
# pull_request payload reviewdog will read.
137130
if: runner.debug == '1'
138-
env:
139-
GITHUB_EVENT_NAME: pull_request
140-
GITHUB_EVENT_PATH: ${{ steps.event.outputs.event_path }}
141-
GITHUB_SHA: ${{ steps.meta.outputs.head_sha }}
142-
GITHUB_REPOSITORY: ${{ steps.meta.outputs.base_repo }}
143131
run: |
144-
echo "::group::GITHUB_* env visible to next step"
132+
echo "::group::GITHUB_* env visible to reviewdog"
145133
env | grep -E '^(GITHUB_|RUNNER_|REVIEWDOG_)' | sort
146134
echo "::endgroup::"
147-
echo "::group::Synth event file location and content"
148-
echo "steps.event.outputs.event_path = ${{ steps.event.outputs.event_path }}"
149-
echo "Effective GITHUB_EVENT_PATH = ${GITHUB_EVENT_PATH}"
135+
echo "::group::Effective GITHUB_EVENT_PATH content (should be our synth)"
136+
echo "Effective GITHUB_EVENT_PATH = ${GITHUB_EVENT_PATH}"
150137
if [ -f "${GITHUB_EVENT_PATH}" ]; then
151-
echo "--- file exists, content: ---"
152138
cat "${GITHUB_EVENT_PATH}"
153139
else
154140
echo "::warning::GITHUB_EVENT_PATH file does not exist"
155141
fi
156142
echo "::endgroup::"
157-
echo "::group::Synth file at literal path (should match above)"
158-
SYNTH="${{ steps.event.outputs.event_path }}"
159-
[ -f "${SYNTH}" ] && cat "${SYNTH}" || echo "missing"
160-
echo "::endgroup::"
161143
162144
- name: Run reviewdog
163145
env:
164146
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165-
GITHUB_EVENT_NAME: pull_request
166-
GITHUB_EVENT_PATH: ${{ steps.event.outputs.event_path }}
167-
GITHUB_SHA: ${{ steps.meta.outputs.head_sha }}
168-
GITHUB_REPOSITORY: ${{ steps.meta.outputs.base_repo }}
169147
run: |
170-
# On debug re-runs add reviewdog's own -log-level=debug so the
171-
# cienv detection trace is visible alongside the env dump above.
148+
# -log-level=debug on debug re-runs for tracing.
172149
LOG_FLAGS=()
173150
if [ "${RUNNER_DEBUG}" = "1" ]; then
174151
LOG_FLAGS+=(-log-level=debug)

MODULE.bazel

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -249,25 +249,19 @@ git_override(
249249
strip_prefix = "verilog",
250250
)
251251

252-
# @orfs marks most non-root-only directives (qt-bazel/yosys-slang git_overrides,
252+
# @orfs marks non-root-only directives (qt-bazel/yosys-slang git_overrides,
253253
# orfs.default(), toolchain registration) as dev_dependency, so they are no-ops
254-
# here. But @orfs//flow loads @bazel-orfs//:openroad.bzl, and @orfs marks its
255-
# bazel-orfs bazel_dep dev_dependency too, which drops @bazel-orfs from @orfs's
256-
# repo mapping when consumed non-root — so loading @orfs//flow fails. The patch
257-
# makes that one bazel_dep non-dev.
254+
# here; its bazel-orfs bazel_dep is non-dev so @orfs//flow can load
255+
# @bazel-orfs//:openroad.bzl when consumed non-root.
258256
#
259257
# Use archive_override (HTTPS tarball) rather than git_override so the
260258
# build resolves on networks that block direct git access to github.com.
261-
ORFS_COMMIT = "4b3f2663609fd3f6fd8d862729de1ec5967eb4e6"
259+
ORFS_COMMIT = "afad87da8d1ebd6ef1bc94288b4204420975a549"
262260

263261
bazel_dep(name = "orfs", dev_dependency = True)
264262
archive_override(
265263
module_name = "orfs",
266-
patch_strip = 1,
267-
patches = [
268-
"//bazel/bazel-orfs-patches:0035-orfs-bazel-orfs-visible-non-root.patch",
269-
],
270-
sha256 = "b6e496221b5be5a5ecd54e978a7a8157a212b67374e2ecd6c27f90d35e02b473",
264+
sha256 = "3b61b0cb106bb64d5cb453dff404a346b29a16bf3614166532ffa6ef733e1f65",
271265
strip_prefix = "OpenROAD-flow-scripts-" + ORFS_COMMIT,
272266
urls = ["https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts/archive/" + ORFS_COMMIT + ".tar.gz"],
273267
)

bazel/bazel-orfs-patches/0035-orfs-bazel-orfs-visible-non-root.patch

Lines changed: 0 additions & 26 deletions
This file was deleted.

bazel/bazel-orfs-patches/BUILD

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/cgt/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ cc_library(
4545
"//src/utl",
4646
"@abc",
4747
"@boost.stacktrace",
48-
"@tcl_lang//:tcl", # build_cleaner keep swig.cc bracket-includes <tcl.h>
48+
"@tcl_lang//:tcl",
4949
],
5050
)
5151

src/cts/src/HTreeBuilder.cpp

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,12 +1268,29 @@ void HTreeBuilder::run()
12681268
computeLevelTopology(level, regionWidth, regionHeight);
12691269

12701270
if (isNumberOfSinksTooSmall(numSinksPerSubRegion)) {
1271-
logger_->info(CTS,
1272-
32,
1273-
" Stop criterion found. Max number of sinks is {}.",
1274-
options_->getMaxFanout() ? options_->getMaxFanout()
1275-
: numMaxLeafSinks_);
1276-
break;
1271+
if (options_->getMaxWl()) {
1272+
double maxHPWL = topologyForEachLevel_.back().getLargestSinkRegionHPWL(
1273+
wireSegmentUnit_);
1274+
if (maxHPWL < options_->getMaxWl()) {
1275+
logger_->info(CTS,
1276+
38,
1277+
" Stop criterion found. Sink region hpwl "
1278+
"is smaller than max wirelength ({:.3f} um) and max "
1279+
"number of sinks is {}.",
1280+
static_cast<double>(options_->getMaxWl())
1281+
/ options_->getDbUnits(),
1282+
options_->getMaxFanout() ? options_->getMaxFanout()
1283+
: numMaxLeafSinks_);
1284+
break;
1285+
}
1286+
} else {
1287+
logger_->info(CTS,
1288+
32,
1289+
" Stop criterion found. Max number of sinks is {}.",
1290+
options_->getMaxFanout() ? options_->getMaxFanout()
1291+
: numMaxLeafSinks_);
1292+
break;
1293+
}
12771294
}
12781295
}
12791296

@@ -1825,6 +1842,33 @@ void HTreeBuilder::initSecondLevelSinks(
18251842
}
18261843
}
18271844

1845+
double HTreeBuilder::LevelTopology::getLargestSinkRegionHPWL(
1846+
const unsigned wireSegmentUnit) const
1847+
{
1848+
double bestHpwl = 0.0;
1849+
for (unsigned i = 0; i < branchSinkLocs_.size(); ++i) {
1850+
const auto& sinks = branchSinkLocs_[i];
1851+
if (sinks.size() < 2) {
1852+
continue;
1853+
}
1854+
double minX = sinks[0].getX();
1855+
double maxX = minX;
1856+
double minY = sinks[0].getY();
1857+
double maxY = minY;
1858+
for (unsigned j = 1; j < sinks.size(); ++j) {
1859+
minX = std::min(minX, sinks[j].getX());
1860+
maxX = std::max(maxX, sinks[j].getX());
1861+
minY = std::min(minY, sinks[j].getY());
1862+
maxY = std::max(maxY, sinks[j].getY());
1863+
}
1864+
const double hpwl = ((maxX - minX) + (maxY - minY));
1865+
if (hpwl > bestHpwl) {
1866+
bestHpwl = hpwl;
1867+
}
1868+
}
1869+
return bestHpwl * wireSegmentUnit;
1870+
}
1871+
18281872
void HTreeBuilder::computeBranchSinks(
18291873
const LevelTopology& topology,
18301874
const unsigned branchIdx,

src/cts/src/HTreeBuilder.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ class HTreeBuilder : public TreeBuilder
128128
return branchSinkLocs_[branchIdx];
129129
}
130130

131+
double getLargestSinkRegionHPWL(unsigned wireSegmentUnit) const;
132+
131133
void setOutputSlew(unsigned slew) { outputSlew_ = slew; }
132134
unsigned getOutputSlew() const { return outputSlew_; }
133135
void setOutputCap(unsigned cap) { outputCap_ = cap; }

src/cts/src/TritonCTS.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ void TritonCTS::runTritonCts()
122122
sinkBuffers_.clear();
123123
regTreeRootBufIndex_ = 0;
124124
delayBufIndex_ = 0;
125+
options_->setMaxWl(0);
125126
options_->removeOwner();
126127
logger_->info(CTS, 500, "Runtime: {:.2f}s", timer.elapsed());
127128
}
@@ -244,7 +245,9 @@ void TritonCTS::setupCharacterization()
244245

245246
double maxWlMicrons
246247
= resizer_->findMaxWireLength(/* don't issue error */ false) * 1e+6;
247-
options_->setMaxWl(block_->micronsToDbu(maxWlMicrons));
248+
if (maxWlMicrons > 0) {
249+
options_->setMaxWl(block_->micronsToDbu(maxWlMicrons));
250+
}
248251

249252
// A new characteriztion is always created.
250253
techChar_ = std::make_unique<TechChar>(

0 commit comments

Comments
 (0)