未验证 提交 12301bc5 编写于 作者: R ronnywang 提交者: GitHub

[CustomDevice] Allow registration of not ready kernels (#57038)

上级 2e9a79f4
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,6 @@
#include "glog/logging.h" #include "glog/logging.h"
static std::vector<std::string> gpu_exclusive_kernels({"sync_batch_norm",
"sync_batch_norm_grad"});
namespace phi { namespace phi {
void CustomKernelMap::RegisterCustomKernel(const std::string& name, void CustomKernelMap::RegisterCustomKernel(const std::string& name,
...@@ -44,16 +41,6 @@ void CustomKernelMap::RegisterCustomKernels() { ...@@ -44,16 +41,6 @@ void CustomKernelMap::RegisterCustomKernels() {
} }
auto& kernels = KernelFactory::Instance().kernels(); auto& kernels = KernelFactory::Instance().kernels();
for (auto& pair : kernels_) { for (auto& pair : kernels_) {
if (kernels.find(pair.first) == kernels.cend()) {
if (std::find(gpu_exclusive_kernels.cbegin(),
gpu_exclusive_kernels.cend(),
pair.first) == gpu_exclusive_kernels.cend()) {
PADDLE_THROW(phi::errors::InvalidArgument(
"The kernel %s is not ready for custom kernel registering.",
pair.first));
}
}
for (auto& info_pair : pair.second) { for (auto& info_pair : pair.second) {
PADDLE_ENFORCE_EQ( PADDLE_ENFORCE_EQ(
kernels[pair.first].find(info_pair.first), kernels[pair.first].find(info_pair.first),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册