tvm.relax.backend#

tvm.relax.backend#

Relax backends

class tvm.relax.backend.DispatchSampling(*args, **kwargs)#

Pass to dispatch scan and sort operators to platform dependent implementation.

class tvm.relax.backend.DispatchSortScan(index_bits: int | None = None)#

Pass to dispatch scan and sort operators to platform dependent implementation.

Parameters:

index_bits (Optional[int]) –

Signed index-width budget for the generated continuous GPU cumsum hierarchy. Must be 32 or 64. By default, use 32 for WebGPU and 64 for other targets. WebGPU does not support an explicit 64-bit budget.

Pipelines that subsequently force indices to int32 should request 32 to avoid generating hierarchy thresholds outside the signed int32 range. The caller must ensure runtime indices fit the requested width; this option does not insert runtime bounds checks. This option does not narrow the generated TIR, change tensor dtypes, or affect other sort/scan implementations.

tvm.relax.backend.get_pattern(name: str) → FusionPattern | None#

Find the pattern with a particular name.

Parameters:

name (str) – The pattern name.

Returns:

pattern – The matched pattern. Returns None if such pattern is not found.

Return type:

Optional[FusionPattern]

tvm.relax.backend.get_patterns_with_prefix(prefix: str) → list[FusionPattern]#

Get a list of patterns whose names startwith prefix.

Parameters:

prefix (str) – The prefix of pattern name.

Returns:

patterns – Matched patterns, ordered by priority from high to low.

Return type:

FusionPattern

tvm.relax.backend.cuda#

The Relax CUDA backend compilation pipeline and other passes.

tvm.relax.backend.rocm#

The Relax ROCm backend compilation pipeline and other passes.

tvm.relax.backend.metal#

The Relax Metal backend compilation pipeline and other passes.

tvm.relax.backend.adreno#

The Relax Adreno backend compilation pipeline and other passes.

tvm.relax.backend.gpu_generic#

The Relax Metal backend compilation pipeline and other passes.

tvm.relax.backend.cpu_generic#

The Relax CPU backend compilation pipeline and other passes.

tvm.relax.backend.contrib#

Relax backends contrib