Layer Boundaries¶
Each layer depends only on the manifest, the op interface,
workloads/ and other layers' published outputs, never on
their internals, so each can be replaced without touching the others.
§Dependencies lists what each one depends on; the sections after
it state what one layer owns and what it must not reach into.
Dependencies¶
| Layer | Depends on |
|---|---|
| Validator (CI) | the manifest and the roofline analysis; for an implemented entry, the op's public interface and its roofline.func module |
Generated checks, fake, operator schemas, eval_roofline() |
the signature; roofline for eval_roofline() |
| Implementation | the signature, through the generated checks that wrap forward |
| Tests | workload rows, the reference in workloads/, the op interface |
| Benchmarks | workload rows, the reference in workloads/, the op interface (including eval_roofline() and roof_key()) |
| Roofline tool | benchmark output and the GPU profile; it never instantiates an op |
| Docs site | the manifest YAML (read without torch), op docstrings, benchmark and roofline output |
| Models | the public op interface |
Manifest¶
Source of truth for op interfaces: signatures (shapes, dtypes, presence, effects), workload rows, roofline formulas, status and composition.
It carries no kernel internals, dispatch strategy, or test logic. Those are implementation choices; freezing one into the spec makes every later implementation conform to an accident.
→ Spec: manifest.md
Test¶
Tests own fixtures, pytest outcomes and assertions about behavior, such as aliasing,
cache reuse and rejection. Numerical op-vs-reference checks consume the workload's
ref_program and verification through check() or compare_outputs(); tests do
not define a second tolerance or comparator. Tests do not import from
benchmarks/.
Input construction and the reference computation of an op that has a workload
named for it belong in workloads/, not in tests. A
benchmark cannot import from tests/ (§Benchmark), so anything
left there gets copied and drifts.
→ Rules: testing.md §Tests
Implementation¶
PyTorch is the spec oracle, not a runtime path. The Op layer produces results
through TileLang kernels or tensor primitives. Delegating to a higher-level
PyTorch operator (torch.sum, F.softmax, …) at forward time is forbidden,
because the library would then measure and ship PyTorch. The one exception is
an operation that TileLang cannot express at the required shape and no
composition of tensor primitives replaces; its call site names the blocking
limitation. A helper such as x.float().mean(...) is a tensor primitive, not a
fallback.
→ Rules: ops-design.md, code-style.md
Models¶
models/ composes published models from the public ops. It is
experimental and does not ship in the package; its interface becomes a contract
only after validation at scale.
- A model calls public ops only; between calls it uses tensor primitives. A computation no op serves becomes a new op, not a helper under
src/. - Nothing under
src/, no reference, no op test and no benchmark depends on a model. - A model is tested against its authors' code, which
workloads/models/runs without any TileOPs kernel.
→ Rules: testing.md §Model tests
Benchmark¶
Benchmarks consume the same workload reference and verification contract as tests,
and own timing, competitor selection and reporting. They do not import from
tests/ or override the workload reference or numerical policy.
Each comparable implementation is verified against that reference before timing.
A torch baseline times the workload's torch_program, not its reference, and is
verified like any other implementation. A competitor with different semantics
must be explicitly marked incomparable; its timing produces no performance ratio.
Reports identify the operator that actually ran. Coverage is checked against those runtime identities, not inferred from source code.
→ Rules: testing.md §Benchmarks
Workloads layer¶
workloads/ owns input generation, reference computation and
numerical verification. A concrete workload combines these through
gen_inputs, ref_program and verification; related operators may share a
parameterized workload.
ref_program is the correctness reference; its precision rules are in
testing.md §Shared correctness contract.
An optional torch_program is the op as torch runs it at the input dtype. It is
a performance baseline, never a reference. Manifest rows supply shapes, dtypes
and other declared parameters. Numerical policy belongs at the narrowest shared
workload boundary, so changing it changes validation for both tests and
benchmarks.
Declared state updates are part of the observable result, alongside returned tensors. Workloads expose the same result structure for the implementation and reference. Partial or unavailable verification must be explicit; a timing or an error metric alone does not establish correctness.
numerics.py owns execution and comparison.
Tests (check) and benchmarks (bench.Runner.compare) both verify through it;
neither has its own comparator.
Workloads do not own pytest outcomes, timing, roofline calculations or benchmark competitor selection. Those remain at the consumer boundary.
→ Cross-refs: testing.md