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

【PaddlePaddle Hackathon 4】No.56 : add fp16 test and bf16 for searchsorted #53205

Closed
wants to merge 11 commits into from

Conversation

longranger2
Copy link
Contributor

@longranger2 longranger2 commented Apr 22, 2023

PR types

Others

PR changes

APIs

Description

  • add fp16 test and bf16 test for searchsorted

相关链接:
#51281
#54871

@paddle-bot
Copy link

paddle-bot bot commented Apr 22, 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 Apr 22, 2023
@paddle-bot
Copy link

paddle-bot bot commented Apr 22, 2023

✅ This PR's description meets the template requirements!
Please wait for other CI results.

@paddle-ci-bot
Copy link

paddle-ci-bot bot commented Apr 30, 2023

Sorry to inform you that c07c5f5's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@@ -48,7 +48,7 @@ HOSTDEVICE inline size_t LowerBound(const T1 *x, size_t num, const T2 &val) {
while (count > 0) {
int64_t step = (count >> 1);
auto *it = first + step;
if (*it < val) {
if (static_cast<float>(*it) < static_cast<float>(val)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

建议不要直接转换为float,最好使用文档里提供的MyTypeTrait来判断需要转换的类型

@@ -71,7 +71,7 @@ HOSTDEVICE inline size_t UpperBound(const T1 *x, size_t num, const T2 &val) {
while (count > 0) {
auto step = (count >> 1);
auto *it = first + step;
if (val < *it) {
if (static_cast<float>(val) < static_cast<float>(*it)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

建议不要直接转换为float,最好使用文档里提供的MyTypeTrait来判断需要转换的类型

@@ -215,5 +219,46 @@ def test_sortedsequence_values_type_error():
self.assertRaises(TypeError, test_sortedsequence_values_type_error)


class TestSearchSortedFP16OP(TestSearchSorted):
Copy link
Contributor

Choose a reason for hiding this comment

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

FP16和BF16的单测数量较少,请再增加几例

@paddle-ci-bot
Copy link

paddle-ci-bot bot commented May 29, 2023

Sorry to inform you that 5134014's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@paddle-ci-bot
Copy link

paddle-ci-bot bot commented Jul 4, 2023

Sorry to inform you that 33ab075's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@zhangting2020 zhangting2020 self-requested a review August 2, 2023 05:26
} else if (type == phi::DataType::FLOAT16) {
visitor.template apply<int16_t>();
} else if (type == phi::DataType::BFLOAT16) {
visitor.template apply<uint16_t>();
Copy link
Contributor

Choose a reason for hiding this comment

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

这里如果是phi::DataType::FLOAT16,apply应该是需要写成phi::dtype::float16
如果是phi::DataType::BFLOAT16,应该是phi::dtype::bfloat16

@longranger2
Copy link
Contributor Author

@zhangting2020 辛苦帮忙看看这个问题

一开始报错如下:

image

经分析是IsInf和IsNan函数被重载了多次,编译器无法区分调用哪个重载版本,于是针对float16和bfloat16类型做出如下修改:

image

但还是无法进行解决

image

@luotao1 luotao1 closed this Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants