Settings

The Settings class controls compilation behavior and debugging options for Helion kernels.

class helion.Settings(**settings)[source]

Bases: _Settings

Settings can be passed to hl.kernel as kwargs and control the behavior of the compilation process. Unlike a Config, settings are not auto-tuned and set by the user.

Parameters:

settings (object)

__init__(**settings)[source]

Initialize the Settings object with the provided dictionary of settings. If no settings are provided, the default settings are used (see set_default_settings).

Parameters:

settings (object) – Keyword arguments representing various settings.

to_dict()[source]

Convert the Settings object to a dictionary.

Returns:

A dictionary representation of the Settings object.

Return type:

dict[str, object]

check_autotuning_disabled()[source]
Return type:

None

static default()[source]

Get the default Settings object. If no default settings are set, create a new one.

Returns:

The default Settings object.

Return type:

Settings

ignore_warnings: list[type[BaseWarning]]

Subtypes of exc.BaseWarning to ignore when compiling.

index_dtype: dtype

The dtype to use for index variables. Default is torch.int32.

dot_precision: Literal['tf32', 'tf32x3', 'ieee']

Precision for dot products, see triton.language.dot. Can be ‘tf32’, ‘tf32x3’, or ‘ieee’.

static_shapes: bool

If True, use static shapes for all tensors. This is a performance optimization.

use_default_config: bool

For development only, skips all autotuning and uses the default config (which may be slow).

autotune_log_level: int

Log level for autotuning using Python logging levels. Default is logging.INFO. Use 0 to disable all output.

autotune_compile_timeout: int

Timeout for Triton compilation in seconds used for autotuning. Default is 60 seconds.

autotune_precompile: bool

If True, precompile the kernel before autotuning. Requires fork-safe environment.

print_output_code: bool

If True, print the output code of the kernel to stderr.

force_autotune: bool

If True, force autotuning even if a config is provided.

allow_warp_specialize: bool

If True, allow warp specialization for tl.range calls on CUDA devices.

Overview

Settings control the compilation process and development environment for Helion kernels.

Key Characteristics

  • Not autotuned: Settings remain constant across all kernel configurations

  • Meta-compilation: Control the compilation process itself, debugging output, and development features

  • Environment-driven: Often configured via environment variables

  • Development-focused: Primarily used for debugging, logging, and development workflow optimization

Settings vs Config

Aspect

Settings

Config

Purpose

Control compilation behavior

Control execution performance

Autotuning

❌ Never autotuned

✅ Automatically optimized

Examples

print_output_code, use_default_config

block_sizes, num_warps

When to use

Development, debugging, environment setup

Performance optimization

Settings can be configured via:

  1. Environment variables

  2. Keyword arguments to @helion.kernel

  3. Global defaults via helion.set_default_settings()

Configuration Examples

Using Environment Variables

env HELION_PRINT_OUTPUT_CODE=1  HELION_USE_DEFAULT_CONFIG=1 my_kernel.py

Using Decorator Arguments

import logging
import helion
import helion.language as hl

@helion.kernel(
    use_default_config=True,           # Skip autotuning
    print_output_code=True,            # Debug output
)
def my_kernel(x: torch.Tensor) -> torch.Tensor:
    result = torch.zeros_like(x)
    for i in hl.grid(x.size(0)):
        result[i] = x[i] * 2
    return result

Global Configuration

import logging
import helion

# Set global defaults
with helion.set_default_settings(
    ignore_warnings=[helion.exc.TensorOperationInWrapper],
    autotune_log_level=logging.WARNING
):
    # All kernels in this block use these settings
    @helion.kernel
    def kernel1(x): ...

    @helion.kernel
    def kernel2(x): ...

Settings Reference

Core Compilation Settings

Settings.index_dtype: dtype

The dtype to use for index variables. Default is torch.int32.

The data type used for index variables in generated code. Default is torch.int32.

Settings.dot_precision: Literal['tf32', 'tf32x3', 'ieee']

Precision for dot products, see triton.language.dot. Can be ‘tf32’, ‘tf32x3’, or ‘ieee’.

Precision mode for dot product operations. Default is "tf32". Controlled by TRITON_F32_DEFAULT environment variable.

Settings.static_shapes: bool

If True, use static shapes for all tensors. This is a performance optimization.

When enabled, tensor shapes are treated as compile-time constants for optimization. Default is False.

Autotuning Settings

Settings.use_default_config: bool

For development only, skips all autotuning and uses the default config (which may be slow).

Skip autotuning and use default configuration. Default is False. Controlled by HELION_USE_DEFAULT_CONFIG=1.

Settings.force_autotune: bool

If True, force autotuning even if a config is provided.

Force autotuning even when explicit configs are provided. Default is False. Controlled by HELION_FORCE_AUTOTUNE=1.

Settings.autotune_log_level: int

Log level for autotuning using Python logging levels. Default is logging.INFO. Use 0 to disable all output.

Controls verbosity of autotuning output using Python logging levels:

  • logging.CRITICAL: No autotuning output

  • logging.WARNING: Only warnings and errors

  • logging.INFO: Standard progress messages (default)

  • logging.DEBUG: Verbose debugging output

You can also use 0 to completely disable all autotuning output.

Settings.autotune_compile_timeout: int

Timeout for Triton compilation in seconds used for autotuning. Default is 60 seconds.

Timeout in seconds for Triton compilation during autotuning. Default is 60. Controlled by HELION_AUTOTUNE_COMPILE_TIMEOUT.

Settings.autotune_precompile: bool

If True, precompile the kernel before autotuning. Requires fork-safe environment.

Whether to precompile kernels before autotuning. Default is True on non-Windows systems, False on Windows.

Debugging and Development

Settings.print_output_code: bool

If True, print the output code of the kernel to stderr.

Print generated Triton code to stderr. Default is False. Controlled by HELION_PRINT_OUTPUT_CODE=1.

Settings.ignore_warnings: list[type[BaseWarning]]

Subtypes of exc.BaseWarning to ignore when compiling.

List of warning types to suppress during compilation. Default is an empty list.

Advanced Optimization

Settings.allow_warp_specialize: bool

If True, allow warp specialization for tl.range calls on CUDA devices.

Allow warp specialization for tl.range calls. Default is True. Controlled by HELION_ALLOW_WARP_SPECIALIZE.

Functions

helion.set_default_settings(settings)[source]

Set the default settings for the current thread and return a context manager that restores the previous settings upon exit.

Parameters:

settings (Settings) – The Settings object to set as the default.

Returns:

A context manager that restores the previous settings upon exit.

Return type:

AbstractContextManager[None, None]

See Also