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

[AMP][Custom Device] add fp16 op detection for custom device #56053

Merged
merged 3 commits into from
Aug 14, 2023

Conversation

jinyouzhi
Copy link
Contributor

PR types

Function optimization

PR changes

Others

Description

Aim to support the fp16 dtype op detection in AMP for custom device.

from paddle.fluid import core
dt = core.VarDesc.VarType.FP16
core.op_supported_infos('intel_gpu', dt)

@paddle-bot
Copy link

paddle-bot bot commented Aug 8, 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 Aug 8, 2023
@jinyouzhi
Copy link
Contributor Author

cc: @ChengleiTian @KevinYuk

@jinyouzhi jinyouzhi changed the title [AMP] add fp16 op detection for custom device [AMP][Custom Device] add fp16 op detection for custom device Aug 8, 2023
@jinyouzhi
Copy link
Contributor Author

@zyfncg Could you help review this PR?

@zyfncg
Copy link
Contributor

zyfncg commented Aug 9, 2023

@zyfncg Could you help review this PR?

@zhangting2020 Please help review this PR~🙏🏻

@jinyouzhi
Copy link
Contributor Author

@ronny1996 @zhangting2020 Could you give some comments?

@jinyouzhi
Copy link
Contributor Author

Note that similar work #56176 merged, very appreciate it. But it still not workable:

>>> import paddle
I0811 00:41:31.618554 1720908 init.cc:239] ENV [CUSTOM_DEVICE_ROOT]=/home/afas/miniconda3/envs/youzhi_ernie/lib/python3.10/site-packages/paddle_custo                                                m_device
I0811 00:41:31.618577 1720908 init.cc:145] Try loading custom device libs from: [/home/afas/miniconda3/envs/youzhi_ernie/lib/python3.10/site-packages/paddle_custom_device]
I0811 00:41:31.711321 1720908 custom_device.cc:1112] Successed in loading custom runtime in lib: /home/afas/miniconda3/envs/youzhi_ernie/lib/python3.10/site-packages/paddle_custom_device/libpaddle-custom-intel-gpu.so
I0811 00:41:31.711938 1720908 custom_kernel.cc:76] Successed in loading 94 custom kernel(s) from loaded lib(s), will be used like native ones.
I0811 00:41:31.711964 1720908 init.cc:157] Finished in LoadCustomDevice with libs_path: [/home/afas/miniconda3/envs/youzhi_ernie/lib/python3.10/site-packages/paddle_custom_device]
I0811 00:41:31.711975 1720908 init.cc:245] CustomDevice: intel_gpu, visible devices count: 4
>>> from paddle.fluid import core
>>> dt = core.VarDesc.VarType.FP16
>>> core.op_supported_infos('intel_gpu', dt)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: (InvalidArgument) The argument `place` should be 'GPU', 'CPU', 'XPU', but got 'intel_gpu'.
  [Hint: Expected is_target_place.count(query_place) != 0, but received is_target_place.count(query_place):0 == 0:0.] (at /home/afas/youzhi/pd-main/paddle/fluid/imperative/amp_auto_cast.cc:56)
>>> exit()

I propose to adopt a more compatible way, rather than hard code as 'CUSTOM_DEVICE' for custom device's name.
Thanks~

Copy link
Contributor

@ronny1996 ronny1996 left a comment

Choose a reason for hiding this comment

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

LGTM

@ronny1996 ronny1996 merged commit 9d40da3 into PaddlePaddle:develop Aug 14, 2023
27 checks passed
jinyouzhi added a commit to jinyouzhi/Paddle that referenced this pull request Aug 23, 2023
…addle#56053)

* [AMP] add fp16 op detection for custom device

* resolve conflicts
jinyouzhi added a commit to jinyouzhi/Paddle that referenced this pull request Aug 24, 2023
…addle#56053)

* [AMP] add fp16 op detection for custom device

* resolve conflicts
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.

None yet

5 participants