Skip to content

docs, examples: an island's entry points arrive in the module's own namespace - #591

Merged
Sunrisepeak merged 4 commits into
mainfrom
feat/island-boundary-names
Sep 8, 2026
Merged

docs, examples: an island's entry points arrive in the module's own namespace#591
Sunrisepeak merged 4 commits into
mainfrom
feat/island-boundary-names

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Sep 8, 2026

Copy link
Copy Markdown
Member

Implements .agents/docs/2026-09-08-island-boundary-names.md on this side. mcpp:plugins 0.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/42 already 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 -- so import app.kernels bought a file name and nothing else. The chapter now states the rule for both lanes with the leaf identifier as the only difference:

The module name is the root. Each directory below the group's base extends the namespace. The leaf identifier is decided by the lane: the data lane derives it from the file name, because a payload has no name of its own; 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 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. 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, and MCPP_EXPORT_C is explained in the chapter that row points at rather than named in a table cell -- it appeared four times in docs/ 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 takes strip_prefix -- it is the one example whose consumer writes a boundary name directly:

import boundary.kernels;

boundary::kernels::saxpy(2.0f, x, y, out, 4);   // short spelling of boundary_saxpy
boundary::kernels::vec::scale(0.5f, out, 4);    // one directory deeper

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.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_of trimmed 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 \image rather than image, 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:plugins through the index:

boundary 6 12 18 24; nm shows one boundary_saxpy and no saxpy, so the short name costs the artifact nothing
boundary, generated module export namespace boundary::kernels and export namespace boundary::kernels::vec
cuda, device leg on an RTX 4080 12 24 36 48, device: NVIDIA GeForce RTX 4080 -- island plus CUDA with the namespaced boundary, which no CI job covers
cuda --no-accel, sycl --no-accel 12 24 36 48, device: cpu (this build names no accelerator)
a fresh project in an xlings subos --sandbox, CN mirror resolved registry/data/xpkgs/mcpp-x-plugins/0.5.2 from the index, printed 6 12 18 24, and the published generator refused overlapping roots naming both
check_docs_structure.sh, check_docs_style.sh, check_version_pins.sh, e2e 616 pass

The generator's own eleven criteria are in mcpp-plugins#13, #14 and #15, and run on Linux, macOS and Windows.

…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
Sunrisepeak merged commit 39264fc into main Sep 8, 2026
37 checks passed
@Sunrisepeak
Sunrisepeak deleted the feat/island-boundary-names branch September 8, 2026 18:11
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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants