Skip to content

Conversation

@cszdrg
Copy link
Contributor

@cszdrg cszdrg commented Jun 5, 2025

PR Category

Operator Mechanism

PR Types

Bug fixes

Description

  • bug原因
    a)thrust::sort_by_key函数不支持大tensor

  • 思考过程
    a)目前首先分段进行排序 在对排序后的tensor进行归并操作
    b)由于thrust::merge也不支持对大tensor进行merge 所以手写核函数进行实现

  • 代码逻辑改动
    a)将原本的thrust::sort_by_key逻辑封装为一个persort函数
    b) 手写核函数kernel_merge
    c)设置每段大小为1 << 31 -1 当tensor大小小于等于1 << 31 -1时 保持原有逻辑运行

结果如下

  • 当将per_number设置为5进行小tenser accuracy测试
    截屏2025-06-09 12 23 25
  • 将per_number设置为(1 << 28) - 1 与torch进行accuracy对比
    由于per_number为2047483647后torch有问题 所以调小数值
    截屏2025-06-09 13 47 12
  • 将per_number设置为(1 << 31) - 1 后 torch不支持 进行paddle only测试
    截屏2025-06-09 14 02 09
    截屏2025-06-09 14 01 15
@paddle-bot
Copy link

paddle-bot bot commented Jun 5, 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 Jun 5, 2025
@lshpku lshpku merged commit 27db3a6 into PaddlePaddle:develop Jun 11, 2025
50 checks passed
shanjiang7 pushed a commit to shanjiang7/Paddle that referenced this pull request Jun 12, 2025
* fix unstack big tensor * fix sort big tensor * fix * add descending * fix * fix * fix * fix * fix * fix * fix * fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

2 participants