-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[Cpp API Compatibility] add pointer related API #77388
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
base: develop
Are you sure you want to change the base?
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
|
/re-run all-failed |
我们真的需要对齐到这个粒度吗?这些 API 用 Paddle 内部的 API 不能获取相关信息吗?而且就算实现了 |
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (77.27%) 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 #77388 +/- ##
==========================================
Coverage ? 77.27%
==========================================
Files ? 1
Lines ? 22
Branches ? 0
==========================================
Hits ? 17
Misses ? 5
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些 API 应该对 intrusive_ptr 也没啥需求
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Paddle通过 const std::shared_ptr<phi::TensorBase> &Tensor::impl() const { return impl_; } 实现强引用,PyTorch 通过 c10::intrusive_ptr<TensorImpl, UndefinedTensorImpl> impl_; 实现强引用,原子读取 refcount_ 和 weakcount_ ,兼容的 weak_use_count() 现在暂时直接返回0,等后面接入算子库的时候再看看要不要用到,那我现在先删了这些文件?
好像确实不需要,Pytorch使用侵入式指针,引用计数直接嵌入到对象本身中,而Paddle使用非侵入式指针,引用计数存储在单独的控制块中,但是 Paddle 在创建 |
|
/re-run all-failed |
|
/re-run all-failed |
|
/re-run all-failed |
|
/re-run all-failed |
|
/re-run CI-H |
PR Category
Environment Adaptation
PR Types
New features
Description
新增
is_same(other)use_count()weak_use_count()is_contiguous_or_false()toString()接口由于 Pytorch 的
impl指针由c10/util/intrusive_ptr.h实现,在c10/core/TensorImpl.h中初始化,这里先实现依赖大多已经实现的intrusive_ptr.h,基本上是复制粘贴的,只处理了pre-commit;TensorImpl.h同时依赖c10/core/DispatchKey.h,处理方式同intrusive_ptr.h,TensorImpl.h后面另提一个pr来实现