Overview
This document describes the JSON schema for a kernel Definition. TheDefinition provides a formal, machine-readable specification for a computational workload found in a model’s forward pass. It is designed to be the single source of truth that guides both human and agent-based kernel development. Specifically, this schema defines:
- Tensor Formats: The shape, data type (
dtype). - Dimension Semantics: The distinction between
constantdimensions (fixed at compile time) andvariabledimensions (determined at runtime). - Computational Logic: A clear, step-by-step reference implementation in plain PyTorch, which serves as the official mathematical specification of the kernel.
Definition does not contain specific input data for its variable axes. That data is provided by the workload field of each Trace, which is used for benchmarking Solution s.
JSON Schema Description
Top-Level Object Structure
op_type: Compute Category
op_type is a string field used for grouping and filtering kernels. It represents the general compute characteristic.
Current supported op_types are:
- Attention:
gqa_ragged,gqa_paged,mla_ragged,mla_paged - GEMM:
gemm - Misc:
rmsnorm,fused_add_rmsnorm
tags : Additional Attributes
tags is an array of strings that attaches searchable attributes to a definition. Tags use namespaced keys to keep meanings clear and filterable.
Each tag is either:
- a namespaced key–value string:
"<namespace>:<value>", or - a flag without a value (e.g.,
"fused").
-
stage: *— Which computation stage this definition fits to. Examples:stage: prefill,stage: decode. -
model:*— Models known to use this definition (ideally system-derived from references/traces). Examples:model:llama-3.1-8b,model:deepseek-v3. -
quantization:*— Indicates quantization characteristics. For the simple case, encode the effective dtype. Examples:quantization:float8_e4m3fn,quantization:int8. -
status:*— Community/validation status. Examples:status:verified,status:draft,status:deprecated. -
fused— Flag tag indicating the definition represents a fused kernel.
axes : Dimension Definitions
The axes object contains any number of keys, where each key is a symbolic dimension name (e.g., "M", "N", "K"), and the value is an object describing its type.
type: const
Represents a constant dimension.
Example:
type: var
Represents a variable axis whose value will be determined by the input data.
Example:
inputs, outputs : Tensor Definitions
These fields describe the input and output tensors of the kernel. They contain any number of key-value pairs, where each key is the name of a tensor (e.g., "A", "B", "C"). The value is a tensor description:
dtype : Data Types
The following values are allowed for dtype:
float32float16bfloat16float8_e4m3fnfloat8_e5m2float4_e2m1int64int32int16int8bool
Scalar Values and 0-D Tensors
Specifically, a tensor with a shape[] (empty array) represents a 0-D tensor.
To represent a scalar value, we use shape null. The scalar input must receive a python scalar data (int, float, bool). The scalar output will return a python scalar value.
Example:
reference : Reference Implementation
The reference field is a string that contains the reference implementation of the kernel in plain PyTorch.
- It must contain a global function named
runas the entry point. - This code defines the official mathematical specification of the kernel.
- It should avoid high-level packagings (e.g.,
torch.nn.functional) in favor of explicit, step-by-step computations to ensure maximum clarity for all consumers (human or agent).

