xref: /aosp_15_r20/external/pytorch/torch/csrc/jit/passes/liveness.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
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 <c10/util/sparse_bitset.h>
8 #include <torch/csrc/Export.h>
9 #include <torch/csrc/jit/ir/ir.h>
10 #include <list>
11 #include <unordered_map>
12 #include <vector>
13 
14 namespace torch::jit {
15 
16 using SparseBitVector = ::c10::SparseBitVector<256>;
17 
18 // BuildLivenessSets computes "bailout" liveness which is equivalent to
19 // "{LIVE_IN} or {GEN}" or "{LIVE_OUT} - {KILL}"
20 TORCH_API std::unordered_map<Node*, std::vector<Value*>> BuildLivenessSets(
21     std::shared_ptr<Graph> graph);
22 } // namespace torch::jit
23