Skip to content

Commit a4fe530

Browse files
authored
add graph_net/tools/fusible_subgraph_generate.sh (#476)
* init 'symbolic_dimension_reifier' field in graph_net.json * remove unused files * refactor cumsum_num_kernels_generator.py to support start_offset_in_original_graph * add sample_pass/fusible_subgraph_ranges_generator.py * refactor FusibleSubgraphRangesGenerator to make a better fusible subgraph detection * add torch/sample_passes/subgraph_generator.py * add start signature and end signature iinformation in subgraph model name * add graph_net/tools/fusible_subgraph_generate.sh
1 parent 934a57f commit a4fe530

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
GRAPH_NET_ROOT=$(python3 -c "import graph_net; import os; print(os.path.dirname(os.path.dirname(graph_net.__file__)))")
4+
5+
model_path_list=$GRAPH_NET_ROOT/graph_net/test/dev_model_list/cumsum_num_kernels_sample_list.txt
6+
WORKSPACE_ROOT=/tmp/fusible_subgraphs
7+
CUMSUM_NUM_KERNELS_WORKSPACE=$WORKSPACE_ROOT/workspace_cumsum_num_kernels
8+
FUSIBLE_SUBGRAPH_RANGES_WORKSPACE=$WORKSPACE_ROOT/workspace_fusible_subgraph_ranges
9+
FUSIBLE_SUBGRAPH_SAMPLES_WORKSPACE=$WORKSPACE_ROOT/workspace_fusible_subgraph_samples
10+
resume=false
11+
12+
python3 -m graph_net.model_path_handler \
13+
--model-path-list "$model_path_list" \
14+
--handler-config $(base64 -w 0 <<EOF
15+
{
16+
"handler_path": "$GRAPH_NET_ROOT/graph_net/torch/sample_passes/cumsum_num_kernels_generator.py",
17+
"handler_class_name": "CumSumNumKernelsGenerator",
18+
"handler_config": {
19+
"output_json_file_name": "cumsum_num_kernels.json",
20+
"model_path_prefix": "$GRAPH_NET_ROOT",
21+
"output_dir": "$CUMSUM_NUM_KERNELS_WORKSPACE",
22+
"resume": $resume
23+
}
24+
}
25+
EOF
26+
)
27+
28+
python3 -m graph_net.model_path_handler \
29+
--model-path-list "$model_path_list" \
30+
--handler-config $(base64 -w 0 <<EOF
31+
{
32+
"handler_path": "$GRAPH_NET_ROOT/graph_net/sample_pass/fusible_subgraph_ranges_generator.py",
33+
"handler_class_name": "FusibleSubgraphRangesGenerator",
34+
"handler_config": {
35+
"model_path_prefix": "$CUMSUM_NUM_KERNELS_WORKSPACE",
36+
"input_json_file_name": "cumsum_num_kernels.json",
37+
"output_json_file_name": "fusible_subgraph_ranges.json",
38+
"output_dir": "$FUSIBLE_SUBGRAPH_RANGES_WORKSPACE",
39+
"resume": $resume
40+
}
41+
}
42+
EOF
43+
)
44+
45+
python3 -m graph_net.model_path_handler \
46+
--model-path-list "$model_path_list" \
47+
--handler-config $(base64 -w 0 <<EOF
48+
{
49+
"handler_path": "$GRAPH_NET_ROOT/graph_net/torch/sample_passes/subgraph_generator.py",
50+
"handler_class_name": "SubgraphGenerator",
51+
"handler_config": {
52+
"model_path_prefix": "$GRAPH_NET_ROOT",
53+
"output_dir": "$FUSIBLE_SUBGRAPH_SAMPLES_WORKSPACE",
54+
"subgraph_ranges_json_root": "$FUSIBLE_SUBGRAPH_RANGES_WORKSPACE",
55+
"resume": $resume
56+
}
57+
}
58+
EOF
59+
)

0 commit comments

Comments
 (0)