1 | #pragma once |
2 | |
3 | #include <ATen/ATen.h> |
4 | #include <ATen/core/ivalue.h> |
5 | #include <ATen/core/jit_type.h> |
6 | #include <ATen/core/stack.h> |
7 | #include <torch/csrc/Export.h> |
8 | #include <torch/csrc/jit/ir/ir.h> |
9 | |
10 | #include <list> |
11 | #include <vector> |
12 | |
13 | namespace torch { |
14 | namespace jit { |
15 | |
16 | // Replaces prim::Guard nodes with prim::BailOut nodes and |
17 | // computes sets of inputs needed to resume execution at |
18 | // bailout points |
19 | TORCH_API void InsertBailOuts(std::shared_ptr<Graph> graph); |
20 | |
21 | // Builds a bailout graph into `target` (which is an empty graph) |
22 | // for a given bailout point `bailout_index` |
23 | // from the original graph `orig` (the original unoptimized graph) |
24 | // BailOut graphs allow Interpreter to resume |
25 | // execution of the (un/de)optimized graph (i.e. |
26 | // a graph that doesn't rely on any assumptions derived from |
27 | // on profiling information) from a given BailOut point |
28 | // should any of the assumptions fail for an actual input. |
29 | TORCH_API std::shared_ptr<Graph> BuildBailOutGraphFrom( |
30 | int64_t bailout_index, |
31 | const std::shared_ptr<Graph>& orig, |
32 | const std::shared_ptr<Graph>& target); |
33 | } // namespace jit |
34 | } // namespace torch |
35 | |