nvidia/write-docs
> Convention and format for writing instruction docstrings and RST tutorials in documentation for tilus instructions, instruction groups, or tutorials.
npx skills add https://github.com/NVIDIA/tilus --skill write-docs
All instruction docstrings use NumPy-style format with the following structure:
def method_name(self, param1: Type1, param2: Type2) -> ReturnType:
"""One-line summary of what the instruction does.
Extended description explaining the behavior, semantics, and constraints
of the instruction. This can be multiple paragraphs.
Parameters
----------
param1: Type1
Description of the parameter. Include constraints and valid ranges
(e.g., "must be evaluated to a positive int32").
param2: Type2
Description. For parameters with defaults, explain the default behavior
(e.g., "By default, it is 1.").
Returns
-------
ret: ReturnType
Description of the return value including shape, dtype, and relationship
to inputs.
"""
RegisterTensor, Expr | int, Optional[Type]Candidates: 'relaxed', 'release'.ret: Type formatEvery instruction must have a Notes section with these items as a compact bullet list:
Notes
-----
- **Thread group**: Can be executed by any sized thread group.
- **Hardware**: Requires compute capability 8.0+ (sm_80).
- **PTX**: ``mbarrier.init.shared::cta.b64``
The three standard note items:
self.single_thread())."self.single_warp()`)"If the instruction maps to multiple PTX instructions depending on parameters, list them:
- **PTX**: ``mbarrier.arrive.shared::cta.b64`` or ``mbarrier.arrive.noComplete.shared::cta.b64``
If the instruction does not lower to a specific PTX instruction (e.g., it's a high-level
construct), omit the PTX line.
.. code-block:: python for usage examples:py:meth: or :py:func:For synchronization instructions, document sem and scope parameters consistently:
sem: str
The memory ordering semantics for the operation. Candidates: 'relaxed', 'release'.
scope: str
The synchronization scope for the operation. Candidates: 'cta', 'cluster'.
root.py:load_global, root.py:castmbarrier.py:alloc, mbarrier.py:arrive_and_expect_txfence.py:proxy_async, fence.py:proxy_async_releaseroot.py:range, root.py:thread_grouptma.py:global_to_sharedTutorials target CS researchers who can write Triton kernels but want to
understand the hardware features underneath Triton's abstractions. Assume readers
know:
tl.load, tl.store, tl.dot semanticsDo not assume they know:
When introducing a concept that Triton handles implicitly, briefly explain why
explicit control is needed. Common contrasts:
tilus gives explicit control --- necessary to use hardware features like TMA and
tcgen05."
MMA results accumulate in registers. Blackwell's tensor cores use dedicated
Tensor Memory, which provides higher bandwidth and avoids consuming register
file capacity for large tiles."
many operations are asynchronous --- the instruction returns immediately and
completes in the background. This enables overlap of data movement and
computation, but requires explicit tracking via mbarriers."
Efficient Blackwell kernels require different warps to perform different
jobs (loading, computing, scheduling) and collaborate asynchronously via
thread groups."
Each tutorial version (v0, v1, ...) should follow this structure:
(with hyperlinks to instruction group docs).
picture before the detailed walkthrough.
understand the example. Order by conceptual dependency. Include:
main loop, epilogue). Use literalinclude with :start-at:/:end-at:
markers (never absolute line numbers). For each group, use a bullet list
explaining each instruction with hyperlinks.
bottleneck.
sync() call, explain what it guards (e.g., "ensures shared memorywrites are visible to all threads before the MMA warp reads them").
warps = 4, explain the choice (e.g., "4 warps = 128threads; later versions use more warps to overlap loading and computing").
enable_input_d, explain: "On the first iteration, tensor memory containsuninitialized data, so we ignore it. On subsequent iterations, it holds the
running sum from prior tiles."
iterations. The phase distinguishes this iteration's completion from the
previous one's."
:meth: for instruction methods::meth:~tilus.Script.copy_async for root instructions,
:meth:tcgen05.mma <tilus.lang.instructions.tcgen05.Tcgen05InstructionGroup.mma>
for instruction group methods (shows short name, links to full path).
:attr: for attributes: :attr:self.attrs.blocks <tilus.lang.script.Attributes.blocks>:doc: for cross-references to other pages: :doc:/programming-guides/thread-group:class: for tensor types: :class:~tilus.ir.tensor.TMemoryTensor:start-at: / :end-at: / :start-after: / :end-before:instead of absolute line numbers. This makes includes resilient to code
changes.
:dedent: to strip leading indentation when including method bodies.:caption: for all included code blocks.figures/ subdirectory next to the tutorial RST files... figure:: with :width: and :align: center.cluster layouts, and any concept that benefits from a visual.
(lead with the instruction/concept name instead).
should give enough to understand the example; detailed semantics belong in the
programming guides and API docs.
docs/source/tutorials/matmul-blackwell/v0.rstTake nvidia/write-docs from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.