Skip to content

Conversation

@HydrogenSulfate
Copy link
Contributor

@HydrogenSulfate HydrogenSulfate commented Sep 12, 2024

PR Category

User Experience

PR Types

New features

Description

Pcard-75624

  1. 为eager Tensor添加__cuda_array_interface__属性,从而允许paddle.Tensor被不同的GPU计算框架在同相同设备上以零拷贝的方式使用。添加对应单测。

    属性定义规范参考:https://numba.readthedocs.io/en/0.52.0/cuda/cuda_array_interface.html(与其他框架对齐,采用version 2而非version 3)

    代码参考:
    Support the __cuda_array_interface__ protocol tensorflow/tensorflow#29039
    Add paddle backend NVIDIA/warp#313
    https://github.com/pytorch/pytorch/blob/e54b559e8860e343692bb5534777b2384a57a613/torch/_tensor.py#L1185-L1252

  2. paddle.numel支持uint8和int8类型,添加对应单测。

[pull] develop from PaddlePaddle:develop
[pull] develop from PaddlePaddle:develop
@paddle-bot
Copy link

paddle-bot bot commented Sep 12, 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.

@HydrogenSulfate HydrogenSulfate force-pushed the add___cuda_array_interface__ branch from 27029c6 to 88eddaa Compare September 13, 2024 05:47
@HydrogenSulfate HydrogenSulfate mentioned this pull request Sep 13, 2024
14 tasks
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow 🐾

相关问题可以单独 PR 看看~

CPU,
ALL_LAYOUT,
phi::NumelKernel,
int8_t,
Copy link
Member

Choose a reason for hiding this comment

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

numel 中英文 API 文档是不是也应该体现这一点修改?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

感觉可以跟下个PR一起改掉

@SigureMo SigureMo changed the title [API] Add __cuda_array_interface__ for eager Tensor [API] Add __cuda_array_interface__ `for eager Tensor Sep 14, 2024
@SigureMo SigureMo changed the title [API] Add __cuda_array_interface__ `for eager Tensor [API] Add __cuda_array_interface__ for eager Tensor Sep 14, 2024
@HydrogenSulfate HydrogenSulfate merged commit e7403a2 into PaddlePaddle:develop Sep 14, 2024
@HydrogenSulfate HydrogenSulfate deleted the add___cuda_array_interface__ branch September 14, 2024 10:32
@HydrogenSulfate HydrogenSulfate mentioned this pull request Sep 28, 2024
14 tasks
gmarkall pushed a commit to NVIDIA/numba-cuda that referenced this pull request Mar 3, 2025
We support `paddle.Tensor.__cuda_array_interface__`(PaddlePaddle/Paddle#68192) and `paddle.to_tensor(tenosr_with_CAI_impl)`(PaddlePaddle/Paddle#69913), so we can convert paddle Tensor from/to other DL frameworks via CAI(based on CAI version 2).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants