MCPcopy Create free account
hub / github.com/pytorch/pytorch / log_results

Method log_results

torch/_inductor/select_algorithm.py:894–929  ·  view source on GitHub ↗
(name, input_nodes, timings, elapse)

Source from the content-addressed store, hash-verified

892
893 @staticmethod
894 def log_results(name, input_nodes, timings, elapse):
895 if not (config.max_autotune or config.max_autotune_gemm) or not PRINT_AUTOTUNE:
896 return
897 sizes = ", ".join(
898 [
899 "x".join(
900 map(
901 str,
902 V.graph.sizevars.size_hints(
903 n.get_size(), fallback=config.unbacked_symint_fallback
904 ),
905 )
906 )
907 for n in input_nodes
908 ]
909 )
910 n = None if log.getEffectiveLevel() == logging.DEBUG else 10
911 top_k = sorted(timings, key=timings.__getitem__)[:n]
912 best = top_k[0]
913 best_time = timings[best]
914 sys.stderr.write(f"AUTOTUNE {name}({sizes})\n")
915 for choice in top_k:
916 result = timings[choice]
917 if result:
918 sys.stderr.write(
919 f" {choice.name} {result:.4f} ms {best_time/result:.1%}\n"
920 )
921 else:
922 sys.stderr.write(
923 f" {choice.name} {result:.4f} ms <DIVIDED BY ZERO ERROR>\n"
924 )
925
926 autotune_type_str = (
927 "SubProcess" if config.autotune_in_subproc else "SingleProcess"
928 )
929 sys.stderr.write(f"{autotune_type_str} AUTOTUNE takes {elapse:.4f} seconds\n")
930
931 @staticmethod
932 def benchmark_example_value(node):

Callers 1

__call__Method · 0.95

Calls 4

size_hintsMethod · 0.80
joinMethod · 0.45
get_sizeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected