Skip to content

[XPU] support XDNN downloading function#5365

Merged
zhupengyang merged 2 commits intoPaddlePaddle:developfrom
cqulilujia:xdnn
Dec 5, 2025
Merged

[XPU] support XDNN downloading function#5365
zhupengyang merged 2 commits intoPaddlePaddle:developfrom
cqulilujia:xdnn

Conversation

@cqulilujia
Copy link
Contributor

Motivation

增加编译时的XDNN下载逻辑

@cqulilujia cqulilujia force-pushed the xdnn branch 2 times, most recently from 2718ca4 to a2b3653 Compare December 3, 2025 14:24
@codecov-commenter
Copy link

codecov-commenter commented Dec 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@1b5fd79). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #5365   +/-   ##
==========================================
  Coverage           ?   59.25%           
==========================================
  Files              ?      325           
  Lines              ?    40214           
  Branches           ?     6087           
==========================================
  Hits               ?    23828           
  Misses             ?    14551           
  Partials           ?     1835           
Flag Coverage Δ
GPU 59.25% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

XDNN_INC_PATH = os.path.join(XDNN_PATH, "include")
XDNN_LIB_DIR = os.path.join(XDNN_PATH, "so")
version_cmd = "python -c 'import paddle; paddle.version.show()' 2>&1 | grep xhpc | awk '{print $2}'"
XHPC_VERSION = subprocess.check_output(version_cmd, shell=True).strip().decode()

Choose a reason for hiding this comment

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

后续可以考虑对 subprocess.check_output 做个异常处理?如果 version_cmd 执行失败,给一个 paddle not found 之类的错误提示,对用户会更友好些

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 125 to 156
version_cmd = "python -c 'import paddle; paddle.version.show()' 2>&1 | grep xhpc | awk '{print $2}'"
XHPC_VERSION = subprocess.check_output(version_cmd, shell=True).strip().decode()
Copy link
Collaborator

Choose a reason for hiding this comment

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

paddle.version.xpu_xhpc()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 137 to 168
else:
download_and_extract(XHPC_URL, THIRD_PARTY_PATH)
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里打印warning log,显示本地xhpc版本和paddle xhpc版本,但是不要强制重新下载

  • paddle使用本地xhpc编译的时候,从paddle.version.xhpc_xhpc()看到的版本可能和实际不同
  • 会有需要强制使用本地xhpc的开发场景

Comment on lines +139 to +193
else:
download_and_extract(XHPC_URL, THIRD_PARTY_PATH)
Copy link
Collaborator

Choose a reason for hiding this comment

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

打印下载xhpc的地址

Copy link
Contributor Author

Choose a reason for hiding this comment

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

download_and_extract函数中会打印

@cqulilujia cqulilujia force-pushed the xdnn branch 3 times, most recently from 6b25695 to 12c38f6 Compare December 4, 2025 08:04
@paddle-bot
Copy link

paddle-bot bot commented Dec 4, 2025

Thanks for your contribution!

@paddle-bot paddle-bot bot added the XPU label Dec 4, 2025
Copy link
Collaborator

@hong19860320 hong19860320 left a comment

Choose a reason for hiding this comment

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

LGTM,按照讨论的结果,后续再提一个 PR 保证优先使用 paddle 中的 xdnn.h,仅 plugin 编译所需的 kernel 头文件才在下载的xhpc 包中搜索。

@zhupengyang zhupengyang merged commit 7b0b6e4 into PaddlePaddle:develop Dec 5, 2025
14 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants