Skip to content

[CINN] Make CINN compilable with arm CPU and add missing nvidia-* dependencies for arm wheel#78712

Merged
SigureMo merged 7 commits intoPaddlePaddle:developfrom
cattidea:cinn/arm-compile
Apr 20, 2026
Merged

[CINN] Make CINN compilable with arm CPU and add missing nvidia-* dependencies for arm wheel#78712
SigureMo merged 7 commits intoPaddlePaddle:developfrom
cattidea:cinn/arm-compile

Conversation

@SigureMo
Copy link
Copy Markdown
Member

@SigureMo SigureMo commented Apr 18, 2026

PR Category

Environment Adaptation

PR Types

Devs

Description

使 Paddle 能够在 WITH_CINN 下编译、运行,这包含如下几部分

  • 添加 ginacislllvm arm64 预编译包版本,并上传 bos,其中 llvm 使用低版本 gcc8 进行编译,确保只包含 glibc2.17 以保证最好的兼容性
  • 更新 CUDA 13 下的 nvidia-* wheel 包依赖:
    • CUDA 13+ 下不再限定仅 x86 下安装,arm64 也会安装(之前会导致依赖里丢掉这些 nvidia 包,用户在没配置好环境的情况下可能跑不起来)
    • 更新 nvidia-cudnn-cu139.15.1.9nvidia-cublas13.1.0.3

This PR is co-authored with @copilot (gpt-5.4)

Remaining issues

正是因为之前极度依赖于开发镜像里装了 nvidia 相关依赖,所以 wheel 包缺失 nvidia 依赖才没被发现,但是在没有 wheel 包依赖的情况下,CINN 单测会暴露出默认 nvrtc 编译时找不到系统里 nv 相关头文件的问题,这个问题依然存在,但是对于用户而言,通过装 wheel 包的方式装 nv 相关依赖,该问题就不存在了

后续如果要在 ARM CPU上(也可能是 cu13 的问题,不是 ARM 的问题)跑单测或者开发可以注意下这一点,单独适配下,这个就暂时低优了

是否引起精度变化

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 18, 2026 05:40
@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented Apr 18, 2026

你的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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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/CINN build configuration to compile under WITH_CINN on ARM CPUs by removing x86-only assumptions and introducing reusable CMake helpers for architecture-aware paths.

Changes:

  • Add cmake/architecture.cmake with helpers to normalize architecture, detect CUDA target directories, and map LLVM native targets.
  • Update multiple CUDA/CINN-related CMake scripts to use detected target directories (CUDA targets/<arch> layout) and avoid x86-only flags on non-x86 platforms.
  • Tighten x86 feature detection in pir spin lock and adjust CINN LLVM runtime IR generation flags to be conditional on x86_64.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
paddle/pir/include/core/spin_lock.h Avoid defining x86-only relax primitive when building for ARM64.
paddle/phi/CMakeLists.txt Make NVTX3 include path depend on detected CUDA target dir.
paddle/cinn/backends/llvm/CMakeLists.txt Make LLVM IR generation flags conditional on x86_64; use configurable LLVM tool paths.
paddle/cinn/backends/CMakeLists.txt Gate x86-only fake lib build behind x86_64 check.
cmake/cupti.cmake Use normalized arch and detected CUDA target dir for include/lib lookup.
cmake/cudnn.cmake Add detected CUDA target include/lib directories to cuDNN lookup.
cmake/cinn/nvtx.cmake Add detected CUDA target lib directories to NVTX lookup.
cmake/cinn/llvm.cmake Link LLVM target component based on native architecture instead of hardcoded X86.
cmake/cinn/external/llvm.cmake Select ARM-specific LLVM prebuilt and use native target component; expose LLVM tool executables.
cmake/cinn/external/isl.cmake Add ARM-specific ISL prebuilt selection and ensure download directory exists.
cmake/cinn/external/ginac.cmake Add ARM-specific GiNaC prebuilt selection and ensure download directory exists.
cmake/cinn/core.cmake Apply AVX/FMA flags only on x86_64 to allow ARM builds.
cmake/cinn.cmake Remove hardcoded system lib include dir; search CUDA libraries in detected target dirs; prefer LLVM include dirs when available.
cmake/architecture.cmake New shared CMake module for arch normalization and CUDA/LLVM target detection.

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

Comment thread cmake/cinn/external/ginac.cmake Outdated
Comment thread cmake/cinn/external/isl.cmake
Comment thread cmake/architecture.cmake
Comment thread cmake/cinn/external/llvm.cmake
Comment thread cmake/cinn/external/llvm.cmake
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SigureMo SigureMo changed the title [CINN] Make CINN can compiled with arm CPU [CINN] Make CINN compilable with arm CPU Apr 18, 2026
@SigureMo SigureMo changed the title [CINN] Make CINN compilable with arm CPU [CINN] Make CINN compilable with arm CPU and add missing nvidia-* dependencies for arm wheel Apr 18, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@894a8e5). Learn more about missing BASE report.

Files with missing lines Patch % Lines
python/paddle/__init__.py 75.00% 2 Missing ⚠️

❌ Your patch status has failed because the patch coverage (75.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop   #78712   +/-   ##
==========================================
  Coverage           ?   75.00%           
==========================================
  Files              ?        1           
  Lines              ?        8           
  Branches           ?        0           
==========================================
  Hits               ?        6           
  Misses             ?        2           
  Partials           ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@risemeup1 risemeup1 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@risemeup1 risemeup1 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@wanghuancoder wanghuancoder left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@From00 From00 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@lugimzzz lugimzzz left a comment

Choose a reason for hiding this comment

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

lgtm

@SigureMo SigureMo merged commit a1fa887 into PaddlePaddle:develop Apr 20, 2026
192 of 213 checks passed
@SigureMo SigureMo deleted the cinn/arm-compile branch April 20, 2026 09:40
risemeup1111 pushed a commit to risemeup1111/Paddle that referenced this pull request Apr 20, 2026
…ependencies for arm wheel (PaddlePaddle#78712)

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@risemeup1111
Copy link
Copy Markdown

✅ Cherry-pick successful! Created PR: #78730

sneaxiy pushed a commit that referenced this pull request Apr 21, 2026
… `nvidia-*` dependencies for arm wheel (#78730)

* [CINN] Make CINN compilable with arm CPU and add missing `nvidia-*` dependencies for arm wheel (#78712)

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* [CI] Update precision check to `yuanlehome` (#78729)

---------

Co-authored-by: Nyakku Shigure <sigure.qaq@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.