vllm.kernels.helion
¶
Helion integration for vLLM.
Modules:
-
case_key–Structured key for identifying kernel config/autotune/benchmark cases.
-
config_manager–Configuration management for Helion kernels.
-
ops–Helion kernel implementation.
-
register–vLLM Helion kernel registration with pre-tuned config selection.
-
utils–Utility functions for Helion kernel management.
Classes:
-
CaseKey–Immutable, hashable dict for identifying kernel cases.
-
ConfigManager–File-level configuration management for Helion kernels (global singleton).
-
ConfigSet–In-memory collection of Helion configs with lookup/query capabilities.
-
ConfiguredHelionKernel–A configured Helion kernel bound to a specific platform.
-
HelionKernelWrapper–Wrapper for Helion kernels with pre-tuned config selection and HOP support.
Functions:
-
canonicalize_gpu_name–Canonicalize GPU name for use as a platform identifier.
-
register_kernel–Register a Helion kernel with pre-tuned config selection.
CaseKey
¶
Immutable, hashable dict for identifying kernel cases.
Used as the key for config lookup, autotuning, benchmarking, and input generation. Behaves like a read-only dict and can be used as a dict key or in sets.
The canonical string form (__str__) is stable JSON with sorted
keys. Use CaseKey.default() for the default/fallback key.
The regular constructor requires at least one key-value pair::
CaseKey({"intermediate": 2048, "numtokens": 256})
CaseKey.default() # default/fallback
Methods:
-
default–Create a default case key (empty).
-
is_default–Return True if this is the default case key (empty).
ConfigManager
¶
File-level configuration management for Helion kernels (global singleton).
Methods:
-
reset_instance–For testing purposes only.
-
save_configs–Save configs for a kernel/platform, merging with existing.
ConfigSet
¶
In-memory collection of Helion configs with lookup/query capabilities.
Configs are stored keyed by CaseKey. The default config
uses CaseKey.default() as its key.
Methods:
-
to_config_entries–Serialize to config entries format for JSON output.
-
to_dict–Return configs as a nested dict (platform -> key -> config).
ConfiguredHelionKernel
¶
A configured Helion kernel bound to a specific platform.
_create_key_computer()
¶
Create a key computer function derived from the config picker.
The returned function receives kernel arguments unpacked (args) to match Helion's key signature (called as self._key_fn(args)).
HelionKernelWrapper
¶
Wrapper for Helion kernels with pre-tuned config selection and HOP support.
Methods:
-
run_autotune–Run autotuning for a single input configuration.
run_autotune(inputs, autotune_effort='quick')
¶
Run autotuning for a single input configuration.
canonicalize_gpu_name(name)
¶
Canonicalize GPU name for use as a platform identifier.
Converts to lowercase, replaces separators with underscores, and maps known variant names to their canonical form via _GPU_NAME_ALIASES. e.g., "NVIDIA H100 80GB HBM3" -> "nvidia_h100" "NVIDIA A100-SXM4-80GB" -> "nvidia_a100" "AMD Instinct MI300X" -> "amd_instinct_mi300x"
register_kernel(op_name=None, *, config_picker, fake_impl=None, mutates_args=None, helion_settings=None, input_generator=None)
¶
Register a Helion kernel with pre-tuned config selection.
Parameters:
-
(op_name¶str | None, default:None) –Name to register the op under. Defaults to the function name.
-
(fake_impl¶Callable | None, default:None) –Optional meta/fake implementation for tracing.
-
(mutates_args¶list[str] | None, default:None) –Names of arguments the kernel mutates in place.
-
(helion_settings¶Settings | None, default:None) –Optional Helion settings override.
-
(config_picker¶ConfigPicker) –Required. Receives
(args, config_keys)where each config key is adict[str, Any]mapping parameter names to values. Return the best-matching dict, orNoneto fall back to the default config.Example::
def pick_config(args, config_keys): x = args[0] best = min(config_keys, key=lambda k: abs(k["size"] - x.shape[0])) return best -
(input_generator¶Callable[[], dict[CaseKey, tuple[Any, ...]]] | None, default:None) –Optional. Returns
dict[str, tuple]where each key is a serialized config key and each value is a tuple of arguments to pass to the kernel.Example::
def generate_inputs(): return { "4096": (torch.randn(4096, device="cuda"), 0.5), "8192": (torch.randn(8192, device="cuda"), 0.5), }