hawk.compile

hawk.compile#

AOT compile drivers + the content-closure cache.

The shipped Python tier’s device compile is NVRTC, in memory, from a sealed aether_dsc payload (current_payload()) — no aether header touches disk. toolchain.device_compiler_kind() picks it whenever no nvcc is findable; the lookup key folds in the payload’s own digest instead of a compiler-reported closure. A host compile against the same sealed payload goes through aether_dsc.Payload.serve() instead of a real include root.

Functions

aether_include()

The aether header root (hawk._roots.aether_include()).

cache_stats()

A copy of the hit/miss counters.

compile_source(…)

Compile source for opts.backend, through the content-closure cache: a valid lookup is a hit and no compiler runs; anything else is a miss that compiles into the key's own slot and rewrites its validity record from the compiler-reported closure.

compiler_identity(…)

<path> || <first --version line> || <digest of the whole --version text> — the compiler term of the lookup key.

cubin(…)

device(source, target="cubin", arch=arch) — the common case named for itself.

cubin_available()

Whether cubin()/device could succeed on THIS process right now: NVRTC importable and a CUDA device present.

current_payload()

The payload this process's NVRTC compiles serve from.

default_cache_dir()

$HAWK_CACHE_DIR, else $XDG_CACHE_HOME/hawk, else ~/.cache/hawk.

device(…)

Compile source (ordinary CUDA C++) for the device through NVRTC — the public entry point a pip-only caller (no nvcc, no aether/eagle checkout) reaches for instead of shelling out.

device_compiler()

nvcc — the developer/CI device compiler, or $HAWK_NVCC.

device_compiler_kind()

"nvcc" or "nvrtc" — which compiles the device backend.

digest_file(…)

The sha256 of path's bytes, or None if it cannot be read — a miss at every call site, never an ignored entry.

eagle_include()

The eagle header root — the directory plugin/gref_abi.h hangs off (hawk._roots.eagle_include()).

host_codegen_flags(…)

The code-generation half of the host recipe for profile (resolved through host_profile()): optimisation level (resolved through opt_level()), target CPU, vector width and the FMA-contraction setting.

host_compiler()

The host compiler, in discovery order: $HAWK_CXX when set, else g++ on PATH, else the ziglang wheel's zig c++ — a pip-only host tier for a box with no system C++ toolchain at all.

host_flags(…)

The host .so recipe: the profile's code-generation flags (host_codegen_flags(), carrying the resolved opt level), then PIC, shared, C++23, and the standalone-artifact build mode (one self-contained TU, dlopen-ed by eagle, never linked against a CUDA-language aether TU).

host_profile(…)

The host profile in effect: requested when given (the compile options' host_profile), else $HAWK_HOST_PROFILE, else default_host_profile().

lookup_key(…)

The lookup key.

opt_level(…)

The optimisation level in effect: requested when given (the compile options' opt_level), else $HAWK_OPT_LEVEL, else DEFAULT_OPT_LEVEL.

publish(…)

Copy a cached artifact to destination (an artifact DIRECTORY is a deployment unit; the cache is a build-time store, never the unit itself).

reset_cache_stats()

Reset the counters (cached artifacts on disk are untouched).

Classes

Cache

A content-closure cache rooted at directory: the compiled object, its emitted source and its validity record all live under the lookup key, and a previous generation is never evicted implicitly.

CompileOptions

Everything outside the source text that changes the output — and so every term of the LOOKUP key beyond the source itself.

DeviceImage

One public device() compile's result: the compiled bytes, which target produced them, and the sm_XX they were compiled for.