Skip to content

Conversation

USTCKAY
Copy link
Contributor

@USTCKAY USTCKAY commented Jan 17, 2024

PR types

Bug fixes

PR changes

Others

Description

  1. gather_nd_grad算子的输入index被设置为skip_transform,当fallback该算子时,index无法被正常拷贝回CPU,而index在计算中又是需要的,所以会出现segment fault。这里为index去除skip_transform属性,可解决这个bug。Enhance dtype support for the get_value operation. #57272 中为index引入skip_transform是因为当输入类型为complex时index被错误地提升为complex,而Update the logic of data_type transform for complex #59287 已修改transform datatype的逻辑使得int32、int64不会被错误提升为complex,所以这里删除index的skip_transform属性应该也不会有问题。使用npu复现的脚本如下,复现时需设置环境变量 export CUSTOM_DEVICE_BLACK_LIST=gather_nd_grad

import paddle
x1 = paddle.to_tensor([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]], stop_gradient=False)
index1 = paddle.full([1], 1, "int64")
out1 = paddle.gather_nd(x1, index1)
print(out1)
out1.retain_grads()
out1.backward()

  1. custom device的MemoryAllocateHost接口判断是否调用插件实现时判断的条件不对,这里改成正确的实现

Copy link

paddle-bot bot commented Jan 17, 2024

你的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 Jan 17, 2024
@USTCKAY USTCKAY changed the title fix core dump when fallback gather_nd_grad and MemoryAllocateHost fix core dump when fallback gather_nd_grad and MemoryAllocateHost condition Jan 17, 2024
@USTCKAY
Copy link
Contributor Author

USTCKAY commented Jan 18, 2024

@zyfncg 麻烦帮忙review下backward.yaml的改动 @ronny1996 麻烦帮忙review下custom_device.cc的改动 谢谢!

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

@USTCKAY
Copy link
Contributor Author

USTCKAY commented Jan 19, 2024

@chenwhql @zyfncg @heavyrain-lzy 辛苦帮忙review下backward.yaml的改动,谢谢

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.

3 participants