Repository navigation
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da3a8c6a37
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| # ``WG - DEEP_ETCH``); ``gds_layer`` then holds only one leaf of it. Kept | ||
| # out of the serialized stack (YAML, ``model_dump``): a stack read back | ||
| # from YAML has plain layers. | ||
| _derived_source: Any = PrivateAttr(default=None) |
There was a problem hiding this comment.
Serialize derived layer semantics in stack exports
When a PDK stack with a boolean level (for example gpdk core) is exported through the documented stack.to_yaml(...) workflow and later loaded with get_stack(yaml_path=...), this private attribute is omitted and the loader has no way to restore it. The reloaded layer consequently takes the plain-GDS branch in extract_geometry() and meshes the unetched leaf rather than the evaluated expression, so a saved stack no longer reproduces the simulation that created it; serialize a reconstructable expression or fail the export clearly instead of silently flattening it.
AGENTS.md reference: AGENTS.md:L50-L52
Useful? React with 👍 / 👎.
| entry = layer.model_dump(mode="json", exclude={"mesh_resolution"}) | ||
| if layer.derived_source is not None: | ||
| # the mesher meshes the evaluated expression, not the GDS tuple | ||
| entry["derived_layer"] = str(layer.derived_source.layer) |
There was a problem hiding this comment.
Hash background semantics for derived levels
When a boolean LayerLevel is also configured with background=True (and possibly background_exclude_layers), layer_level_region() meshes the component bounding box minus those exclusions rather than the region represented by .layer, but this cache entry hashes only .layer. Reusing a mesh after toggling the background flag or changing its exclusions therefore reports no stack change and can run against stale geometry; include every source field consulted by the evaluator in this fingerprint entry.
AGENTS.md reference: AGENTS.md:L50-L55
Useful? React with 👍 / 👎.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #560 +/- ##
=======================================
Coverage 91.66% 91.67%
=======================================
Files 216 216
Lines 30533 30590 +57
Branches 5672 5685 +13
=======================================
+ Hits 27989 28042 +53
- Misses 1458 1462 +4
Partials 1086 1086 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Before and after, on Polygons the Palace mesher receives per stack level (top view). Before the fix the core is the raw WG layer (453.4 µm²) and Mesh, x-z slice through the trenches, coarse preset. Before: 634 tetrahedra and a flat unetched core. After: 69,843 tetrahedra with the trenches meshed as |
|
@nikosavola could you review this one? Palace meshed etched levels with the unetched core, so any FEM run of a grating or a rib with shallow-etch bars simulated a different device. The before/after images are in the comment above. |
da3a8c6 to
f85130d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f85130d7fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| elif gds_tuple in boolean_tuples: | ||
| sources.append((None, gds_tuple, polys, False)) | ||
| for name, level in boolean_levels.items(): | ||
| polys = _boolean_level_polygons(component, level) |
There was a problem hiding this comment.
Evaluate derived conductors during auto-sizing
When a derived conductor's boolean operation creates a narrower feature than its first GDS leaf and auto_size=True (or the default resolution warning runs), this branch gives the evaluated region to the mesher, but auto_size._conductor_regions() still reads only layer.gds_layer. The advertised minimum-feature calculation therefore sizes against the unetched mask and can leave the newly corrected conductor under-resolved without a warning; evaluate derived_source in that path as well.
AGENTS.md reference: AGENTS.md:L53-L55
Useful? React with 👍 / 👎.


Palace/FEM meshing now uses the evaluated region of boolean stack levels, as the FDTD route already does.
With the generic PDK,
coreis(WG - DEEP_ETCH) - SHALLOW_ETCHandshallow_etchisSHALLOW_ETCH & WG. The FDTD route evaluates these. The Palace route kept one GDS layer per level and read its raw polygons. So an etched component was meshed with the unetched core andshallow_etchwas empty.straight(cross_section="rib")Areas in µm² of the polygons handed to the mesher per stack level.
What changed:
Layerrecords its PDK level when its layer is a boolean expression (private, not serialized).extract_geometrytakes the region from the same function the FDTD route uses.(layer, datatype)for plain levels that share a GDS layer number with another datatype, and the layer number otherwise, as before. This also removes a collision where gpdkdeep_etchandslab90(both on layer 3) got each other's polygons.Tests:
tests/palace/test_derived_layers.pycompares the area per stack level with the FDTD route on two synthetic strips, the grating coupler and a rib control, plus keys, symmetry planes, fingerprint and a Gmsh extrusion.tests/palace tests/common tests/fdtd: 5003 passed, 20 skipped. pre-commit clean on the changed files.Behaviour change: Palace meshes of components that draw on boolean-level layers change (etched core, meshed
shallow_etchvolume), so their results change. Stacks loaded from YAML hold plain layers and are unaffected. I have not checked IHP or other PDK notebooks, and I have not run a Palace solve on an etched component.