API Stability¶
This page defines what TileOPs supports as public API and what a release may change.
Public modules¶
| Module | What it holds |
|---|---|
tileops |
The family modules, Op, and the backend names it re-exports. |
tileops.<family> |
The ops of one family, and the value types their constructors take (for example tileops.moe.MaskedLayoutSpec). |
tileops.backend |
Target selection and registration of out-of-tree kernels. |
tileops.authoring |
Op, Kernel, KernelInterface, CallSpec, Entry, SignatureCall: the classes code outside TileOPs uses to write a new op. |
tileops.manifest |
The names in its __all__, the tileops.manifest.primitives module, and the spec format. |
tileops.trace |
The in-kernel timeline tracer. |
A name is public when it is listed in the __all__ of a public module.
Every module, function, class, attribute or method whose name starts with an underscore is internal, including tileops._ops, tileops._kernels, tileops._utils and tileops._perf.
Internal names change in any release without notice.
A concrete op such as tileops.elementwise.HardtanhFwdOp is public to construct and call, not to subclass.
Compatibility¶
Within 0.x, a patch release changes the public API only additively, and a minor release may also carry a reviewed break:
- Public names, signatures, parameter defaults, return structure and documented behavior stay as they are, except for a reviewed break.
- A release may add a module, a name, an optional parameter, or a new accepted input.
- The release notes name every reviewed break. From 1.0, a break waits for a major release.
scripts/ci/check_api_compat.py checks every pull request against the latest release and fails on a change that breaks a call written against it. A reviewed break the check reports is listed in scripts/ci/api_compat_allow.txt, which the check skips and the next release empties. A break the check cannot see, such as a change to the spec format, is named in the pull request.
Support scope¶
A call is supported under these conditions:
- An op instance is used by one thread and one CUDA stream at a time.
- A CUDA graph replay of an instance does not overlap that instance's eager calls.
- A compiled callable (
torch.compileoutput) does not outlive the op instance it calls. - An input the call does not write is contiguous, unless the op documents otherwise.
- A
Bwdop is called directly; it does not plug intotorch.autograd. - CUDA Graph capture is supported for the ops
tests/cuda_graph_contract.pylists, on the calls theircuda_graphtests make (CUDA Graph validation).
Caching and logging¶
- Compiled kernels and tuning results are cached on disk under
TILELANG_CACHE_DIR, by default~/.tilelang/cache, and reused across processes. - Tuning progress goes through the
loggingmodule, under thetilelanglogger, for the application to route; nothing is printed to stdout or written to the working directory. - A tuning candidate that fails to compile or run is skipped; running out of device memory or an error in the calling code stops the tuning.
Writing an op outside TileOPs¶
Code outside TileOPs writes a new op by subclassing tileops.authoring.Op:
- The class provides its spec as the class attribute
spec, in the same schema as a manifest entry (manifest.md). __init__assigns the spec's parameters, then callssuper().__init__(target=target).- The class declares its
Kernelsubclasses inkernel_typesand itsKernelInterfacecall sites ininterfaces, and writesforward, which gets a kernel withkernel_for(interface, call).
The op is then called as op(...), like a built-in op.