|
1 | 1 | # GraphNet   [](https://github.com/PaddlePaddle/GraphNet/issues/98) |
2 | 2 |
|
3 | 3 |
|
4 | | -**GraphNet** is a large-scale dataset of deep learning **computation graphs**, designed to serve as a standard benchmark and training corpus for **AI-driven tensor compiler optimization**. It contains diverse graphs extracted from state-of-the-art models, enabling effective evaluation of compiler pass optimizations across frameworks and hardware platforms. |
5 | | - |
| 4 | +**GraphNet** is a large-scale dataset of deep learning **computation graphs**, built as a standard benchmark for **tensor compiler** optimization. It provides 2.7K computation graphs extracted from state-of-the-art deep learning models spanning diverse tasks and ML frameworks. With standardized formats and rich metadata, GraphNet enables fair comparison, reproducible evaluation, and deeper research into the general optimization capabilities of tensor compilers. |
| 5 | +<br> |
| 6 | +<div align="center"> |
| 7 | +<img src="/pics/graphnet_overview.jpg" alt="GraphNet Architecture Overview" width="65%"> |
| 8 | +</div> |
6 | 9 |
|
7 | 10 | With GraphNet, users can: |
8 | | -1. Quickly benchmark the optimization performance of various compiler strategies. |
9 | | -2. Easily conduct regression tests on existing compilers. |
10 | | -3. Train AI‑for‑Systems models to automatically generate compiler optimization passes. |
| 11 | +1. **Contribute new computation graphs** through the built-in automated extraction and validation pipeline. |
| 12 | +2. **Evaluate tensor compilers** on existing graphs with the integrated compiler evaluation tool, supporting multiple compiler backends. |
| 13 | +3. **Advance research** in tensor compiler optimization using the test data and statistics provided by GraphNet. |
| 14 | + |
| 15 | + |
| 16 | + |
11 | 17 |
|
12 | 18 | **Vision**: We aim to achieve cross-hardware portability of compiler optimizations by allowing models to learn and transfer optimization strategies. It will significantly reduce the manual effort required to develop efficient operator implementations. |
13 | 19 |
|
14 | 20 |
|
15 | | -### Dataset Construction Constraints: |
| 21 | +## Dataset Construction |
| 22 | + |
| 23 | +To guarantee the dataset’s overall quality, reproducibility, and cross-compiler compatibility, we define the following construction **constraints**: |
| 24 | + |
16 | 25 | 1. Dynamic graphs must execute correctly. |
17 | 26 | 2. Graphs and their corresponding Python code must support serialization and deserialization. |
18 | 27 | 3. The full graph can be decomposed into two disjoint subgraphs. |
19 | 28 | 4. Operator names within each computation graph must be statically parseable. |
20 | 29 | 5. If custom operators are used, their implementation code must be fully accessible. |
21 | 30 |
|
22 | 31 |
|
23 | | -## ⚡ Quick Start |
| 32 | +### Graph Extraction & Validation |
24 | 33 | For full implementation details, please refer to the [Co-Creation Tutorial](https://github.com/PaddlePaddle/GraphNet/blob/develop/CONTRIBUTE_TUTORIAL.md#co-creation-tutorial). |
25 | | -### Benchmark your compiler on the model: |
26 | | - |
27 | | -**graph_net.torch.test_compiler** |
28 | | -``` |
29 | | -python3 -m graph_net.torch.test_compiler \ |
30 | | - --model-path $GRAPH_NET_EXTRACT_WORKSPACE/model_name/ \ |
31 | | - --compiler /path/to/custom/compiler |
32 | | -# Note: if --compiler is omitted, PyTorch’s built-in compiler is used by default |
33 | | -``` |
34 | 34 |
|
35 | | -### Contribute computation graphs to GraphNet: |
36 | 35 | **Demo: Extract & Validate ResNet‑18** |
37 | 36 | ``` |
38 | 37 | git clone https://github.com/PaddlePaddle/GraphNet.git |
@@ -71,22 +70,46 @@ python -m graph_net.torch.validate \ |
71 | 70 | --model-path $GRAPH_NET_EXTRACT_WORKSPACE/model_name |
72 | 71 | ``` |
73 | 72 |
|
74 | | -**graph_net.pack** |
75 | | -``` |
76 | | -# Create a ZIP archive of $GRAPH_NET_EXTRACT_WORKSPACE. |
77 | | -# The --clear-after-pack flag (True|False) determines whether to delete the workspace after packing. |
78 | | -python -m graph_net.pack \ |
79 | | - --output /path/to/output.zip \ |
80 | | - --clear-after-pack True |
81 | | -``` |
82 | 73 |
|
83 | | -Note: To configure your user details (username and email) for GraphNet, run: |
| 74 | +## Compiler Evaluation |
| 75 | + |
| 76 | +The compiler evaluation process takes a GraphNet sample as input and involves: |
| 77 | +1. Running the original model in eager mode to record a baseline. |
| 78 | +2. Compiling the model with the specified backend (e.g., CINN, TorchInductor, TVM). |
| 79 | +3. Executing the compiled model and collecting its runtime and outputs. |
| 80 | +4. Analyzing performance by comparing the compiled results against the baseline. |
| 81 | + |
| 82 | +### Evaluation Metrics |
| 83 | + |
| 84 | +We define two key metrics here: **rectified speedup** and **GraphNet Score**. Rectified speedup measures runtime performance while incorporating compilation success, time cost, and correctness. GraphNet Score aggregates the rectified speedup of a compiler on specified tasks, providing a measure of its general optimization capability. |
| 85 | + |
| 86 | +**Demo: How to benchmark your compiler on the model:** |
| 87 | + |
84 | 88 | ``` |
85 | | -python -m graph_net.config --global \ |
86 | | - --username "your-name" \ |
87 | | - --email "your-email" |
| 89 | +python3 -m graph_net.torch.test_compiler \ |
| 90 | + --model-path $GRAPH_NET_EXTRACT_WORKSPACE/model_name/ \ |
| 91 | + --compiler /path/to/custom/compiler |
| 92 | +# Note: if --compiler is omitted, PyTorch’s built-in compiler is used by default |
88 | 93 | ``` |
89 | | -Once you have packaged these extracted computation graphs, submit them to the GraphNet community via the following group chats. |
| 94 | + |
| 95 | +### Evaluation Results Example |
| 96 | + |
| 97 | +<div align="center"> |
| 98 | +<img src="/pics/Eval_result.jpg" alt="Violin plots of rectified speedup distributions" width="65%"> |
| 99 | +</div> |
| 100 | + |
| 101 | + |
| 102 | +## Roadmap |
| 103 | + |
| 104 | +1. Scale GraphNet to 10K+ graphs. |
| 105 | +2. Further annotate GraphNet samples into more granular sub-categories |
| 106 | +3. Extract samples from multi-GPU scenarios to support benchmarking and optimization for large-scale, distributed computing. |
| 107 | +4. Enable splitting full graphs into independently optimized subgraphs and operator sequences. |
| 108 | + |
| 109 | +## GraphNet Community: |
| 110 | + |
| 111 | + |
| 112 | +You can join GraphNet community via the following group chats. |
90 | 113 |
|
91 | 114 |
|
92 | 115 | <div align="center"> |
|
0 commit comments