Metadata#
- class cutlass.operators.metadata.base.OperatorMetadata(
- operator_name: str,
- operator_class: type[Operator],
- supported_targets: list[TargetSm],
- operands: OperandsMetadata,
- design: DesignMetadata | None = None,
- epilogue: EpilogueMetadata | None = None,
Bases:
objectOperatorMetadata exposes a uniform schema to inspect the properties of an Operator.
It allows users to programmatically and uniformly inspect properties of an Operator without manually inspecting its source code, and without learning a different schema of properties for each Operator.
It describes fixed properties of the Operator in three categories:
OperandsMetadata: properties of the operands passed to the Operator and the constraints it places on them. It describes the conditions for an Operator to functionally support (compute the correct result of) an operation.DesignMetadata: architectural, performance, or design characteristics of the kernel. Useful for inspecting and comparing otherwise functionally equivalent Operators.EpilogueMetadata: any custom epilogue computation that was fused into the Operator.
These properties are declared by the
Operatoritself when it is instantiated, and are fixed after that.They may be determined by design, or the Operator’s implementation may be parametrized to generate instances supporting different values of a metadata field.
- operator_name: str#
A unique human-readable Operator name.
Important
There are no backward-compatibility guarantees for these names, even for patch releases. Users are strongly advised to not use these names for filtering, and use metadata fields instead.
- operator_class: type[Operator]#
The derived class of cutlass.operators.Operator that implements interfaces to expose a DSL kernel
- supported_targets: list[TargetSm]#
Supported targets that this Operator can be compiled for
Only the earliest portable target in each architecture family is reported, as support for future targets is implied.
Examples
supported_targets=[TargetSm("100f"), TargetSm("120f")]implies support for["100a", "103a", ... , "120a", "121a", ...]for all members of100f&120farch familiessupported_targets=[TargetSm("80")]implies support for["80","89","90","90a","100", ...]
To check if this Operator is supported on a desired target_sm, use
target_sm.supports_operators_from(supported_targets).
- operands: OperandsMetadata#
per-operand constraints and any operand-independent choices (e.g. the accumulator type for a GEMM).
- Type:
Describes the per-operand requirements of the Operator
- design: DesignMetadata | None = None#
Describes characteristics of the design & implementation of the Operator
- epilogue: EpilogueMetadata | None = None#
Describes the custom epilogue of the Operator.
- property provider: Provider#
The
Providerthat this Operator’s class is registered with.
- supports(
- args: RuntimeArguments | None,
- *,
- target_sm: TargetSm | str | None = None,
Check if the provided
args/target_smsatisfy the properties described by this OperatorMetadata.- Parameters:
args (RuntimeArguments | None) – Check if Operator supports these RuntimeArguments. Can be explicitly set to None, in order to check only target_sm.
target_sm (TargetSm | str | None) – Check if Operator can be compiled/ran on given TargetSm architecture, if any.
- Returns:
Status indicating whether the args/target_sm are supported, and reason for failure if not.
- Return type:
- Raises:
ValueError – If both args and target_sm are None.
Operands metadata#
- class cutlass.operators.metadata.operands.OperandsMetadata#
Bases:
ABCDescribes properties expected of the logical operands passed to an Operator.
It describes the conditions under which an Operator can correctly execute a given
RuntimeArguments. It mirrors the fields of aRuntimeArgumentssubclass implemented by the Operator, and describes requirements placed on each field. For instance,GemmOperandsMetadatamirrorsGemmArguments.RuntimeArgumentsdescribes what operation the user wishes to perform, independent of which Operator will perform it.OperandsMetadatadescribes conditions under which anOperatorcan accept and correctly executeRuntimeArgumentspassed to it.If an Operator’s
OperandsMetadatasupports theRuntimeArgumentspresented by a user, then it produces functionally correct result for those RuntimeArguments.- abstract supports(args: RuntimeArguments) Status#
Check whether
argssatisfy the operand requirements described by this metadata.- Parameters:
args (RuntimeArguments) – Runtime arguments to validate.
- Returns:
Status indicating whether
argssatisfy the operand requirements described by this metadata.- Return type:
- class cutlass.operators.metadata.operands.GemmOperandsMetadata(
- A: OperandConstraints,
- B: OperandConstraints,
- out: OperandConstraints,
- accumulator_type: Numeric,
Bases:
OperandsMetadataDescribes conditions under which an Operation functionally supports
GemmArguments.- A: OperandConstraints#
Constraints on operand
Aof the GEMM
- B: OperandConstraints#
Constraints on operand
Bof the GEMM
- out: OperandConstraints#
Constraints on operand
outof the GEMM
- accumulator_type: Numeric#
The required data type of the accumulator tensor
- supports(
- other: GemmArguments | GemmOperandsMetadata,
Check whether
otherarguments or metadata are compatible with GEMM operands described by this metadata.- Parameters:
other (GemmArguments | GemmOperandsMetadata) – Either runtime
GemmArgumentsor a peerGemmOperandsMetadatato validate.- Returns:
Status.success()if every operand and the accumulator type match, otherwiseStatus.fail(...)with the first failing operand’s reason.- Return type:
- class cutlass.operators.metadata.operands.GroupedGemmOperandsMetadata(
- A: OperandConstraints,
- B: OperandConstraints,
- out: OperandConstraints,
- offsets: OperandConstraints,
- accumulator_type: Numeric,
Bases:
OperandsMetadataDescribes conditions under which an Operation functionally supports
GroupedGemmArguments.- A: OperandConstraints#
Constraints on operand
Aof the grouped GEMM
- B: OperandConstraints#
Constraints on operand
Bof the grouped GEMM
- out: OperandConstraints#
Constraints on operand
outof the grouped GEMM
- offsets: OperandConstraints#
Constraints on operand
offsetsof the grouped GEMM.
- accumulator_type: Numeric#
The required data type of the accumulator tensor
- supports( ) Status#
Check whether
otherarguments or metadata are compatible with grouped-GEMM operands described by this metadata.- Parameters:
other (GroupedGemmArguments | GroupedGemmOperandsMetadata) – Either runtime
GroupedGemmArgumentsor a peerGroupedGemmOperandsMetadatato validate.- Returns:
Status.success()if every operand,offsets, and the accumulator type match, otherwiseStatus.fail(...)with the first failure.- Return type:
- class cutlass.operators.metadata.operand_constraints.OperandConstraints#
Bases:
ABCAbstract base class describing the constraints an Operator places on an Operand.
An instance of this class describes the requirements an Operator places on one
Operand, such as its data type, stride pattern, divisibility, and pointer alignment.- abstract supports(
- operand: Operand | OperandConstraints,
Check whether
operandsatisfies these constraints.- Parameters:
operand (Operand | OperandConstraints) – The runtime operand or another constraints object to check against
self.- Returns:
Status.success()whenoperandis accepted, otherwiseStatus.fail(...)with a human-readable reason.- Return type:
- class cutlass.operators.metadata.operand_constraints.DenseTensorConstraints(
- dtype: Numeric,
- stride: tuple[int, ...],
- divisibility: int,
- ptr_alignment_bytes: int | None = None,
Bases:
OperandConstraintsConstraints on a single
DenseTensor.Describes the data type, stride pattern, divisibility, and pointer alignment that an Operator requires a
DenseTensorto satisfy.- dtype: Numeric#
The data type of the tensor
- stride: tuple[int, ...] | None#
The stride of the tensor. If none, any arbitrary stride is allowed.
- divisibility: int#
The divisibility requirement on a tensor’s stride and shape elements
- ptr_alignment_bytes: int#
The alignment of the tensor’s data pointer, in bytes By default, it matches the number of bytes in stride/shape alignment.
- supports(
- operand: DenseTensor | DenseTensorConstraints,
Check whether
operandsatisfies the constraints described by this object.- Parameters:
operand (Operand | OperandConstraints) – Operand or peer constraints object to validate.
- Returns:
Status.success()if accepted,Status.fail(...)otherwise.- Return type:
- class cutlass.operators.metadata.operand_constraints.ScaledOperandConstraints(
- quantized: DenseTensorConstraints,
- scale: DenseTensorConstraints,
- mode: ScaleMode | tuple[int, ...],
- swizzle: ScaleSwizzleMode,
Bases:
OperandConstraintsConstraints on a scaled (quantized + scale-factor) operand.
A scaled operand combines a quantized tensor and a scale tensor with a chosen scale mode + scale swizzle. Constraints on each piece are carried in
quantizedandscale;supports()checks all four.- quantized: DenseTensorConstraints#
Constraints on the narrow-precision tensor holding the quantized values.
- scale: DenseTensorConstraints#
Constraints on the scale-factor tensor.
- swizzle: ScaleSwizzleMode#
Swizzling pattern used within scale factor tensor
- supports(
- operand: ScaledOperand | ScaledOperandConstraints,
Check whether
operandsatisfies these scaled-operand constraints.
Design metadata#
- class cutlass.operators.metadata.design.DesignMetadata#
Bases:
ABCDescribes architectural, performance, or design characteristics of the kernel separate from its functional contribution.
These properties do not directly alter the logical result of the Operator. Instead, they distinguish the design characteristics of otherwise logically-equivalent Operators, and can be used to guide Operator selection and performance characterization.
This could include properties like:
inherent design choices like which MMA instruction it uses, or use of other architectural features
its performance options, tile scheduling algorithm, etc.
its tile shape, cluster shape, number of shared memory stages, etc.
- abstract supports(args: RuntimeArguments) Status#
Checks whether the provided
argssatisfy the properties described by this DesignMetadata.It validates that
PerformanceControlswithinargs.performanceare supported by the Operator with this DesignMetadata.DesignMetadatadoes not directly influence the logical result of the Operator, and thus does not affect what logical operands can be supported inRuntimeArguments.- Parameters:
args (RuntimeArguments) – The arguments to check support for.
- Returns:
Status indicating whether the provided args satisfy the properties described by the design in this metadata
- Return type:
- class cutlass.operators.metadata.design.BLASDesignMetadata(
- *,
- mma_instruction_type: type[MmaInstruction],
- tile_shape: tuple[int, ...],
- cluster_shape: tuple[int, ...],
- num_smem_stages: int | None = None,
Bases:
DesignMetadataDesign metadata for a BLAS (basic-linear algebra subprogram) operation, like GEMM.
It describes fields common to many kernels that perform BLAS-like operations, such as tile/cluster shape, MMA instruction type, etc.
- mma_instruction_type: type[MmaInstruction]#
The type of the MMA instruction used by the Operator, if any.
- tile_shape: tuple[int, ...]#
Shape of the threadblock-level tile
- cluster_shape: tuple[int, ...]#
Shape of the cluster used in terms of threadblocks
- num_smem_stages: int | None = None#
Number of shared memory buffers used to pipeline data loading and computation. When None, the Operator determines this internally.
- supports(args: RuntimeArguments) Status#
Checks whether the provided args satisfy the properties described by the design in this metadata.
- Parameters:
args (RuntimeArguments) – The arguments to check support for
- Returns:
Status indicating whether the provided args satisfy the properties described by the design in this metadata
- Return type:
- class cutlass.operators.metadata.design.Sm100DesignMetadata(
- use_2cta_mma: bool,
- use_tma_store: bool,
- tile_scheduler: TileSchedulerMetadata | None = None,
- fallback_cluster_shape: tuple[int, ...] | None = None,
- *,
- mma_instruction_type: type[MmaInstruction],
- tile_shape: tuple[int, ...],
- cluster_shape: tuple[int, ...],
- num_smem_stages: int | None = None,
Bases:
BLASDesignMetadataDesign metadata for operators in the SM100 architecture family.
- use_2cta_mma: bool#
Whether to use a 2CTA MMA instruction
- use_tma_store: bool#
Whether to use TMA to store the results of the operation
- tile_scheduler: TileSchedulerMetadata | None = None#
Describes the tile scheduling strategy used by the Operator
- fallback_cluster_shape: tuple[int, ...] | None = None#
Fallback cluster shape for preferred cluster mode.
When
None(default), the Operator uses a single fixed cluster shape (BLASDesignMetadata.cluster_shape). When set:the Operator uses two cluster shapes:
cluster_shapeas the preferred (larger) shape andfallback_cluster_shapeas the smaller fallback for tiles that cannot fill a full preferred cluster.Preferred cluster depth (Z dimension) must be the same as that of fallback cluster.
Fallback cluster shape must evenly divide the preferred cluster shape.
- use_fallback_cluster() bool#
Return True when this design uses a preferred (larger) and fallback (smaller) cluster shape.
- class cutlass.operators.metadata.design.TileSchedulerMetadata#
Bases:
ABCModels an abstract tile scheduler.
- abstract classmethod supported_targets(
- design: DesignMetadata | None = None,
- operands: OperandsMetadata | None = None,
Returns all the supported targets for the tile scheduler.
Considers optional design and operands metadata when determining which targets are supported.
- class cutlass.operators.metadata.design.CLCDynamicPersistentTileSchedulerMetadata#
Bases:
TileSchedulerMetadataMetadata for the CLC dynamic persistent tile scheduler.
- classmethod supported_targets(
- design: DesignMetadata | None = None,
- operands: OperandsMetadata | None = None,
Returns supported targets for CLC dynamic persistent tile scheduler.
- class cutlass.operators.metadata.design.StaticPersistentTileSchedulerMetadata#
Bases:
TileSchedulerMetadataMetadata for the static persistent tile scheduler.
- classmethod supported_targets(
- design: DesignMetadata | None = None,
- operands: OperandsMetadata | None = None,
Returns supported targets for static persistent tile scheduler.
Epilogue metadata#
- class cutlass.operators.metadata.epilogue.EpilogueMetadata(epilogue_args: EpilogueArguments)#
Bases:
objectDescribes properties related to custom EpilogueArguments that an Operator may support.
- classmethod from_args(
- args: EpilogueArguments,
Creates an EpilogueMetadata from an EpilogueArguments.
- property parameters: list[cute.Tensor | Numeric]#
Returns the list of input and output parameters of the epilogue.
- property parameter_names: list[str]#
Returns the list of names of the input and output parameters of the epilogue.
- supports(args: RuntimeArguments) Status#
Checks if the provided EpilogueArguments are supported by the Operator.
MMA instructions#
- class cutlass.operators.mma.MmaInstruction#
Bases:
objectModels properties of an abstract MMA instruction.
- static supported_targets(
- design: DesignMetadata | None = None,
- operands: OperandsMetadata | None = None,
Return all the supported targets for the MMA instruction, given optional design and operands metadata.
- static shape_k(operands: OperandsMetadata) int#
Return the K dimension of the shape of matrix multiplication performed by this instruction.
- class cutlass.operators.mma.BlackwellTcgen05Mma#
Bases:
MmaInstructionModels the tcgen05.mma instruction for the Blackwell architecture.
- static supported_targets(
- design: DesignMetadata | None = None,
- operands: OperandsMetadata | None = None,
- static shape_k(operands: OperandsMetadata) int#
- class cutlass.operators.mma.BlackwellTcgen05MmaSparse#
Bases:
MmaInstructionModels the tcgen05.mma.sp instruction for the Blackwell architecture.
- static supported_targets(
- design: DesignMetadata | None = None,
- operands: OperandsMetadata | None = None,
- class cutlass.operators.mma.HopperWgmma#
Bases:
MmaInstructionModels the wgmma Tensor Core MMA instruction for the Hopper architecture.
- static supported_targets(
- design: DesignMetadata | None = None,
- operands: OperandsMetadata | None = None,
- class cutlass.operators.mma.AmpereMma#
Bases:
MmaInstructionModels the Tensor Core MMA instruction for the Ampere architecture.
- static supported_targets(
- design: DesignMetadata | None = None,
- operands: OperandsMetadata | None = None,