未验证 提交 5c8455d6 编写于 作者: Q QingshuChen 提交者: GitHub

try again if kunlun memory malloc failed (#30855)

* try again if kunlun memory malloc failed

* minor
上级 2ac4143b
......@@ -135,6 +135,11 @@ void *Alloc<platform::XPUPlace>(const platform::XPUPlace &place, size_t size) {
"Baidu Kunlun Card is properly installed.",
ret));
ret = xpu_malloc(reinterpret_cast<void **>(&p), size);
if (ret != XPU_SUCCESS) {
std::cout << "xpu memory malloc(" << size << ") failed, try again\n";
xpu_wait();
ret = xpu_malloc(reinterpret_cast<void **>(&p), size);
}
PADDLE_ENFORCE_EQ(
ret, XPU_SUCCESS,
platform::errors::External(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册