Skip to content

Commit 016ea5b

Browse files
author
Han Wang
committed
test(pt_expt): reduce AOTInductor compile time with fast configs
Set inductor configs in conftest to skip expensive C++ optimizations during .pt2 compilation: max_fusion_size=8, epilogue_fusion=False, pattern_matcher=False, package_cpp_only=True, compile_opt_level=O0. Tests only validate correctness so runtime performance is irrelevant. Cuts per-model compile time from ~50s to ~30s.
1 parent d69632e commit 016ea5b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

source/tests/pt_expt/conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,21 @@
1212
"""
1313

1414
import pytest
15+
import torch._inductor.config as _inductor_config
1516
import torch.utils._device as _device
1617
from torch.overrides import (
1718
_get_current_function_mode_stack,
1819
)
1920

21+
# Reduce AOTInductor (.pt2) compile time for unit tests.
22+
# Tests only validate correctness, not runtime performance, so we can
23+
# skip expensive C++ optimizations. This cuts compile time by ~50%.
24+
_inductor_config.max_fusion_size = 8
25+
_inductor_config.epilogue_fusion = False
26+
_inductor_config.pattern_matcher = False
27+
_inductor_config.aot_inductor.package_cpp_only = True
28+
_inductor_config.aot_inductor.compile_wrapper_opt_level = "O0"
29+
2030

2131
def _pop_device_contexts() -> list:
2232
"""Pop all stale DeviceContext modes from the torch function mode stack."""

0 commit comments

Comments
 (0)