Skip to content

Language: version 1, frozen, with overlay(bvh = true) reserved - #384

Merged
rmrsk merged 4 commits into
mainfrom
ebg-1
Nov 29, 2026
Merged

rmrsk merged 4 commits into
mainfrom
ebg-1

Conversation

@rmrsk

@rmrsk rmrsk commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Background

The .ebg language has been at version 0, meaning unstable with no promise of compatibility, until everything that adds or changes syntax or meaning had landed (roadmap #232, section E). The last such item is #337's overlay(bvh = true), a BVH over an overlay's regions for assemblies of many parts. Its draft (#349) is parked on a crash in the CUDA compiler (ptxas) in the double RegionBVH kernel, with no date for a fix. Rather than keep the language waiting on that, this PR reserves the syntax and its rules now and freezes the language as version 1. #337 can then land later as a speed-up with no change in meaning.

Solution

  • Version 1.
    • The reader knows version 1. A file whose first line is ebg 0, the draft version 1 freezes, reads as version 1, so no existing file breaks.
    • print() (and ebgstudio print) writes ebg 1, so printing a file also updates its version line.
    • Every file, model, example, test and page in the repository says ebg 1, as does the studio's writer.
    • LanguageModels.rst states the promise:
      • a file a reader of version 1 accepts means the same in every later release;
      • additions that give a meaning to text an older reader refuses (a new shape, a new setting) keep the version;
      • anything that would change or refuse an accepted file raises it.
  • overlay(bvh = true) reserved.
  • Reference docs:
    • the grammar line for overlay now shows its settings, overlay [ "(" args ")" ], which it did not before;
    • the sub-program limit lists overlay(bvh = true);
    • the error table shows the new version message.

Side-effects

  • Files still say ebg 0 outside this repository (users' models, a studio session's files). They keep reading as before, and ebgstudio print rewrites them with ebg 1.
  • A reader from before this PR refuses ebg 1 files ("version 1 is unknown; this reader knows version 0").
  • No change to the library outside the language, and no new public API.

Alternative solutions

Performance

Host: green. No probe uses the language, so every probe compiled to the same code on both sides and none was run (366 cases skipped as identical). No device section, since no device code changed. Receipt: Performance/receipts/ebg-1-83b48037.md.

Where to look

  • Source/EBGeometry_LanguageSyntaxImplem.hpp (file()): reading the version.
  • Source/EBGeometry_LanguageImplem.hpp:
    • overlay(): the settings and the region checks;
    • operand(), label() and the transforms: where an overlay through a BVH is refused or passed on;
    • flagged() and LanguageDetail::regionBVHUses.
  • Docs/Sphinx/source/LanguageModels.rst: the stability promise, and the paragraph on overlay(bvh = true).
  • Verified:
    • all 865 debug tests pass;
    • TestLanguage and TestThreads pass in both precisions;
    • the clang-18 -Wdouble-promotion -Werror syntax check passes on the changed test files;
    • pre-commit passes on the changed files;
    • Doxygen and the Sphinx HTML build without warnings;
    • two @claude review rounds. Round 1 found that an overlay clipped two levels down escaped the check. That is fixed: overlay() now carries the flag up through the levels, and a test and a doc line cover it. Round 2 had no blocking finding.
  • Not verified:
    • release-test, debug-san and HIP;
    • the GPU build: no device code changed;
    • the local ebgstudio binary was not rebuilt.

Reviewer checklist (to be completed by a human)

  • The test suite compiles and runs to completion without warnings or errors.
  • All relevant new features are documented in the user documentation (Sphinx).
  • This contribution does not break existing sections in the user documentation.
  • All relevant APIs are documented in the doxygen documentation.
  • Appropriate labels have been assigned to this PR.
  • New or revised proper licensing and copyright information is in place.
  • A PR review has been run using @claude review.
  • The continuous integration and testing hooks at GitHub run to completion.
  • The performance receipt is current (CI's Performance-receipt passes), and every regression in it is explained.

🤖 Generated with Claude Code

https://claude.ai/code/session_012mR37bzMSJWYPpFgLhy9sk

The reader knows version 1 and reads a file of version 0, the draft it froze,
as version 1; every file, example and page says ebg 1, and print() writes it.
An overlay takes bvh = true or false: such an overlay is evaluated region by
region until a tape can search an overlay through a BVH, and is already held
to what a BVH over its regions allows (the object or moved, not clipped,
drilled, labeled or in another overlay; an overlay in it not clipped), and
counts as a sub-program, so a model written for it keeps its meaning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012mR37bzMSJWYPpFgLhy9sk
@rmrsk rmrsk added documentation Improvements or additions to documentation enhancement New feature or request csg Affects constructive solid geometry functionalities labels Nov 28, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012mR37bzMSJWYPpFgLhy9sk
@rmrsk

rmrsk commented Nov 28, 2026

Copy link
Copy Markdown
Owner Author

@claude review

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Claude finished @rmrsk's task in 30s —— View job


Review of #384: Language version 1, with overlay(bvh = true) reserved

I read the full Source/ diff and checked it against the tests. I did not build or run anything, so this review covers the code only. I found nothing blocking.

What looks right

  • Version reading: ebg 0 reads as 1, anything above 1 is refused, and File::m_version defaults to 1. print() writes ebg 1 in both the empty-model and normal paths, so printing a file also updates its version line. The "too many digits" and "unknown version" messages both say "knows version 1".
  • bvh = true refusals:
    • operand() allows only translate, rotate, scale and reflect, so union, intersection and difference with such an overlay are refused. label() and region-of-another-overlay are refused as well.
    • The moved lambda carries both flags through the transforms.
    • label() keeps m_clipped when it labels, so a clipped overlay stays clipped.
  • Depth: deepened(..., bvh, ...) makes the overlay count toward Tape::MaxCallDepth as a BVH union does. The setting is validated and then dropped, so Language::Model is unchanged.
  • Docs and tests: the wording matches across Language*.rst, the grammar line and the error table. TestLanguage covers the duplicate setting, a non-bool value, moved overlays, the bvh = false case and a clipped region.

Points to consider (non-blocking)

  1. Clipping that happens deeper inside the overlay.

    • m_clipped is set only on the value returned by intersection or difference, and overlay() resets it with flagged(..., bvh, false).
    • Suppose a clipped overlay C is a region of a plain overlay B (bvh = false), and B is a region of a bvh = true overlay A. The check at A sees B with m_clipped == false and accepts it.
    • The rule says "an overlay inside it can be moved but not clipped or drilled". If it should cover C, which is clipped one level further down, this is a gap in the check.
    • That would break the freeze: Overlay through a BVH: region queries over many regions (assemblies) #337 would have to refuse a file that version 1 accepted.
    • Decide now whether C inside B inside A is allowed. Either carry "contains a clipped overlay" up through overlay() (for example clipped = any region has m_clipped), or add a test and a sentence in LanguageModels.rst saying it is allowed.
    • The same question applies to a bvh = true overlay nested at depth two. m_regionBVH is checked for each region, so that case is covered. Only m_clipped is one level deep.
  2. A second bvh check sits after the weld check. The continue on the bvh branch makes the weld code skip it correctly. That's fine, but a one-line comment on the continue would help the next reader.

  3. Wording. The regionBVHUses string reads "it can be the object or be moved … but not clipped, drilled, labeled or placed in another overlay". It is also appended to the "region of another overlay" error, where "placed in another overlay" repeats the message's own text. This is cosmetic.

  4. Verification gaps. The PR body lists release-test, debug-san and HIP as unverified. No device code changed, so HIP is low risk. The full CI matrix will cover the others once the PR leaves draft.

CLAUDE.md conventions: American English, no history in the comments, and a blank line before and after each loop in the changed code. The receipt is still to be recorded before promotion, as the PR body says.
· branch ebg-1

…epth in it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012mR37bzMSJWYPpFgLhy9sk
@rmrsk

rmrsk commented Nov 28, 2026

Copy link
Copy Markdown
Owner Author

@claude review

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Claude finished @rmrsk's task in 16s —— View job


Review of #384: Language version 1, with overlay(bvh = true) reserved

I read the Source/ diff and checked the main paths against the tests. I did not build or run anything. I found nothing blocking.

Correction to the earlier review: its point 1 does not apply. The earlier review said a clipped overlay C inside a plain overlay B inside a bvh = true overlay A would pass the check. overlay() accumulates clipped = clipped || value.m_shape->m_clipped over its regions (EBGeometry_LanguageImplem.hpp:4066) and passes it to flagged(..., bvh, clipped) (line 4122). B therefore carries m_clipped == true, and A refuses it at line 4059, with an error message saying "nor hold one that is". Nesting at any depth is covered. If you want it pinned down, add a test with C inside B inside A.

What looks right

  • Version: ebg 0 reads as 1 and later versions are refused. print() writes ebg 1, and the ebg 1 rewrite in the models, tests, docs and studio writer is consistent.
  • bvh = true rules:
    • operand() allows only translate, rotate, scale and reflect (line 2752).
    • A region of another overlay is refused (line 4052), and so is labeling.
    • Moving carries both flags through (lines 3452–3456).
    • The overlay counts toward the call depth through deepened(..., bvh, ...).
  • API: Language::Model is unchanged, as the PR describes.

Minor, non-blocking

  1. A one-line comment on the continue in the bvh branch of the settings loop would help, since the weld code after it relies on it.
  2. regionBVHUses (line 48) is also appended to the "cannot be a region of another overlay" message, so it repeats "placed in another overlay". This is cosmetic.
  3. As the PR body says, release-test, debug-san and HIP are unverified, and the receipt is still to be recorded. The full CI will cover the first two once the PR is out of draft.
    · branch ebg-1

@rmrsk
rmrsk marked this pull request as ready for review November 28, 2026 12:40
@rmrsk rmrsk self-assigned this Nov 28, 2026
@rmrsk
rmrsk merged commit e097677 into main Nov 29, 2026
35 of 58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

csg Affects constructive solid geometry functionalities documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant