Skip to content

Commit 99ea131

Browse files
authored
Merge branch 'PaddlePaddle:develop' into dec1
2 parents 594f6fe + 33cbc0d commit 99ea131

File tree

20 files changed

+656
-140
lines changed

20 files changed

+656
-140
lines changed

GraphNet_technical_report.pdf

8.27 KB
Binary file not shown.

README.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33

44
<div align="center">
55

6-
![](https://img.shields.io/badge/version-v0.1-brightgreen)
76
![](https://img.shields.io/github/issues/PaddlePaddle/GraphNet?label=open%20issues)
8-
[![Documentation](https://img.shields.io/badge/documentation-blue)](./GraphNet_technical_report.pdf)
7+
[![arXiv](https://img.shields.io/badge/arXiv-2510.24035-b31b1b.svg)](https://arxiv.org/abs/2510.24035)
98
<a href="https://github.com/user-attachments/assets/125e3494-25c9-4494-9acd-8ad65ca85d03"><img src="https://img.shields.io/badge/微信-green?logo=wechat&amp"></a>
109
</div>
1110

1211
**GraphNet** is a large-scale dataset of deep learning **computation graphs**, built as a standard benchmark for **tensor compiler** optimization. It provides over 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 and reproducible evaluation of the general optimization capabilities of tensor compilers, thereby supporting advanced research such as AI for System on compilers.
1312

14-
## News
15-
- [2025-10-14] ✨ Our technical report is out: a detailed study of dataset construction and compiler benchmarking, introducing the novel performance metrics Speedup Score S(t) and Error-aware Speedup Score ES(t). [📘 GraphNet: A Large-Scale Computational Graph Dataset for Tensor Compiler Research](./GraphNet_technical_report.pdf)
13+
## 📣 News
14+
- [2025-10-14] ✨ Our technical report is out: a detailed study of dataset construction and compiler benchmarking, introducing the novel performance metrics Speedup Score S(t) and Error-aware Speedup Score ES(t). [📘 GraphNet: A Large-Scale Computational Graph Dataset for Tensor Compiler Research](https://arxiv.org/abs/2510.24035)
1615
- [2025-8-20] 🚀 The second round of [open contribution tasks](https://github.com/PaddlePaddle/Paddle/issues/74773) was released. (completed ✅)
1716
- [2025-7-30] 🚀 The first round of [open contribution tasks](https://github.com/PaddlePaddle/GraphNet/issues/44) was released. (completed ✅)
18-
## Benchmark Results
19-
We evaluate two representative tensor compiler backends, CINN (PaddlePaddle) and TorchInductor (PyTorch), on GraphNet's NLP and CV subsets. The evaluation adopts two quantitative metrics proposed in the [Technical Report](./GraphNet_technical_report.pdf):
17+
## 📊 Benchmark Results
18+
We evaluate two representative tensor compiler backends, CINN (PaddlePaddle) and TorchInductor (PyTorch), on GraphNet's NLP and CV subsets. The evaluation adopts two quantitative metrics proposed in the [Technical Report](https://arxiv.org/abs/2510.24035):
2019
- **Speedup Score** S(t) — evaluates compiler performance under varying numerical tolerance levels.
2120
<div align="center">
2221
<img src="/pics/St-result.jpg" alt="Speedup Score S_t Results" width="80%">
@@ -28,7 +27,7 @@ We evaluate two representative tensor compiler backends, CINN (PaddlePaddle) and
2827

2928
</div>
3029

31-
## Quick Start
30+
## Quick Start
3231
This section shows how to evaluate tensor compilers and reproduce benchmark results (for compiler users and developers),
3332
as well as how to contribute new computation graphs (for GraphNet contributors).
3433

@@ -97,12 +96,12 @@ python -m graph_net.plot_violin \
9796

9897
The scripts are designed to process a file structure as `/benchmark_path/category_name/`, and items on x-axis are identified by name of the sub-directories. After executing, several summary plots of result in categories (model tasks, libraries...) will be exported to `$GRAPH_NET_BENCHMARK_PATH`.
9998

100-
## 🧱 Construction & Contribution Guide
99+
### 🧱 Construction & Contribution Guide
101100
Want to understand how GraphNet is built or contribute new samples?
102101
Check out the [Construction Guide](./docs/README_contribute.md) for details on the extraction and validation workflow.
103102

104103

105-
## Future Roadmap
104+
## 🚀 Future Roadmap
106105

107106
1. Scale GraphNet to 10K+ graphs.
108107
2. Further annotate GraphNet samples into more granular sub-categories
@@ -136,10 +135,13 @@ GraphNet is released under the [MIT License](./LICENSE).
136135
If you find this project helpful, please cite:
137136

138137
```bibtex
139-
@article{li2025graphnet,
140-
title = {GraphNet: A Large-Scale Computational Graph Dataset for Tensor Compiler Research},
141-
author = {Xinqi Li and Yiqun Liu and Shan Jiang and Enrong Zheng and Huaijin Zheng and Wenhao Dai and Haodong Deng and Dianhai Yu and Yanjun Ma},
142-
year = {2025},
143-
url = {https://github.com/PaddlePaddle/GraphNet/blob/develop/GraphNet_technical_report.pdf}
138+
@misc{li2025graphnetlargescalecomputationalgraph,
139+
title={GraphNet: A Large-Scale Computational Graph Dataset for Tensor Compiler Research},
140+
author={Xinqi Li and Yiqun Liu and Shan Jiang and Enrong Zheng and Huaijin Zheng and Wenhao Dai and Haodong Deng and Dianhai Yu and Yanjun Ma},
141+
year={2025},
142+
eprint={2510.24035},
143+
archivePrefix={arXiv},
144+
primaryClass={cs.LG},
145+
url={https://arxiv.org/abs/2510.24035},
144146
}
145147
```
File renamed without changes.
File renamed without changes.

docs/README_contribute.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,23 @@ python -m graph_net.torch.validate \
6565
--model-path $GRAPH_NET_EXTRACT_WORKSPACE/model_name
6666
```
6767

68-
All the **construction constraints** will be examined automatically. After passing validation, a unique `graph_hash.txt` will be generated and later checked in CI procedure to avoid redundant.
68+
All the **construction constraints** will be examined automatically. After passing validation, a unique `graph_hash.txt` will be generated and later checked in CI procedure to avoid redundant.
69+
70+
## 📁 Repository Structure
71+
This repository is organized as follows:
72+
73+
| Directory | Description |
74+
|------------|--------------|
75+
| **graph_net/** | Core module for graph extraction, validation, and benchmarking |
76+
| **paddle_samples/** | Computation graph samples extracted from PaddlePaddle |
77+
| **samples/** | Computation graph samples extracted from PyTorch |
78+
| **docs/** | Technical documents and contributor guides|
79+
80+
Below is the structure of the **graph_net/**:
81+
```text
82+
graph_net/
83+
├─ config/ # Config files, params
84+
├─ paddle/ # PaddlePaddle graph extraction & validation
85+
├─ torch/ # PyTorch graph extraction & validation
86+
├─ test/ # Unit tests and example scripts
87+
└─ *.py # Benchmark & analysis scripts

graph_net/analysis_util.py

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,10 @@ def print_stat_info(
254254
# pi is a list of constants for t > 0 for each group
255255
pi = [0, 0]
256256

257+
is_correct_at_t1 = [False] * total_samples
258+
speedup_at_t1 = [None] * total_samples
259+
fail_type_at_t1 = ["CORRECT"] * total_samples
260+
257261
final_correct_count = 0
258262
final_correct_negative_speedup_count = 0
259263
final_correct_speedups = []
@@ -291,8 +295,8 @@ def print_stat_info(
291295
get_correctness(eager_dtypes[i], t_key, correctness_data, i)
292296
for i in range(output_count)
293297
)
294-
if not is_correct:
295-
fail_type = "accuracy"
298+
if not is_correct:
299+
fail_type = "accuracy"
296300

297301
# Collect statistics
298302
if is_correct:
@@ -306,6 +310,11 @@ def print_stat_info(
306310
if fail_type == "accuracy":
307311
acc_failure_count += 1
308312

313+
if t_key == 1:
314+
is_correct_at_t1[idx] = is_correct
315+
speedup_at_t1[idx] = speedup
316+
fail_type_at_t1[idx] = fail_type if fail_type is not None else "CORRECT"
317+
309318
# S(t) calculation
310319
if fail_type is not None or speedup is None:
311320
regularized_speedup = fpdb
@@ -320,37 +329,25 @@ def print_stat_info(
320329
# ES(t) calculation: based on state change
321330
rec_speedup_fake_degrad = 0
322331
if t_key < 1:
323-
# When t < 1, ES behaves the same as S
324332
if fail_type is not None or speedup is None:
325333
rec_speedup_fake_degrad = fpdb
326-
# print(f"sample: {sample.get('configuration').get('model')}, fail_type: {fail_type}, rec_speedup_fake_degrad: {rec_speedup_fake_degrad}")
327334
else:
328335
rec_speedup_fake_degrad = (
329336
speedup ** (negative_speedup_penalty + 1)
330337
if speedup < 1
331338
else speedup
332339
)
333340
else:
334-
# When t >= 1, ES starts applying stepwise logic
335-
# ES curve's stepwise state, initialized as 'CORRECT'
336-
es_status = ["CORRECT"] * total_samples
337-
if es_status[idx] == "CORRECT" and fail_type is not None:
338-
es_status[idx] = fail_type
339-
340-
if (
341-
es_status[idx] is not None
342-
and es_status[idx] != "CORRECT"
343-
or speedup is None
344-
):
341+
if not is_correct_at_t1[idx] or speedup_at_t1[idx] is None:
342+
fail_type_frozen = fail_type_at_t1[idx]
345343
rec_speedup_fake_degrad = fake_perf_degrad(
346-
t_key, es_status[idx], fpdb
344+
t_key, fail_type_frozen, fpdb
347345
)
348-
# print(f"sample: {sample.get('configuration').get('model')}, error type: {es_status[idx]}, rec_speedup_fake_degrad: {rec_speedup_fake_degrad}")
349-
else: # Still in a "CORRECT" state
346+
else:
350347
rec_speedup_fake_degrad = (
351-
speedup ** (negative_speedup_penalty + 1)
352-
if speedup < 1
353-
else speedup
348+
speedup_at_t1[idx] ** (negative_speedup_penalty + 1)
349+
if speedup_at_t1[idx] < 1
350+
else speedup_at_t1[idx]
354351
)
355352
rectified_speedups_fake_degrad.append(rec_speedup_fake_degrad)
356353

@@ -399,4 +396,3 @@ def print_stat_info(
399396
print(f" - pi: {pi}")
400397

401398
return s_scores, s_scores_fake_degrad
402-
return s_scores, es_scores
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import paddle
2+
from graph_net.paddle.backend.graph_compiler_backend import GraphCompilerBackend
3+
4+
5+
class CinnBackend(GraphCompilerBackend):
6+
def __call__(self, model, input_spec=None):
7+
build_strategy = paddle.static.BuildStrategy()
8+
compiled_model = paddle.jit.to_static(
9+
model,
10+
input_spec=input_spec,
11+
build_strategy=build_strategy,
12+
full_graph=True,
13+
)
14+
compiled_model.eval()
15+
program = compiled_model.forward.concrete_program.main_program
16+
return compiled_model
17+
18+
def synchronize(self):
19+
if (
20+
paddle.device.is_compiled_with_cuda()
21+
or paddle.device.is_compiled_with_rocm()
22+
):
23+
paddle.device.synchronize()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class GraphCompilerBackend:
2+
def __call__(self, model, input_spec=None):
3+
raise NotImplementedError()
4+
5+
def synchronize(self):
6+
raise NotImplementedError()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import paddle
2+
from graph_net.paddle.backend.graph_compiler_backend import GraphCompilerBackend
3+
4+
5+
class NopeBackend(GraphCompilerBackend):
6+
def __call__(self, model, input_spec=None):
7+
return model
8+
9+
def synchronize(self):
10+
if (
11+
paddle.device.is_compiled_with_cuda()
12+
or paddle.device.is_compiled_with_rocm()
13+
):
14+
paddle.device.synchronize()

0 commit comments

Comments
 (0)