【Hackathon 9th No.109】[CppExtension] 添加 fastdeploy_ops 目录到 package_data 以支持现代打包方式 - part#5156
Conversation
…Paddle#5136)" This reverts commit e021048.
…into setuptools80_package_data
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5156 +/- ##
==========================================
Coverage ? 57.68%
==========================================
Files ? 317
Lines ? 38445
Branches ? 5762
==========================================
Hits ? 22178
Misses ? 14489
Partials ? 1778
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
今天定位这个 xpu 的问题,对比 #4998 pass 的https://github.com/PaddlePaddle/FastDeploy/actions/runs/19541739687/job/55949692263?pr=4998 日志,与今天 fail 的日志,fail 的日志显示: 2025-11-21T08:52:00.7069490Z [Error] Neither modern nor legacy directory found in /workspace/FastDeploy/custom_ops/tmp
2025-11-21T08:52:00.7069882Z [Error] Contents of /workspace/FastDeploy/custom_ops/tmp:
2025-11-21T08:52:00.7080416Z total 8
2025-11-21T08:52:00.7080597Z drwxr-xr-x 2 root root 4096 Nov 21 08:51 .
2025-11-21T08:52:00.7080838Z drwxr-xr-x 3 root root 4096 Nov 21 08:51 ..
预期是: 2025-11-20T15:21:05.6596399Z [Info] Ready to use ops from modern directory fastdeploy_ops
2025-11-20T15:21:05.6596654Z >>> 3
2025-11-20T15:21:05.6596856Z Listing files in: /workspace/FastDeploy/custom_ops/tmp
2025-11-20T15:21:05.6597234Z /workspace/FastDeploy/custom_ops/tmp/__pycache__/fastdeploy_ops.cpython-310.pyc
2025-11-20T15:21:05.6597669Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops-0.0.0-py3.10.egg-info/PKG-INFO
2025-11-20T15:21:05.6598333Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops-0.0.0-py3.10.egg-info/SOURCES.txt
2025-11-20T15:21:05.6598811Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops-0.0.0-py3.10.egg-info/dependency_links.txt
2025-11-20T15:21:05.6599303Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops-0.0.0-py3.10.egg-info/not-zip-safe
2025-11-20T15:21:05.6599773Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops-0.0.0-py3.10.egg-info/top_level.txt
2025-11-20T15:21:05.6600193Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops/__init__.py
2025-11-20T15:21:05.6600578Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops/fastdeploy_ops_pd_.so
2025-11-20T15:21:05.6600917Z /workspace/FastDeploy/custom_ops/tmp/version.txt
2025-11-20T15:21:05.6601098Z
2025-11-20T15:21:05.6601163Z >>> 3 1
2025-11-20T15:21:05.6601401Z Listing files in: /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops
2025-11-20T15:21:05.6601763Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops/__init__.py
2025-11-20T15:21:05.6602145Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops/fastdeploy_ops_pd_.so
2025-11-20T15:21:05.6602375Z
2025-11-20T15:21:05.6606387Z >>> 4
2025-11-20T15:21:05.6606601Z Listing files in: /workspace/FastDeploy/custom_ops/tmp
2025-11-20T15:21:05.6617353Z /workspace/FastDeploy/custom_ops/tmp/__pycache__/fastdeploy_ops.cpython-310.pyc
2025-11-20T15:21:05.6617796Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops-0.0.0-py3.10.egg-info/PKG-INFO
2025-11-20T15:21:05.6618258Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops-0.0.0-py3.10.egg-info/SOURCES.txt
2025-11-20T15:21:05.6618736Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops-0.0.0-py3.10.egg-info/dependency_links.txt
2025-11-20T15:21:05.6619227Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops-0.0.0-py3.10.egg-info/not-zip-safe
2025-11-20T15:21:05.6619682Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops-0.0.0-py3.10.egg-info/top_level.txt
2025-11-20T15:21:05.6620097Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops/__init__.py
2025-11-20T15:21:05.6620481Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops/fastdeploy_ops_pd_.so
2025-11-20T15:21:05.6620815Z /workspace/FastDeploy/custom_ops/tmp/version.txt
2025-11-20T15:21:05.6620982Z
2025-11-20T15:21:05.6621056Z >>> 4 1
2025-11-20T15:21:05.6621291Z Listing files in: /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops
2025-11-20T15:21:05.6628909Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops/__init__.py
2025-11-20T15:21:05.6629426Z /workspace/FastDeploy/custom_ops/tmp/fastdeploy_ops/fastdeploy_ops_pd_.so
2025-11-20T15:21:05.6629686Z
2025-11-20T15:21:06.0310478Z �[0;34m[build]�[0m �[1;32mbuild fastdeploy_ops success �[0m
2025-11-20T15:21:06.0806695Z �[1;32m[Info]�[0m Ready to copy ops from modern directory fastdeploy_ops to target directory
上面日志里面 ${python} setup_ops.py install --install-lib ${OPS_TMP_DIR} --verbose
而 fail 的日志说明,这条安装命令应该就没有执行成功 ~ 仔细对比了昨天 pass 和今天 fail 的日志,发现,pass 的 custom_ops 是 66 个 2025-11-20T15:21:05.0373483Z Received len(custom_op) = 66, using custom operator
而今天 fail 的是 67 个 2025-11-21T08:52:00.0822675Z Received len(custom_op) = 67, using custom operator
结合前两天 debug 的时候也发现, 其他 CI 测试目前看基础功能没啥问题,应该不是 cpp_extension 的问题了 ~ @SigureMo 目前定位的情况是这样,得请大佬看看其他环节? |
|
我要到 XPU 机器了,我调试下 |
|
应该搞定了 |
|
单测问题我再看看 |
gpu 那边 tmp 目录是个相对路径,xpu 这边是个绝对路径 ~ 太细了 ... ... 👍️👍️👍️
看上去是算子加载有问题? |
rpath 的问题,相对路径不一样,因为现在多了一层目录,从自定义算子找 |
对的,xpu 是从上层 |
There was a problem hiding this comment.
Pull request overview
This PR adds support for modern Python packaging methods (PEP 517/518) by including the fastdeploy_ops directory in package_data for various hardware backends (GPU, CPU, XPU, NPU, GCU, Iluvatar). The changes ensure that .so files generated under the new packaging structure are properly included in the wheel distribution.
Key changes:
- Updated
setup.pyto includefastdeploy_opssubdirectories inpackage_datafor all device types - Refactored build scripts to handle both modern (directory-based) and legacy (egg-based) packaging methods
- Updated CI/CD workflows to use
--preflag for installing nightly paddlepaddle-gpu builds
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Added fastdeploy_ops/* patterns to package_data for all hardware backends (gpu, cpu, xpu, npu, gcu, iluvatar, base) to support modern Python packaging |
| build.sh | Refactored variable naming (WHEEL_NAME→EGG_NAME) and added logic to detect and handle both modern and legacy package directory structures |
| custom_ops/xpu_ops/build.sh | Refactored to support modern packaging with improved directory handling, rpath configuration, and directory existence checks |
| scripts/run_ci_xpu.sh | Updated paddlepaddle-xpu installation to use package index instead of direct URL |
| .github/workflows/*.yml | Updated all workflow files to use --pre flag for installing nightly paddlepaddle-gpu builds consistently |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 9 comments.
Comments suppressed due to low confidence (1)
build.sh:177
- The variable
WHEEL_CPU_NAMEis undefined. It was renamed toEGG_CPU_NAMEin this PR. This should likely useTMP_PACKAGE_DIR_BASEwhich is set earlier in the function to handle both legacy and modern packaging methods.
cp -r ${OPS_TMP_DIR}/${WHEEL_CPU_NAME}/* ../fastdeploy/model_executor/ops/cpu
fastdeploy_ops 目录到 package_data 以支持现代打包方式fastdeploy_ops 目录到 package_data 以支持现代打包方式 - part
|
这个 PR 的修改导致了单测覆盖率统计增加了 |
|
#5177 会修复该问题 |
Motivation
关联:#5106
paddle 框架使用 python 现代的打包方式之后,生成的
.so文件在fastdeploy_ops目录中,因此需要在setup.py打包时添加到package_data中。Modifications
setup.py的package_dataUsage or Command
build.sh中的:Accuracy Tests
关联:#4998
Checklist
[FDConfig],[APIServer],[Engine],[Scheduler],[PD Disaggregation],[Executor],[Graph Optimization],[Speculative Decoding],[RL],[Models],[Quantization],[Loader],[OP],[KVCache],[DataProcessor],[BugFix],[Docs],[CI],[Optimization],[Feature],[Benchmark],[Others],[XPU],[HPU],[GCU],[DCU],[Iluvatar],[Metax]]pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.@SigureMo 帮忙请 fd 的大佬帮忙跑一下 ci 吧 ~
#4998 测试了 patch cpp_extension 后应该是没啥问题了 ~