Skip to content

[0-size Tensor No.59、62、250] Add 0-size Tensor support for fftshift etc #72809

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

Merged
merged 5 commits into from
May 28, 2025

Conversation

co63oc
Copy link
Contributor

@co63oc co63oc commented May 20, 2025

PR Category

Operator Mechanism

PR Types

Others

Description

59 paddle.fft.fftshift
62 paddle.fft.ifftshift
250 paddle.roll

修改的是 fftshift, ifftshift, fftshift, ifftshift 是cuda错误
fftshift, ifftshift调用的是paddle.roll,所以修改roll kernel
cpu/gpu前向已修改,修改反向和xpu kernel
infermeta不用修改

PaddleAPITest 测试通过
image
image

单测参照已有单测编写

Copy link

paddle-bot bot commented May 20, 2025

你的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 the contributor External developers label May 20, 2025
@co63oc co63oc changed the title CI测试不review fft [0-size Tensor No.57-66] Add 0-size Tensor support for fft2 etc May 20, 2025
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label May 20, 2025
@DanielSun11
Copy link
Contributor

此时的修改策略如下:

  1. 请参考Paddle API文档:https://www.paddlepaddle.org.cn/documentation/docs/zh/2.2/api/paddle/fft/fft2_cn.html
    image
    若明确某些轴不得为0,请让这些api及时报错报错/抛出异常(invalidArgument、ValueError),paddle的行为需要保持和torch一致!
  2. 有些fft相关的api目前报错cuda error 9(调用了0 thread的cuda kernel),
    image
    请检查一下参数检查是否合法,以及Torch对应的API 0-size是否支持。若支持则修改kernel,若不支持则在参数检查时就抛出异常。cuda error 9是必须要避免的。

@co63oc co63oc changed the title [0-size Tensor No.57-66] Add 0-size Tensor support for fft2 etc [0-size Tensor No.57-66] Add 0-size Tensor support for fftshift etc May 21, 2025
@co63oc co63oc changed the title [0-size Tensor No.57-66] Add 0-size Tensor support for fftshift etc [0-size Tensor No.59、62] Add 0-size Tensor support for fftshift etc May 21, 2025
@codecov-commenter
Copy link

codecov-commenter commented May 21, 2025

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Please upload report for BASE (develop@705356a). Learn more about missing BASE report.

Files with missing lines Patch % Lines
paddle/phi/kernels/cpu/roll_grad_kernel.cc 0.00% 3 Missing ⚠️

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop   #72809   +/-   ##
==========================================
  Coverage           ?    0.00%           
==========================================
  Files              ?        1           
  Lines              ?        3           
  Branches           ?        0           
==========================================
  Hits               ?        0           
  Misses             ?        3           
  Partials           ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@co63oc
Copy link
Contributor Author

co63oc commented May 21, 2025

此时的修改策略如下:

  1. 请参考Paddle API文档:https://www.paddlepaddle.org.cn/documentation/docs/zh/2.2/api/paddle/fft/fft2_cn.html
    image
    若明确某些轴不得为0,请让这些api及时报错报错/抛出异常(invalidArgument、ValueError),paddle的行为需要保持和torch一致!
  2. 有些fft相关的api目前报错cuda error 9(调用了0 thread的cuda kernel),
    image
    请检查一下参数检查是否合法,以及Torch对应的API 0-size是否支持。若支持则修改kernel,若不支持则在参数检查时就抛出异常。cuda error 9是必须要避免的。

已修改fftshift/ifftshift错误,其他算子再提交PR修改,CI已完成

@co63oc co63oc changed the title [0-size Tensor No.59、62] Add 0-size Tensor support for fftshift etc [0-size Tensor No.59、62、250] Add 0-size Tensor support for fftshift etc May 25, 2025
@luotao1
Copy link
Contributor

luotao1 commented May 27, 2025

@DanielSun11 可以review了

Copy link
Contributor

@DanielSun11 DanielSun11 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@wanghuancoder wanghuancoder left a comment

Choose a reason for hiding this comment

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

LGTM

@wanghuancoder wanghuancoder merged commit 9788095 into PaddlePaddle:develop May 28, 2025
48 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants