docs, examples: an island's entry points arrive in the module's own namespace - #591
Merged
Conversation
…amespace `docs/42` states one rule for both lanes -- the module name and the namespace are one identifier path -- and the shader lane followed it while `mcpp.tools.island` did not: every entry point was emitted at global scope, so `import app.kernels` bought a file name and nothing else. `mcpp:plugins` 0.5.0 makes the island lane follow it, and this updates the three examples that use the generator and the chapters that describe it. The rule is now stated once, for both lanes, with the leaf identifier as the only difference: the data lane derives it from a file name because a payload has no name of its own, and the island lane takes the entry point's name because the author wrote one. That is also why a file name reaches nothing on the island lane, and why moving a function between two files in one directory renames nothing a consumer wrote. The generator's section moves from 31 to 42. 31's reader is a rule author, and no rule package calls the generator -- `tools/island.cppm` says a project does, from its own build program. What stays in 31 is the one field a rule owes it, `options::flags`, and a link. `docs/README.md`'s concept row moves with it, and `MCPP_EXPORT_C` is now explained in the chapter that row points at rather than named in a table cell. `examples/09-heterogeneous/boundary` gains a second island one directory deeper, because the namespace mirroring the tree is the thing the example exists to show, and it takes `strip_prefix` -- it is the one example whose consumer writes a boundary name directly. `cuda` and `sycl` name two roots and say which supplies the shape; their seams call `kernels::saxpy_device` from inside `namespace app`. Every example pins 0.5.0, so one version of the package is resolved across the tree. Verified against the released mcpp 2026.9.8.1 before the pin was restored: `boundary` prints `6 12 18 24` and `nm` shows one `boundary_saxpy` and no `saxpy`; the CPU legs of `cuda` and `sycl` build and run with the namespaced boundary. `check_docs_structure.sh`, `check_docs_style.sh`, `check_version_pins.sh` and e2e 616 pass.
0.5.1 adds the refusal of overlapping roots that the design record states and 0.5.0 shipped without. Every example resolves one version of the package.
0.5.2 fixes a defect the cross-platform run of the generator's fixture found: `namespace_of` trimmed a base directory off a file's directory as a string, and on Windows a root stated with forward slashes against a directory iterator appending with the preferred separator left `\image` rather than `image` -- so the root directory became a namespace segment and an entry point landed in `app::kernels::_::image`. The shader lane shares that function and had the defect latent: its Windows fixture keeps every payload in one directory, so a segment was never derived there. `examples/09-heterogeneous/vulkan` and `examples/10-graphics/offscreen` therefore take this pin for a reason of their own. Verified against the published package: `boundary` resolves `mcpp-x-plugins/0.5.2` from the index and prints `6 12 18 24`.
0.5.0 carried the design, 0.5.1 the refusal of overlapping roots the design states and 0.5.0 omitted, and 0.5.2 the separator defect the first cross-platform run of the generator's fixture found.
Sunrisepeak
pushed a commit
that referenced
this pull request
Sep 8, 2026
…writes The replacement that updated this file in #591 did not match its anchor and made no change, so the README still showed `export using ::saxpy_device;` at global scope, a file list without `src/kernels/vec/scale.c`, and an `emit` signature that no longer exists. Nothing failed, because the replacement was not asserted -- an anchor that does not match is a silent no-op. It now carries the generated module as it is written, the section explaining that the namespace is the module's own path extended by a directory, and the L2 row naming `island::declared`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements
.agents/docs/2026-09-08-island-boundary-names.mdon this side.mcpp:plugins0.5.2 is released and indexed (mcpp-index#374), so the examples here resolve it through the index rather than through a path override.The rule, stated once
docs/42already said that the module name and the namespace are one identifier path. The shader lane followed it; the island lane did not, and put every entry point at global scope -- soimport app.kernelsbought a file name and nothing else. The chapter now states the rule for both lanes with the leaf identifier as the only difference:That is also why a file name reaches nothing on the island lane, and why moving a function between two files in one directory renames nothing a consumer wrote.
The section moves from 31 to 42
31's reader is a rule author, and no rule package calls the generator --
tools/island.cppmsays a project does, from its own build program. So the chapter that described it was the one whose reader does not use it. 31 keeps the one field a rule owes it,options::flags, and a link.docs/README.md's concept row moves with it, andMCPP_EXPORT_Cis explained in the chapter that row points at rather than named in a table cell -- it appeared four times indocs/before this, all inside one table row and one index line.Examples
boundary/gains a second island one directory deeper, because the namespace mirroring the tree is what the example exists to show, and it takesstrip_prefix-- it is the one example whose consumer writes a boundary name directly:cuda/andsycl/name two roots and say which supplies the shape; their seams callkernels::saxpy_devicefrom insidenamespace app. Every example pins 0.5.2, so one version of the package is resolved across the tree.Three releases, and why there are three
0.5.0 carried the design. 0.5.1 added the refusal of overlapping roots that the design record states and 0.5.0 shipped without -- a requirement folded into a larger change, gone when that change shipped, because §6 stated it in prose and the criteria table gave it none. 0.5.2 fixed a defect that the first cross-platform run of the generator's fixture found:
namespace_oftrimmed a base directory as a string, and on Windows a root written with forward slashes against a directory iterator appending with the preferred separator left\imagerather thanimage, so the root directory became a namespace segment. The shader lane shares that function and had the defect latent -- its Windows fixture keeps every payload in one directory, so a segment was never derived there.Measured
Against the released mcpp 2026.9.8.1, resolving
mcpp:pluginsthrough the index:boundary6 12 18 24;nmshows oneboundary_saxpyand nosaxpy, so the short name costs the artifact nothingboundary, generated moduleexport namespace boundary::kernelsandexport namespace boundary::kernels::veccuda, device leg on an RTX 408012 24 36 48,device: NVIDIA GeForce RTX 4080-- island plus CUDA with the namespaced boundary, which no CI job coverscuda --no-accel,sycl --no-accel12 24 36 48,device: cpu (this build names no accelerator)xlings subos --sandbox, CN mirrorregistry/data/xpkgs/mcpp-x-plugins/0.5.2from the index, printed6 12 18 24, and the published generator refused overlapping roots naming bothcheck_docs_structure.sh,check_docs_style.sh,check_version_pins.sh, e2e 616The generator's own eleven criteria are in mcpp-plugins#13, #14 and #15, and run on Linux, macOS and Windows.