latest (dev)
Copy
Latest development documentation · Updated 2026-10-15
tensorplay._stax
tensorplay._stax is TensorPlay’s private compilation package. It owns
capture orchestration, specialization guards, backend registration, code
caching, and the native Stax and TVM lowering implementations.
Graph values and graph transformations are intentionally separate:
tensorplay.graphcontainsGraph,Node,GraphModule,Proxy, andTracer.tensorplay.graph.passescontains graph transformations and pass composition utilities.tensorplay._staxconsumes those graph objects and produces executable callables.
The supported public entry point is tensorplay.compile. The _stax
namespace is private and is exposed only for backend registration and
diagnostic tooling.
Private services
CodeCache— compiled artifact cachingGuardandGuardChain— specialization validationCudaGraphManager— CUDA graph capture and replayAOTErrorandbuild_aot— ahead-of-time compilation helpers
Compiler backends
tensorplay.compile(fn, backend=...) accepts a registered name or any
callable with the contract
backend(graph_module, example_inputs, **kwargs) -> callable.
tensorplay.compiler.list_backends() lists the names; debug-tagged backends
appear with list_backends(exclude_tags=None). An unknown name raises
tensorplay.compiler.InvalidBackend, which suggests close matches.
Name |
Tags |
Purpose |
|---|---|---|
|
Native Stax lowering (default) |
|
|
Apache-TVM lowering; needs |
|
|
Capture each input layout once as a CUDA graph and replay it |
|
|
debug |
Run the captured graph on its Python executor |
|
debug |
As |
|
debug |
Run node by node; errors name the failing node |
|
debug |
Inject compile, run-time or accuracy failures on |
cudagraphs leaves a region uncaptured (and logs
skipping cudagraphs due to ...) when it mutates an input, touches the CPU
or several devices, or contains host-synchronizing or data-dependent-shape
operations. With strict_native=True those cases raise instead.
Calls that record autograd history run uncaptured.
Third-party backends
A package makes a backend available by name through the
tensorplay_compiler_backends entry-point group:
[project.entry-points.tensorplay_compiler_backends]
my_compiler = "my_backend.compiler:my_compiler_function"
The entry point is imported the first time its name is looked up. Built-in
and explicitly registered names take precedence over entry points. A backend
that holds process-wide state may define reset(); tensorplay.compiler.reset()
calls it.
Help improve this page
Found an error, an unclear step, or a missing example?

