Skip to content

Commit fa5562f

Browse files
committed
Add missing settings environment variables
stack-info: PR: #965, branch: jansel/stack/204
1 parent c542566 commit fa5562f

File tree

2 files changed

+278
-85
lines changed

2 files changed

+278
-85
lines changed

docs/api/settings.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ Settings can be configured via:
3737

3838
If both are provided, decorator arguments take precedence.
3939

40+
```{note}
41+
Helion reads the environment variables for `Settings` when the
42+
`@helion.kernel` decorator defines the function (typically at import
43+
time). One can modify Kernel.settings to change settings
44+
for an already defined kernel.
45+
```
46+
4047
## Configuration Examples
4148

4249
### Using Environment Variables
@@ -74,14 +81,16 @@ def my_kernel(x: torch.Tensor) -> torch.Tensor:
7481
.. autoattribute:: Settings.index_dtype
7582
7683
The data type used for index variables in generated code. Default is ``torch.int32``.
84+
Override via ``HELION_INDEX_DTYPE=int64`` (or any ``torch.<dtype>`` name).
7785
7886
.. autoattribute:: Settings.dot_precision
7987
8088
Precision mode for dot product operations. Default is ``"tf32"``. Controlled by ``TRITON_F32_DEFAULT`` environment variable.
8189
8290
.. autoattribute:: Settings.static_shapes
8391
84-
When enabled, tensor shapes are treated as compile-time constants for optimization. Default is ``True``. Set this to ``False`` if you need a single compiled kernel instance to serve many shape variants.
92+
When enabled, tensor shapes are treated as compile-time constants for optimization. Default is ``True``.
93+
Set ``HELION_STATIC_SHAPES=0`` the default if you need a compiled kernel instance to serve many shape variants.
8594
```
8695

8796
### Autotuning Settings
@@ -100,7 +109,7 @@ def my_kernel(x: torch.Tensor) -> torch.Tensor:
100109
- ``logging.INFO``: Standard progress messages (default)
101110
- ``logging.DEBUG``: Verbose debugging output
102111
103-
You can also use ``0`` to completely disable all autotuning output.
112+
You can also use ``0`` to completely disable all autotuning output. Controlled by ``HELION_AUTOTUNE_LOG_LEVEL``.
104113
105114
.. autoattribute:: Settings.autotune_compile_timeout
106115
@@ -150,6 +159,7 @@ def my_kernel(x: torch.Tensor) -> torch.Tensor:
150159
.. autoattribute:: Settings.autotune_config_overrides
151160
152161
Dict of config key/value pairs to force during autotuning. Useful for disabling problematic candidates or pinning experimental options.
162+
Provide JSON via ``HELION_AUTOTUNE_CONFIG_OVERRIDES='{"num_warps": 4}'`` for global overrides.
153163
154164
.. autoattribute:: Settings.autotune_effort
155165
@@ -183,6 +193,7 @@ See :class:`helion.autotuner.LocalAutotuneCache` for details on cache keys and b
183193
.. autoattribute:: Settings.ignore_warnings
184194
185195
List of warning types to suppress during compilation. Default is an empty list.
196+
Accepts comma-separated warning class names from ``helion.exc`` via ``HELION_IGNORE_WARNINGS`` (for example, ``HELION_IGNORE_WARNINGS=TensorOperationInWrapper``).
186197
187198
.. autoattribute:: Settings.debug_dtype_asserts
188199
@@ -207,6 +218,7 @@ See :class:`helion.autotuner.LocalAutotuneCache` for details on cache keys and b
207218
.. autoattribute:: Settings.autotuner_fn
208219
209220
Override the callable that constructs autotuner instances. Accepts the same signature as :func:`helion.runtime.settings.default_autotuner_fn`.
221+
Pass a replacement callable via ``@helion.kernel(..., autotuner_fn=...)`` or ``helion.kernel(autotuner_fn=...)`` at definition time.
210222
```
211223

