Skip to content

Commit 004051a

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

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
@@ -146,6 +155,7 @@ def my_kernel(x: torch.Tensor) -> torch.Tensor:
146155
.. autoattribute:: Settings.autotune_config_overrides
147156
148157
Dict of config key/value pairs to force during autotuning. Useful for disabling problematic candidates or pinning experimental options.
158+
Provide JSON via ``HELION_AUTOTUNE_CONFIG_OVERRIDES='{"num_warps": 4}'`` for global overrides.
149159
150160
.. autoattribute:: Settings.autotune_effort
151161
@@ -179,6 +189,7 @@ See :class:`helion.autotuner.LocalAutotuneCache` for details on cache keys and b
179189
.. autoattribute:: Settings.ignore_warnings
180190
181191
List of warning types to suppress during compilation. Default is an empty list.
192+
Accepts comma-separated warning class names from ``helion.exc`` via ``HELION_IGNORE_WARNINGS`` (for example, ``HELION_IGNORE_WARNINGS=TensorOperationInWrapper``).
182193
183194
.. autoattribute:: Settings.debug_dtype_asserts
184195
@@ -203,6 +214,7 @@ See :class:`helion.autotuner.LocalAutotuneCache` for details on cache keys and b
203214
.. autoattribute:: Settings.autotuner_fn
204215
205216
Override the callable that constructs autotuner instances. Accepts the same signature as :func:`helion.runtime.settings.default_autotuner_fn`.
217+
Pass a replacement callable via ``@helion.kernel(..., autotuner_fn=...)`` or ``helion.kernel(autotuner_fn=...)`` at definition time.
206218
```
207219

208220
Built-in values for ``HELION_AUTOTUNER`` include ``"PatternSearch"``, ``"DifferentialEvolutionSearch"``, ``"FiniteSearch"``, and ``"RandomSearch"``.
@@ -218,9 +230,12 @@ Built-in values for ``HELION_AUTOTUNER`` include ``"PatternSearch"``, ``"Differe
218230
| Environment Variable | Maps To | Description |
219231
|----------------------|---------|-------------|
220232
| ``TRITON_F32_DEFAULT`` | ``dot_precision`` | Sets default floating-point precision for Triton dot products (``"tf32"``, ``"tf32x3"``, ``"ieee"``). |
233+
| ``HELION_INDEX_DTYPE`` | ``index_dtype`` | Choose the default index dtype (accepts any ``torch.<dtype>`` name, e.g. ``int64``). |
234+
| ``HELION_STATIC_SHAPES`` | ``static_shapes`` | Set to ``0``/``false`` to disable global static shape specialization. |
221235
| ``HELION_FORCE_AUTOTUNE`` | ``force_autotune`` | Force the autotuner to run even when explicit configs are provided. |
222236
| ``HELION_DISALLOW_AUTOTUNING`` | ``check_autotuning_disabled`` | Hard-disable autotuning; kernels must supply explicit configs when this is ``1``. |
223237
| ``HELION_AUTOTUNE_COMPILE_TIMEOUT`` | ``autotune_compile_timeout`` | Maximum seconds to wait for Triton compilation during autotuning. |
238+
| ``HELION_AUTOTUNE_LOG_LEVEL`` | ``autotune_log_level`` | Adjust logging verbosity; accepts names like ``INFO`` or numeric levels. |
224239
| ``HELION_AUTOTUNE_PRECOMPILE`` | ``autotune_precompile`` | Select the autotuner precompile mode (``"spawn"``, ``"fork"``, or disable when empty). |
225240
| ``HELION_AUTOTUNE_PRECOMPILE_JOBS`` | ``autotune_precompile_jobs`` | Cap the number of concurrent Triton precompile subprocesses. |
226241
| ``HELION_AUTOTUNE_RANDOM_SEED`` | ``autotune_random_seed`` | Seed used for randomized autotuning searches. |
@@ -229,9 +244,11 @@ Built-in values for ``HELION_AUTOTUNER`` include ``"PatternSearch"``, ``"Differe
229244
| ``HELION_AUTOTUNE_EFFORT`` | ``autotune_effort`` | Select autotuning preset (``"none"``, ``"quick"``, ``"full"``). |
230245
| ``HELION_REBENCHMARK_THRESHOLD`` | ``autotune_rebenchmark_threshold`` | Re-run configs whose performance is within a multiplier of the current best. |
231246
| ``HELION_AUTOTUNE_PROGRESS_BAR`` | ``autotune_progress_bar`` | Enable or disable the progress bar UI during autotuning. |
247+
| ``HELION_AUTOTUNE_CONFIG_OVERRIDES`` | ``autotune_config_overrides`` | Supply JSON forcing particular autotuner config key/value pairs. |
232248
| ``HELION_CACHE_DIR`` | ``LocalAutotuneCache`` | Override the on-disk directory used for cached autotuning artifacts. |
233249
| ``HELION_SKIP_CACHE`` | ``LocalAutotuneCache`` | When set to ``1``, ignore cached autotuning entries and rerun searches. |
234250
| ``HELION_PRINT_OUTPUT_CODE`` | ``print_output_code`` | Print generated Triton code to stderr for inspection. |
251+
| ``HELION_IGNORE_WARNINGS`` | ``ignore_warnings`` | Comma-separated warning names defined in ``helion.exc`` to suppress. |
235252
| ``HELION_ALLOW_WARP_SPECIALIZE`` | ``allow_warp_specialize`` | Permit warp-specialized code generation for ``tl.range``. |
236253
| ``HELION_DEBUG_DTYPE_ASSERTS`` | ``debug_dtype_asserts`` | Inject dtype assertions after each lowering step. |
237254
| ``HELION_INTERPRET`` | ``ref_mode`` | Run kernels through the reference interpreter when set to ``1`` (maps to ``RefMode.EAGER``). |

0 commit comments

Comments
 (0)