PaddlePaddle / PaddlePaddle/FastDeploy

【热身打卡】FastDeploy 编译打卡

Open
#6,225 0 comments 0 reactions 2 assignees View on GitHub

@mattheliu is already working on this.

Since Jan 26, 2026.

Dominant language
Python
Stars
3.7k
Forks
756
Avg merge
19h 28m
Merged PRs (30d)
4

Description

[!NOTE]
🎉 V100 GPU 也可以参与热身打卡啦! 详细教程请参考:V100 Warmup Tutorial

🚀 FastDeploy 热身打卡活动

—— 从源码编译开始,解锁高性能推理框架开发之路

各位飞桨开发者大家好!

为了帮助更多小伙伴快速进入 FastDeploy 二次开发生态,熟悉大型框架的工程结构与编译流程,飞桨社区特推出本次 FastDeploy 热身打卡活动
通过亲手完成一次完整的 FastDeploy 编译与打包流程,你将正式具备参与 FastDeploy 套件开发的基础能力。

参与热身打卡活动并按照邮件模板格式将截图发送至 ext_paddle_oss@baidu.com ,还可获得社区认可与后续任务推荐资格。~

🧩 活动目标

通过本次打卡,你将掌握:

  • FastDeploy 源码结构
  • Paddle 运行时与 FastDeploy 的依赖关系
  • 自定义算子编译机制
  • wheel 构建与分发流程
  • 二次编译优化与开发调试效率提升方法

注:本次热身打卡活动需要使用 V100 GPU 或者 GPU A800 硬件,赶快行动起来吧~也可 申请AI Studio开发资源

🧰 准备环境

1. 安装 PaddlePaddle

以 GPU 版本为例(CPU 同理):

python -m pip install paddlepaddle-gpu==3.3.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
2. 克隆 FastDeploy 源码
git clone https://github.com/PaddlePaddle/FastDeploy
cd FastDeploy
3. 编译打卡流程

所有关键步骤需加 time 记录耗时,并截图保存。

Step 1:执行 FastDeploy 编译与打包
# 参数说明
# 第1个参数: 是否构建 wheel(1=构建,0=仅编译)
# 第2个参数: Python 解释器
# 第3个参数: 是否编译 CPU BF16 算子
# 第4个参数: GPU 架构(如 [80,90])

# A800 编译命令
time MAX_JOBS=24 bash build.sh 1 python false [80]

# V100 编译命令(使用 SM70 架构)
time MAX_JOBS=24 bash build.sh 1 python false [70]

编译完成后,产物位于:
FastDeploy/dist/

Step 2:初次编译/二次编译

初次编译时间较长,二次编译因为有编译缓存的存在,时间会缩短,对日常开发来说,二次编译时间才是影响开发效率的。让我们来感受下修改不同文件的二次编译时间。

  • 修改kernel_traits的头文件:custom_ops/gpu_ops/flash_mask_attn/kernel_traits.h
  • 修改transfer_output的cc文件:custom_ops/gpu_ops/transfer_output.cc
  • 修改python文件:custom_ops/gpu_ops/read_ids.py

二次编译方式:对应文件加一个空行/空格保存退出后,然后执行编译命令time MAX_JOBS=24 bash build.sh 0 python false [80](V100 使用 [70])。

Step 3:安装whl包
pip install FastDeploy/dist/xxx.whl
Step 4:运行单元测试
python tests/layers/test_ffn.py

邮件格式

标题: [Hackathon-FastDeploy 热身打卡]

内容:

飞桨团队你好,

【GitHub ID】:XXX

【打卡内容】:初次编译/二次编译/安装whl包/运行单元测试

【打卡截图】:

如:

标题: [Hackathon-FastDeploy 热身打卡]

内容:

飞桨团队你好,

【GitHub ID】:XXX(例如:paddle-hack)

【打卡内容】:初次编译&二次编译&安装whl包&运行单元测试

【打卡截图】:

硬件 Image
编译方式 参考【编译】文档(源码编译文档
初次编译命令和时间 命令:time MAX_JOBS=24 bash build.sh 1 python false [80]
时间:以下时间仅作为示例,不代表真实的初次编译时间
Image
二次编译时间 时间:以下时间仅作为示例,不代表真实的二次编译时间
custom_ops/gpu_ops/flash_mask_attn/kernel_traits.h
custom_ops/gpu_ops/transfer_output.cc
custom_ops/gpu_ops/read_ids.py
Image
安装whl包 编译完成后,产物位于 FastDeploy/dist/xxx.whl
Image
Image
运行单元测试 tests/layers/test_ffn.py 为例,由于aistudio环境的影响因素,可以把 quant_config = BlockWiseFP8Config(weight_block_size=[128, 128]) 移动至 self.fd_config 外。(不影响模型结构测试)
python tests/layers/test_ffn.py
Image
Image

优秀作品

期待你的跑通 "踩坑" 文档能成为大家的教程哦~

参与飞桨框架贡献

如果你已经顺利完成了打卡,具备了基础的框架和套件开发知识,你就可以参与飞桨社区丰富的开发任务,为一个大型开源项目做贡献,同时收获飞桨社区开发者的认可与各种福利。传送门:

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.