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_int( |
31 | torch_lazy_compilation_cache_size, |
32 | 1024, |
33 | "Size of the compilation cache" ); |
34 | |
35 | C10_DEFINE_int( |
36 | torch_lazy_device_data_cache_size, |
37 | 128, |
38 | "Size of the DeviceData cache" ); |
39 | |
40 | C10_DEFINE_int( |
41 | torch_lazy_io_thread_pool_size, |
42 | // TODO: measure which default value will give better |
43 | // performance, std::thread::hardware_concurrency()? |
44 | 1, |
45 | "Size of the execution thread pool" ); |
46 | |
47 | C10_DEFINE_int(torch_lazy_metrics_samples, 1024, "Max metrics sample size" ); |
48 | |
49 | C10_DEFINE_int( |
50 | torch_lazy_trim_graph_check_frequency, |
51 | 5000, |
52 | "How often to check for whether a graph needs to be split" ); |
53 | |
54 | C10_DEFINE_int( |
55 | torch_lazy_trim_graph_size, |
56 | 100000, |
57 | "The threshold (in terms of the number of nodes) for splitting a graph" ); |
58 | |
59 | C10_DEFINE_string( |
60 | torch_lazy_metrics_percentiles, |
61 | "0.01:0.05:0.1:0.2:0.5:0.8:0.9:0.95:0.99" , |
62 | "Metrics percentiles to be collected, using : as the delimiter" ); |
63 | |
64 | C10_DEFINE_int( |
65 | torch_lazy_shape_cache_size, |
66 | 4096, |
67 | "Set the size for the shape cache used for shape inference" ); |
68 | |
69 | namespace torch { |
70 | namespace lazy { |
71 | |
72 | std::string& getLTCForceFallback() { |
73 | static std::string config; |
74 | static bool _ignore = [&]() { |
75 | char* envptr = std::getenv("LTC_FORCE_FALLBACK" ); |
76 | if (envptr) { |
77 | config = std::string(envptr); |
78 | } |
79 | return true; |
80 | }(); |
81 | (void)_ignore; // avoid unused variables warning |
82 | return config; |
83 | } |
84 | |
85 | } // namespace lazy |
86 | } // namespace torch |
87 | |