Skip to content

[Build] Packaging vendored liblapack dylib on ARM64 platform#79516

Merged
SigureMo merged 1 commit into
PaddlePaddle:developfrom
cattidea:build/build-vendored-liblapack-dylib-on-arm
Jul 20, 2026
Merged

[Build] Packaging vendored liblapack dylib on ARM64 platform#79516
SigureMo merged 1 commit into
PaddlePaddle:developfrom
cattidea:build/build-vendored-liblapack-dylib-on-arm

Conversation

@SigureMo

@SigureMo SigureMo commented Jul 20, 2026

Copy link
Copy Markdown
Member

PR Category

Environment Adaptation

PR Types

Bug fixes

Description

ARM64 上编译单独编译 liblapack 动态库,避免 paddle arm64 wheel 包里 liblapack 及其依赖项均为 x86 的

dylibs in paddle/libs arch
libblas.so.3 x86
libgfortran.so.3 x86
libphi_core.so arm64
libphi.so arm64
libwarpctc.so arm64
libcommon.so arm64
liblapack.so.3 x86
libphi_gpu.so arm64
libquadmath.so.0 x86
libwarprnnt.so arm64

该问题如下代码即可复现:

python -c 'import paddle; x = paddle.to_tensor([[1, -2j], [2j, 5]]).cpu(); out_value = paddle.eigvalsh(x, UPLO="L"); print(out_value)'

是否引起精度变化

This PR is co-authored with @codex (gpt-5.6 sol max)

Copilot AI review requested due to automatic review settings July 20, 2026 11:45
@paddle-bot

paddle-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Paddle’s build/packaging logic so that on Linux ARM64 builds it uses an ARM64-specific prebuilt LAPACK bundle, and avoids unconditionally packaging GNU_RT_LIB_1 (e.g., libquadmath) when it is not provided.

Changes:

  • Add a Linux ARM (WITH_ARM) branch in cmake/external/lapack.cmake to download an ARM64-specific LAPACK archive.
  • Make packaging/copying of GNU_RT_LIB_1 conditional in both the generated and template setup.py logic to support platforms/configs where it is absent.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
setup.py Only package/copy GNU_RT_LIB_1 when present in env_dict (supports ARM64 where it may be empty).
python/setup.py.in Mirror the conditional packaging/copy logic for GNU_RT_LIB_1 in the CMake-generated setup script.
cmake/external/lapack.cmake Add ARM64-specific LAPACK prebuilt download settings under LINUX + WITH_ARM.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现一个会影响 ARM/Jetson 构建路径的问题,具体建议已放在行内评论中,建议修复后再继续合入。CI 目前还有检查在运行,后续仍需结合最新 CI 结果确认。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

CACHE STRING "" FORCE)
set(LAPACK_URL_MD5 71f8cc8237a8571692f3e07f9a4f25f6)
set(GNU_RT_LIB_1 "${LAPACK_LIB_DIR}/libquadmath.so.0")
if(WITH_ARM)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 优先级:P1

问题: 这里仅判断 WITH_ARM 会漏掉 WITH_NV_JETSON=ON 的配置路径。CMakeLists.txtinclude(third_party) 之后才把 WITH_NV_JETSON 强制转换成 WITH_ARM=ON,所以用户只传 -DWITH_NV_JETSON=ON 时,lapack.cmake 已经进入 else() 并下载 x86 的 lapack_lnx_v3.10.0.20210628.tar.gz。这会让 Jetson/ARM wheel 继续打包错误架构的 LAPACK,和本 PR 的修复目标相反。

处理要求:请针对该评论修复并提交新的 commit。

Suggested change
if(WITH_ARM)
if(WITH_ARM OR WITH_NV_JETSON)

@SigureMo SigureMo Jul 20, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@risemeup1111 你说的,在「include(third_party) 之后才把 WITH_NV_JETSON 强制转换成 WITH_ARM=ON」,这个逻辑在哪啊?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有,依据在这几处:

  • CMakeLists.txt:613-614 先执行 include(third_party)
  • cmake/third_party.cmake:400 在这个阶段就会 include(external/lapack)
  • CMakeLists.txt:662-665 才把 WITH_NV_JETSON 写回成 WITH_ARM=ON

所以 lapack.cmake 读取到的是当时的 WITH_ARM,而不是后面才转换出来的值。也就是说,-DWITH_NV_JETSON=ON 但没有显式带 -DWITH_ARM=ON 时,仍然会走到当前的 else() 分支。

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@risemeup1111 已确定 NV JETSON 不再支持,这个很早就编译不出来了,已经确定 NV JETSON 支持后续可以移除

cc @EmmonsCurse @risemeup1

@risemeup1 risemeup1 Jul 20, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确实,确定 NV JETSON 不再支持,属于废弃代码

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

收到。如果 NV JETSON 已明确不在当前支持范围内,那这条不应作为本 PR 的阻塞项;我撤回前面这条建议,并关闭该线程。

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复查,原先关于 NV JETSON 的阻塞意见已按当前支持范围撤回,细节已在原线程说明。当前改动未发现需要阻塞合入的问题;Coverage test 的失败看起来是 runner 的 Docker 权限问题,后续再按 CI 流程确认即可。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

@SigureMo

SigureMo commented Jul 20, 2026

Copy link
Copy Markdown
Member Author
Traceback (most recent call last):
  File "/workspace/PaddleTest/tools/bos_tools.py", line 103, in <module>
正在上传 benchmark_history_PR_result.csv 到存储桶 paddle-github-action, 路径为paddle-qa/benchmark/modelBK_CI/benchmark_history_PR_result.csv ...
    bos_upload(bucket_name, object_key, file2upload)
  File "/workspace/PaddleTest/tools/bos_tools.py", line 26, in bos_upload
    result = bos_client.put_super_obejct_from_file(
AttributeError: 'BosClient' object has no attribute 'put_super_obejct_from_file'. Did you mean: 'put_super_object_from_file'?

@ShigureNyako 喵子,Model-Benchmark 流水线里发现 PaddleTest 里用的 typo API put_super_obejct_from_file 已经被最新版 bce-python-sdk==0.9.72 修复了,因此麻烦在 PaddleTest 提个修复 PR 吧,不过考虑有些场景还在用低版本 bce-python-sdk,做下兼容性处理吧,比如

def method_put_super_object_from_file(bos_client: BosClient):
    # Compatibility layer for BosClient.put_super_object_from_file before bce-python-sdk==0.9.72
    if hasattr(bos_client, "put_super_obejct_from_file"):
        return bos_client.put_super_obejct_from_file
    return bos_client.put_super_object_from_file

method_put_super_object_from_file(bos_client)(...)

method_put_super_object_from_file 名字也许不太好?你来起名吧

@SigureMo
SigureMo merged commit f2396e7 into PaddlePaddle:develop Jul 20, 2026
193 of 201 checks passed
@SigureMo
SigureMo deleted the build/build-vendored-liblapack-dylib-on-arm branch July 20, 2026 16:16
@risemeup1111

Copy link
Copy Markdown
Contributor

✅ Cherry-pick successful! Created PR: #79518

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants