[Cpp API Compatibility] Fix CUDAContext.h to align with Pytorch#78584
[Cpp API Compatibility] Fix CUDAContext.h to align with Pytorch#78584SigureMo merged 7 commits intoPaddlePaddle:developfrom
CUDAContext.h to align with Pytorch#78584Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
There was a problem hiding this comment.
Pull request overview
This PR updates the ATen CUDA compat header(s) to better match PyTorch’s include surface so that #include <ATen/cuda/CUDAContext.h> also brings in the CUDA stream definitions needed by downstream builds (e.g., DeepEP).
Changes:
- Add missing transitive includes (
ATen/cuda/Exceptions.h,c10/cuda/CUDAStream.h) toATen/cuda/CUDAContext.h. - Update
CUDAContext.cppto includeATen/cuda/CUDAContext.hinstead ofCUDAContextLight.h.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| paddle/phi/api/include/compat/ATen/cuda/CUDAContext.h | Adds missing includes for CUDA stream / exceptions, but changes conditional include behavior. |
| paddle/phi/api/include/compat/ATen/cuda/CUDAContext.cpp | Switches to including the main CUDAContext header. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #include <ATen/cuda/CUDAContextLight.h> | ||
| #endif | ||
|
|
||
| #include <ATen/cuda/Exceptions.h> | ||
| #include <c10/cuda/CUDAStream.h> |
There was a problem hiding this comment.
CUDAContext.h used to only include CUDAContextLight.h when PADDLE_WITH_CUDA/PADDLE_WITH_HIP was enabled. After this change the header unconditionally includes CUDAContextLight.h and c10/cuda/CUDAStream.h, which pulls in CUDA-only APIs (e.g., cudaError_t / cudaStream_t) and will break compilation in non-CUDA/HIP builds that still include this header transitively. Please restore a build-flag guard around the CUDA-specific includes (or provide CPU stubs matching the previous behavior) while still adding c10/cuda/CUDAStream.h for CUDA/HIP builds.
|
/re-run all-failed |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #78584 +/- ##
==========================================
Coverage ? 94.44%
==========================================
Files ? 1
Lines ? 72
Branches ? 0
==========================================
Hits ? 68
Misses ? 4
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PR Category
Execute Infrastructure
PR Types
Bug fixes
Description
修复
#include <ATen/cuda/CUDAContext.h>时没有#include <c10/cuda/CUDAStream.h>的错误,用于 DeepEP 的编译对齐

getStreamFromPool函数,详细兼容架构文档已在 PFCCLab/PaddleCppAPITest#59 中更新是否引起精度变化
否