-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[C++ API GetAllocator] Add C++ GetAllocator
interface
#50813
[C++ API GetAllocator] Add C++ GetAllocator
interface
#50813
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
06268c0
to
026ba33
Compare
paddle/phi/core/CMakeLists.txt
Outdated
@@ -49,7 +49,7 @@ cc_library( | |||
cc_library( | |||
tensor_base | |||
SRCS tensor_base.cc allocator.cc | |||
DEPS phi_enforce) | |||
DEPS phi_enforce context_pool phi_device_context) |
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.
这里看上去会有循环依赖,GetAllocator可能需要换到其他文件里
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/phi/core/allocator.h
用于底层的 Allocation
定义,上层的 GetAllocator
API 接口放到 api 目录下的 context_pool.h
文件中
After offline discussion, paddle/phi/core/allocator.h
is specific for the definition of Allocation
, on the other hand, the upper-level GetAllocator
API will be moved to phi/context_pool.h
.
See the License for the specific language governing permissions and | ||
limitations under the License. */ | ||
|
||
#include <gtest/gtest.h> |
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.
这个单测应该放在core目录下吧?
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.
Thanks~GetAllocator
移动到了 api 目录下,单测也相应移动到 tests/api
目录
Thanks~As GetAllocator
has been moved to api
directory, the corresponding unit test moves to test/api
directory.
#include "paddle/phi/api/include/context_pool.h" | ||
#include "paddle/phi/core/device_context.h" | ||
|
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.
这两个头文可以移除
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.
Next PR fix this.
@@ -18,6 +18,7 @@ limitations under the License. */ | |||
#include <functional> | |||
#include <memory> | |||
|
|||
#include "paddle/phi/api/include/dll_decl.h" |
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.
同上
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.
Same as above. Next PR fix this.
@@ -87,3 +87,10 @@ class PADDLE_API DeviceContextPool { | |||
|
|||
} // namespace experimental | |||
} // namespace paddle | |||
|
|||
namespace phi { |
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.
这里需要决策下是以phi
还是paddle
的namespace暴露到外部
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.
Next PR fix this.
After offline discussion, we decide to use the namespace paddle
* polish codes according #50813 * [getCurrentCUDAStream] Add C++ API getCurrentCUDAStream * change get->Get * wrap with macro * use Get instead of get
PR types
New features
PR changes
APIs
Describe
Add C++
GetAllocator
interface, which enables acquiringAllocator*
directly.