Skip to content
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

Merged
merged 3 commits into from
Feb 15, 2023

Conversation

piDack
Copy link
Contributor

@piDack piDack commented Feb 10, 2023

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, ...

@paddle-bot
Copy link

paddle-bot bot commented Feb 10, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Feb 10, 2023
@@ -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
Copy link
Contributor

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 的提示

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

#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))
Copy link
Contributor

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(...))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@qili93 qili93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qili93 qili93 merged commit 66d3c56 into PaddlePaddle:develop Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants