Skip to content

Commit 40b25b1

Browse files
[cherry-pick]fix DeepEP compile in infer mode (#71590) (#71656)
* fix DeepEP compile in infer mode (#71590) * fix DeepEP compile in infer mode * add compile judge * fix include optional * fix DeepEP with ON_INFER (#71701)
1 parent d33a367 commit 40b25b1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

paddle/fluid/distributed/collective/deep_ep/deep_ep.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
// https://github.com/deepseek-ai/DeepEP/blob/main/LICENSE
1919

2020
#include <cuda_runtime.h>
21-
#include <pybind11/functional.h>
2221
#include <atomic>
2322
#include <chrono>
2423
#include <memory>
@@ -209,6 +208,7 @@ int Buffer::get_root_rdma_rank(bool global) const {
209208

210209
int Buffer::get_local_device_id() const { return device_id; }
211210

211+
#ifndef PADDLE_NO_PYTHON
212212
pybind11::bytearray Buffer::get_local_ipc_handle() const {
213213
return {ipc_handles[nvl_rank].reserved, CUDA_IPC_HANDLE_SIZE};
214214
}
@@ -301,6 +301,7 @@ void Buffer::sync(
301301
// Ready to use
302302
available = true;
303303
}
304+
#endif
304305

305306
std::tuple<deep_ep::detail::Tensor,
306307
std::optional<deep_ep::detail::Tensor>,

paddle/fluid/distributed/collective/deep_ep/deep_ep.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424
#undef NDEBUG
2525
#endif
2626

27+
#ifndef PADDLE_NO_PYTHON
2728
#include <pybind11/pybind11.h>
2829
#include <pybind11/pytypes.h>
30+
#endif
31+
#include <optional>
2932
#include <tuple>
3033
#include <vector>
3134
#include "paddle/fluid/distributed/collective/deep_ep/include/types.h"
@@ -119,6 +122,7 @@ struct Buffer {
119122

120123
int get_local_device_id() const;
121124

125+
#ifndef PADDLE_NO_PYTHON
122126
pybind11::bytearray get_local_ipc_handle() const;
123127

124128
pybind11::bytearray get_local_nvshmem_unique_id() const;
@@ -127,6 +131,7 @@ struct Buffer {
127131
const std::vector<std::optional<pybind11::bytearray>>&
128132
all_gathered_handles,
129133
const std::optional<pybind11::bytearray>& root_unique_id_opt);
134+
#endif
130135

131136
std::tuple<deep_ep::detail::Tensor,
132137
std::optional<deep_ep::detail::Tensor>,

0 commit comments

Comments
 (0)