Skip to content

[Docs] Describe op to kernel dispatch as kernel interfaces and implementations - #59

Merged
lcy-seso merged 5 commits into
tile-ai:mainfrom
lcy-seso:docs/dispatch-mechanism
Oct 1, 2026
Merged

lcy-seso merged 5 commits into
tile-ai:mainfrom
lcy-seso:docs/dispatch-mechanism

Conversation

@lcy-seso

@lcy-seso lcy-seso commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Problems

  • new-op teaches role, a three-argument kernel_for(role, inputs, call) and an op-level entry_for(role, call). None of those exist; the op→kernel dispatch migration removed them. Its kernel_types keys are invented, and its _eager_forward calls a self._call_spec(...) the base class does not define. It never mentions interfaces, which every op holding kernels now declares.
  • backends says kernel_for and entry_for are the op author's and that an op with no in-tree implementation may leave entry_for out. It predates register_implementation, so a backend is offered only a target. Its "why selection has two layers" section says TileOPs does no candidate filtering, which now holds only of the target path.
  • torch-compile declares kernel_types and no interfaces in its op skeleton, and calls kernel_for with three arguments.
  • manifest calls a composition stage's target a kernel role.

Changes

  • new-op gains a kernel-selection section: the two arguments of kernel_for, what a kernel interface is and where it lives, the four declarations an implementation makes (devices / supported_archs, applies / refusal, general / preferred_over, entry_for) with their defaults, and GemmFwdOp's three implementations as the worked example.
  • backends gains a section comparing the three ways in — kernel_map= replaces one implementation for one op instance, register_implementation adds an implementation to an interface, a target replaces the whole op — and states for each what it changes, what it acts on, which contract it is written against, and what happens to a call it does not serve.
  • Corrected throughout: the error a call raises when no key runs on the device type, when a backend's registration takes effect, gemm_cp_async's refusal of a K row narrower than one four-byte load, and the claim that the protocol has no default target, which the same page contradicts by documenting set_default_target.
  • Every code block is copied from TileOPs main and names the file it came from.
  • English and Chinese pages change together.

Copilot AI balanced review requested due to automatic review settings October 1, 2026 05:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The new manifest-family precedence and Sampling-page routing lack focused renderer coverage.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Updates dispatch documentation to match TileOPs’ current kernel-interface model and extends benchmark rendering for Sampling.

Changes:

  • Documents kernel interfaces, implementations, and backend extension paths bilingually.
  • Corrects obsolete dispatch examples and terminology.
  • Adds manifest-driven Sampling benchmark classification and navigation.
File Description
scripts/​gen_bench_pages.py Adds manifest-family routing and Sampling pages.
mkdocs.yml Adds Sampling navigation translation.
hooks.py Adds Sampling to benchmark navigation order.
docs/​torch-compile.md Updates the English dispatch example.
docs/​torch-compile.zh.md Updates the Chinese dispatch example.
docs/​new-op.md Documents current kernel selection architecture.
docs/​new-op.zh.md Chinese counterpart of the new-op updates.
docs/​manifest.md Replaces obsolete kernel-role terminology.
docs/​manifest.zh.md Updates corresponding Chinese terminology.
docs/​backends.md Documents three backend integration mechanisms.
docs/​backends.zh.md Chinese counterpart of backend guidance.
CLAUDE.md Refreshes repository development conventions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +213 to +215
fam = _MANIFEST_FAMILY.get((manifest_family or "").lower())
if fam:
return fam
…tations

The dispatch migration replaced the op-level hooks the manual still taught. An
op declares `interfaces`, `kernel_for(interface, call)` takes two arguments, and
the implementations of an interface state their own availability, applicability,
precedence and `entry_for`. The role concept, the op-level `entry_for` and the
`kernel_for` path for an op with no interfaces are gone.

new-op rewrites the kernel-selection section against that model, with the real
`GemmFwdOp`, `GemmFwdInterface` and `RMSNormKernel`. backends gains the three
extension granularities, `kernel_map=` and `register_implementation` beside a
target, and drops the claim that an op may leave `entry_for` out. torch-compile
gives `RMSNormFwdOp` its `interfaces` and its real `_eager_forward` body.
manifest renames a composite's kernel roles to kernel keys.

The backends pages also stated that no target is used unless a backend claims
the device, which the same page contradicts forty lines earlier by documenting
`set_default_target`.
…e lint

TileOPs #2352 fixed the interface naming rule and added interface-names-lint
after this branch was written.
The Chinese dropped subjects and compressed clauses to the point of reading as
notes: the dispatcher, the op and the implementation are now named where they
act. Three places defined a thing by what it is not and now say what it is.
Replaced the invented word for making a tensor contiguous, and the one for the
builder, with what they do.
@lcy-seso
lcy-seso force-pushed the docs/dispatch-mechanism branch from bbd499d to bd89ba9 Compare October 1, 2026 05:21
Twelve places where the two languages had drifted into each other: a spatial
metaphor for a mapping, an implementation that 'reaches' an instance, a coined
'place' for a kernel call, builder translated two different ways and once as
constructor, and two defaults defined by what they are not.
An ungrammatical English clause left by the previous fix, a Chinese sentence
that still ranked the three mechanisms by size, implementations attached to a
call rather than to the interface they implement, and one sentence corrected in
Chinese but not in English.
@lcy-seso
lcy-seso merged commit f7570d2 into tile-ai:main Oct 1, 2026
3 checks passed
@lcy-seso
lcy-seso deleted the docs/dispatch-mechanism branch October 1, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants