Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/bailout_graph.h +32 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/batch_mm.h +9 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/canonicalize.h +20 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/canonicalize_graph_fuser_ops.h +9 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/check_strict_fusion.h +10 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/clear_profiling.h +17 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/clear_undefinedness.h +22 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/common_subexpression_elimination.h +9 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/concat_opt.h +17 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/constant_pooling.h +9 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/constant_propagation.h +30 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/create_autodiff_subgraphs.h +17 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/create_functional_graphs.h +12 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/dbr_quantization/remove_redundant_aliases.h +19 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/dead_code_elimination.h +40 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/decompose_ops.h +9 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/device_type_analysis.h +11 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/dtype_analysis.h +15 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/eliminate_no_ops.h +15 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/erase_number_types.h +21 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/fixup_trace_scope_blocks.h +45 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/fold_conv_bn.h +35 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/fold_linear_bn.h +27 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/freeze_module.h +34 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/frozen_concat_linear.h +11 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/frozen_conv_add_relu_fusion.h +13 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/frozen_conv_folding.h +22 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/frozen_graph_optimizations.h +20 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/frozen_linear_folding.h +12 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/frozen_linear_transpose.h +11 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/frozen_ops_to_mkldnn.h +13 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/fuse_linear.h +22 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/fuse_relu.h +9 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/graph_fuser.h +35 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/graph_rewrite_helper.h +50 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/guard_elimination.h +17 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/hoist_conv_packed_params.h +10 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/inline_autodiff_subgraphs.h +13 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/inline_fork_wait.h +14 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/inline_forked_closures.h +10 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/inliner.h +12 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/inplace_check.h +9 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/insert_guards.h +19 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/integer_value_refinement.h +10 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/lift_closures.h +10 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/liveness.h +22 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/loop_unrolling.h +34 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/lower_grad_of.h +15 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/lower_graph.h +20 -0
- code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/lower_tuples.h +18 -0
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/bailout_graph.h
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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::jit {
|
| 14 |
+
|
| 15 |
+
// Replaces prim::Guard nodes with prim::BailOut nodes and
|
| 16 |
+
// computes sets of inputs needed to resume execution at
|
| 17 |
+
// bailout points
|
| 18 |
+
TORCH_API void InsertBailOuts(std::shared_ptr<Graph> graph);
|
| 19 |
+
|
| 20 |
+
// Builds a bailout graph into `target` (which is an empty graph)
|
| 21 |
+
// for a given bailout point `bailout_index`
|
| 22 |
+
// from the original graph `orig` (the original unoptimized graph)
|
| 23 |
+
// BailOut graphs allow Interpreter to resume
|
| 24 |
+
// execution of the (un/de)optimized graph (i.e.
|
| 25 |
+
// a graph that doesn't rely on any assumptions derived from
|
| 26 |
+
// on profiling information) from a given BailOut point
|
| 27 |
+
// should any of the assumptions fail for an actual input.
|
| 28 |
+
TORCH_API std::shared_ptr<Graph> BuildBailOutGraphFrom(
|
| 29 |
+
int64_t bailout_index,
|
| 30 |
+
const std::shared_ptr<Graph>& orig,
|
| 31 |
+
const std::shared_ptr<Graph>& target);
|
| 32 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/batch_mm.h
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
TORCH_API void BatchMM(std::shared_ptr<Graph>& graph);
|
| 8 |
+
|
| 9 |
+
}
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/canonicalize.h
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
TORCH_API std::shared_ptr<Graph> Canonicalize(
|
| 8 |
+
const std::shared_ptr<Graph>& graph,
|
| 9 |
+
bool keep_unique_names = true);
|
| 10 |
+
|
| 11 |
+
TORCH_API void CanonicalizeOutputs(std::shared_ptr<Graph>& graph);
|
| 12 |
+
|
| 13 |
+
TORCH_API std::optional<const Use> firstOrLastUse(Value* v, bool find_first);
|
| 14 |
+
|
| 15 |
+
TORCH_API bool isBeforeOrAfter(
|
| 16 |
+
const Use& a,
|
| 17 |
+
const Use& b,
|
| 18 |
+
bool checking_before);
|
| 19 |
+
|
| 20 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/canonicalize_graph_fuser_ops.h
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
TORCH_API void CanonicalizeOps(const std::shared_ptr<Graph>& graph);
|
| 8 |
+
|
| 9 |
+
}
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/check_strict_fusion.h
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 5 |
+
|
| 6 |
+
namespace torch::jit {
|
| 7 |
+
|
| 8 |
+
TORCH_API void CheckStrictFusion(std::shared_ptr<Graph>& graph);
|
| 9 |
+
|
| 10 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/clear_profiling.h
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <ATen/ATen.h>
|
| 4 |
+
#include <ATen/core/ivalue.h>
|
| 5 |
+
#include <ATen/core/jit_type.h>
|
| 6 |
+
#include <torch/csrc/Export.h>
|
| 7 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 8 |
+
|
| 9 |
+
namespace torch::jit {
|
| 10 |
+
|
| 11 |
+
TORCH_API void unprofileGraphInputs(const std::shared_ptr<Graph>& graph);
|
| 12 |
+
TORCH_API void unprofileBlock(Block* start_block);
|
| 13 |
+
// Unprofiles all the node outputs in a block.
|
| 14 |
+
|
| 15 |
+
TORCH_API void ClearProfilingInformation(const std::shared_ptr<Graph>& graph);
|
| 16 |
+
|
| 17 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/clear_undefinedness.h
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <ATen/ATen.h>
|
| 4 |
+
#include <ATen/core/ivalue.h>
|
| 5 |
+
#include <ATen/core/jit_type.h>
|
| 6 |
+
#include <torch/csrc/Export.h>
|
| 7 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 8 |
+
|
| 9 |
+
namespace torch::jit {
|
| 10 |
+
|
| 11 |
+
// Undefinedness makes argument matching fail for regular tensor operations
|
| 12 |
+
// if 1+ arguments are undefined or possibly undefined tensors.
|
| 13 |
+
// Technically, undefined tensors are **not** tensors as the regular tensor
|
| 14 |
+
// operations do not know how to handle them.
|
| 15 |
+
// However, in practice, there are guards and conversion operators that
|
| 16 |
+
// **always** gate regular operations if undefined tensors may be present
|
| 17 |
+
// Eventually, we would love to move to the world where we use optionals
|
| 18 |
+
// in lieu of undefined tensors.
|
| 19 |
+
// When this happens, this pass will be removed
|
| 20 |
+
TORCH_API void ClearUndefinedness(const std::shared_ptr<Graph>& graph);
|
| 21 |
+
|
| 22 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/common_subexpression_elimination.h
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
TORCH_API bool EliminateCommonSubexpression(
|
| 8 |
+
const std::shared_ptr<Graph>& graph);
|
| 9 |
+
}
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/concat_opt.h
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// Eliminates common inputs among `aten::cat` ops.
|
| 8 |
+
TORCH_API bool EliminateConcatCommonInputs(const std::shared_ptr<Graph>& graph);
|
| 9 |
+
|
| 10 |
+
// Expands `aten::cat` ops into `aten::copy` ops and eliminates redudancies
|
| 11 |
+
// in the buffers used for concatenation if possible.
|
| 12 |
+
TORCH_API void ExpandConcatAndEliminateRedundancy(
|
| 13 |
+
const std::shared_ptr<Graph>& graph);
|
| 14 |
+
|
| 15 |
+
TORCH_API bool CombineConcats(const std::shared_ptr<Graph>& graph);
|
| 16 |
+
|
| 17 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/constant_pooling.h
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
TORCH_API void ConstantPooling(const std::shared_ptr<Graph>& graph);
|
| 8 |
+
|
| 9 |
+
}
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/constant_propagation.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// Runs constant propagation on all objects unless ignore_custom_classes is
|
| 8 |
+
// specified as true, in which case user defined classes are skipped. This is
|
| 9 |
+
// useful to prevent early fusion of packing operations, which end up lowering
|
| 10 |
+
// away information about their constructors (e.g. packed::linear_clamp_prepack
|
| 11 |
+
// and prepacked::conv2d_clamp_prepack)
|
| 12 |
+
// Returns True if the pass made a change to the graph
|
| 13 |
+
TORCH_API bool ConstantPropagation(
|
| 14 |
+
std::shared_ptr<Graph>& graph,
|
| 15 |
+
bool ignore_custom_classes = false);
|
| 16 |
+
|
| 17 |
+
// runs constant propagation only on ops that have non-aliasing inputs & outputs
|
| 18 |
+
// Returns True if the pass made a change to the graph
|
| 19 |
+
TORCH_API bool ConstantPropagationImmutableTypes(std::shared_ptr<Graph>& graph);
|
| 20 |
+
|
| 21 |
+
// Runs the node if its inputs are constants. Callers of this function must
|
| 22 |
+
// make their own determination if constant prop is appropriate - for example
|
| 23 |
+
// non-deterministic ops or ops with side effects. If ignore_custom_classes is
|
| 24 |
+
// specified, nodes that output user defined classes are not run.
|
| 25 |
+
TORCH_API std::optional<Stack> runNodeIfInputsAreConstant(
|
| 26 |
+
const Node* node,
|
| 27 |
+
bool ignore_custom_classes = false,
|
| 28 |
+
AliasDb* db = nullptr);
|
| 29 |
+
|
| 30 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/create_autodiff_subgraphs.h
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/Export.h>
|
| 4 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 5 |
+
|
| 6 |
+
#include <cstddef>
|
| 7 |
+
|
| 8 |
+
namespace torch::jit {
|
| 9 |
+
|
| 10 |
+
// insert GraphExecutor nodes that group together
|
| 11 |
+
// subgraphs that are differentiable by the jit's autodiff passes
|
| 12 |
+
// threshold - minimum number of nodes that will appear in a block
|
| 13 |
+
// returns all differentiable blocks that have been found
|
| 14 |
+
TORCH_API std::vector<Node*> CreateAutodiffSubgraphs(
|
| 15 |
+
const std::shared_ptr<Graph>& graph,
|
| 16 |
+
size_t threshold = 2);
|
| 17 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/create_functional_graphs.h
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/Export.h>
|
| 4 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 5 |
+
|
| 6 |
+
namespace torch::jit {
|
| 7 |
+
|
| 8 |
+
TORCH_API void CreateFunctionalGraphs(const std::shared_ptr<Graph>& graph);
|
| 9 |
+
|
| 10 |
+
TORCH_API void InlineFunctionalGraphs(const std::shared_ptr<Graph>& graph);
|
| 11 |
+
|
| 12 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/dbr_quantization/remove_redundant_aliases.h
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/api/module.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// This function replaces instances of
|
| 8 |
+
//
|
| 9 |
+
// %b = aten::alias(%a)
|
| 10 |
+
// %c = foo(%b)
|
| 11 |
+
//
|
| 12 |
+
// with
|
| 13 |
+
//
|
| 14 |
+
// %c = foo(%a)
|
| 15 |
+
//
|
| 16 |
+
// on the module forward, if it's safe to do so.
|
| 17 |
+
TORCH_API Module DBRQuantRemoveRedundantAliases(Module& module);
|
| 18 |
+
|
| 19 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/dead_code_elimination.h
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// If given a top-level graph, DCE will construct do alias analysis that allows
|
| 8 |
+
// for "smarter" dead code elimination (we will eliminate mutable ops if we can
|
| 9 |
+
// prove the mutated values are not used). Otherwise, we will not allow DCE to
|
| 10 |
+
// eliminate mutable ops.
|
| 11 |
+
//
|
| 12 |
+
// So, prefer to use the graph version if you can.
|
| 13 |
+
enum class DCESideEffectPolicy : uint8_t {
|
| 14 |
+
// default behavior: dead code elimination will check if a node has side
|
| 15 |
+
// effects
|
| 16 |
+
// and not delete it if it does.
|
| 17 |
+
DONT_DELETE_NODES_WITH_SIDE_EFFECTS,
|
| 18 |
+
// with this flag, dead code elimination will not check if a node has side
|
| 19 |
+
// effects and treat nodes with side effects like any other node,
|
| 20 |
+
// i.e. delete them if their outputs aren't used anywhere.
|
| 21 |
+
ALLOW_DELETING_NODES_WITH_SIDE_EFFECTS
|
| 22 |
+
};
|
| 23 |
+
|
| 24 |
+
TORCH_API void EliminateDeadCode(
|
| 25 |
+
const std::shared_ptr<Graph>& graph,
|
| 26 |
+
DCESideEffectPolicy sideEffectPolicy =
|
| 27 |
+
DCESideEffectPolicy::DONT_DELETE_NODES_WITH_SIDE_EFFECTS);
|
| 28 |
+
TORCH_API void EliminateDeadCode(
|
| 29 |
+
Block* block,
|
| 30 |
+
bool recurse = true,
|
| 31 |
+
DCESideEffectPolicy sideEffectPolicy =
|
| 32 |
+
DCESideEffectPolicy::DONT_DELETE_NODES_WITH_SIDE_EFFECTS);
|
| 33 |
+
|
| 34 |
+
// Invoke the user-provided callback on all live values before deleting anything
|
| 35 |
+
TORCH_API void EliminateDeadCode(
|
| 36 |
+
Block* block,
|
| 37 |
+
std::function<void(const std::unordered_set<const Value*>&)> cb,
|
| 38 |
+
DCESideEffectPolicy sideEffectPolicy =
|
| 39 |
+
DCESideEffectPolicy::DONT_DELETE_NODES_WITH_SIDE_EFFECTS);
|
| 40 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/decompose_ops.h
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
TORCH_API void DecomposeOps(std::shared_ptr<Graph>& graph);
|
| 8 |
+
|
| 9 |
+
}
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/device_type_analysis.h
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
struct Graph;
|
| 7 |
+
|
| 8 |
+
// Propagates Device type info throughout the given graph.
|
| 9 |
+
TORCH_API bool DeviceTypePropagation(std::shared_ptr<Graph>& graph);
|
| 10 |
+
|
| 11 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/dtype_analysis.h
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/Export.h>
|
| 4 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 5 |
+
#include <memory>
|
| 6 |
+
|
| 7 |
+
namespace torch::jit {
|
| 8 |
+
struct Graph;
|
| 9 |
+
|
| 10 |
+
// Propagate tensor properties (e.g., dtype, device, is_contiguous, layout)
|
| 11 |
+
// propagation on all tensor objects. Currently, we only support dtype
|
| 12 |
+
// propagation
|
| 13 |
+
TORCH_API bool DtypePropagation(std::shared_ptr<Graph>& graph);
|
| 14 |
+
|
| 15 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/eliminate_no_ops.h
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// Remove ops that do nothing on the forward pass (like aten::detach).
|
| 8 |
+
// This pass is invoked as a part of freeze_module.
|
| 9 |
+
// This function also takes a set of custom ops to eliminate. All ops in this
|
| 10 |
+
// set must take their output as their first input, i.e. x = f(x, ...)
|
| 11 |
+
TORCH_API bool EliminateNoOps(
|
| 12 |
+
std::shared_ptr<Graph>& graph,
|
| 13 |
+
std::unordered_set<c10::Symbol> custom_ops = {});
|
| 14 |
+
|
| 15 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/erase_number_types.h
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// Erase NumberType information. This is necessary for and only used in
|
| 8 |
+
// exporting to ONNX. This pass ensures that no remaining Values have
|
| 9 |
+
// NumberType types, replacing them with tensors.
|
| 10 |
+
// The following things are done to erase NumberType info:
|
| 11 |
+
// - NumberType outputs are changed to DynamicType.
|
| 12 |
+
// - prim::Constant nodes which are numbers get changed into 0-dim tensors of
|
| 13 |
+
// the corresponding type
|
| 14 |
+
// - prim::TensorToNum, aten::Float, aten::Int and prim::NumToTensor nodes
|
| 15 |
+
// are erased.
|
| 16 |
+
//
|
| 17 |
+
// The pass assumes that DCE will be called sometime after.
|
| 18 |
+
TORCH_API void EraseNumberTypes(const std::shared_ptr<Graph>& graph);
|
| 19 |
+
TORCH_API void EraseNumberTypesOnBlock(Block* block);
|
| 20 |
+
|
| 21 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/fixup_trace_scope_blocks.h
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/api/module.h>
|
| 4 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 5 |
+
|
| 6 |
+
namespace torch::jit {
|
| 7 |
+
|
| 8 |
+
// Directly after tracing, we have an ill-formed graph with blocks inserted.
|
| 9 |
+
// Example:
|
| 10 |
+
//
|
| 11 |
+
// graph(%self : ClassType<Module>,
|
| 12 |
+
// %input.1 : Float(3, 4)):
|
| 13 |
+
// %1 : ClassType<Module> = prim::GetAttr[name="relu1"](%self)
|
| 14 |
+
// %2 : ClassType<Module> = prim::GetAttr[name="relu2"](%self)
|
| 15 |
+
// %3 : ClassType<Module> = prim::GetAttr[name="rrr"](%2)
|
| 16 |
+
// = prim::TracedModuleForward[scope="__module.relu1"]()
|
| 17 |
+
// block0():
|
| 18 |
+
// %input : Float(3, 4) = aten::relu(%input.1),
|
| 19 |
+
// -> ()
|
| 20 |
+
// = prim::TracedModuleForward[scope="__module.relu2"](),
|
| 21 |
+
// block0():
|
| 22 |
+
// = prim::TracedModuleForward[scope="__module.relu2.rrr"](),
|
| 23 |
+
// block0():
|
| 24 |
+
// %6 : Float(3, 4) = aten::relu(%input),
|
| 25 |
+
// -> ()
|
| 26 |
+
// -> ()
|
| 27 |
+
// return (%6)
|
| 28 |
+
//
|
| 29 |
+
// In this pass, we:
|
| 30 |
+
// 1) Lift Value defs to as high of a scope as needed to ensure that
|
| 31 |
+
// they dominate all their uses. For example, `input` in the above
|
| 32 |
+
// graph needs to be lifted to the top-level block so that its use
|
| 33 |
+
// in the second `relu` operator is dominated.
|
| 34 |
+
// 2) Lambda lift the blocks. This ensures that all values used within
|
| 35 |
+
// each scope have their defs captured.
|
| 36 |
+
// 3) Convert the scope blocks into methods on their respective Modules,
|
| 37 |
+
// and convert TracedModuleForward nodes to CallMethod nodes into those
|
| 38 |
+
// methods.
|
| 39 |
+
//
|
| 40 |
+
// Then, we'll have a well-formed graph with proper method calls.
|
| 41 |
+
TORCH_API void FixupTraceScopeBlocks(
|
| 42 |
+
std::shared_ptr<Graph>& graph,
|
| 43 |
+
Module* self);
|
| 44 |
+
|
| 45 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/fold_conv_bn.h
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/api/module.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
/** \brief Fold Conv2d-BatchNorm2d into Conv2d in all methods of this
|
| 8 |
+
* module and all its submodules, forward is included by default.
|
| 9 |
+
*
|
| 10 |
+
* The weight and bias of the Conv2d are correspondingly updated. Should only be
|
| 11 |
+
* used on modules in eval mode.
|
| 12 |
+
*/
|
| 13 |
+
TORCH_API Module FoldConvBatchNorm(const Module& module);
|
| 14 |
+
|
| 15 |
+
struct TORCH_API ConvBNParameters {
|
| 16 |
+
at::Tensor conv_w;
|
| 17 |
+
at::Tensor conv_b;
|
| 18 |
+
at::Tensor bn_rm;
|
| 19 |
+
at::Tensor bn_rv;
|
| 20 |
+
double bn_eps = 0.0;
|
| 21 |
+
at::Tensor bn_w;
|
| 22 |
+
at::Tensor bn_b;
|
| 23 |
+
};
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Given the current weight and bias tensors of a Conv module and parameters
|
| 27 |
+
* of the BatchNorm module we're folding with, compute the updated values
|
| 28 |
+
* for the weight and bias.
|
| 29 |
+
*
|
| 30 |
+
* The function is basically copied from torch/nn/utils/fusion.py
|
| 31 |
+
*/
|
| 32 |
+
TORCH_API std::tuple<at::Tensor, at::Tensor> computeUpdatedConvWeightAndBias(
|
| 33 |
+
const ConvBNParameters& p);
|
| 34 |
+
|
| 35 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/fold_linear_bn.h
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/api/module.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
struct TORCH_API LinearBNParameters {
|
| 8 |
+
at::Tensor linear_w;
|
| 9 |
+
at::Tensor linear_b;
|
| 10 |
+
at::Tensor bn_rm;
|
| 11 |
+
at::Tensor bn_rv;
|
| 12 |
+
double bn_eps = 0.0;
|
| 13 |
+
at::Tensor bn_w;
|
| 14 |
+
at::Tensor bn_b;
|
| 15 |
+
};
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* Given the current weight and bias tensors of a Linear module and parameters
|
| 19 |
+
* of the BatchNorm module we're folding with, compute the updated values
|
| 20 |
+
* for the weight and bias.
|
| 21 |
+
*
|
| 22 |
+
* The function is basically copied from torch/nn/utils/fusion.py
|
| 23 |
+
*/
|
| 24 |
+
TORCH_API std::tuple<at::Tensor, at::Tensor> computeUpdatedLinearWeightAndBias(
|
| 25 |
+
const LinearBNParameters& p);
|
| 26 |
+
|
| 27 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/freeze_module.h
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/** \brief This file defines freezing Torchscript module API.
|
| 2 |
+
*
|
| 3 |
+
* This API has python-binding and can be invoked directly or as a part of
|
| 4 |
+
* general optimization pipeline.
|
| 5 |
+
*/
|
| 6 |
+
#pragma once
|
| 7 |
+
|
| 8 |
+
#include <torch/csrc/jit/api/module.h>
|
| 9 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 10 |
+
|
| 11 |
+
/** \brief Freeze Module, i.e., Assume all attributes are constants.
|
| 12 |
+
*
|
| 13 |
+
* Freezing module is a functionality that allows the JIT to internalize
|
| 14 |
+
* immutable attributes. Combined with inlining, the module is aggressively
|
| 15 |
+
* optimized and significant overhead is optimized away. The freezeModule API
|
| 16 |
+
* produces a cloned frozen module.
|
| 17 |
+
*/
|
| 18 |
+
|
| 19 |
+
namespace torch::jit {
|
| 20 |
+
|
| 21 |
+
TORCH_API Module freeze_module(
|
| 22 |
+
const Module& module,
|
| 23 |
+
std::vector<std::string> preservedAttrs = std::vector<std::string>(),
|
| 24 |
+
bool freezeInterfaces = true,
|
| 25 |
+
bool preserveParameters = false);
|
| 26 |
+
|
| 27 |
+
// Clone-free version of freeze_module. This modifies the module inplace.
|
| 28 |
+
// Use this version to avoid extra memory usage incurred by cloning the module.
|
| 29 |
+
TORCH_API void freeze_module_inplace(
|
| 30 |
+
Module* module,
|
| 31 |
+
std::vector<std::string> preservedAttrs = std::vector<std::string>(),
|
| 32 |
+
bool freezeInterfaces = true,
|
| 33 |
+
bool preserveParameters = false);
|
| 34 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/frozen_concat_linear.h
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// Concats multiple linear ops with the same Tensor input
|
| 8 |
+
// into a single linear op.
|
| 9 |
+
TORCH_API bool FrozenConcatLinear(std::shared_ptr<Graph>& graph);
|
| 10 |
+
|
| 11 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/frozen_conv_add_relu_fusion.h
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/api/module.h>
|
| 4 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 5 |
+
|
| 6 |
+
namespace torch::jit {
|
| 7 |
+
|
| 8 |
+
TORCH_API extern std::function<void(std::shared_ptr<Graph>&)>&
|
| 9 |
+
getFuseFrozenConvAddReluImpl();
|
| 10 |
+
|
| 11 |
+
TORCH_API void FuseFrozenConvAddRelu(std::shared_ptr<Graph>& graph);
|
| 12 |
+
|
| 13 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/frozen_conv_folding.h
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// Fuses Convolution -> Batchnorm into a single Convolution by
|
| 8 |
+
// folding batchnorm weights into conv weights.
|
| 9 |
+
// This pass only works on Frozen Graphs; otherwise it is a No-Op.
|
| 10 |
+
TORCH_API bool FoldFrozenConvBatchnorm(std::shared_ptr<Graph>& graph);
|
| 11 |
+
|
| 12 |
+
// Fuses Convolution -> Add/Sub into a single Convolution by
|
| 13 |
+
// folding add constant tensor into conv weights.
|
| 14 |
+
// This pass only works on Frozen Graphs; otherwise it is a No-Op.
|
| 15 |
+
TORCH_API bool FoldFrozenConvAddOrSub(std::shared_ptr<Graph>& graph);
|
| 16 |
+
|
| 17 |
+
// Fuses Convolution -> Mul/Div into a single Convolution by
|
| 18 |
+
// folding add constant tensor into conv weights.
|
| 19 |
+
// This pass only works on Frozen Graphs; otherwise it is a No-Op.
|
| 20 |
+
TORCH_API bool FoldFrozenConvMulOrDiv(std::shared_ptr<Graph>& graph);
|
| 21 |
+
|
| 22 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/frozen_graph_optimizations.h
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
/** \brief Runs a set of Optimizations that Optimize Frozen Graphs
|
| 6 |
+
*
|
| 7 |
+
* Currently this set of optimizations is:
|
| 8 |
+
* - FoldFrozenConvBatchnorm
|
| 9 |
+
* - FoldFrozenConvAddOrSub
|
| 10 |
+
* - FoldFrozenConvMulOrDiv
|
| 11 |
+
* - FoldFrozenLinearBatchnorm
|
| 12 |
+
*/
|
| 13 |
+
|
| 14 |
+
namespace torch::jit {
|
| 15 |
+
|
| 16 |
+
TORCH_API void OptimizeFrozenGraph(
|
| 17 |
+
std::shared_ptr<Graph>& graph,
|
| 18 |
+
bool optimize_numerics = true);
|
| 19 |
+
|
| 20 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/frozen_linear_folding.h
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// Fuses Linear -> BatchNormNd into a single Linear by
|
| 8 |
+
// folding batchnorm weights into linear weights.
|
| 9 |
+
// This pass only works on Frozen Graphs; otherwise it is a No-Op.
|
| 10 |
+
TORCH_API bool FoldFrozenLinearBatchnorm(std::shared_ptr<Graph>& graph);
|
| 11 |
+
|
| 12 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/frozen_linear_transpose.h
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// Transposes the weight matrix for frozen linear modules.
|
| 8 |
+
// and converts it into a matmul
|
| 9 |
+
TORCH_API bool FrozenLinearTranspose(std::shared_ptr<Graph>& graph);
|
| 10 |
+
|
| 11 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/frozen_ops_to_mkldnn.h
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// Converts operators & their parameters to mkldnn if it is profitable
|
| 8 |
+
// Currently encompassing Conv2d and Conv3d, and Linear
|
| 9 |
+
// Op must be in float32 and mkldnn must be built
|
| 10 |
+
// This pass only works on frozen graph
|
| 11 |
+
TORCH_API void ConvertFrozenOpsToMKLDNN(std::shared_ptr<Graph>& graph);
|
| 12 |
+
|
| 13 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/fuse_linear.h
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/** \brief Fusing linear patterns as single at::linear for easier pattern
|
| 2 |
+
* matching in later passes
|
| 3 |
+
*/
|
| 4 |
+
#pragma once
|
| 5 |
+
|
| 6 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 7 |
+
|
| 8 |
+
namespace torch::jit {
|
| 9 |
+
|
| 10 |
+
/** \brief Match the at::linear pattern and fuse it into a single at::linear
|
| 11 |
+
* This pass fuse the addmm or matmul + add generated by JIT back to linear
|
| 12 |
+
* This pass can be deleted once the JIT can emit the aten::linear in the future
|
| 13 |
+
*/
|
| 14 |
+
TORCH_API void FuseLinear(std::shared_ptr<Graph>& graph);
|
| 15 |
+
|
| 16 |
+
/** Swap functional linear CallFunctions to aten::linear
|
| 17 |
+
*/
|
| 18 |
+
TORCH_API void SwapFunctionalLinear(std::shared_ptr<Graph>& graph);
|
| 19 |
+
/** Swap all functional linear CallFunctions in module
|
| 20 |
+
*/
|
| 21 |
+
TORCH_API void SwapFunctionalLinear(Module& module);
|
| 22 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/fuse_relu.h
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/api/module.h>
|
| 4 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 5 |
+
|
| 6 |
+
namespace torch::jit {
|
| 7 |
+
TORCH_API void FuseAddRelu(script::Module& module);
|
| 8 |
+
TORCH_API void FuseAddRelu(std::shared_ptr<Graph>& graph);
|
| 9 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/graph_fuser.h
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
TORCH_API bool canFuseOnCPULegacy();
|
| 8 |
+
TORCH_API void overrideCanFuseOnCPULegacy(bool value);
|
| 9 |
+
|
| 10 |
+
// NB: Be sure to run DCE before fusion, because dead instructions
|
| 11 |
+
// can prevent fusion opportunities from being exploited.
|
| 12 |
+
// On Windows will noop, NYI
|
| 13 |
+
TORCH_API void FuseGraph(
|
| 14 |
+
std::shared_ptr<Graph>& graph,
|
| 15 |
+
bool strict_fuser_check = false);
|
| 16 |
+
|
| 17 |
+
// \brief Custom fusion pass using a node-level callback to
|
| 18 |
+
// determine the inclusion of nodes in a subgraph.
|
| 19 |
+
//
|
| 20 |
+
// This helper omits aliased inputs and fusion across control flow
|
| 21 |
+
// boundaries.
|
| 22 |
+
//
|
| 23 |
+
// \arg graph The graph to be modified in-place
|
| 24 |
+
// \arg is_fusable A callback run on each fusable node in the graph.
|
| 25 |
+
// \arg kind The label given to the resultant fused subgraph
|
| 26 |
+
// \arg arg_limit The maximum number of args the resultant fused subgraph
|
| 27 |
+
// should have. Note: This will likely develop into a general
|
| 28 |
+
// post condition on the fused subgraph.
|
| 29 |
+
TORCH_API void CustomFuseGraph(
|
| 30 |
+
std::shared_ptr<Graph>& graph,
|
| 31 |
+
const std::function<bool(Node*)>& is_fusable,
|
| 32 |
+
Symbol kind,
|
| 33 |
+
size_t arg_limit = std::numeric_limits<size_t>::max());
|
| 34 |
+
|
| 35 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/graph_rewrite_helper.h
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
#include <torch/csrc/jit/ir/irparser.h>
|
| 5 |
+
#include <torch/csrc/jit/ir/subgraph_matcher.h>
|
| 6 |
+
#include <torch/csrc/jit/passes/subgraph_rewrite.h>
|
| 7 |
+
|
| 8 |
+
namespace torch::jit::graph_rewrite_helper {
|
| 9 |
+
|
| 10 |
+
std::string getFuncName(Value* func_value);
|
| 11 |
+
Value* getValue(
|
| 12 |
+
const std::string& name,
|
| 13 |
+
const std::unordered_map<const Value*, Value*>& match_vmap,
|
| 14 |
+
const std::unordered_map<std::string, Value*>& vmap);
|
| 15 |
+
std::optional<IValue> getIValue(
|
| 16 |
+
const std::string& name,
|
| 17 |
+
const std::unordered_map<const Value*, Value*>& match_vmap,
|
| 18 |
+
const std::unordered_map<std::string, Value*>& vmap);
|
| 19 |
+
TORCH_API void replaceConvolutionWithAtenConv(std::shared_ptr<Graph>& graph);
|
| 20 |
+
|
| 21 |
+
bool isClampFusable(
|
| 22 |
+
const Match& match,
|
| 23 |
+
const std::unordered_map<std::string, Value*>& vmap);
|
| 24 |
+
|
| 25 |
+
// This struct contains a compiled IR patterns slated for use in the
|
| 26 |
+
// findPatternMatches function. The struct encapsulates the common
|
| 27 |
+
// information from parseIR that is used in conjunction with the
|
| 28 |
+
// pattern matching facility. A const instance of this struct can
|
| 29 |
+
// also be stored away to cache the compiled IR pattern and reduce
|
| 30 |
+
// runtime cost
|
| 31 |
+
struct PatternInfo {
|
| 32 |
+
std::string pattern_string;
|
| 33 |
+
std::unique_ptr<Graph> pattern_graph;
|
| 34 |
+
std::unordered_map<std::string, Value*> vmap;
|
| 35 |
+
std::vector<MatchFilter> filters;
|
| 36 |
+
|
| 37 |
+
static PatternInfo parse_from_str(
|
| 38 |
+
std::string pattern_string,
|
| 39 |
+
const std::vector<MatchFilter>& filters = {}) {
|
| 40 |
+
PatternInfo rv{
|
| 41 |
+
std::move(pattern_string),
|
| 42 |
+
std::make_unique<Graph>(),
|
| 43 |
+
decltype(vmap){},
|
| 44 |
+
filters};
|
| 45 |
+
parseIR(rv.pattern_string, rv.pattern_graph.get(), rv.vmap);
|
| 46 |
+
return rv;
|
| 47 |
+
}
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
} // namespace torch::jit::graph_rewrite_helper
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/guard_elimination.h
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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::jit {
|
| 14 |
+
|
| 15 |
+
TORCH_API void EliminateRedundantGuards(std::shared_ptr<Graph> graph);
|
| 16 |
+
|
| 17 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/hoist_conv_packed_params.h
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/api/module.h>
|
| 4 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 5 |
+
|
| 6 |
+
namespace torch::jit {
|
| 7 |
+
|
| 8 |
+
void HoistConvPackedParams(script::Module& m);
|
| 9 |
+
|
| 10 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/inline_autodiff_subgraphs.h
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
TORCH_API bool canRunWithAutograd(Node* node);
|
| 8 |
+
|
| 9 |
+
TORCH_API void InlineAutodiffSubgraphs(
|
| 10 |
+
std::shared_ptr<Graph>& graph,
|
| 11 |
+
size_t threshold = 5);
|
| 12 |
+
|
| 13 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/inline_fork_wait.h
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// Inline Fork and Wait calls. This is used, for example, in ONNX export, where
|
| 8 |
+
// we do not support the explicit parallelism structures and would rather
|
| 9 |
+
// just have a flat graph. This inlines the forked section in the fork()
|
| 10 |
+
// callsite and replaces uses of the result of wait() calls with the values
|
| 11 |
+
// produced from the (now-inlined) forked section.
|
| 12 |
+
TORCH_API void InlineForkWait(const std::shared_ptr<Graph>& graph);
|
| 13 |
+
|
| 14 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/inline_forked_closures.h
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/Export.h>
|
| 4 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 5 |
+
|
| 6 |
+
namespace torch::jit {
|
| 7 |
+
|
| 8 |
+
TORCH_API void inlineForkedClosures(std::shared_ptr<Graph>& to_clean);
|
| 9 |
+
|
| 10 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/inliner.h
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// Inline function and method calls.
|
| 8 |
+
TORCH_API void Inline(Graph& graph);
|
| 9 |
+
|
| 10 |
+
TORCH_API GraphFunction* tryToGraphFunction(Node* n);
|
| 11 |
+
|
| 12 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/inplace_check.h
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
TORCH_API void CheckInplace(std::shared_ptr<Graph>& graph);
|
| 8 |
+
|
| 9 |
+
}
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/insert_guards.h
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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::jit {
|
| 14 |
+
|
| 15 |
+
TORCH_API void InsertGuards(std::shared_ptr<Graph> graph);
|
| 16 |
+
|
| 17 |
+
TORCH_API void RemoveProfilingNodes(const std::shared_ptr<Graph>& graph);
|
| 18 |
+
|
| 19 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/integer_value_refinement.h
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// return true if graph is modified
|
| 8 |
+
TORCH_API bool RefineIntegerValues(const std::shared_ptr<Graph>& graph);
|
| 9 |
+
|
| 10 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/lift_closures.h
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/Export.h>
|
| 4 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 5 |
+
|
| 6 |
+
namespace torch::jit {
|
| 7 |
+
|
| 8 |
+
TORCH_API void liftClosures(const std::shared_ptr<Graph>& graph);
|
| 9 |
+
|
| 10 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/liveness.h
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/loop_unrolling.h
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// return true if graph is modified
|
| 8 |
+
TORCH_API bool UnrollLoops(std::shared_ptr<Graph>& graph);
|
| 9 |
+
|
| 10 |
+
// Only unrolls constant loops. Will unroll them regardless of loop block size
|
| 11 |
+
TORCH_API bool UnrollConstantLoops(std::shared_ptr<Graph>& graph);
|
| 12 |
+
|
| 13 |
+
TORCH_API Node* PeelLoop(Node* n, size_t times);
|
| 14 |
+
|
| 15 |
+
// return true if graph is modified
|
| 16 |
+
TORCH_API bool PeelProfilingLoops(const std::shared_ptr<Graph>& graph);
|
| 17 |
+
|
| 18 |
+
struct TORCH_API LoopsPeeler {
|
| 19 |
+
LoopsPeeler(std::function<bool(Node* n)> callback, size_t num_iterations = 1)
|
| 20 |
+
: callback_(std::move(callback)), num_iterations_(num_iterations) {}
|
| 21 |
+
|
| 22 |
+
bool run(const std::shared_ptr<Graph>& graph);
|
| 23 |
+
|
| 24 |
+
private:
|
| 25 |
+
void collectLoop(Node* n);
|
| 26 |
+
void collectLoops(Block* block);
|
| 27 |
+
void peelLoops();
|
| 28 |
+
|
| 29 |
+
std::function<bool(Node* n)> callback_ = nullptr;
|
| 30 |
+
Node* in_loop_ = nullptr;
|
| 31 |
+
std::list<Node*> loops_to_peel_;
|
| 32 |
+
size_t num_iterations_ = 1;
|
| 33 |
+
};
|
| 34 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/lower_grad_of.h
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// This pass removes 'grad_of' nodes, replacing them with conditionals of
|
| 8 |
+
// the form:
|
| 9 |
+
// if any_defined(inputs):
|
| 10 |
+
// outputs = <original_computation>
|
| 11 |
+
// else:
|
| 12 |
+
// outputs = undefineds
|
| 13 |
+
TORCH_API void LowerGradOf(Graph& g);
|
| 14 |
+
|
| 15 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/lower_graph.h
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
using ModulePtr = c10::intrusive_ptr<c10::ivalue::Object>;
|
| 8 |
+
|
| 9 |
+
// Given a graph with of a method which first argument is %self, lower it to a
|
| 10 |
+
// graph where all attributes accesses are replaced with explicit inputs of the
|
| 11 |
+
// graph (rather than results of prim::GetAttr executed on %self).
|
| 12 |
+
//
|
| 13 |
+
// Returns a tuple (graph, parameters) where the last module.parameters.size()
|
| 14 |
+
// inputs to the graph are the trainable parameters used in this method. The
|
| 15 |
+
// remaining inputs are the true inputs to the function.
|
| 16 |
+
TORCH_API std::pair<std::shared_ptr<Graph>, std::vector<IValue>> LowerGraph(
|
| 17 |
+
Graph& graph,
|
| 18 |
+
const ModulePtr& self);
|
| 19 |
+
|
| 20 |
+
} // namespace torch::jit
|
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/torch/include/torch/csrc/jit/passes/lower_tuples.h
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch::jit {
|
| 6 |
+
|
| 7 |
+
// removes tuples where TupleConstruct and TupleUnpack are matched
|
| 8 |
+
// but leaves tuples in place across if statements, loops, and as inputs/outputs
|
| 9 |
+
TORCH_API void LowerSimpleTuples(const std::shared_ptr<Graph>& graph);
|
| 10 |
+
|
| 11 |
+
// removes _all_ tuples and raises an error if some cannot be removed
|
| 12 |
+
// this is used by ONNX to ensure there are not tuples before conversion,
|
| 13 |
+
// but will not work on graphs whose inputs contain tuples.
|
| 14 |
+
TORCH_API void LowerAllTuples(const std::shared_ptr<Graph>& graph);
|
| 15 |
+
|
| 16 |
+
TORCH_API void LowerSimpleTuples(Block* block);
|
| 17 |
+
|
| 18 |
+
} // namespace torch::jit
|