aether-dsc 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
aether_dsc/__init__.py ADDED
@@ -0,0 +1,99 @@
1
+ # Copyright 2026 Alessandro Masat
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ """aether-dsc — the sealed AETHER header payload.
5
+
6
+ aether ships to Python-only users as a SEALED PAYLOAD, never as readable
7
+ headers inside a wheel's include tree: one digest-named, zlib-compressed tar
8
+ blob (opacity, not secrecy — see :mod:`aether_dsc._core`) carrying the
9
+ `aether/`/`rtc/` headers a HAWK-emitted device kernel needs, plus eagle's
10
+ `plugin/gref_layout.h` (device-clean) and `plugin/gref_abi.h` (host-only —
11
+ NVRTC never sees its real bytes; :mod:`hawk.compile.nvrtc` serves an alias to
12
+ the layout header's instead). Two consumers:
13
+
14
+ * **device** — NVRTC compiles a kernel straight from :func:`payload`'s
15
+ in-memory `headers` mapping; nothing touches disk.
16
+ * **host, or any file-only compiler** — :meth:`Payload.serve` materialises
17
+ the payload into a private, owner-only RAM directory for the compile's
18
+ lifetime and removes it afterwards, failure path included.
19
+
20
+ Typical use::
21
+
22
+ import aether_dsc
23
+ p = aether_dsc.payload() # the blob shipped in this wheel
24
+ # device: hand p.digest / p.headers to NVRTC (hawk.compile.nvrtc)
25
+ with p.serve() as include_root: # host / any file compiler
26
+ ... # -I include_root
27
+
28
+ Building a payload from a live checkout (never the shipped-wheel path — a
29
+ developer's own aether tree, or the CLI that regenerates the shipped blob)
30
+ goes through :func:`seal`; see :mod:`aether_dsc.seal`'s module docstring.
31
+ """
32
+ from __future__ import annotations
33
+
34
+ from ._core import Payload, PAYLOAD_DIR, _unpack, digest_of
35
+ # Imported from `_seal_impl`, deliberately NOT from `.seal`:
36
+ # `aether_dsc/seal.py` is `python -m aether_dsc.seal`'s CLI file, and
37
+ # Python binds `aether_dsc.seal` to that MODULE the instant anything imports
38
+ # it — which running the CLI does internally. Importing the function from
39
+ # its own home (`_seal_impl.py`) instead means `aether_dsc.seal` stays
40
+ # callable even in a process that has also run the CLI or imported
41
+ # `aether_dsc.seal` as a submodule (see `_seal_impl`'s docstring;
42
+ # `tests/test_aether_dsc.py` exercises both in one process).
43
+ from ._seal_impl import seal
44
+
45
+ __all__ = ["Payload", "seal", "payload", "version", "PAYLOAD_DIR"]
46
+
47
+ #: This distribution's version — tracks aether's own (`aether/version.h`:
48
+ #: `constexpr version()`), because a sealed payload speaks for exactly one
49
+ #: aether checkout and a version skew between the two would silently claim
50
+ #: otherwise.
51
+ version = "0.2.0"
52
+
53
+ _PAYLOAD_CACHE: Payload | None = None
54
+
55
+
56
+ def payload() -> Payload:
57
+ """The sealed blob shipped in this distribution — decompressed
58
+ once per process and cached; every call after the first returns the same
59
+ object.
60
+
61
+ Raises `FileNotFoundError` when this checkout carries no blob yet (a
62
+ source tree that has never run ``python -m aether_dsc.seal``, or an
63
+ editable install before the first seal). Nothing here falls back to
64
+ sealing the live tree — that fallback belongs to
65
+ ``hawk.compile.payload.current_payload()``, gated on
66
+ `$HAWK_AETHER_INCLUDE`: a caller that wants "seal if there is no
67
+ blob" asks for it explicitly, `payload()` never guesses.
68
+ """
69
+ global _PAYLOAD_CACHE
70
+ if _PAYLOAD_CACHE is not None:
71
+ return _PAYLOAD_CACHE
72
+ blobs = sorted(PAYLOAD_DIR.glob("*.bin")) if PAYLOAD_DIR.is_dir() else []
73
+ if not blobs:
74
+ raise FileNotFoundError(
75
+ f"no sealed payload under {PAYLOAD_DIR} — run `python -m "
76
+ "aether_dsc.seal` from the aether/dsc checkout to build one")
77
+ if len(blobs) > 1:
78
+ raise RuntimeError(
79
+ f"{PAYLOAD_DIR} carries {len(blobs)} blobs "
80
+ f"({[b.name for b in blobs]}) — exactly one is expected; a stale "
81
+ "blob from a previous seal was not cleaned up")
82
+ blob_path = blobs[0]
83
+ claimed_digest = blob_path.stem
84
+ headers, host_only_names = _unpack(blob_path.read_bytes())
85
+ actual_digest = digest_of(headers)
86
+ if actual_digest != claimed_digest:
87
+ raise ValueError(
88
+ f"{blob_path} is named for digest {claimed_digest} but its content "
89
+ f"digests to {actual_digest} — corrupt or hand-edited blob")
90
+ _PAYLOAD_CACHE = Payload(actual_digest, headers, host_only_names)
91
+ return _PAYLOAD_CACHE
92
+
93
+
94
+ def _reset_payload_cache() -> None:
95
+ """Test/dev hook: forget the cached :func:`payload` so a re-seal (or a
96
+ freshly written blob in a test's tmp `_payload/` dir) is picked up
97
+ without restarting the process."""
98
+ global _PAYLOAD_CACHE
99
+ _PAYLOAD_CACHE = None
aether_dsc/_core.py ADDED
@@ -0,0 +1,200 @@
1
+ # Copyright 2026 Alessandro Masat
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ """The `Payload` type and its (de)serialisation — everything `aether_dsc`
5
+ needs at IMPORT time, with zero third-party dependencies. Kept apart
6
+ from :mod:`aether_dsc.seal`, which needs `cuda-bindings` for its NVRTC-clean
7
+ gate: an ordinary consumer who only ever calls `payload()`/`.serve()` must
8
+ never pay for (or need installed) a CUDA binding just to unpack a blob.
9
+ """
10
+ from __future__ import annotations
11
+
12
+ import contextlib
13
+ import hashlib
14
+ import io
15
+ import os
16
+ import shutil
17
+ import tarfile
18
+ import tempfile
19
+ import zlib
20
+ from pathlib import Path
21
+ from typing import Iterator, Mapping
22
+
23
+ __all__ = ["Payload", "PAYLOAD_DIR", "digest_of"]
24
+
25
+ #: Where a sealed blob lives once `python -m aether_dsc.seal` has written one
26
+ #: — `aether_dsc/_payload/<digest>.bin`, shipped as package data.
27
+ PAYLOAD_DIR = Path(__file__).resolve().parent / "_payload"
28
+
29
+
30
+ def digest_of(headers: Mapping[str, bytes]) -> str:
31
+ """The payload's content digest: sha256 over the
32
+ SORTED `(name, bytes)` pairs. Sorting is what makes it order-independent
33
+ — two payloads built by walking the same files in a different order (a
34
+ different filesystem, a different `os.walk` order) still digest to the
35
+ same value, and a single renamed or altered file changes it.
36
+ """
37
+ h = hashlib.sha256()
38
+ for name in sorted(headers):
39
+ encoded = name.encode()
40
+ h.update(len(encoded).to_bytes(4, "big"))
41
+ h.update(encoded)
42
+ data = headers[name]
43
+ h.update(len(data).to_bytes(8, "big"))
44
+ h.update(data)
45
+ return h.hexdigest()
46
+
47
+
48
+ #: The tar member :func:`_pack`/:func:`_unpack` use to carry the host-only
49
+ #: name set through the blob. Never a real header's own name — every real
50
+ #: payload entry spells ``aether/...``, ``rtc/...`` or ``plugin/...``, so a
51
+ #: bare dunder name with no such prefix cannot collide with one, now or as
52
+ #: the manifests grow.
53
+ _HOST_ONLY_MANIFEST_MEMBER = "__host_only_names__"
54
+
55
+
56
+ def _pack(headers: Mapping[str, bytes],
57
+ host_only_names: frozenset[str] = frozenset()) -> bytes:
58
+ """Serialise `headers` (both sections — NVRTC-clean and host-only —
59
+ already merged into one mapping by the caller) to the on-disk blob
60
+ format: a zlib-compressed tar, one member per header plus one more
61
+ (:data:`_HOST_ONLY_MANIFEST_MEMBER`) naming which of those members are
62
+ host-only, newline-joined and sorted. Opacity, not secrecy, so a viewer
63
+ cannot casually `strings` or `cat` the payload."""
64
+ buf = io.BytesIO()
65
+ with tarfile.open(fileobj=buf, mode="w") as tf:
66
+ for name in sorted(headers):
67
+ data = headers[name]
68
+ info = tarfile.TarInfo(name=name)
69
+ info.size = len(data)
70
+ tf.addfile(info, io.BytesIO(data))
71
+ if host_only_names:
72
+ data = "\n".join(sorted(host_only_names)).encode()
73
+ info = tarfile.TarInfo(name=_HOST_ONLY_MANIFEST_MEMBER)
74
+ info.size = len(data)
75
+ tf.addfile(info, io.BytesIO(data))
76
+ return zlib.compress(buf.getvalue(), level=9)
77
+
78
+
79
+ def _unpack(blob: bytes) -> tuple[dict[str, bytes], frozenset[str]]:
80
+ """The inverse of :func:`_pack`: ``(headers, host_only_names)`` — the
81
+ latter empty when the blob predates the host-only section (an older
82
+ payload sealed only the NVRTC-clean set)."""
83
+ raw = zlib.decompress(blob)
84
+ headers: dict[str, bytes] = {}
85
+ host_only_names: frozenset[str] = frozenset()
86
+ with tarfile.open(fileobj=io.BytesIO(raw), mode="r") as tf:
87
+ for member in tf.getmembers():
88
+ if not member.isfile():
89
+ continue
90
+ extracted = tf.extractfile(member)
91
+ data = extracted.read() if extracted else b""
92
+ if member.name == _HOST_ONLY_MANIFEST_MEMBER:
93
+ host_only_names = frozenset(
94
+ ln for ln in data.decode().splitlines() if ln)
95
+ else:
96
+ headers[member.name] = data
97
+ return headers, host_only_names
98
+
99
+
100
+ def _is_tmpfs(path: Path) -> bool:
101
+ """Whether `path` is itself a tmpfs mount (prefer `/dev/shm` when it is
102
+ one). Read from `/proc/mounts` rather than assumed from the name —
103
+ `/dev/shm` is conventional, not guaranteed, and measurement found a box
104
+ where a private tmpfs mount is refused entirely (SELinux enforcing), so
105
+ this function only ever REPORTS what is already mounted, never mounts
106
+ anything itself."""
107
+ try:
108
+ target = str(path.resolve())
109
+ except OSError:
110
+ return False
111
+ try:
112
+ with open("/proc/mounts") as f:
113
+ for line in f:
114
+ parts = line.split()
115
+ if len(parts) >= 3 and parts[1] == target and parts[2] == "tmpfs":
116
+ return True
117
+ except OSError:
118
+ return False
119
+ return False
120
+
121
+
122
+ def _ram_dir() -> Path:
123
+ """Where :meth:`Payload.serve` stages files: `/dev/shm` when it is a
124
+ tmpfs, else `$TMPDIR` (the measured fallback when a private mount
125
+ namespace is refused)."""
126
+ shm = Path("/dev/shm")
127
+ if shm.is_dir() and _is_tmpfs(shm):
128
+ return shm
129
+ return Path(os.environ.get("TMPDIR", "/tmp"))
130
+
131
+
132
+ class Payload:
133
+ """A sealed set of headers plus its content digest.
134
+
135
+ `headers` maps include-relative names (`aether/...`, `rtc/<std name>`,
136
+ `plugin/gref_layout.h`) to their bytes; `digest` is :func:`digest_of`
137
+ applied to that mapping — two `Payload` instances with the same file set and
138
+ content always carry the same digest, independent of how or in what
139
+ order their files were discovered (:mod:`aether_dsc.seal`'s own
140
+ order-independence guarantee, exercised by
141
+ `tests/test_aether_dsc.py::test_seal_digest_order_independent`).
142
+
143
+ `host_only_names` names the subset of `headers` that is the HOST-ONLY
144
+ section: sealed (so :meth:`serve` writes them out for a host `-I` root
145
+ exactly like every other entry) but never claimed NVRTC-clean and never
146
+ handed to an NVRTC compile — see :attr:`device_headers`. `digest` covers
147
+ `headers` whole, host-only entries included, so a changed host-only file
148
+ changes the digest too (the cache-validity term every compile keys on).
149
+ """
150
+
151
+ __slots__ = ("digest", "headers", "host_only_names")
152
+
153
+ def __init__(self, digest: str, headers: Mapping[str, bytes],
154
+ host_only_names: frozenset[str] = frozenset()):
155
+ self.digest = digest
156
+ self.headers = dict(headers)
157
+ self.host_only_names = frozenset(host_only_names)
158
+
159
+ def __repr__(self) -> str: # pragma: no cover - debugging aid
160
+ return (f"Payload(digest={self.digest[:12]}…, {len(self.headers)} headers, "
161
+ f"{len(self.host_only_names)} host-only)")
162
+
163
+ @property
164
+ def device_headers(self) -> dict[str, bytes]:
165
+ """`headers` minus the host-only section — what an NVRTC compile is
166
+ actually served (:mod:`hawk.compile.drivers`'s device path,
167
+ :mod:`hawk.compile.nvrtc`'s public ``device``/``cubin``): the
168
+ host-only headers are never NVRTC-clean-checked and must never
169
+ reach NVRTC even as an unreferenced, served-but-unused file."""
170
+ if not self.host_only_names:
171
+ return self.headers
172
+ return {k: v for k, v in self.headers.items() if k not in self.host_only_names}
173
+
174
+ @contextlib.contextmanager
175
+ def serve(self) -> Iterator[Path]:
176
+ """Materialise every header into a PRIVATE, owner-only directory for
177
+ the compile's lifetime, then remove it — on the normal exit path and
178
+ when the `with` block raises.
179
+
180
+ Prefers a tmpfs (`/dev/shm`, checked via `/proc/mounts` — never
181
+ assumed from the path alone) so nothing touches spinning or
182
+ networked storage; falls back to `$TMPDIR` otherwise. A private
183
+ mount namespace with its own tmpfs is an opportunistic upgrade this
184
+ function does not attempt: measurement found it refused outright on
185
+ an SELinux-enforcing box, so the plain RAM directory is the one
186
+ path every caller can rely on.
187
+ """
188
+ base = _ram_dir()
189
+ base.mkdir(parents=True, exist_ok=True)
190
+ served = Path(tempfile.mkdtemp(prefix="aether_dsc_", dir=str(base)))
191
+ os.chmod(served, 0o700)
192
+ try:
193
+ for name, data in self.headers.items():
194
+ dest = served / name
195
+ dest.parent.mkdir(parents=True, exist_ok=True)
196
+ dest.write_bytes(data)
197
+ os.chmod(dest, 0o600)
198
+ yield served
199
+ finally:
200
+ shutil.rmtree(served, ignore_errors=True)
@@ -0,0 +1,254 @@
1
+ # Copyright 2026 Alessandro Masat
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ """The NVRTC-clean-compile check: the manifest of aether headers claimed
5
+ to be NVRTC-clean, the seven ``rtc/`` shim names, the NVRTC options
6
+ measured to compile cleanly, and the one compile-and-report primitive
7
+ both :func:`aether_dsc._seal_impl.seal_and_write`'s gate and the
8
+ standalone ``aether/tools/rtc_seal_check.py`` CLI share.
9
+
10
+ Self-contained by design: this module reaches nowhere outside
11
+ ``aether_dsc`` — no ``sys.path`` mutation, no dependency on
12
+ ``aether/tools/`` being on disk. The manifest ships as package data
13
+ (``aether_dsc/payload_headers.txt``, declared in ``pyproject.toml`` so a
14
+ wheel carries it), and the one third-party import this module needs
15
+ (``cuda-bindings``, for :func:`check_headers_nvrtc_clean`'s NVRTC calls)
16
+ happens inside that function only — ``import aether_dsc`` never pays for
17
+ a CUDA binding just because this module exists.
18
+ """
19
+ from __future__ import annotations
20
+
21
+ import importlib.util
22
+ import os
23
+ import platform
24
+ import shutil
25
+ from pathlib import Path
26
+ from typing import Mapping
27
+
28
+ __all__ = ["RTC_SHIM_NAMES", "NVRTC_OPTIONS", "PAYLOAD_MANIFEST",
29
+ "HOST_ONLY_MANIFEST", "manifest_paths", "host_only_manifest_paths",
30
+ "repo_headers", "cccl_include_dir", "served_name",
31
+ "check_headers_nvrtc_clean"]
32
+
33
+ #: The seven NVRTC compatibility shims — see ``aether/rtc/``'s own files for the served text.
34
+ RTC_SHIM_NAMES = ("cstddef", "cstdint", "type_traits", "utility", "concepts",
35
+ "cmath", "atomic")
36
+
37
+ #: NVRTC options measured to compile cleanly: c++20 device standard, this
38
+ #: box's default arch (P2000 = sm_61), ``-default-device`` so a bare
39
+ #: ``AETHER_DEVICE()``-qualified free function needs no
40
+ #: ``extern "C" __global__`` wrapper to be reachable from the probe TU.
41
+ NVRTC_OPTIONS = ["-std=c++20", "-arch=compute_61", "-default-device"]
42
+
43
+ #: The committed manifest, shipped as package data — the ``aether/...``
44
+ #: paths claimed to be NVRTC-clean. A directory walk is deliberately
45
+ #: NOT the source of truth (see ``payload_headers.txt``'s own header
46
+ #: comment): growing the payload to cover more headers is a deliberate,
47
+ #: evidenced addition made later, not a default.
48
+ PAYLOAD_MANIFEST = Path(__file__).resolve().parent / "payload_headers.txt"
49
+
50
+ #: The host-only manifest (``payload_headers_host.txt``) — headers sealed
51
+ #: into the payload's host-only section (see that file's own header
52
+ #: comment): never claimed NVRTC-clean, never part of the NVRTC-clean gate
53
+ #: this module runs, never handed to an NVRTC compile at all
54
+ #: (:data:`aether_dsc._core.Payload.device_headers` excludes every name
55
+ #: this manifest lists).
56
+ HOST_ONLY_MANIFEST = Path(__file__).resolve().parent / "payload_headers_host.txt"
57
+
58
+
59
+ def manifest_paths() -> list[str]:
60
+ """The manifest's ``aether/...`` entries — comments (``#``) and blank
61
+ lines skipped, order preserved as committed (already sorted)."""
62
+ lines = PAYLOAD_MANIFEST.read_text().splitlines()
63
+ return [ln for ln in lines if ln.strip() and not ln.lstrip().startswith("#")]
64
+
65
+
66
+ def host_only_manifest_paths() -> list[str]:
67
+ """:data:`HOST_ONLY_MANIFEST`'s entries, same shape as
68
+ :func:`manifest_paths` — never fed to :func:`check_headers_nvrtc_clean`
69
+ by anything in this package; that gate reads :func:`manifest_paths`
70
+ alone."""
71
+ lines = HOST_ONLY_MANIFEST.read_text().splitlines()
72
+ return [ln for ln in lines if ln.strip() and not ln.lstrip().startswith("#")]
73
+
74
+
75
+ def repo_headers(aether_root: Path, rtc_dir: Path) -> dict[str, bytes]:
76
+ """Every manifested ``aether/...`` file under ``aether_root``, plus the
77
+ seven ``rtc/<name>`` shims under ``rtc_dir`` — named exactly as a sealed
78
+ payload would name them. Raises ``FileNotFoundError`` naming the missing
79
+ file; never silently returns fewer headers than the manifest promises."""
80
+ headers: dict[str, bytes] = {}
81
+ for rel in manifest_paths():
82
+ f = aether_root / rel
83
+ if not f.is_file():
84
+ raise FileNotFoundError(
85
+ f"{PAYLOAD_MANIFEST} lists {rel!r}, which does not exist under {aether_root}")
86
+ headers[rel] = f.read_bytes()
87
+ for name in RTC_SHIM_NAMES:
88
+ f = rtc_dir / name
89
+ if not f.is_file():
90
+ raise FileNotFoundError(f"NVRTC shim missing: {f}")
91
+ headers[f"rtc/{name}"] = f.read_bytes()
92
+ return headers
93
+
94
+
95
+ def _default_options(nvrtc) -> list[str]:
96
+ """:data:`NVRTC_OPTIONS` with ``-arch`` set to the oldest architecture the
97
+ loaded NVRTC supports (``nvrtcGetSupportedArchs``): ``compute_61`` on a
98
+ CUDA 12.x NVRTC, ``compute_75`` on CUDA 13, whose NVRTC dropped the older
99
+ targets. Falls back to the constant when the query is unavailable."""
100
+ try:
101
+ err, archs = nvrtc.nvrtcGetSupportedArchs()
102
+ oldest = min(int(a) for a in archs)
103
+ except Exception:
104
+ return list(NVRTC_OPTIONS)
105
+ return [f"-arch=compute_{oldest}" if o.startswith("-arch=") else o
106
+ for o in NVRTC_OPTIONS]
107
+
108
+
109
+ def _loaded_nvrtc_root() -> str | None:
110
+ """The toolkit root (the directory above ``lib``/``lib64``) of the
111
+ ``libnvrtc`` this process has loaded, or ``None`` when none is mapped."""
112
+ try:
113
+ from cuda.bindings import nvrtc # noqa: F401 (loads the library)
114
+ except Exception:
115
+ pass
116
+ try:
117
+ with open("/proc/self/maps") as maps:
118
+ for line in maps:
119
+ path = line.split(None, 5)[-1].strip() if line.count(" ") >= 5 else ""
120
+ if "/libnvrtc.so" in path or "/libnvrtc-" in path:
121
+ lib = Path(path).resolve().parent
122
+ while lib.name in ("lib", "lib64", "x86_64-linux", "sbsa-linux",
123
+ "aarch64-linux") or lib.parent.name == "targets":
124
+ lib = lib.parent
125
+ return str(lib.parent if lib.name == "targets" else lib)
126
+ except OSError:
127
+ pass
128
+ return None
129
+
130
+
131
+ def cccl_include_dir() -> str:
132
+ """Where ``<cuda/std/...>`` lives: the ``nvidia-cuda-cccl-cu12`` wheel's
133
+ ``include/`` directory when it is installed, else a CUDA toolkit's own
134
+ headers. Every CUDA 12.x/13 toolkit ships CCCL, either in a flat
135
+ ``include/`` (CUDA 13: ``include/cccl/``) or in NVIDIA's
136
+ ``targets/<arch>-linux/include/`` layout (a
137
+ conda toolkit has only the latter). Toolkit roots are tried in order:
138
+ the root of the loaded NVRTC, ``$CUDA_PATH``, ``$CONDA_PREFIX``, the toolkit holding the ``nvcc`` on
139
+ ``PATH``, then ``/usr/local/cuda``.
140
+
141
+ ``importlib.util.find_spec`` on a DOTTED name imports the PARENT first
142
+ (``nvidia``) to look inside it, and raises ``ModuleNotFoundError`` rather
143
+ than returning ``None`` when that parent does not exist at all — the
144
+ exact shape of a box with no ``nvidia-cuda-*`` wheel installed to create
145
+ the ``nvidia`` namespace package at all. That is a "not installed"
146
+ answer, the same as the wheel existing but lacking ``cuda_cccl``, so it
147
+ is caught here rather than left to crash a caller that only wanted to
148
+ know whether the wheel is there."""
149
+ try:
150
+ spec = importlib.util.find_spec("nvidia.cuda_cccl")
151
+ except ModuleNotFoundError:
152
+ spec = None
153
+ if spec is not None and spec.submodule_search_locations:
154
+ for loc in spec.submodule_search_locations:
155
+ candidate = Path(loc) / "include"
156
+ if (candidate / "cuda" / "std").is_dir():
157
+ return str(candidate)
158
+ for candidate in _toolkit_include_dirs():
159
+ if (candidate / "cuda" / "std").is_dir():
160
+ return str(candidate)
161
+ raise RuntimeError(
162
+ "no CCCL include directory found: install nvidia-cuda-cccl-cu12 or "
163
+ "set $CUDA_PATH to a toolkit whose include/cuda/std exists")
164
+
165
+
166
+ def _toolkit_include_dirs() -> list[Path]:
167
+ """Candidate toolkit include directories for :func:`cccl_include_dir`,
168
+ most specific first: for each toolkit root, its flat ``include/``, then
169
+ ``targets/<arch>-linux/include/`` (this machine's arch first, then any
170
+ other ``targets/*-linux`` the toolkit carries, e.g. ``sbsa-linux``)."""
171
+ roots = [_loaded_nvrtc_root(), os.environ.get("CUDA_PATH"),
172
+ os.environ.get("CONDA_PREFIX")]
173
+ nvcc = shutil.which("nvcc")
174
+ if nvcc:
175
+ roots.append(str(Path(nvcc).resolve().parent.parent))
176
+ roots.append("/usr/local/cuda")
177
+ dirs: list[Path] = []
178
+ for root in dict.fromkeys(r for r in roots if r):
179
+ base = Path(root)
180
+ targets = base / "targets"
181
+ own = targets / f"{platform.machine()}-linux" / "include"
182
+ others = sorted(targets.glob("*-linux/include")) if targets.is_dir() else []
183
+ flat = [base / "include", own, *others]
184
+ # CUDA 13 moved CCCL into an ``include/cccl`` subdirectory.
185
+ for d in [p for x in flat for p in (x / "cccl", x)]:
186
+ if d not in dirs:
187
+ dirs.append(d)
188
+ return dirs
189
+
190
+
191
+ def served_name(payload_name: str) -> str:
192
+ """The name NVRTC is asked to resolve for a payload entry — what a REAL
193
+ ``#include`` directive spells. ``aether/...``/``plugin/...`` entries are
194
+ ``#include``d by that exact prefixed name, so they serve unchanged; an
195
+ ``rtc/<std name>`` shim is never included by that stored path itself — it
196
+ satisfies aether's own plain ``#include <cstdint>`` et al., so it must be
197
+ offered under the bare std name with the ``rtc/`` storage prefix
198
+ stripped (NVRTC's header lookup is an exact string match)."""
199
+ return payload_name.split("/", 1)[1] if payload_name.startswith("rtc/") else payload_name
200
+
201
+
202
+ def check_headers_nvrtc_clean(headers: Mapping[str, bytes], *,
203
+ cccl_include: str | None = None,
204
+ options: list[str] | None = None,
205
+ exclude_from_toplevel: frozenset[str] = frozenset(),
206
+ ) -> list[str]:
207
+ """Compile ONE synthetic TU ``#include``-ing every TOP-LEVEL name in
208
+ ``headers`` (sorted, for a reproducible diagnostic order) through NVRTC,
209
+ serving every name from ``headers`` itself — never from disk — under its
210
+ :func:`served_name`. Only ``aether/...``/``plugin/...`` entries not in
211
+ ``exclude_from_toplevel`` are ``#include``d directly; ``rtc/...`` shims
212
+ are reachable only indirectly, exactly as real aether source reaches
213
+ them.
214
+
215
+ ``exclude_from_toplevel`` is for an entry that is served (resolvable if
216
+ something reaches it) but never itself the subject of the NVRTC-clean
217
+ claim — see :mod:`aether_dsc._seal_impl`'s ``GREF_ABI_HOST_NAME`` for
218
+ the one case this applies to.
219
+
220
+ Returns the NVRTC log's diagnostic lines (empty means the claim holds);
221
+ raises only on an environment failure (no NVRTC binding, no CCCL) that
222
+ is not itself the thing under test.
223
+ """
224
+ from cuda.bindings import nvrtc # function-local: only a real check pays for this
225
+
226
+ cccl_include = cccl_include or cccl_include_dir()
227
+ opts = list(options or _default_options(nvrtc)) + [f"-I{cccl_include}"]
228
+ names = sorted(headers)
229
+ top_level = [n for n in names
230
+ if not n.startswith("rtc/") and n not in exclude_from_toplevel]
231
+ src = "".join(f'#include "{n}"\n' for n in top_level)
232
+ src += "\n// reachability only — the TU need not use anything.\n"
233
+
234
+ _, prog = nvrtc.nvrtcCreateProgram(
235
+ src.encode(), b"rtc_seal_check.cu",
236
+ len(names), [headers[n] for n in names],
237
+ [served_name(n).encode() for n in names])
238
+ try:
239
+ nvrtc.nvrtcCompileProgram(prog, len(opts), [o.encode() for o in opts])
240
+ _, log_size = nvrtc.nvrtcGetProgramLogSize(prog)
241
+ log_buf = bytearray(log_size)
242
+ nvrtc.nvrtcGetProgramLog(prog, log_buf)
243
+ log = bytes(log_buf).decode(errors="replace").rstrip("\x00")
244
+ finally:
245
+ nvrtc.nvrtcDestroyProgram(prog)
246
+ return [line for line in log.splitlines()
247
+ if line.strip() and not _is_target_deprecation_notice(line)]
248
+
249
+
250
+ def _is_target_deprecation_notice(line: str) -> bool:
251
+ """NVRTC 12.x warns that pre-sm_75 targets are deprecated. That notice is about
252
+ the toolkit's support window for the chosen ``-arch``, not about the headers
253
+ under test, so it never counts against the NVRTC-clean claim."""
254
+ return "Architectures prior to" in line and "are deprecated" in line
@@ -0,0 +1,175 @@
1
+ # Copyright 2026 Alessandro Masat
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ """The real `seal()` implementation, kept out of `aether_dsc/seal.py` on
5
+ purpose: that file is `python -m aether_dsc.seal`'s CLI entry point, and
6
+ Python sets `aether_dsc.seal` to the MODULE object the moment anything
7
+ does `import aether_dsc.seal` (exactly what running it as `-m` does
8
+ internally) — which would silently shadow a `seal` FUNCTION of the same
9
+ name re-exported through `aether_dsc/__init__.py` (`aether_dsc.seal`
10
+ would stop being callable). Splitting the implementation into its own
11
+ module and having BOTH `aether_dsc/__init__.py` and `aether_dsc/seal.py`
12
+ import it from here (never from each other) means both `seal` spellings —
13
+ the function `aether_dsc.seal(*roots)` and the CLI
14
+ `python -m aether_dsc.seal` — can coexist.
15
+ """
16
+ from __future__ import annotations
17
+
18
+ from pathlib import Path
19
+ from typing import Mapping
20
+
21
+ from . import _rtc_check as _tools
22
+ from ._core import Payload, PAYLOAD_DIR, _pack, digest_of
23
+
24
+ __all__ = ["seal", "seal_and_write"]
25
+
26
+ #: This checkout's own repo root (`aether_dsc/_seal_impl.py` -> `aether_dsc/`
27
+ #: -> `dsc/` -> the `aether` repo root) and its workspace parent — the same
28
+ #: "the four *-abi worktrees and aether hang off one directory" convention
29
+ #: `hawk._roots.WORKSPACE` documents. Used only to DEFAULT `seal()`'s own
30
+ #: `aether_root`/`layout_header` arguments to THIS checkout — never to reach
31
+ #: outside the package for logic, which now lives entirely in `_rtc_check`
32
+ #: (`aether_dsc` mutates no `sys.path` and needs nothing on disk outside
33
+ #: its own package directory to be imported, only to seal).
34
+ _AETHER_REPO_ROOT = Path(__file__).resolve().parents[2]
35
+ _WORKSPACE = _AETHER_REPO_ROOT.parent
36
+
37
+
38
+ #: Served, never force-#include'd by the NVRTC-clean check (see
39
+ #: `tools.check_headers_nvrtc_clean`'s `exclude_from_toplevel` docstring):
40
+ #: eagle's real `plugin/gref_abi.h` reaches `<stdexcept>`/`<string>`, so it is
41
+ #: sealed for the host `-I <served root>` path only. `hawk.compile.nvrtc`'s
42
+ #: own NVRTC serving layer answers a request for this exact name with
43
+ #: `plugin/gref_layout.h`'s bytes instead (`GREF_ABI_ALIAS_NAME`) — hawk's
44
+ #: emitted prelude text spells `#include "plugin/gref_abi.h"` on both
45
+ #: backends unconditionally, and that string is pinned byte-for-byte by
46
+ #: read-only corpora that must not change independently: hawk's own
47
+ #: `tests/test_index_width.py::test_the_mandated_include_order_is_aether_first`
48
+ #: and the golden kernel sources of its consumers. The
49
+ #: substitution is transparent to what a device kernel actually computes: it
50
+ #: never reaches `gref_abi.h`'s host-only validation functions, only the
51
+ #: mirror PODs/constants both files carry identically.
52
+ GREF_ABI_HOST_NAME = "plugin/gref_abi.h"
53
+
54
+
55
+ def _default_layout_header() -> Path:
56
+ """`eagle/plugin/gref_layout.h` from the sibling eagle checkout under this
57
+ workspace. `aether_dsc` depends on this ONE file from eagle (not on eagle
58
+ as a whole): the sealed payload must carry it because a HAWK-emitted
59
+ device kernel `#include`s it, and nothing else about eagle belongs in an
60
+ AETHER payload.
61
+ """
62
+ for name in ("eagle", "eagle-abi"):
63
+ candidate = _WORKSPACE / name / "plugin" / "gref_layout.h"
64
+ if candidate.is_file():
65
+ return candidate
66
+ raise FileNotFoundError(
67
+ "seal(): no eagle checkout with plugin/gref_layout.h found under "
68
+ f"{_WORKSPACE} — pass layout_header= explicitly, or check out eagle as "
69
+ "a sibling of this aether checkout")
70
+
71
+
72
+ def seal(aether_root: str | Path | None = None,
73
+ rtc_dir: str | Path | None = None,
74
+ layout_header: str | Path | None = None) -> Payload:
75
+ """Build a fresh :class:`~aether_dsc._core.Payload` from headers on disk.
76
+ Every argument defaults to THIS checkout's own paths,
77
+ so a bare `seal()` reproduces exactly what `python -m aether_dsc.seal`
78
+ ships; a caller with a different aether install (`hawk.compile.toolchain
79
+ .aether_include()`'s resolved root, when it differs from this checkout)
80
+ passes its own roots instead.
81
+
82
+ * `aether_root` — an aether INCLUDE ROOT: a directory such that
83
+ `aether_root/aether/<name>` are the library's own headers, exactly
84
+ what a compiler resolves for `#include <aether/...>` against
85
+ `-I aether_root`. Only the paths listed in this PACKAGE's own
86
+ `aether_dsc/payload_headers.txt` (the NVRTC-clean manifest, shipped
87
+ as package data — see that file's header comment for why a manifest,
88
+ not a directory walk: aether/ holds headers not yet claimed to be
89
+ NVRTC-clean) are sealed from this root — never a blind walk of
90
+ everything under it.
91
+ * `rtc_dir` — the directory of the seven NVRTC std shims; every one
92
+ becomes a payload header named `"rtc/<filename>"`.
93
+ * `layout_header` — the path to eagle's `plugin/gref_layout.h`;
94
+ sealed as exactly `"plugin/gref_layout.h"`. Its own directory is also
95
+ where eagle's REAL host-only `gref_abi.h` is found, sealed as
96
+ :data:`GREF_ABI_HOST_NAME` for the host `-I` path (see that constant's
97
+ docstring — NVRTC never receives it under this content, only under an
98
+ alias to `gref_layout.h`'s bytes).
99
+
100
+ A second, HOST-ONLY set of headers — this package's own
101
+ `payload_headers_host.txt` manifest — is sealed into the SAME payload
102
+ alongside the above: never claimed NVRTC-clean (excluded from
103
+ :func:`seal_and_write`'s gate entirely, not merely from its
104
+ force-`#include` set) and never served to an NVRTC compile
105
+ (:attr:`~aether_dsc._core.Payload.device_headers` excludes them), but
106
+ served to a host `-I` root exactly like every other entry
107
+ (:meth:`~aether_dsc._core.Payload.serve`). Resolved from the SAME
108
+ `aether_root`, since both manifests name files under one aether
109
+ checkout.
110
+
111
+ Raises `FileNotFoundError` naming the missing file when a manifested
112
+ header, a shim, or a layout/abi header is not where expected — never
113
+ silently seals a smaller payload than either manifest promises.
114
+ """
115
+ root = Path(aether_root) if aether_root is not None else _AETHER_REPO_ROOT
116
+ rtc = Path(rtc_dir) if rtc_dir is not None else (_AETHER_REPO_ROOT / "rtc")
117
+ layout = Path(layout_header) if layout_header is not None else _default_layout_header()
118
+ abi = layout.parent / "gref_abi.h"
119
+
120
+ headers: dict[str, bytes] = {}
121
+ for rel in _tools.manifest_paths():
122
+ f = root / rel
123
+ if not f.is_file():
124
+ raise FileNotFoundError(f"seal(): manifested header missing: {f}")
125
+ headers[rel] = f.read_bytes()
126
+ for name in _tools.RTC_SHIM_NAMES:
127
+ f = rtc / name
128
+ if not f.is_file():
129
+ raise FileNotFoundError(f"seal(): NVRTC shim missing: {f}")
130
+ headers[f"rtc/{name}"] = f.read_bytes()
131
+ if not layout.is_file():
132
+ raise FileNotFoundError(f"seal(): eagle layout header missing: {layout}")
133
+ if not abi.is_file():
134
+ raise FileNotFoundError(f"seal(): eagle host-abi header missing: {abi}")
135
+ headers["plugin/gref_layout.h"] = layout.read_bytes()
136
+ headers[GREF_ABI_HOST_NAME] = abi.read_bytes()
137
+
138
+ host_only_names = frozenset(_tools.host_only_manifest_paths())
139
+ for rel in host_only_names:
140
+ f = root / rel
141
+ if not f.is_file():
142
+ raise FileNotFoundError(f"seal(): host-only manifested header missing: {f}")
143
+ headers[rel] = f.read_bytes()
144
+
145
+ return Payload(digest_of(headers), headers, host_only_names)
146
+
147
+
148
+ def seal_and_write(headers: Mapping[str, bytes],
149
+ host_only_names: frozenset[str] = frozenset()) -> Path:
150
+ """Runs the NVRTC-clean gate over the NVRTC-clean section ONLY, then
151
+ writes `_payload/<digest>.bin` — refuses to write a payload that fails
152
+ the gate. Removes any stale blob first: `aether_dsc.payload()` globs
153
+ `_payload/*.bin` and would otherwise have two candidates after a
154
+ re-seal that changed the digest.
155
+
156
+ `host_only_names` — `headers` entries never passed to the gate at all
157
+ (not merely excluded from its force-#include set, the way
158
+ `GREF_ABI_HOST_NAME` is — see its own docstring): the host-only section
159
+ is never claimed NVRTC-clean and the gate never even sees its content.
160
+ """
161
+ nvrtc_headers = ({k: v for k, v in headers.items() if k not in host_only_names}
162
+ if host_only_names else headers)
163
+ diagnostics = _tools.check_headers_nvrtc_clean(
164
+ nvrtc_headers, exclude_from_toplevel=frozenset({GREF_ABI_HOST_NAME}))
165
+ if diagnostics:
166
+ raise RuntimeError(
167
+ "NVRTC-clean check FAILED: the sealed payload does not compile clean under NVRTC "
168
+ f"({len(diagnostics)} diagnostic line(s)):\n" + "\n".join(diagnostics))
169
+ digest = digest_of(headers)
170
+ PAYLOAD_DIR.mkdir(parents=True, exist_ok=True)
171
+ for stale in PAYLOAD_DIR.glob("*.bin"):
172
+ stale.unlink()
173
+ blob_path = PAYLOAD_DIR / f"{digest}.bin"
174
+ blob_path.write_bytes(_pack(headers, host_only_names))
175
+ return blob_path
@@ -0,0 +1,69 @@
1
+ # NVRTC-clean payload manifest — committed, sorted, one path per line, same
2
+ # discipline as tests/expected_tests_*.txt: a manifest, not a count, so a
3
+ # same-commit swap cannot pass silently.
4
+ #
5
+ # Every aether header listed here is claimed NVRTC-clean (the seven rtc/
6
+ # shims, AETHER_BITCOPY, no offsetof-in-constant-expression) and
7
+ # `tools/rtc_seal_check.py` gates that claim on every run. This is the
8
+ # ground-truth closure measured for `benchmarks._hawk_arm.grav_body` (hawk
9
+ # repo) via a real `nvcc -MD` build — not a directory walk: measured,
10
+ # ~28 other aether headers (aether/accum/, aether/banded/,
11
+ # aether/chunk/, aether/interop/, aether/residency/, aether/backend/,
12
+ # aether/err/, aether/dtype/Format.h, some aether/view/Make*.h) reach std
13
+ # headers the rtc/ shim set does not cover (<algorithm>, <cstring>,
14
+ # <stdexcept>, DLPack's own includes) — profiling them is deliberately out
15
+ # of scope here; the manifest grows deliberately, one committed line at a
16
+ # time, exactly like the test-count manifests: add a path, run this
17
+ # script, commit the diff.
18
+ #
19
+ # `aether/aether.h` (the umbrella) is deliberately not listed: it
20
+ # transitively includes every one of the ~28 excluded headers, so it is
21
+ # not yet part of the payload either.
22
+ aether/device.h
23
+ aether/device/Device.h
24
+ aether/dtype/DType.h
25
+ aether/dtype/Fetch.h
26
+ aether/dtype/WorkingType.h
27
+ aether/dtype/dlpack.h
28
+ aether/expr/Assign.h
29
+ aether/expr/Expression.h
30
+ aether/expr/Operations.h
31
+ aether/expr/Reduce.h
32
+ aether/expr/nodes/Arithmetic.h
33
+ aether/expr/nodes/Constant.h
34
+ aether/expr/nodes/Elementwise.h
35
+ aether/expr/nodes/Geometric.h
36
+ aether/expr/nodes/Inverse.h
37
+ aether/expr/nodes/Product.h
38
+ aether/expr/nodes/Quaternion.h
39
+ aether/expr/nodes/Structural.h
40
+ aether/index/BundleIndex.h
41
+ aether/index/Offset.h
42
+ aether/index/SampleIndex.h
43
+ aether/layout/Extents.h
44
+ aether/layout/Layout.h
45
+ aether/layout/detail/Carray.h
46
+ aether/macros.h
47
+ aether/math/detail/BandedFwd.h
48
+ aether/math/detail/BoundedTrig.h
49
+ aether/math/detail/HostVectorMathRoute.h
50
+ aether/math/detail/MathDispatch.h
51
+ aether/math/detail/MathDispatchUndef.h
52
+ aether/math/explog.h
53
+ aether/math/hyperbolic.h
54
+ aether/math/invtrig.h
55
+ aether/math/math.h
56
+ aether/math/root.h
57
+ aether/math/round.h
58
+ aether/math/special.h
59
+ aether/math/trig.h
60
+ aether/random/detail/Backend.h
61
+ aether/random/detail/Philox.h
62
+ aether/typedefs.h
63
+ aether/view/Item.h
64
+ aether/view/Reshape.h
65
+ aether/view/RuntimeView.h
66
+ aether/view/TableHandle.h
67
+ aether/view/TableView.h
68
+ aether/view/View.h
69
+ aether/view/WorkView.h
@@ -0,0 +1,32 @@
1
+ # Host-only payload manifest — committed, sorted, one path per line, same
2
+ # discipline as payload_headers.txt (and the test-count manifests): a
3
+ # manifest, not a directory walk.
4
+ #
5
+ # These headers are sealed into the SAME payload as payload_headers.txt's
6
+ # NVRTC-clean set, but are a SEPARATE section: never claimed NVRTC-clean,
7
+ # never handed to an NVRTC compile at all (`Payload.device_headers` excludes
8
+ # every name listed here; only `Payload.headers`/`Payload.serve()`, the HOST
9
+ # `-I` path, carries them). Growing this manifest does not touch the NVRTC
10
+ # gate (`aether/tools/rtc_seal_check.py`, `aether_dsc._rtc_check
11
+ # .manifest_paths`) at all — a wholly separate list, checked by nothing but
12
+ # "does this file exist under the aether root being sealed".
13
+ #
14
+ # Ground truth: the real dependency closure of
15
+ # `aether/math/detail/HostVectorMath.h` under `-DAETHER_HOST_VECTOR_MATH`,
16
+ # measured via a real `g++ -MD` build of a hawk-emitted host
17
+ # kernel (`osc_step`-shaped) with hawk's own host flags
18
+ # (`hawk.compile.toolchain.host_flags()`) against a real aether checkout —
19
+ # not a directory walk. `HostVectorMathRoute.h` (already in
20
+ # payload_headers.txt) `#include`s `HostVectorMath.h` only when
21
+ # `AETHER_HOST_VECTOR_MATH` is defined and the pass is not `__CUDACC__`, so
22
+ # NVRTC never reaches these headers through any real include chain either;
23
+ # the exclusion here is belt-and-braces, not a response to an NVRTC failure
24
+ # ever observed.
25
+ aether/backend/cpu/simd/math/PacketArcTrig.h
26
+ aether/backend/cpu/simd/math/PacketExpLog.h
27
+ aether/backend/cpu/simd/math/PacketHyperbolic.h
28
+ aether/backend/cpu/simd/math/PacketMathCore.h
29
+ aether/backend/cpu/simd/math/PacketMisc.h
30
+ aether/backend/cpu/simd/math/PacketRounding.h
31
+ aether/backend/cpu/simd/math/PacketSinCos.h
32
+ aether/math/detail/HostVectorMath.h
aether_dsc/seal.py ADDED
@@ -0,0 +1,47 @@
1
+ # Copyright 2026 Alessandro Masat
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ """`python -m aether_dsc.seal` — the packaging CLI.
5
+
6
+ Seals this repository's own checkout, runs the NVRTC-clean gate (every
7
+ payload header must compile under NVRTC with zero diagnostics), and only
8
+ then writes `aether_dsc/_payload/<digest>.bin` — a payload that fails the
9
+ gate is refused, never shipped silently broken. The actual sealing logic
10
+ lives in :mod:`aether_dsc._seal_impl` (see that module's docstring for
11
+ why: this file being importable as `aether_dsc.seal` — which `-m` does
12
+ internally — would otherwise shadow the `aether_dsc.seal(*roots)`
13
+ function exposed from `aether_dsc/__init__.py`).
14
+
15
+ python -m aether_dsc.seal
16
+ """
17
+ from __future__ import annotations
18
+
19
+ import sys
20
+
21
+ from ._seal_impl import seal, seal_and_write
22
+
23
+ __all__ = ["main"]
24
+
25
+
26
+ def main(argv: list[str] | None = None) -> int:
27
+ """Seal this checkout, gate it on the NVRTC-clean check, write the
28
+ blob. Prints the outcome; exit 0 on a written blob, 1 on a gate
29
+ failure or a missing input file."""
30
+ del argv # no options today — the CLI seals exactly this checkout
31
+ try:
32
+ p = seal()
33
+ except FileNotFoundError as exc:
34
+ print(f"RED: {exc}", file=sys.stderr)
35
+ return 1
36
+ try:
37
+ blob_path = seal_and_write(p.headers, p.host_only_names)
38
+ except RuntimeError as exc:
39
+ print(f"RED: {exc}", file=sys.stderr)
40
+ return 1
41
+ print(f"GREEN: sealed {len(p.headers)} headers "
42
+ f"({len(p.host_only_names)} host-only), digest {p.digest[:16]}… -> {blob_path}")
43
+ return 0
44
+
45
+
46
+ if __name__ == "__main__":
47
+ raise SystemExit(main())
@@ -0,0 +1,60 @@
1
+ Metadata-Version: 2.4
2
+ Name: aether-dsc
3
+ Version: 0.2.0
4
+ Summary: aether-dsc — the sealed AETHER header payload: opaque, digest-named, no readable source in the wheel
5
+ Author: Alessandro Masat
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/amasat01/aether
8
+ Project-URL: Documentation, https://amasat01.github.io/aether/
9
+ Project-URL: Repository, https://github.com/amasat01/aether
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.9
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ License-File: NOTICE
16
+ Provides-Extra: test
17
+ Requires-Dist: pytest; extra == "test"
18
+ Dynamic: license-file
19
+
20
+ # aether-dsc
21
+
22
+ The sealed AETHER header payload.
23
+
24
+ ## What the payload is
25
+
26
+ aether ships to Python-only users as ONE opaque, digest-named blob instead of
27
+ readable headers inside a wheel's include tree. `aether_dsc.payload()`
28
+ returns a `Payload(digest, headers)`: `digest` is a sha256 over the sorted
29
+ `(name, bytes)` pairs of `headers`; `headers` maps include-relative names
30
+ (`aether/...`, `rtc/<std name>`, `plugin/gref_layout.h`, `plugin/gref_abi.h`)
31
+ to bytes — the exact set an NVRTC-compiled HAWK device kernel needs, plus
32
+ what a host compiler needs through `Payload.serve()`.
33
+
34
+ Two consumers: **device** — NVRTC compiles a kernel straight from
35
+ `payload().headers`, in memory, nothing written to disk; **host, or any
36
+ file-only compiler** — `payload().serve()` is a context manager materialising
37
+ the headers into a private, owner-only (`0700`) RAM directory (`/dev/shm`
38
+ when it is a tmpfs, else `$TMPDIR`), removed on both the normal exit path
39
+ AND a `with`-block exception.
40
+
41
+ ## How to seal one
42
+
43
+ ```bash
44
+ python -m aether_dsc.seal
45
+ ```
46
+ Reads this checkout's aether headers — scoped to the committed manifest
47
+ `aether_dsc/payload_headers.txt` (package data, not every file under
48
+ `aether/` — see that file's comment for why) — the seven `rtc/` shims, and
49
+ the sibling `eagle` checkout's `plugin/gref_layout.h` + `plugin/gref_abi.h`
50
+ (host path only — NVRTC gets an alias to the layout header's bytes instead);
51
+ runs the NVRTC-clean gate (every device-reachable header compiles under
52
+ NVRTC with zero diagnostics); only then writes
53
+ `aether_dsc/_payload/<digest>.bin` — a payload failing the gate is
54
+ refused, never shipped silently broken.
55
+
56
+ ## Opacity, not secrecy
57
+
58
+ The blob is a zlib-compressed tar — not obfuscation against a determined
59
+ reader, just enough that `strings`/`cat` on the wheel does not hand back
60
+ readable C++ source.
@@ -0,0 +1,14 @@
1
+ aether_dsc/__init__.py,sha256=BTSt5dDWg5nkzSB10YofaPEeynrNF8DNDLmuqkdobgI,4553
2
+ aether_dsc/_core.py,sha256=GGlSbrMKHaH-d0ddccBFqJzq_nFNSxRURUcSPTTySzw,8561
3
+ aether_dsc/_rtc_check.py,sha256=fWJRkwRY6qtyOyhkIJbZmoF0-UcZIuPw5bi9rQhVE6c,12339
4
+ aether_dsc/_seal_impl.py,sha256=byfbFycI7_1IApC83weY4ysrC9YyGw9hBUF_66EsTKY,9017
5
+ aether_dsc/payload_headers.txt,sha256=SRafdxuFrnj-jCvBia-SpOAhsspdd_TBvrbIMSvwIBo,2460
6
+ aether_dsc/payload_headers_host.txt,sha256=r0m51s0dr6eSDV3kKPjqXldPw1uIM8m63Q5jnUZzygg,1800
7
+ aether_dsc/seal.py,sha256=iE2i4B8xXKRaSONq7dgIAOsNmeahHHBQQH91UrFgj0s,1646
8
+ aether_dsc/_payload/a9c89146169d59183c41dba2a050a420a5f3dd40729154ae547b61a2239c38b8.bin,sha256=4UjU0YpFv530FyQaUlisxNvwQlLoW7TQqmTss3CGFZY,130534
9
+ aether_dsc-0.2.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
10
+ aether_dsc-0.2.0.dist-info/licenses/NOTICE,sha256=cvnGaTwoxgk98Vzj3SGSL_72LeoEyYZhETfzaUitL3k,39
11
+ aether_dsc-0.2.0.dist-info/METADATA,sha256=sqYtN4t_Q9PW_jtZR9Wt7bUuFfDYRdPQtizDF46QJPA,2529
12
+ aether_dsc-0.2.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
13
+ aether_dsc-0.2.0.dist-info/top_level.txt,sha256=KBrIE6wia1rnS9vjcp7fsNUP8P1Zsq_T6K1tYJPBuwc,11
14
+ aether_dsc-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,2 @@
1
+ aether
2
+ Copyright 2026 Alessandro Masat
@@ -0,0 +1 @@
1
+ aether_dsc