Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
74e46a93
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
74e46a93
编写于
8月 01, 2022
作者:
W
Wilber
提交者:
GitHub
8月 01, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
infer context fix place error. (#44726)
* infer context fix place error. * update * update
上级
71f74f5c
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
23 addition
and
17 deletion
+23
-17
paddle/fluid/inference/api/analysis_predictor.cc
paddle/fluid/inference/api/analysis_predictor.cc
+1
-1
paddle/fluid/inference/api/infer_context.cc
paddle/fluid/inference/api/infer_context.cc
+9
-1
paddle/fluid/inference/api/infer_context.h
paddle/fluid/inference/api/infer_context.h
+2
-0
paddle/phi/backends/gpu/gpu_context.cc
paddle/phi/backends/gpu/gpu_context.cc
+0
-4
paddle/phi/backends/gpu/gpu_context.h
paddle/phi/backends/gpu/gpu_context.h
+0
-1
paddle/phi/tests/common/test_scalar.cu
paddle/phi/tests/common/test_scalar.cu
+3
-2
paddle/phi/tests/kernels/test_sparse_conv3d_dev_api.cc
paddle/phi/tests/kernels/test_sparse_conv3d_dev_api.cc
+1
-1
paddle/phi/tests/kernels/test_sparse_pool_dev_api.cc
paddle/phi/tests/kernels/test_sparse_pool_dev_api.cc
+1
-1
paddle/phi/tests/kernels/test_sparse_utils_dev_api.cc
paddle/phi/tests/kernels/test_sparse_utils_dev_api.cc
+6
-6
未找到文件。
paddle/fluid/inference/api/analysis_predictor.cc
浏览文件 @
74e46a93
...
...
@@ -393,7 +393,7 @@ void AnalysisPredictor::InitDeviceContexts() {
place_
,
std
::
async
(
std
::
launch
::
deferred
,
[
=
]
{
auto
*
gpu_resource
=
ResourceManager
::
Instance
().
GetGPUResource
(
predictor_stream_
);
auto
*
gpu_context
=
new
InferGPUContext
();
auto
*
gpu_context
=
new
InferGPUContext
(
place_
);
gpu_context
->
SetAllocator
(
memory
::
allocation
::
AllocatorFacade
::
Instance
()
.
GetAllocator
(
place_
,
gpu_resource
->
GetStream
())
...
...
paddle/fluid/inference/api/infer_context.cc
浏览文件 @
74e46a93
...
...
@@ -13,5 +13,13 @@
// limitations under the License.
#include "paddle/fluid/inference/api/infer_context.h"
#include "paddle/phi/backends/gpu/gpu_context.h"
namespace
paddle
{}
// namespace paddle
namespace
paddle
{
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
InferGPUContext
::
InferGPUContext
(
const
phi
::
Place
&
place
)
:
phi
::
GPUContext
(
place
,
false
)
{}
#endif
}
// namespace paddle
paddle/fluid/inference/api/infer_context.h
浏览文件 @
74e46a93
...
...
@@ -14,6 +14,7 @@
#pragma once
#include "paddle/phi/backends/all_context.h"
#include "paddle/phi/common/place.h"
namespace
paddle
{
...
...
@@ -25,6 +26,7 @@ class InferCPUContext : public phi::CPUContext {
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
class
InferGPUContext
:
public
phi
::
GPUContext
{
public:
explicit
InferGPUContext
(
const
phi
::
Place
&
place
);
using
phi
::
GPUContext
::
SetBlasHandle
;
using
phi
::
GPUContext
::
SetBlasTensorCoreHandle
;
using
phi
::
GPUContext
::
SetBlasTF32Handle
;
...
...
paddle/phi/backends/gpu/gpu_context.cc
浏览文件 @
74e46a93
...
...
@@ -240,8 +240,6 @@ struct GPUContext::Impl {
InitDnnWorkspace
();
}
Impl
()
:
place_
(
GPUPlace
())
{}
explicit
Impl
(
const
GPUPlace
&
place
)
:
place_
(
place
)
{}
~
Impl
()
{
...
...
@@ -784,8 +782,6 @@ struct GPUContext::Impl {
std
::
unique_ptr
<
internal
::
EigenGpuStreamDevice
>
eigen_stream_
{
nullptr
};
};
GPUContext
::
GPUContext
()
:
DeviceContext
(),
impl_
(
std
::
make_unique
<
Impl
>
())
{}
GPUContext
::
GPUContext
(
GPUContext
&&
)
=
default
;
GPUContext
&
GPUContext
::
operator
=
(
GPUContext
&&
)
=
default
;
...
...
paddle/phi/backends/gpu/gpu_context.h
浏览文件 @
74e46a93
...
...
@@ -79,7 +79,6 @@ class DnnWorkspaceHandle {
class
PADDLE_API
GPUContext
:
public
DeviceContext
{
public:
GPUContext
();
explicit
GPUContext
(
const
GPUPlace
&
place
,
bool
init
=
true
);
GPUContext
(
GPUContext
&&
);
...
...
paddle/phi/tests/common/test_scalar.cu
浏览文件 @
74e46a93
...
...
@@ -21,6 +21,7 @@ limitations under the License. */
#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/common/complex.h"
#include "paddle/phi/common/float16.h"
#include "paddle/phi/common/place.h"
#include "paddle/phi/common/scalar.h"
#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/kernel_registry.h"
...
...
@@ -159,7 +160,7 @@ TEST(Scalar, ConstructFromDenseTensor7) {
alloc
.
get
(),
phi
::
DenseTensorMeta
(
phi
::
DataType
::
FLOAT32
,
phi
::
make_ddim
({
1
}),
phi
::
DataLayout
::
NCHW
));
phi
::
GPUContext
dev_ctx
;
phi
::
GPUContext
dev_ctx
{
phi
::
GPUPlace
()}
;
dev_ctx
.
SetAllocator
(
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
.
GetAllocator
(
phi
::
GPUPlace
())
.
get
());
...
...
@@ -181,7 +182,7 @@ TEST(Scalar, ConstructFromTensor) {
phi
::
DenseTensorMeta
(
phi
::
DataType
::
FLOAT32
,
phi
::
make_ddim
({
1
}),
phi
::
DataLayout
::
NCHW
));
phi
::
GPUContext
dev_ctx
;
phi
::
GPUContext
dev_ctx
{
phi
::
GPUPlace
()}
;
dev_ctx
.
SetAllocator
(
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
.
GetAllocator
(
phi
::
GPUPlace
())
.
get
());
...
...
paddle/phi/tests/kernels/test_sparse_conv3d_dev_api.cc
浏览文件 @
74e46a93
...
...
@@ -160,7 +160,7 @@ void TestConv3dBase(const std::vector<IntT>& indices,
// test gpu
#if defined(PADDLE_WITH_CUDA)
phi
::
GPUContext
dev_ctx_gpu
;
phi
::
GPUContext
dev_ctx_gpu
{
phi
::
GPUPlace
()}
;
dev_ctx_gpu
.
PartialInitWithoutAllocator
();
dev_ctx_gpu
.
SetAllocator
(
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
...
...
paddle/phi/tests/kernels/test_sparse_pool_dev_api.cc
浏览文件 @
74e46a93
...
...
@@ -122,7 +122,7 @@ void TestMaxPoolBase(const std::vector<IntT>& indices,
// test gpu
#if defined(PADDLE_WITH_CUDA)
phi
::
GPUContext
dev_ctx_gpu
;
phi
::
GPUContext
dev_ctx_gpu
{
phi
::
GPUPlace
()}
;
dev_ctx_gpu
.
PartialInitWithoutAllocator
();
dev_ctx_gpu
.
SetAllocator
(
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
...
...
paddle/phi/tests/kernels/test_sparse_utils_dev_api.cc
浏览文件 @
74e46a93
...
...
@@ -105,7 +105,7 @@ void TestDenseToSparseCoo(const DenseTensor& dense_x,
// 2. test cuda
#if defined(PADDLE_WITH_CUDA)
phi
::
GPUContext
dev_ctx_gpu
;
phi
::
GPUContext
dev_ctx_gpu
{
phi
::
GPUPlace
()}
;
dev_ctx_gpu
.
PartialInitWithoutAllocator
();
dev_ctx_gpu
.
SetAllocator
(
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
...
...
@@ -319,7 +319,7 @@ void TestSparseCsrToCoo(const DDim& dense_dims,
alloc
);
// 2. test cuda
#if defined(PADDLE_WITH_CUDA)
phi
::
GPUContext
dev_ctx_gpu
;
phi
::
GPUContext
dev_ctx_gpu
{
phi
::
GPUPlace
()}
;
dev_ctx_gpu
.
PartialInitWithoutAllocator
();
dev_ctx_gpu
.
SetAllocator
(
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
...
...
@@ -505,7 +505,7 @@ void TestCooToCsr(const DDim& dense_dims,
const
auto
cuda_alloc
=
std
::
make_shared
<
paddle
::
experimental
::
DefaultAllocator
>
(
paddle
::
platform
::
CUDAPlace
());
phi
::
GPUContext
dev_ctx_gpu
;
phi
::
GPUContext
dev_ctx_gpu
{
phi
::
GPUPlace
()}
;
dev_ctx_gpu
.
PartialInitWithoutAllocator
();
dev_ctx_gpu
.
SetAllocator
(
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
...
...
@@ -608,7 +608,7 @@ void TestDenseToSparseCsr(const DenseTensor& dense_x,
cuda_alloc
.
get
(),
DenseTensorMeta
(
dense_x
.
dtype
(),
dense_x
.
dims
(),
dense_x
.
layout
()));
phi
::
GPUContext
dev_ctx_gpu
;
phi
::
GPUContext
dev_ctx_gpu
{
phi
::
GPUPlace
()}
;
dev_ctx_gpu
.
PartialInitWithoutAllocator
();
dev_ctx_gpu
.
SetAllocator
(
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
...
...
@@ -741,7 +741,7 @@ void TestSparseCooToDense(const DDim& dense_dims,
const
auto
cuda_alloc
=
std
::
make_shared
<
paddle
::
experimental
::
DefaultAllocator
>
(
paddle
::
platform
::
CUDAPlace
());
phi
::
GPUContext
dev_ctx_gpu
;
phi
::
GPUContext
dev_ctx_gpu
{
phi
::
GPUPlace
()}
;
dev_ctx_gpu
.
PartialInitWithoutAllocator
();
dev_ctx_gpu
.
SetAllocator
(
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
...
...
@@ -889,7 +889,7 @@ void TestSparseCsrToDense(const DDim& dense_dims,
const
auto
cuda_alloc
=
std
::
make_shared
<
paddle
::
experimental
::
DefaultAllocator
>
(
paddle
::
platform
::
CUDAPlace
());
phi
::
GPUContext
dev_ctx_gpu
;
phi
::
GPUContext
dev_ctx_gpu
{
phi
::
GPUPlace
()}
;
dev_ctx_gpu
.
PartialInitWithoutAllocator
();
dev_ctx_gpu
.
SetAllocator
(
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录