tensor_wasm_jit/lib.rs
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Craton Software Company
3//! JIT pipeline: Cranelift detector, IR normalisation, PTX codegen, kernel cache, deopt.
4//!
5//! # Unstable surface — `pliron_*` modules
6//!
7//! The `pliron_dialect`, `pliron_lowering`, and `pliron_ptx` modules (and
8//! any other `pliron_*` module exposed by this crate) are an **in-progress
9//! implementation surface** for the W3.x / W4.x cuda-oxide backend tracked
10//! in [RFC 0001](../../rfcs/0001-cuda-oxide-integration.md). They contain
11//! several hundred lines of `NotYetWired` scaffolding stubs that exist only
12//! so the v0.4 author has a target to fill in. They are deliberately
13//! `#[doc(hidden)]` to keep them out of the rendered docs.rs surface, and
14//! they are **NOT covered by semver compatibility until tensor-wasm-jit
15//! reaches 1.0** — any name, signature, or behaviour inside a `pliron_*`
16//! module is liable to change in a 0.x.y patch release without notice.
17//! External consumers should not import from them.
18#![deny(missing_docs)]
19
20pub mod cache;
21pub mod clif_lower;
22pub mod deopt;
23pub mod detector;
24pub mod ir;
25pub mod ptx_emit;
26pub mod rewrite;
27
28// Differential JIT correctness oracle (roadmap feature #6). The
29// scaffold lives behind its own feature flag because v0.4 will wire it
30// against the self-hosted CUDA runner; the default host build does not
31// need to compile the harness. The module is also compiled under
32// `cfg(test)` so in-crate unit tests can reach it without flipping
33// the feature.
34#[cfg(any(test, feature = "differential-oracle"))]
35pub mod differential;
36
37// Signed kernel registry (roadmap feature #3). Scaffold only in v0.3.7:
38// the in-memory `KernelRegistry` trait + `InMemoryRegistry` impl land so
39// design partners can target a stable surface; the on-disk store, signing
40// CLI, and server-side `/kernels` endpoint are v0.4 deliverables. Gated
41// behind the `kernel-registry` feature because the HMAC/SHA-2/serde
42// dependency chain is otherwise pure surface-area cost for the default
43// build (which doesn't yet exercise this path). See
44// `docs/KERNEL-REGISTRY.md` for the v0.4 wiring plan.
45#[cfg(feature = "kernel-registry")]
46pub mod registry;
47
48#[doc(hidden)]
49#[cfg(feature = "cuda-oxide-backend")]
50pub mod pliron_dialect;
51
52// Wave 1 of the Pliron pipeline: pure-Rust interim IR + per-family
53// Cranelift-IR lowering passes. See [`lowered_ir`] for the IR contract
54// and [`pliron_dialect`] for the trait surface that ties them together.
55#[cfg(feature = "cuda-oxide-backend")]
56pub mod blueprint_adapter;
57#[cfg(feature = "cuda-oxide-backend")]
58pub mod lower_arith;
59#[cfg(feature = "cuda-oxide-backend")]
60pub mod lower_cf;
61#[cfg(feature = "cuda-oxide-backend")]
62pub mod lower_conv;
63#[cfg(feature = "cuda-oxide-backend")]
64pub mod lower_float;
65#[cfg(feature = "cuda-oxide-backend")]
66pub mod lower_memory;
67#[cfg(feature = "cuda-oxide-backend")]
68pub mod lower_signature;
69#[cfg(feature = "cuda-oxide-backend")]
70pub mod lower_vector;
71#[cfg(feature = "cuda-oxide-backend")]
72pub mod lowered_ir;
73#[cfg(feature = "cuda-oxide-backend")]
74pub mod lowering_builder;
75#[cfg(feature = "cuda-oxide-backend")]
76pub mod lowering_driver;
77#[cfg(feature = "cuda-oxide-backend")]
78pub mod lowering_errors;
79/// Internal test fixtures for the lowering passes.
80///
81/// Gated behind the opt-in `test-utils` feature so the symbols don't leak
82/// into the stable public API. The crate's own unit and integration tests
83/// see the module via `cfg(test)` (unit tests) or via the `test-utils`
84/// feature flag enabled on the test target (integration tests). External
85/// consumers that genuinely need these fixtures must opt in by adding
86/// `tensor-wasm-jit = { ..., features = ["test-utils"] }` to their
87/// `[dev-dependencies]` — they are not part of the stable surface.
88#[cfg(any(test, feature = "test-utils"))]
89#[cfg(feature = "cuda-oxide-backend")]
90pub mod lowering_test_support;
91#[doc(hidden)]
92#[cfg(feature = "cuda-oxide-backend")]
93pub mod pliron_lowering;
94#[doc(hidden)]
95#[cfg(feature = "cuda-oxide-backend")]
96pub mod pliron_ptx;
97#[cfg(feature = "cuda-oxide-backend")]
98pub mod reject_list;