1 #include <torch/csrc/lazy/core/config.h>
2
3 C10_DEFINE_bool(torch_lazy_ir_debug, false, "Enable lazy tensor IR debugging");
4
5 C10_DEFINE_bool(
6 torch_lazy_param_aliasing,
7 true,
8 "Enable parameter aliasing support");
9
10 C10_DEFINE_bool(
11 torch_lazy_handle_special_scalars,
12 false,
13 "Handle special scalars 0 and 1 differently");
14
15 C10_DEFINE_bool(
16 torch_lazy_all_numbers_special_scalars,
17 false,
18 "Handle all numbers as special scalars");
19
20 C10_DEFINE_bool(
21 torch_lazy_reuse_ir,
22 false,
23 "Reuse IR nodes from previous tracing when possible");
24
25 C10_DEFINE_bool(
26 torch_lazy_use_thread_pool,
27 false,
28 "Use thread pool to schedule backend execution");
29
30 C10_DEFINE_bool(
31 torch_lazy_enable_device_data_cache,
32 true,
33 "Enable or disable device data cache (turns cache on or off), does not change cache state");
34
35 C10_DEFINE_int(
36 torch_lazy_compilation_cache_size,
37 1024,
38 "Size of the compilation cache");
39
40 C10_DEFINE_int(
41 torch_lazy_device_data_cache_size,
42 128,
43 "Size of the DeviceData cache");
44
45 C10_DEFINE_int(
46 torch_lazy_io_thread_pool_size,
47 // TODO: measure which default value will give better
48 // performance, std::thread::hardware_concurrency()?
49 1,
50 "Size of the execution thread pool");
51
52 C10_DEFINE_int(torch_lazy_metrics_samples, 1024, "Max metrics sample size");
53
54 C10_DEFINE_int(
55 torch_lazy_trim_graph_check_frequency,
56 5000,
57 "How often to check for whether a graph needs to be split");
58
59 C10_DEFINE_int(
60 torch_lazy_trim_graph_size,
61 100000,
62 "The threshold (in terms of the number of nodes) for splitting a graph");
63
64 C10_DEFINE_string(
65 torch_lazy_metrics_percentiles,
66 "0.01:0.05:0.1:0.2:0.5:0.8:0.9:0.95:0.99",
67 "Metrics percentiles to be collected, using : as the delimiter");
68
69 C10_DEFINE_int(
70 torch_lazy_shape_cache_size,
71 4096,
72 "Set the size for the shape cache used for shape inference");
73
74 namespace torch {
75 namespace lazy {
76
getLTCForceFallback()77 std::string& getLTCForceFallback() {
78 static std::string config;
79 static bool _ignore = [&]() {
80 char* envptr = std::getenv("LTC_FORCE_FALLBACK");
81 if (envptr) {
82 config = std::string(envptr);
83 }
84 return true;
85 }();
86 (void)_ignore; // avoid unused variables warning
87 return config;
88 }
89
90 } // namespace lazy
91 } // namespace torch
92