未验证 提交 f5428eca 编写于 作者: J Jack Zhou 提交者: GitHub

fix enforce msg of sum xpu op (#30113)

上级 8020e34e
...@@ -50,8 +50,25 @@ class SumXPUKernel : public framework::OpKernel<T> { ...@@ -50,8 +50,25 @@ class SumXPUKernel : public framework::OpKernel<T> {
} }
int r = xpu::sum_batch(dev_ctx.x_context(), ptrs.data(), out->data<T>(), int r = xpu::sum_batch(dev_ctx.x_context(), ptrs.data(), out->data<T>(),
valid_count, out->numel()); valid_count, out->numel());
PADDLE_ENFORCE_EQ(r, xpu::Error_t::SUCCESS, if (r == xpu::Error_t::INVALID_PARAM) {
platform::errors::Fatal("XPU sum kernel error!")); PADDLE_ENFORCE_EQ(
r, xpu::Error_t::SUCCESS,
platform::errors::InvalidArgument(
"XPU kernel error of SumOp, error message: INVALID_PARAM, "
"please check your input & output."));
} else if (r == xpu::Error_t::RUNTIME_ERROR) {
PADDLE_ENFORCE_EQ(r, xpu::Error_t::SUCCESS,
platform::errors::Unavailable(
"XPU kernel error of SumOp, error message: "
"RUNTIME_ERROR, please check whether Baidu "
"Kunlun Card is properly installed."));
} else if (r == xpu::Error_t::NO_ENOUGH_WORKSPACE) {
PADDLE_ENFORCE_EQ(r, xpu::Error_t::SUCCESS,
platform::errors::ResourceExhausted(
"XPU kernel error of SumOp, error "
"message: NO_ENOUGH_WORKSPACE, XPU "
"has no enough memory."));
}
} }
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册