Skip to content

Commit 8eb259f

Browse files
Chilleepytorchmergebot
authored andcommitted
Added option to control number of kernel options displayed (pytorch#138788)
Pull Request resolved: pytorch#138788 Approved by: https://github.com/drisspg
1 parent fc74ec4 commit 8eb259f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

torch/_inductor/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,9 @@ def bundle_triton_into_fx_graph_cache_default() -> Optional[bool]:
298298
# enable slow autotuning passes to select gemm algorithms
299299
max_autotune_gemm = os.environ.get("TORCHINDUCTOR_MAX_AUTOTUNE_GEMM") == "1"
300300

301+
# Modifies the number of autotuning choices displayed, set to None for all
302+
autotune_num_choices_displayed = 10
303+
301304
# force cublas and triton to use the same precision; cublas supports TF32 for matmul operations
302305
# when m, n, k are multiples of 16, 16, 8, whereas triton supports TF32 for matmul operations
303306
# for any combinations of m, n, k, regardless of their alignment. setting this flag will ensure

torch/_inductor/select_algorithm.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1730,9 +1730,15 @@ def log_results(
17301730
for n in input_nodes
17311731
]
17321732
)
1733+
if config.autotune_num_choices_displayed == 0:
1734+
return
1735+
elif config.autotune_num_choices_displayed is None:
1736+
n = -1
1737+
else:
1738+
n = config.autotune_num_choices_displayed
17331739

1734-
n = None if log.getEffectiveLevel() == logging.DEBUG else 10
17351740
top_k = sorted(timings, key=timings.__getitem__)[:n]
1741+
17361742
best = top_k[0]
17371743

17381744
def get_choice_info(choice):

0 commit comments

Comments
 (0)