-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[CUSTOM]custom device add black_list #50409
[CUSTOM]custom device add black_list #50409
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -141,7 +141,8 @@ phi::KernelKey FallBackToCpu(const phi::KernelKey& kernel_key, | |||
#endif | |||
#ifdef PADDLE_WITH_CUSTOM_DEVICE | |||
auto place = phi::TransToPhiPlace(kernel_key.backend()); | |||
if (platform::is_custom_place(place)) { | |||
if (platform::is_custom_place(place) || | |||
phi::backends::custom_device::is_in_custom_black_list(op.Type())) { | |||
VLOG(3) << "phi missing " << place.GetDeviceType() | |||
<< " kernel: " << op.Type() | |||
<< ", expected_kernel_key:" << kernel_key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里修改下 VLOG 信息,目前提示都是 missing kernel 的,加上 black list 的提示
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
paddle/phi/core/kernel_factory.cc
Outdated
#elif defined(PADDLE_WITH_CUSTOM_DEVICE) | ||
if ((FLAGS_enable_api_kernel_fallback && kernel_iter == iter->second.end()) || | ||
phi::backends::custom_device::is_in_custom_black_list( | ||
TransToFluidOpName(kernel_name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的判断逻辑需要修改下,当 FLAGS_enable_api_kernel_fallback = False 的时候,任何情况都不会 fallback 算子到 CPU 上,会直接报错。因此这里需要修改为:
FLAGS_enable_api_kernel_fallback && (FLAGS_enable_api_kernel_fallback || is_in_custom_black_list(...))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR types
New features
PR changes
Others
Describe
Add black_list 4 custom_device plugin.
Use env var
$CUSTOM_DEVICE_BLACK_LIST
to enable this feature.example:
export CUSTOM_DEVICE_BLACK_LIST=op-1, op-2, ...