未验证 提交 85907b58 编写于 作者: J jiangfan06 提交者: GitHub

[XPU] fix l3 malloc (#54114)

上级 8c2ef016
......@@ -2180,7 +2180,7 @@ bool AnalysisPredictor::ExpRunWithRuntimeConfig(void *config) {
"l3_autotune_size(%zu) should be less than or equal to l3_size(%zu).",
l3_autotune_size,
l3_size));
dev_ctx->SetL3Info(l3_size, l3_ptr, l3_autotune_size);
dev_ctx->SetL3Info(l3_size, l3_ptr, l3_autotune_size, place_);
bool ret = ZeroCopyRun();
dev_ctx->L3CacheAutotune();
......
......@@ -77,7 +77,9 @@ void* InferXPUContext::Alloc(phi::TensorBase* tensor,
void InferXPUContext::SetL3Info(size_t l3_size,
void* l3_ptr,
size_t l3_autotune_size) {
size_t l3_autotune_size,
const phi::Place& place) {
phi::backends::xpu::XPUDeviceGuard guard(place.GetDeviceId());
if (l3_ptr == nullptr) {
if (l3_size_ != l3_size) {
if (l3_owned_) {
......
......@@ -60,7 +60,10 @@ class InferXPUContext : public phi::XPUContext {
bool pinned = false,
bool fake_alloc = false) const override;
void SetL3Info(size_t l3_size, void* l3_ptr, size_t l3_autotune_size);
void SetL3Info(size_t l3_size,
void* l3_ptr,
size_t l3_autotune_size,
const phi::Place& place);
void L3CacheAutotune();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册