Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
a1422f73
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a1422f73
编写于
5月 20, 2020
作者:
Y
Yuan Shuai
提交者:
GitHub
5月 20, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[LITE][PROFILE] Enhance Profiler for OpenCL. test=develop (#3668)
上级
8dc7b259
变更
27
显示空白变更内容
内联
并排
Showing
27 changed file
with
422 addition
and
152 deletion
+422
-152
lite/kernels/opencl/activation_buffer_compute.cc
lite/kernels/opencl/activation_buffer_compute.cc
+34
-14
lite/kernels/opencl/activation_image_compute.cc
lite/kernels/opencl/activation_image_compute.cc
+19
-7
lite/kernels/opencl/bilinear_interp_image_compute.cc
lite/kernels/opencl/bilinear_interp_image_compute.cc
+11
-7
lite/kernels/opencl/box_coder_image_compute.cc
lite/kernels/opencl/box_coder_image_compute.cc
+19
-7
lite/kernels/opencl/concat_buffer_compute.cc
lite/kernels/opencl/concat_buffer_compute.cc
+26
-14
lite/kernels/opencl/concat_image_compute.cc
lite/kernels/opencl/concat_image_compute.cc
+12
-0
lite/kernels/opencl/conv_buffer_compute.h
lite/kernels/opencl/conv_buffer_compute.h
+12
-0
lite/kernels/opencl/depthwise_conv2d_buffer_compute.cc
lite/kernels/opencl/depthwise_conv2d_buffer_compute.cc
+12
-0
lite/kernels/opencl/dropout_image_compute.cc
lite/kernels/opencl/dropout_image_compute.cc
+19
-7
lite/kernels/opencl/elementwise_add_buffer_compute.h
lite/kernels/opencl/elementwise_add_buffer_compute.h
+12
-0
lite/kernels/opencl/elementwise_add_image_compute.h
lite/kernels/opencl/elementwise_add_image_compute.h
+4
-1
lite/kernels/opencl/elementwise_mul_compute.cc
lite/kernels/opencl/elementwise_mul_compute.cc
+7
-7
lite/kernels/opencl/elementwise_mul_image_compute.cc
lite/kernels/opencl/elementwise_mul_image_compute.cc
+11
-7
lite/kernels/opencl/elementwise_sub_image_compute.cc
lite/kernels/opencl/elementwise_sub_image_compute.cc
+7
-2
lite/kernels/opencl/elementwise_sub_image_compute.h
lite/kernels/opencl/elementwise_sub_image_compute.h
+12
-0
lite/kernels/opencl/fc_buffer_compute.cc
lite/kernels/opencl/fc_buffer_compute.cc
+19
-7
lite/kernels/opencl/grid_sampler_image_compute.cc
lite/kernels/opencl/grid_sampler_image_compute.cc
+19
-7
lite/kernels/opencl/instance_norm_image_compute.cc
lite/kernels/opencl/instance_norm_image_compute.cc
+26
-14
lite/kernels/opencl/lrn_image_compute.cc
lite/kernels/opencl/lrn_image_compute.cc
+19
-7
lite/kernels/opencl/mul_buffer_compute.cc
lite/kernels/opencl/mul_buffer_compute.cc
+19
-7
lite/kernels/opencl/nearest_interp_image_compute.cc
lite/kernels/opencl/nearest_interp_image_compute.cc
+19
-7
lite/kernels/opencl/pad2d_image_compute.cc
lite/kernels/opencl/pad2d_image_compute.cc
+19
-7
lite/kernels/opencl/pool_buffer_compute.cc
lite/kernels/opencl/pool_buffer_compute.cc
+19
-7
lite/kernels/opencl/pool_image_compute.cc
lite/kernels/opencl/pool_image_compute.cc
+4
-1
lite/kernels/opencl/reshape_image_compute.cc
lite/kernels/opencl/reshape_image_compute.cc
+4
-1
lite/kernels/opencl/scale_image_compute.cc
lite/kernels/opencl/scale_image_compute.cc
+19
-7
lite/kernels/opencl/slice_image_compute.cc
lite/kernels/opencl/slice_image_compute.cc
+19
-7
未找到文件。
lite/kernels/opencl/activation_buffer_compute.cc
浏览文件 @
a1422f73
...
...
@@ -18,6 +18,10 @@
#include "lite/kernels/opencl/image_helper.h"
#include "lite/operators/op_params.h"
#include "lite/utils/replace_stl/stream.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -63,16 +67,24 @@ class ReluCompute
auto
global_work_size
=
cl
::
NDRange
{
count
};
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
private:
std
::
string
kernel_func_name_
{
"relu"
};
std
::
string
build_options_
{
"-DCL_DTYPE_float -DRELU"
};
...
...
@@ -120,16 +132,24 @@ class SigmoidCompute
auto
global_work_size
=
cl
::
NDRange
{
count
};
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
private:
std
::
string
kernel_func_name_
{
"sigmoid"
};
std
::
string
build_options_
{
"-DCL_DTYPE_float -DSIGMOID"
};
...
...
lite/kernels/opencl/activation_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -19,6 +19,10 @@
#include "lite/kernels/opencl/image_helper.h"
#include "lite/operators/op_params.h"
#include "lite/utils/replace_stl/stream.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -148,16 +152,24 @@ class ActivationComputeImageDefault
auto
&
context
=
ctx_
->
As
<
OpenCLContext
>
();
CHECK
(
context
.
cl_context
()
!=
nullptr
);
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size_
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
private:
param_t
*
act_param_
{
nullptr
};
DDim
x_img_shape_
=
DDim
(
std
::
vector
<
DDim
::
value_type
>
(
...
...
lite/kernels/opencl/bilinear_interp_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -23,6 +23,10 @@
#include "lite/operators/op_params.h"
#include "lite/utils/logging.h"
#include "lite/utils/replace_stl/stream.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -142,13 +146,13 @@ class BilinearInterpImageCompute
static_cast
<
cl
::
size_type
>
(
default_work_size
[
1
]),
static_cast
<
cl
::
size_type
>
(
default_work_size
[
2
])};
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
#ifdef LITE_WITH_LOG
VLOG
(
4
)
<<
"global_work_size:[2D]:"
<<
global_work_size
[
0
]
<<
" "
...
...
lite/kernels/opencl/box_coder_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -23,6 +23,10 @@
#include "lite/operators/op_params.h"
#include "lite/utils/logging.h"
#include "lite/utils/replace_stl/stream.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -121,13 +125,13 @@ class BoxCoderComputeImage : public KernelLite<TARGET(kOpenCL),
cl
::
NDRange
{
static_cast
<
cl
::
size_type
>
(
default_work_size
[
0
]),
static_cast
<
cl
::
size_type
>
(
default_work_size
[
2
])};
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
#ifdef LITE_WITH_LOG
...
...
@@ -138,6 +142,14 @@ class BoxCoderComputeImage : public KernelLite<TARGET(kOpenCL),
}
std
::
string
doc
()
{
return
"Boxcoder using cl::Image, kFP16"
;
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
param_t
*
boxcoder_param_
{
nullptr
};
std
::
string
kernel_func_name_
{};
std
::
string
build_options_
{
" -DCL_DTYPE_half"
};
...
...
lite/kernels/opencl/concat_buffer_compute.cc
浏览文件 @
a1422f73
...
...
@@ -18,6 +18,10 @@
#include "lite/kernels/opencl/image_helper.h"
#include "lite/operators/op_params.h"
#include "lite/utils/replace_stl/stream.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -124,13 +128,13 @@ class ConcatCompute : public KernelLite<TARGET(kOpenCL),
status
=
kernel
.
setArg
(
++
arg_idx
,
total1
);
CL_CHECK_FATAL
(
status
);
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
}
else
{
auto
start
=
0
;
...
...
@@ -157,13 +161,13 @@ class ConcatCompute : public KernelLite<TARGET(kOpenCL),
status
=
kernel
.
setArg
(
++
arg_idx
,
total0
);
CL_CHECK_FATAL
(
status
);
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
start
+=
size
;
}
...
...
@@ -172,6 +176,14 @@ class ConcatCompute : public KernelLite<TARGET(kOpenCL),
std
::
string
doc
()
{
return
"Concat using cl::Buffer, kFloat"
;
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
int
axis_size_
=
1
;
int
post_size_
=
1
;
int
pre_size_
=
1
;
...
...
lite/kernels/opencl/concat_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -19,6 +19,10 @@
#include "lite/kernels/opencl/image_helper.h"
#include "lite/operators/op_params.h"
#include "lite/utils/replace_stl/stream.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -246,6 +250,14 @@ class ConcatComputeImage : public KernelLite<TARGET(kOpenCL),
std
::
string
doc
()
{
return
"Concat using cl::Image, kFP16"
;
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
int
axis_size_
=
1
;
int
axis_
=
1
;
int
flag_
=
1
;
...
...
lite/kernels/opencl/conv_buffer_compute.h
浏览文件 @
a1422f73
...
...
@@ -23,6 +23,10 @@
#include "lite/core/tensor.h"
#include "lite/kernels/opencl/image_helper.h"
#include "lite/operators/op_params.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -39,6 +43,14 @@ class ConvCompute
void
Run
()
override
;
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_names_
[
0
];
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
private:
void
GemmlikeConv2d
();
void
Conv2d1x1
();
...
...
lite/kernels/opencl/depthwise_conv2d_buffer_compute.cc
浏览文件 @
a1422f73
...
...
@@ -20,6 +20,10 @@
#include "lite/kernels/opencl/image_helper.h"
#include "lite/operators/op_params.h"
#include "lite/utils/replace_stl/stream.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -119,6 +123,14 @@ class DepthwiseConv2dCompute
CL_CHECK_FATAL
(
status
);
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
private:
std
::
string
kernel_func_name_
{
"depthwise_conv2d"
};
std
::
string
build_options_
{
"-DCL_DTYPE_float"
};
...
...
lite/kernels/opencl/dropout_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -21,6 +21,10 @@
#include "lite/operators/op_params.h"
#include "lite/utils/replace_stl/stream.h"
#include "lite/utils/string.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -89,16 +93,24 @@ class DropoutComputeImage2D : public KernelLite<TARGET(kOpenCL),
static_cast
<
cl
::
size_type
>
(
default_work_size
.
data
()[
1
]),
static_cast
<
cl
::
size_type
>
(
default_work_size
.
data
()[
2
])};
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
private:
std
::
string
kernel_func_name_
{
"dropout"
};
std
::
string
build_options_
{
"-DCL_DTYPE_half"
};
...
...
lite/kernels/opencl/elementwise_add_buffer_compute.h
浏览文件 @
a1422f73
...
...
@@ -19,6 +19,10 @@
#include "lite/kernels/opencl/image_helper.h"
#include "lite/operators/op_params.h"
#include "lite/utils/cp_logging.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -38,6 +42,14 @@ class ElementwiseAddCompute
return
"ElementwiseAdd using cl::Buffer, kFloat"
;
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
protected:
void
UpdateParams
();
...
...
lite/kernels/opencl/elementwise_add_image_compute.h
浏览文件 @
a1422f73
...
...
@@ -17,11 +17,14 @@
#include <string>
#include <vector>
#include "lite/backends/opencl/cl_half.h"
#include "lite/backends/opencl/cl_utility.h"
#include "lite/core/kernel.h"
#include "lite/kernels/opencl/image_helper.h"
#include "lite/operators/op_params.h"
#include "lite/utils/cp_logging.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
lite/kernels/opencl/elementwise_mul_compute.cc
浏览文件 @
a1422f73
...
...
@@ -153,13 +153,13 @@ void ElementwiseMulFloatImageCompute::Run() {
auto
global_work_size
=
cl
::
NDRange
{
static_cast
<
cl
::
size_type
>
(
x_img_width
),
static_cast
<
cl
::
size_type
>
(
x_img_height
)};
auto
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
auto
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
std
::
string
time_stamp_
{
GetTimeStamp
()};
...
...
lite/kernels/opencl/elementwise_mul_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -23,6 +23,10 @@
#include "lite/operators/op_params.h"
#include "lite/utils/logging.h"
#include "lite/utils/replace_stl/stream.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -186,13 +190,13 @@ class ElementwiseMulImageCompute
cl
::
NDRange
{
static_cast
<
cl
::
size_type
>
(
x_img_width
),
static_cast
<
cl
::
size_type
>
(
x_img_height
)};
auto
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
auto
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
#ifdef LITE_WITH_LOG
VLOG
(
4
)
<<
"global_work_size:[2D]:"
<<
x_img_width
<<
" "
<<
x_img_height
;
...
...
lite/kernels/opencl/elementwise_sub_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -138,8 +138,13 @@ void ElementwiseSubImageCompute::Run() {
VLOG
(
4
)
<<
"global_work_size:[2D]:"
<<
x_img_width
<<
" "
<<
x_img_height
;
#endif
auto
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
auto
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
event_
);
CL_CHECK_FATAL
(
status
);
}
...
...
lite/kernels/opencl/elementwise_sub_image_compute.h
浏览文件 @
a1422f73
...
...
@@ -20,6 +20,10 @@
#include "lite/kernels/opencl/image_helper.h"
#include "lite/operators/op_params.h"
#include "lite/utils/cp_logging.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -41,6 +45,14 @@ class ElementwiseSubImageCompute
return
"ElementwiseSub using cl::Image2D, kFP16"
;
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
protected:
param_t
*
ele_param_
{
nullptr
};
std
::
string
kernel_func_name_
{
"elementwise_sub"
};
...
...
lite/kernels/opencl/fc_buffer_compute.cc
浏览文件 @
a1422f73
...
...
@@ -20,6 +20,10 @@
#include "lite/operators/op_params.h"
#include "lite/utils/replace_stl/stream.h"
#include "lite/utils/string.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -124,16 +128,24 @@ class FcCompute
auto
&
context
=
ctx_
->
As
<
OpenCLContext
>
();
CHECK
(
context
.
cl_context
()
!=
nullptr
);
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size_
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
private:
int
m_
,
n_
,
k_
;
param_t
*
fc_param_
{
nullptr
};
...
...
lite/kernels/opencl/grid_sampler_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -23,6 +23,10 @@
#include "lite/operators/op_params.h"
#include "lite/utils/logging.h"
#include "lite/utils/replace_stl/stream.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -131,16 +135,24 @@ class GridSamplerImageCompute : public KernelLite<TARGET(kOpenCL),
auto
&
context
=
ctx_
->
As
<
OpenCLContext
>
();
CHECK
(
context
.
cl_context
()
!=
nullptr
);
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size_
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
protected:
param_t
*
grid_param_
{
nullptr
};
bool
first_epoch_for_reinit_
{
true
};
...
...
lite/kernels/opencl/instance_norm_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -23,6 +23,10 @@
#include "lite/operators/op_params.h"
#include "lite/utils/logging.h"
#include "lite/utils/replace_stl/stream.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -137,13 +141,13 @@ class InstanceNormImageCompute : public KernelLite<TARGET(kOpenCL),
status
=
kernel
.
setArg
(
7
,
*
out_img
);
CL_CHECK_FATAL
(
status
);
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
local_work_size
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
}
...
...
@@ -258,17 +262,25 @@ class InstanceNormImageCompute : public KernelLite<TARGET(kOpenCL),
status
=
kernel
.
setArg
(
arg_idx
++
,
in_w
);
CL_CHECK_FATAL
(
status
);
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
local_work_size
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
}
#endif
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
protected:
param_t
*
instance_norm_param_
{
nullptr
};
std
::
string
kernel_func_name_
{
"instance_norm_onnx"
};
...
...
lite/kernels/opencl/lrn_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -23,6 +23,10 @@
#include "lite/operators/op_params.h"
#include "lite/utils/logging.h"
#include "lite/utils/replace_stl/stream.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -128,13 +132,13 @@ class LrnImageCompute : public KernelLite<TARGET(kOpenCL),
static_cast
<
cl
::
size_type
>
(
default_work_size
[
1
]),
static_cast
<
cl
::
size_type
>
(
default_work_size
[
2
])};
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
#ifdef LITE_WITH_LOG
VLOG
(
4
)
<<
"global_work_size:[2D]:"
<<
global_work_size
[
0
]
<<
" "
...
...
@@ -142,6 +146,14 @@ class LrnImageCompute : public KernelLite<TARGET(kOpenCL),
#endif
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
protected:
param_t
*
lrn_param_
{
nullptr
};
int
n_
{
5
};
...
...
lite/kernels/opencl/mul_buffer_compute.cc
浏览文件 @
a1422f73
...
...
@@ -20,6 +20,10 @@
#include "lite/operators/op_params.h"
#include "lite/utils/replace_stl/stream.h"
#include "lite/utils/string.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -92,16 +96,24 @@ class MulCompute
auto
global_work_size
=
cl
::
NDRange
{
static_cast
<
size_t
>
((
m_
+
3
)
/
4
),
static_cast
<
size_t
>
((
n_
+
3
)
/
4
)};
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
private:
int
m_
,
n_
,
k_
;
std
::
string
kernel_func_name_
{
"mat_mul"
};
...
...
lite/kernels/opencl/nearest_interp_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -19,6 +19,10 @@
#include "lite/kernels/opencl/image_helper.h"
#include "lite/operators/op_params.h"
#include "lite/utils/replace_stl/stream.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -110,16 +114,24 @@ class NearestInterpComputeImageDefault
static_cast
<
cl
::
size_type
>
(
default_work_size
.
data
()[
1
]),
static_cast
<
cl
::
size_type
>
(
default_work_size
.
data
()[
2
])};
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
private:
std
::
string
kernel_func_name_
{
"nearest_interp"
};
std
::
string
build_options_
{
" -DCL_DTYPE_half"
};
...
...
lite/kernels/opencl/pad2d_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -23,6 +23,10 @@
#include "lite/operators/op_params.h"
#include "lite/utils/logging.h"
#include "lite/utils/replace_stl/stream.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -142,13 +146,13 @@ class Pad2dCompute : public KernelLite<TARGET(kOpenCL),
static_cast
<
cl
::
size_type
>
(
default_work_size
[
1
]),
static_cast
<
cl
::
size_type
>
(
default_work_size
[
2
])};
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
#ifdef LITE_WITH_LOG
VLOG
(
4
)
<<
"global_work_size:[2D]:"
<<
global_work_size
[
0
]
<<
" "
...
...
@@ -156,6 +160,14 @@ class Pad2dCompute : public KernelLite<TARGET(kOpenCL),
#endif
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
protected:
param_t
*
pad2d_param_
{
nullptr
};
std
::
string
kernel_func_name_
{};
...
...
lite/kernels/opencl/pool_buffer_compute.cc
浏览文件 @
a1422f73
...
...
@@ -20,6 +20,10 @@
#include "lite/operators/op_params.h"
#include "lite/utils/replace_stl/stream.h"
#include "lite/utils/string.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -106,16 +110,24 @@ class PoolCompute
CL_CHECK_FATAL
(
status
);
auto
global_work_size
=
cl
::
NDRange
(
static_cast
<
size_t
>
(
numel
));
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
private:
std
::
string
kernel_func_name_
{
"pool_"
};
std
::
string
build_options_
{
"-DCL_DTYPE_float"
};
...
...
lite/kernels/opencl/pool_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -16,13 +16,16 @@
#include "lite/backends/opencl/cl_half.h"
#include "lite/backends/opencl/cl_include.h"
#include "lite/backends/opencl/cl_utility.h"
#include "lite/core/kernel.h"
#include "lite/core/op_registry.h"
#include "lite/kernels/opencl/image_helper.h"
#include "lite/operators/op_params.h"
#include "lite/utils/replace_stl/stream.h"
#include "lite/utils/string.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
#undef LITE_WITH_LOG
...
...
lite/kernels/opencl/reshape_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -14,13 +14,16 @@
#include "lite/backends/opencl/cl_half.h"
#include "lite/backends/opencl/cl_include.h"
#include "lite/backends/opencl/cl_utility.h"
#include "lite/core/kernel.h"
#include "lite/core/op_registry.h"
#include "lite/kernels/opencl/image_helper.h"
#include "lite/operators/op_params.h"
#include "lite/utils/logging.h"
#include "lite/utils/replace_stl/stream.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
#undef LITE_WITH_LOG
...
...
lite/kernels/opencl/scale_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -21,6 +21,10 @@
#include "lite/operators/op_params.h"
#include "lite/utils/replace_stl/stream.h"
#include "lite/utils/string.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -93,16 +97,24 @@ class ScaleComputeImage2D : public KernelLite<TARGET(kOpenCL),
status
=
kernel
.
setArg
(
3
,
bias
);
CL_CHECK_FATAL
(
status
);
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size_
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
private:
std
::
string
kernel_func_name_
{
"scale"
};
std
::
string
build_options_
{
"-DCL_DTYPE_half"
};
...
...
lite/kernels/opencl/slice_image_compute.cc
浏览文件 @
a1422f73
...
...
@@ -21,6 +21,10 @@
#include "lite/operators/op_params.h"
#include "lite/utils/replace_stl/stream.h"
#include "lite/utils/string.h"
#ifdef LITE_WITH_PROFILE
#include "lite/core/profile/profiler.h"
#endif
#include "lite/backends/opencl/cl_utility.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -96,16 +100,24 @@ class SliceComputeImage2D : public KernelLite<TARGET(kOpenCL),
static_cast
<
cl
::
size_type
>
(
default_work_size
.
data
()[
1
]),
static_cast
<
cl
::
size_type
>
(
default_work_size
.
data
()[
2
])};
status
=
context
.
cl_context
()
->
GetCommandQueue
().
enqueueNDRangeKernel
(
status
=
EnqueueNDRangeKernel
(
context
,
kernel
,
cl
::
NullRange
,
global_work_size
,
cl
::
NullRange
,
nullptr
,
nullptr
);
event_
);
CL_CHECK_FATAL
(
status
);
}
#ifdef LITE_WITH_PROFILE
void
SetProfileRuntimeKernelInfo
(
paddle
::
lite
::
profile
::
OpCharacter
*
ch
)
{
ch
->
kernel_func_name
=
kernel_func_name_
;
ch
->
cl_event
=
event_
;
// `event_` defined in `kernel.h`, valid after kernel::Run
}
#endif
private:
std
::
string
kernel_func_name_
{
"slice"
};
std
::
string
build_options_
{
"-DCL_DTYPE_half"
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录