Kernel discovery#
get_operators() is the entry point for finding
Operators that support a given operation, operands, and target. It returns
Operators drawn from the
Manifest of registered kernels.
Operators can be additionally discovered or filtered by target compute
capability, which is described by TargetSm.
- cutlass.operators.get_operators(
- args: RuntimeArguments | None = None,
- metadata_filter: Callable[[OperatorMetadata], bool] | None = None,
- target_sm: TargetSm | str | None = None,
- providers: list[Provider] | None = None,
Return Operators that match the given arguments, metadata filter, and target.
- Parameters:
args (RuntimeArguments | None) – Runtime arguments describing the operator invocation (e.g.
GemmArguments). WhenNone, no argument-based filtering is applied.metadata_filter (Callable[[OperatorMetadata], bool] | None) – An optional Callable that takes OperatorMetadata as input and returns a boolean indicating if it should be considered for inclusion in results. The result is an intersection of operators filtered by the callable and by other parameters passed to this method.
target_sm (TargetSm | str | None) – Compute capability to target (e.g.
"100a"or aTargetSminstance). Filters Operators that cannot run on this target.providers (list[Provider] | None) – Optional list of Providers to restrict discovery to (e.g.
[ops.CuTeDSLProvider]).
- Returns:
Operators matching all filters.
- Return type:
list[Operator]
- class cutlass.operators.manifest.Manifest#
Bases:
objectA Manifest holds a collection of generated Operators.
- static get_operators(
- args: RuntimeArguments = None,
- metadata_filter: Callable[[OperatorMetadata], bool] | None = None,
- target_sm: TargetSm | str | None = None,
- providers: list[Provider] = None,
Get the operators that match the given arguments, metadata filter, compute capability and available providers.
- Parameters:
args (RuntimeArguments) – The arguments of the operator
metadata_filter (Callable[[OperatorMetadata], bool]) – A boolean function that takes in OperatorMetadata and returns whether an Operator with this metadata should be included
target_sm (TargetSm | str | None) – Optional target compute capability for which operators should be fetched
providers (list[Provider]) – Optionally limit the search to the given providers. If None, all available providers are used.
- Returns:
The operators that match the given arguments, metadata filter, and compute capability
- Return type:
list[Operator]
- add_operators(operators: list[Operator]) None#
Add the given operators to the Manifest’s set of discovered operators.
- Parameters:
operators (list[Operator]) – The operators to add to the Manifest
- filter_operators(
- args: RuntimeArguments = None,
- metadata_filter: Callable[[OperatorMetadata], bool] | None = None,
- target_sm: TargetSm | str | None = None,
- providers: list[Provider] = None,
Filter the operators that have been added to this Manifest.
This is similar to
get_operators, but only considers operators previously added to this Manifest usingadd_operators().
- class cutlass.operators.arch.TargetSm(
- sm_str: str | None = None,
- *,
- cc: int | None = None,
- portability: ArchPortability | None = None,
Bases:
objectTarget compute capability & portability to compile for.
- classmethod ensure(
- value: TargetSm | str | None,
Coerce a string to
TargetSm, or return as-is if already one.
- static get_supported_targets(
- design: DesignMetadata,
- operands: OperandsMetadata,
Get the supported targets for a given design and operands.
- Raises:
ValueError – If
designdoes not have amma_instruction_typefield.
- is_portable_to(
- other: TargetSm | str,
Check if this target can compile/run on architecture described by other TargetSm.
- supports_operators_from(
- operator_targets: Iterable[TargetSm | str],
Check if this target can compile/run operators designed for any of the given targets.
- property major: int#
Get the major version of the target SM.
- property minor: int#
Get the minor version of the target SM.
- class cutlass.operators.arch.ArchPortability(value)#
Bases:
EnumPortability of a compiled Operator to other architectures/compute capabilities.
- Portable = 1#
Portable to future architectures (e.g. sm_100 without “a” or “f”).
- FamilyPortable = 2#
Portable to future architectures within the same family (e.g. sm_100f). Only applicable to Blackwell and newer architectures (cc >= 100).
- ArchConditional = 3#
Not portable to any other architecture (e.g. sm_100a). Only applicable to Hopper and newer architectures (cc >= 90).