Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XPU] avoid pre-allocating gm buffer #60387

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions paddle/fluid/distributed/collective/process_group_bkcl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ void ProcessGroupBKCL::CreateBKCLEnvCache(const Place& place,
platform::DeviceContextPool::Instance().Get(place));
// must use XPUDeviceContext here to make sure XPUContext::Init() is called
auto comm_ctx = std::make_unique<XPUDeviceContext>(place);
// comm_ctx does not require a pre-allocated GM buffer
comm_ctx->x_context()->set_option("XPUAPI_DEFAULT_SIZE", "1");
auto bkcl_comm_ctx = this->GetCommContext();
comm_ctx->SetBkclContext(bkcl_comm_ctx->GetBKCLComm());

Expand Down
3 changes: 3 additions & 0 deletions paddle/phi/backends/xpu/xpu_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ struct XPUContext::Impl {
<< tname << " currently " << context_map_.size()
<< " contexts existing";
xpu::Context* ctx_t = xpu::create_context();
// DataLoader does not require a pre-allocated GM buffer
// to avoid xpu_wait calls
ctx_t->set_option("XPUAPI_DEFAULT_SIZE", "1");
context_map_[tname] = ctx_t;
}
}
Expand Down