212224
Built-in values for ``HELION_AUTOTUNER`` include ``"PatternSearch"``, ``"DifferentialEvolutionSearch"``, ``"FiniteSearch"``, and ``"RandomSearch"``.
@@ -222,9 +234,12 @@ Built-in values for ``HELION_AUTOTUNER`` include ``"PatternSearch"``, ``"Differe
222234
| Environment Variable | Maps To | Description |
223235
|----------------------|---------|-------------|
224236
| ``TRITON_F32_DEFAULT`` | ``dot_precision`` | Sets default floating-point precision for Triton dot products (``"tf32"``, ``"tf32x3"``, ``"ieee"``). |
237+
| ``HELION_INDEX_DTYPE`` | ``index_dtype`` | Choose the default index dtype (accepts any ``torch.<dtype>`` name, e.g. ``int64``). |
238+
| ``HELION_STATIC_SHAPES`` | ``static_shapes`` | Set to ``0``/``false`` to disable global static shape specialization. |
225239
| ``HELION_FORCE_AUTOTUNE`` | ``force_autotune`` | Force the autotuner to run even when explicit configs are provided. |
226240
| ``HELION_DISALLOW_AUTOTUNING`` | ``check_autotuning_disabled`` | Hard-disable autotuning; kernels must supply explicit configs when this is ``1``. |
227241
| ``HELION_AUTOTUNE_COMPILE_TIMEOUT`` | ``autotune_compile_timeout`` | Maximum seconds to wait for Triton compilation during autotuning. |
242+
| ``HELION_AUTOTUNE_LOG_LEVEL`` | ``autotune_log_level`` | Adjust logging verbosity; accepts names like ``INFO`` or numeric levels. |
228243
| ``HELION_AUTOTUNE_PRECOMPILE`` | ``autotune_precompile`` | Select the autotuner precompile mode (``"spawn"``, ``"fork"``, or disable when empty). |
229244
| ``HELION_AUTOTUNE_PRECOMPILE_JOBS`` | ``autotune_precompile_jobs`` | Cap the number of concurrent Triton precompile subprocesses. |
230245
| ``HELION_AUTOTUNE_RANDOM_SEED`` | ``autotune_random_seed`` | Seed used for randomized autotuning searches. |
@@ -234,9 +249,11 @@ Built-in values for ``HELION_AUTOTUNER`` include ``"PatternSearch"``, ``"Differe
234249
| ``HELION_REBENCHMARK_THRESHOLD`` | ``autotune_rebenchmark_threshold`` | Re-run configs whose performance is within a multiplier of the current best. |
235250
| ``HELION_AUTOTUNE_PROGRESS_BAR`` | ``autotune_progress_bar`` | Enable or disable the progress bar UI during autotuning. |
236251
| ``HELION_AUTOTUNE_IGNORE_ERRORS`` | ``autotune_ignore_errors`` | Continue autotuning even when recoverable runtime errors occur. |
252+
| ``HELION_AUTOTUNE_CONFIG_OVERRIDES`` | ``autotune_config_overrides`` | Supply JSON forcing particular autotuner config key/value pairs. |
237253
| ``HELION_CACHE_DIR`` | ``LocalAutotuneCache`` | Override the on-disk directory used for cached autotuning artifacts. |
238254
| ``HELION_SKIP_CACHE`` | ``LocalAutotuneCache`` | When set to ``1``, ignore cached autotuning entries and rerun searches. |
239255
| ``HELION_PRINT_OUTPUT_CODE`` | ``print_output_code`` | Print generated Triton code to stderr for inspection. |
256+
| ``HELION_IGNORE_WARNINGS`` | ``ignore_warnings`` | Comma-separated warning names defined in ``helion.exc`` to suppress. |
240257
| ``HELION_ALLOW_WARP_SPECIALIZE`` | ``allow_warp_specialize`` | Permit warp-specialized code generation for ``tl.range``. |
241258
| ``HELION_DEBUG_DTYPE_ASSERTS`` | ``debug_dtype_asserts`` | Inject dtype assertions after each lowering step. |
242259
| ``HELION_INTERPRET`` | ``ref_mode`` | Run kernels through the reference interpreter when set to ``1`` (maps to ``RefMode.EAGER``). |

0 commit comments

Comments
 (0)