Repository navigation
bazel: enable Blender 3D-viewer targets on every supported-PDK design - #4235
Conversation
…orkaround
Two pieces, bundled because they only make sense together:
1. Bump bazel-orfs ce6efd9 -> 3a5ddd7 (~80 commits of upstream main).
This pulls in the orfs_blender() rule plus the layerstack-trim
`_LAYER_PRESETS` heuristic in render_gds.py. The previously
vendored //bazel:0001-orfs_design-add-user_sources.patch is now
upstream as of 5b65b4e so it goes away.
2. Flip `blender = True` once in flow/designs/design.bzl's design()
funnel so every design routes through the same blender-supported
branch. Designs whose PDK has no BlenderGDS stackup (asap7,
nangate45, ...) silently no-op via the upstream
`blender_supports_pdk` predicate.
A small vendored patch on render_gds.py works around a real bug in
the BlenderGDS addon (`UnboundLocalError: pdk_info` inside
import_gdsii's custom-config branch); routing the trimmed YAML
through `addon.PDK_CONFIGS[pdk]['config_path']` instead of
`gdsii_use_custom_config = True` avoids the bug. TODO: upstream the
fix to aesc-silicon/BlenderGDS and drop this patch.
End-to-end on sky130hd/microwatt (a 562 MB merged GDS), the trim
heuristic produces a 123 MB GLB and a 158 MB self-contained HTML
viewer in ~71 s of wall time once synth/place/route are cached.
gcd-class designs already fit under the addon's full default
layerstack so the preset is a no-op for them.
Usage:
bazelisk run //flow/designs/sky130hd/gcd:gcd_final_blender_html
opens the resulting model-viewer page in the default browser via
xdg-open.
Signed-off-by: Øyvind Harboe <oyvind@ascenium.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
There was a problem hiding this comment.
Code Review
This pull request updates the bazel-orfs dependency commit and replaces an existing patch with a new one that addresses an UnboundLocalError in render_gds.py by monkey-patching PDK_CONFIGS. Additionally, it enables Blender targets by default for all designs. Feedback recommends exposing the blender setting as a parameter in the design macro to provide more flexibility for individual designs to opt-out.
|
@povik @maliberty Heads up! Needs a yosys upgrade in MODULE.bazel, waiting for a bazel bcr yosys/abc versions to land bazelbuild/bazel-central-registry#8862 bazelbuild/bazel-central-registry#8900 bazelbuild/bazel-central-registry#8899 bazelbuild/bazel-central-registry#8863 bazelbuild/bazel-central-registry#8862 |
|
@maliberty pr-merge works, so ignore pr-head, right? |
So not ready to merge? |
It is good to merge. It works for those designs that don't have the kogge stone bug in yosys. |
Summary
Two pieces, bundled because they only make sense together:
Bump bazel-orfs from `ce6efd9` to `3a5ddd7` (~80 commits of
upstream main). Pulls in the `orfs_blender()` rule + the
layerstack-trim heuristic in `render_gds.py` for browser-loadable
GLB+HTML viewers. The previously vendored
`//bazel:0001-orfs_design-add-user_sources.patch` is now upstream
as of bazel-orfs `5b65b4e`, so it goes away.
Flip `blender = True` once in `flow/designs/design.bzl`'s
`design()` funnel. Every design routes through this single line;
designs whose PDK has no BlenderGDS stackup (asap7, nangate45, ...)
silently no-op via the upstream `blender_supports_pdk` predicate.
A small vendored patch on `render_gds.py` works around a real bug in
the BlenderGDS addon (`UnboundLocalError: pdk_info` inside
`import_gdsii`'s custom-config branch); routing the trimmed layerstack
YAML through `addon.PDK_CONFIGS[pdk]['config_path']` instead of
`gdsii_use_custom_config = True` avoids the bug. TODO: upstream the
fix in aesc-silicon/BlenderGDS and drop this patch.
Targets emitted per design
For each design + supported PDK, `orfs_blender()` emits 5 targets:
```
{name}_gds # orfs_gds; runs klayout to produce 6_final.gds
{name}_gen # runs Blender headless to save a .blend scene
{name} # bazelisk run -> hermetic Blender on the saved scene
{name}_html_gen # exports glTF + base64-embeds into HTML template
{name}_html # bazelisk run -> xdg-open on the HTML viewer
```
All tagged `manual` so wildcard builds don't pull in Blender or the
BlenderGDS addon.
End-to-end on microwatt sky130hd
```
render_gds.py [layerstack-trimmed] kept=[nwell, met3, met4, via4, met5]
render_gds.py [gdsii-imported] meshes=7 polygons=2,313,779 VmRSS=2.6 GB
render_gds.py [gltf-exported] glb=123,236,008 bytes
render_gds.py [html-written] out=165,271,042 bytes
Build completed successfully, 2 total actions
Elapsed time: 71.263s
```
123 MB GLB / 158 MB HTML on disk — well inside any browser tab's
working memory. The trim heuristic drops the densest interconnect /
contact / lower-metal layers (mcon, licon, li1, met1, via, via2, via3)
which carry most of the polygon count but read as featureless noise at
zoom levels that fit a 10mm² chip on a laptop screen.
gcd-class designs already fit under the addon's full default
layerstack, so the preset is a no-op for them.
Usage
```
bazelisk run //flow/designs/sky130hd/gcd:gcd_final_blender_html
```
opens the resulting model-viewer page in the default browser via
`xdg-open`.
Test plan
succeeds end-to-end (`Build completed successfully`).
`gcd_final_blender*` targets (sky130hd is supported).
(asap7 has no BlenderGDS stackup — silent skip).
only `gcd_test` — `tags = ["manual"]` keeps the blender targets
out of `bazelisk test //...` wildcards.
🤖 Generated with Claude Code