Skip to content

Commit 97cd251

Browse files
committed
bazel-orfs: pull src OrfsDepInfo.files into source_inputs
Vendors a new bazel-orfs patch (0004) that propagates the design's per-stage source files through the orfs_final -> orfs_gds chain. Without this, orfs_gds (which orfs_blender invokes standalone with src=orfs_final and no data=) gets 6_gds.args.mk's ADDITIONAL_LEFS correctly populated via OrfsInfo.arguments, but the actual LEF files are missing from the sandbox. klayout's def2stream then fails with errno=2 on the very first read, e.g. on microwatt: RuntimeError: Unable to open file: .../sandbox/.../execroot/_main/flow/designs/sky130hd/microwatt/lef/Microwatt_FP_DFFRFile.lef The patch adds ctx.attr.src[OrfsDepInfo].files to source_inputs()'s transitive list. OrfsDepInfo.files is the per-stage tuple of (config + ctx.files.src + ctx.files.data + extra_configs) without the stage's logs/reports, so propagating it carries the design's ADDITIONAL_LEFS / ADDITIONAL_GDS source files forward but avoids read-only-log collisions in the next stage's sandbox. (Tried DefaultInfo.default_runfiles.files first — it includes the previous stage's logs and the next stage's write to logs/.../6_1_merge.log fails with Permission denied.) Verified end-to-end: - bazelisk build //flow/designs/sky130hd/gcd:gcd_final_blender_html still succeeds (no macros — regression check). - bazelisk build //flow/designs/sky130hd/microwatt:microwatt_final_blender_html now gets past orfs_gds and produces 6_final.gds (562 MB, including the four IP macros: Microwatt_FP_DFFRFile, RAM32_1RW1R, RAM512, multiply_add_64x64). Subsequent BlenderGDS html-export step fails for microwatt — separate issue, Blender appears to choke on the merged-GDS size — but that is downstream of the klayout/def2stream lookup this patch addresses. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent bd816be commit 97cd251

2 files changed

Lines changed: 79 additions & 0 deletions

File tree

‎MODULE.bazel‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ git_override(
6262
"//patches/bazel-orfs:0001-flow.bzl-pull-synth-into-generate_metadata-data-deps.patch",
6363
"//patches/bazel-orfs:0002-blender.bzl-export-blender_supports_pdk-predicate.patch",
6464
"//patches/bazel-orfs:0003-orfs_design.bzl-forward-blender-silently-skip-unsupp.patch",
65+
"//patches/bazel-orfs:0004-environment.bzl-pull-src-OrfsDepInfo.files-into-sour.patch",
6566
],
6667
remote = BAZEL_ORFS_REMOTE,
6768
)
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
From e1eb1c37dd96242575388e8df38fb6b3b2b675d7 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?=C3=98yvind=20Harboe?= <oyvind@ascenium.com>
3+
Date: Sat, 16 May 2026 20:26:09 +0200
4+
Subject: [PATCH] environment.bzl: pull src OrfsDepInfo.files into
5+
source_inputs
6+
7+
Without this, orfs_gds (and any other stage rule whose src is a
8+
previous _make_impl stage) only sees its own ctx.files.data plus
9+
OrfsInfo.{additional_gds,additional_lefs,additional_libs}. Those
10+
OrfsInfo.additional_* depsets are populated only from `deps`
11+
(block macros), so the design's own ADDITIONAL_LEFS / ADDITIONAL_GDS
12+
sources from config.mk's `$(wildcard $(DESIGN_DIR)/lef/*.lef)`
13+
never propagate to stages past the one that consumed them as
14+
ctx.files.data.
15+
16+
For orfs_gds specifically (which is invoked standalone by
17+
orfs_blender with src=orfs_final and no data=), the 6_gds.args.mk
18+
correctly inherits ADDITIONAL_LEFS via OrfsInfo.arguments, so the
19+
make recipe writes the macro LEF paths into klayout.lyt -- but
20+
klayout then opens those paths under the sandbox and fails with
21+
errno=2, e.g.:
22+
23+
RuntimeError: Unable to open file:
24+
.../sandbox/.../execroot/_main/flow/designs/sky130hd/microwatt/lef/Microwatt_FP_DFFRFile.lef
25+
26+
Propagating src's OrfsDepInfo.files (which carries the previous
27+
stage's ctx.files.src + ctx.files.data + extra_configs but NOT its
28+
logs/reports) makes the per-stage `data` files follow the
29+
orfs_final -> orfs_gds chain automatically. depset dedup keeps
30+
the inputs tractable across the rest of the synth -> final chain.
31+
32+
Why OrfsDepInfo.files and not DefaultInfo.default_runfiles.files:
33+
the latter also carries the previous stage's logs, which are
34+
read-only in the sandbox and collide with the new stage's
35+
same-named log writes (Permission denied on logs/.../6_1_merge.log).
36+
37+
Tested with sky130hd/microwatt (which has ADDITIONAL_LEFS for
38+
Microwatt_FP_DFFRFile / RAM32_1RW1R / RAM512 / multiply_add_64x64
39+
IP macros).
40+
---
41+
private/environment.bzl | 14 ++++++++++++++
42+
1 file changed, 14 insertions(+)
43+
44+
diff --git a/private/environment.bzl b/private/environment.bzl
45+
index f6df134..85dcbde 100644
46+
--- a/private/environment.bzl
47+
+++ b/private/environment.bzl
48+
@@ -4,6 +4,7 @@ load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
49+
load(
50+
"//private:providers.bzl",
51+
"LoggingInfo",
52+
+ "OrfsDepInfo",
53+
"OrfsInfo",
54+
"PdkInfo",
55+
"TopInfo",
56+
@@ -175,6 +176,19 @@ def source_inputs(ctx):
57+
return depset(
58+
ctx.files.src,
59+
transitive = [
60+
+ # Pull in src's OrfsDepInfo.files so action inputs include
61+
+ # the design's per-stage source files (sources= -> data= via
62+
+ # get_sources, e.g. ADDITIONAL_LEFS from $(wildcard
63+
+ # $(DESIGN_DIR)/lef/*.lef)). OrfsInfo.additional_lefs only
64+
+ # carries block-macro LEFs from deps, not the design's own
65+
+ # macro LEFs, so without this propagation orfs_gds runs with
66+
+ # the LEF paths in args.mk but the LEF files missing from the
67+
+ # sandbox -- klayout def2stream fails errno=2 on first read.
68+
+ # We pick OrfsDepInfo.files rather than default_runfiles.files
69+
+ # because the latter also carries the previous stage's logs,
70+
+ # which are read-only in the sandbox and collide with the new
71+
+ # stage's same-named log writes (Permission denied).
72+
+ ctx.attr.src[OrfsDepInfo].files,
73+
ctx.attr.src[OrfsInfo].additional_gds,
74+
ctx.attr.src[OrfsInfo].additional_lefs,
75+
ctx.attr.src[OrfsInfo].additional_libs,
76+
--
77+
2.51.0
78+

0 commit comments

Comments
 (0)