PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
22.25k stars 5.59k forks source link

[Bug] GetStream函数重名 #58444

Open engineer1109 opened 1 year ago

engineer1109 commented 1 year ago

bug描述 Describe the Bug

版本 develop 1540e20051338597c3df4e001c4a1f896c25d74e

编译选项 cmake .. -DWITH_CUSTOM_DEVICE=ON -DWITH_GPU=ON -DWITH_TENSORRT=ON

原因commit https://github.com/PaddlePaddle/Paddle/commit/f04f6ee68ae1ae2be8e53eaff5a70f75f3121074

出现了两个同名 但是返回类型不一样的函数

  phi::stream::stream_t GetStream(
      const std::shared_ptr<Allocation>& allocation) const;
gpuStream_t GetStream(const std::shared_ptr<Allocation>& allocation) const;

编译LOG

In file included from /media/wjl/D2/github/fork/Paddle/paddle/fluid/framework/tensor_util.h:27,
                 from /media/wjl/D2/github/fork/Paddle/paddle/fluid/framework/lod_tensor.h:24,
                 from /media/wjl/D2/github/fork/Paddle/paddle/fluid/framework/operator.h:31,
                 from /media/wjl/D2/github/fork/Paddle/paddle/fluid/framework/phi_utils.h:25,
                 from /media/wjl/D2/github/fork/Paddle/paddle/fluid/eager/eager_tensor.h:17,
                 from /media/wjl/D2/github/fork/Paddle/paddle/fluid/framework/type_info.cc:15:
/media/wjl/D2/github/fork/Paddle/paddle/fluid/memory/allocation/allocator_facade.h:106:25: error: ‘void* paddle::memory::allocation::AllocatorFacade::GetStream(const std::shared_ptr<phi::Allocation>&) const’ cannot be overloaded with ‘CUstream_st* paddle::memory::allocation::AllocatorFacade::GetStream(const std::shared_ptr<phi::Allocation>&) const’
  106 |   phi::stream::stream_t GetStream(
      |                         ^~~~~~~~~
/media/wjl/D2/github/fork/Paddle/paddle/fluid/memory/allocation/allocator_facade.h:90:15: note: previous declaration ‘CUstream_st* paddle::memory::allocation::AllocatorFacade::GetStream(const std::shared_ptr<phi::Allocation>&) const’
   90 |   gpuStream_t GetStream(const std::shared_ptr<Allocation>& allocation) const;
      |               ^~~~~~~~~

@ronny1996

其他补充信息 Additional Supplementary Information

No response

engineer1109 commented 1 year ago

@ronny1996

qili93 commented 1 year ago

您好,WITH_CUSTOM_DEVICE 请不要和 WITH_GPU 同时打开,PaddleCustomDevice后段是为了多设备注册的一个开发选项,默认只需要在编译 PaddlePaddle CPU WHL 安装包的时候打开 WITH_CUSTOM_DEVICE 选项即可,目前Paddle暂不支持一个安装包支持多种设备的情况。详细可以参考 https://github.com/PaddlePaddle/PaddleCustomDevice

engineer1109 commented 1 year ago

@qili93 之前不是可以同时打开吗?怎么现在不行了?

engineer1109 commented 1 year ago

我先提个PR https://github.com/PaddlePaddle/Paddle/pull/58534 Custom Device不应该和GPU冲突。 Custom Device也有GPU共存的场景。 也需要和GPU做对比验证测试。

况且,这个commit之前一直是支持共存的。不能因为这个commit把特性废除。