Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

Out of bound access on `test_sparse_sum_op`

Open lawrence910426 opened this issue 1 year ago • 2 comments

PR Category

Operator Mechanism

PR Types

Bug fixes

Description

  1. sum_kernel.cu The size of out_cols_data is only x_dim0 * x_dim1. It is illegal to access memory after x_dim0 * x_dim1. To prevent such illegal access, the loop in SumCsr3DGradCudaKernel is splitted into two loops.

  2. sum_grad_kernel.cu The length of x_crows_data is only x_dim0 * (x_dim1 + 1). Access to x_crows_data[x_dim0 * (x_dim1 + 1)] is in fact illegal. However, x_crows_data[x_dim0 * (x_dim1 + 1)] would be 0 to the alignment mechanism of StreamSafeAllocator.

Moreover, dx_values_data would never be filled when index = x_dim0 * (x_dim1 + 1) - 1. Therefore, the last iteration of the loop could be ignored.

lawrence910426 avatar May 09 '24 08:05 lawrence910426

你的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[bot] avatar May 09 '24 08:05 paddle-bot[bot]

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

paddle-ci-bot[bot] avatar May 17 '24 03:05 paddle-ci-bot[bot]

hi, @lawrence910426

  • 非常感谢你对飞桨的贡献,我们正在运营一个PFCC组织,会通过定期分享技术知识与发布开发者主导任务的形式持续为飞桨做贡献,详情可见 https://github.com/luotao1 主页说明。
  • 如果你对PFCC有兴趣,请发送邮件至 [email protected],我们会邀请你加入~

luotao1 avatar Jun 06 '24 09:06 luotao1