Skip to content

vllm.model_executor.warmup.jit_warmup_triton_helper

Classes:

Functions:

TritonCompileKey dataclass

Triton-derived compile key with one non-comparing replay input.

TritonJitKey dataclass

Process-local identity of one Triton JIT specialization.

TritonKernelDispatcher

Bases: Protocol[P]

Callable Triton launcher with compile-time warmup support.

TritonWarmupTensor dataclass

Compile-only tensor metadata used by Triton warmup.

strides=None represents compact row-major storage. Pass explicit strides whenever the runtime tensor can be padded, transposed, or otherwise strided.

ptr_range_bytes is the byte size of the storage behind the runtime tensor (its untyped_storage(), not the view), most easily derived with triton_ptr_range. With buffer ops enabled, Triton's ROCm backend gives pointers into storage of at most 2 GB a tt.pointer_range = 32 specialization (32-bit buffer offsets), which is part of the compile key. The default 0 assumes such a small storage; set it above 2 GB for tensors that view a larger pool, such as a KV cache layer, or warmup compiles a variant the runtime never uses. CUDA ignores it.

VllmTritonJitKernel

Bases: VllmJitKernel[CompileKeyT], Generic[CompileKeyT]

Triton owner whose runtime launch specification is reused for warmup.

Methods:

  • compile_many –

    Compile CUDA startup warmup variants in parallel, then wait.

  • warmup_inputs –

    Return runtime-shaped inputs that reproduce one compile key.

compile_many(compile_keys)

Compile CUDA startup warmup variants in parallel, then wait.

warmup_inputs(compile_key) abstractmethod

Return runtime-shaped inputs that reproduce one compile key.

_triton_key_deriver(kernel)

Prepare Triton's key derivation once for one kernel and device.

compile_triton_warmup(compile_all, num_keys)

Share one compiler pool across all eligible warmup kernels.

triton_kernel_dispatcher_with_warmup(*, warmup_inputs, kernel=None)

triton_kernel_dispatcher_with_warmup(
    *,
    warmup_inputs: Callable[..., WarmupCases],
    kernel: None = None,
) -> Callable[[Any], Any]
triton_kernel_dispatcher_with_warmup(
    *,
    warmup_inputs: Callable[..., WarmupCases],
    kernel: Any,
) -> Callable[
    [Callable[P, DispatchSpec]], TritonKernelDispatcher[P]
]

Decorate a dispatch function or a native Triton kernel for warmup.

triton_ptr_range(tensor)

Pointer range Triton's backend would read off tensor.

Mirrors HIPBackend.is_within_2gb.

triton_scalar_specialization_rep(value)

Return an integer with the same default Triton JIT specialization.

For an ordinary integer argument, Triton's cache key contains its inferred type (i32, i64, or u64) and one of three value classes:

  • 1 is specialized as the exact constant 1.
  • Multiples of 16 receive a tt.divisibility = 16 attribute.
  • All other values have no value specialization.

Warmup only needs one concrete value for each cache-key class. This helper returns 1 for the exact-one class and otherwise returns a divisible or generic representative while preserving the inferred integer type.

This applies only to non-constexpr integer arguments using Triton's default specialization. Do not use it for arguments listed in do_not_specialize or do_not_specialize_on_alignment.

triton_warmup_inputs(kernel, *args, grid, pointer_dtypes=None, **kwargs)

Build launcher inputs from Triton's native positional argument order.