Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
b2a64047
Mace
项目概览
Xiaomi
/
Mace
通知
107
Star
40
Fork
27
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
b2a64047
编写于
7月 27, 2018
作者:
L
Liangliang He
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'load-opencl-lib' into 'master'
Use singleton pattern to load OpenCL library. See merge request !686
上级
f6db015d
4512ed21
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
72 addition
and
158 deletion
+72
-158
mace/core/runtime/opencl/opencl_runtime.cc
mace/core/runtime/opencl/opencl_runtime.cc
+0
-3
mace/core/runtime/opencl/opencl_runtime.h
mace/core/runtime/opencl/opencl_runtime.h
+0
-1
mace/core/runtime/opencl/opencl_wrapper.cc
mace/core/runtime/opencl/opencl_wrapper.cc
+72
-128
mace/core/runtime/opencl/opencl_wrapper.h
mace/core/runtime/opencl/opencl_wrapper.h
+0
-26
未找到文件。
mace/core/runtime/opencl/opencl_runtime.cc
浏览文件 @
b2a64047
...
@@ -308,8 +308,6 @@ OpenCLRuntime::OpenCLRuntime():
...
@@ -308,8 +308,6 @@ OpenCLRuntime::OpenCLRuntime():
precompiled_binary_storage_
(
nullptr
),
precompiled_binary_storage_
(
nullptr
),
cache_storage_
(
nullptr
),
cache_storage_
(
nullptr
),
is_profiling_enabled_
(
false
)
{
is_profiling_enabled_
(
false
)
{
LoadOpenCLLibrary
();
std
::
vector
<
cl
::
Platform
>
all_platforms
;
std
::
vector
<
cl
::
Platform
>
all_platforms
;
cl
::
Platform
::
get
(
&
all_platforms
);
cl
::
Platform
::
get
(
&
all_platforms
);
if
(
all_platforms
.
size
()
==
0
)
{
if
(
all_platforms
.
size
()
==
0
)
{
...
@@ -456,7 +454,6 @@ OpenCLRuntime::~OpenCLRuntime() {
...
@@ -456,7 +454,6 @@ OpenCLRuntime::~OpenCLRuntime() {
command_queue_
.
reset
();
command_queue_
.
reset
();
context_
.
reset
();
context_
.
reset
();
device_
.
reset
();
device_
.
reset
();
UnloadOpenCLLibrary
();
}
}
cl
::
Context
&
OpenCLRuntime
::
context
()
{
return
*
context_
;
}
cl
::
Context
&
OpenCLRuntime
::
context
()
{
return
*
context_
;
}
...
...
mace/core/runtime/opencl/opencl_runtime.h
浏览文件 @
b2a64047
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
#include "mace/core/future.h"
#include "mace/core/future.h"
#include "mace/core/runtime/opencl/cl2_header.h"
#include "mace/core/runtime/opencl/cl2_header.h"
#include "mace/core/runtime/opencl/opencl_wrapper.h"
#include "mace/public/mace_runtime.h"
#include "mace/public/mace_runtime.h"
#include "mace/utils/string_util.h"
#include "mace/utils/string_util.h"
#include "mace/utils/timer.h"
#include "mace/utils/timer.h"
...
...
mace/core/runtime/opencl/opencl_wrapper.cc
浏览文件 @
b2a64047
...
@@ -12,8 +12,6 @@
...
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
#include "mace/core/runtime/opencl/opencl_wrapper.h"
#include <CL/opencl.h>
#include <CL/opencl.h>
#include <dlfcn.h>
#include <dlfcn.h>
#include <string>
#include <string>
...
@@ -26,11 +24,17 @@
...
@@ -26,11 +24,17 @@
*/
*/
namespace
mace
{
namespace
mace
{
namespace
{
namespace
runtime
{
class
OpenCLLibraryImpl
final
{
class
OpenCLLibrary
final
{
public:
private:
OpenCLLibrary
();
MACE_DISABLE_COPY_AND_ASSIGN
(
OpenCLLibrary
);
bool
Load
();
bool
Load
();
void
Unload
();
void
*
LoadFromPath
(
const
std
::
string
&
path
);
public:
static
OpenCLLibrary
*
Get
();
using
clGetPlatformIDsFunc
=
cl_int
(
*
)(
cl_uint
,
cl_platform_id
*
,
cl_uint
*
);
using
clGetPlatformIDsFunc
=
cl_int
(
*
)(
cl_uint
,
cl_platform_id
*
,
cl_uint
*
);
using
clGetPlatformInfoFunc
=
using
clGetPlatformInfoFunc
=
...
@@ -243,11 +247,19 @@ class OpenCLLibraryImpl final {
...
@@ -243,11 +247,19 @@ class OpenCLLibraryImpl final {
#undef MACE_CL_DEFINE_FUNC_PTR
#undef MACE_CL_DEFINE_FUNC_PTR
private:
private:
void
*
LoadFromPath
(
const
std
::
string
&
path
);
void
*
handle_
=
nullptr
;
void
*
handle_
=
nullptr
;
};
};
bool
OpenCLLibraryImpl
::
Load
()
{
OpenCLLibrary
*
OpenCLLibrary
::
Get
()
{
static
OpenCLLibrary
library
;
return
&
library
;
}
OpenCLLibrary
::
OpenCLLibrary
()
{
this
->
Load
();
}
bool
OpenCLLibrary
::
Load
()
{
if
(
handle_
!=
nullptr
)
{
if
(
handle_
!=
nullptr
)
{
return
true
;
return
true
;
}
}
...
@@ -281,25 +293,17 @@ bool OpenCLLibraryImpl::Load() {
...
@@ -281,25 +293,17 @@ bool OpenCLLibraryImpl::Load() {
}
}
if
(
handle_
==
nullptr
)
{
if
(
handle_
==
nullptr
)
{
LOG
(
ERROR
)
<<
"Failed to load OpenCL library, "
LOG
(
FATAL
)
<<
"Failed to load OpenCL library, "
"please make sure there exist OpenCL library on your device, "
"please make sure there exist
s
OpenCL library on your device, "
"and your APP have right to access the library."
;
"and your APP have right to access the library."
;
return
false
;
return
false
;
}
}
// Do not dlclose, leave it to system.
return
true
;
return
true
;
}
}
void
OpenCLLibraryImpl
::
Unload
()
{
void
*
OpenCLLibrary
::
LoadFromPath
(
const
std
::
string
&
path
)
{
if
(
handle_
!=
nullptr
)
{
if
(
dlclose
(
handle_
)
!=
0
)
{
LOG
(
ERROR
)
<<
"dlclose failed for OpenCL library"
;
}
handle_
=
nullptr
;
}
}
void
*
OpenCLLibraryImpl
::
LoadFromPath
(
const
std
::
string
&
path
)
{
void
*
handle
=
dlopen
(
path
.
c_str
(),
RTLD_LAZY
|
RTLD_LOCAL
);
void
*
handle
=
dlopen
(
path
.
c_str
(),
RTLD_LAZY
|
RTLD_LOCAL
);
if
(
handle
==
nullptr
)
{
if
(
handle
==
nullptr
)
{
...
@@ -371,22 +375,7 @@ void *OpenCLLibraryImpl::LoadFromPath(const std::string &path) {
...
@@ -371,22 +375,7 @@ void *OpenCLLibraryImpl::LoadFromPath(const std::string &path) {
return
handle
;
return
handle
;
}
}
OpenCLLibraryImpl
*
openclLibraryImpl
=
nullptr
;
}
// namespace runtime
}
// namespace
void
LoadOpenCLLibrary
()
{
MACE_CHECK
(
openclLibraryImpl
==
nullptr
);
openclLibraryImpl
=
new
OpenCLLibraryImpl
();
MACE_CHECK
(
openclLibraryImpl
->
Load
());
}
void
UnloadOpenCLLibrary
()
{
MACE_CHECK_NOTNULL
(
openclLibraryImpl
);
openclLibraryImpl
->
Unload
();
delete
openclLibraryImpl
;
openclLibraryImpl
=
nullptr
;
}
}
// namespace mace
}
// namespace mace
// Platform APIs
// Platform APIs
...
@@ -394,8 +383,7 @@ CL_API_ENTRY cl_int clGetPlatformIDs(cl_uint num_entries,
...
@@ -394,8 +383,7 @@ CL_API_ENTRY cl_int clGetPlatformIDs(cl_uint num_entries,
cl_platform_id
*
platforms
,
cl_platform_id
*
platforms
,
cl_uint
*
num_platforms
)
cl_uint
*
num_platforms
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clGetPlatformIDs
;
auto
func
=
mace
::
openclLibraryImpl
->
clGetPlatformIDs
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clGetPlatformIDs"
);
MACE_LATENCY_LOGGER
(
3
,
"clGetPlatformIDs"
);
return
func
(
num_entries
,
platforms
,
num_platforms
);
return
func
(
num_entries
,
platforms
,
num_platforms
);
...
@@ -407,8 +395,7 @@ CL_API_ENTRY cl_int clGetPlatformInfo(cl_platform_id platform,
...
@@ -407,8 +395,7 @@ CL_API_ENTRY cl_int clGetPlatformInfo(cl_platform_id platform,
void
*
param_value
,
void
*
param_value
,
size_t
*
param_value_size_ret
)
size_t
*
param_value_size_ret
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clGetPlatformInfo
;
auto
func
=
mace
::
openclLibraryImpl
->
clGetPlatformInfo
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clGetPlatformInfo"
);
MACE_LATENCY_LOGGER
(
3
,
"clGetPlatformInfo"
);
return
func
(
platform
,
param_name
,
param_value_size
,
param_value
,
return
func
(
platform
,
param_name
,
param_value_size
,
param_value
,
...
@@ -422,8 +409,7 @@ CL_API_ENTRY cl_int clGetDeviceIDs(cl_platform_id platform,
...
@@ -422,8 +409,7 @@ CL_API_ENTRY cl_int clGetDeviceIDs(cl_platform_id platform,
cl_device_id
*
devices
,
cl_device_id
*
devices
,
cl_uint
*
num_devices
)
cl_uint
*
num_devices
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clGetDeviceIDs
;
auto
func
=
mace
::
openclLibraryImpl
->
clGetDeviceIDs
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clGetDeviceIDs"
);
MACE_LATENCY_LOGGER
(
3
,
"clGetDeviceIDs"
);
return
func
(
platform
,
device_type
,
num_entries
,
devices
,
num_devices
);
return
func
(
platform
,
device_type
,
num_entries
,
devices
,
num_devices
);
...
@@ -435,8 +421,7 @@ CL_API_ENTRY cl_int clGetDeviceInfo(cl_device_id device,
...
@@ -435,8 +421,7 @@ CL_API_ENTRY cl_int clGetDeviceInfo(cl_device_id device,
void
*
param_value
,
void
*
param_value
,
size_t
*
param_value_size_ret
)
size_t
*
param_value_size_ret
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clGetDeviceInfo
;
auto
func
=
mace
::
openclLibraryImpl
->
clGetDeviceInfo
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clGetDeviceInfo"
);
MACE_LATENCY_LOGGER
(
3
,
"clGetDeviceInfo"
);
return
func
(
device
,
param_name
,
param_value_size
,
param_value
,
return
func
(
device
,
param_name
,
param_value_size
,
param_value
,
...
@@ -445,8 +430,7 @@ CL_API_ENTRY cl_int clGetDeviceInfo(cl_device_id device,
...
@@ -445,8 +430,7 @@ CL_API_ENTRY cl_int clGetDeviceInfo(cl_device_id device,
CL_API_ENTRY
cl_int
clRetainDevice
(
cl_device_id
device
)
CL_API_ENTRY
cl_int
clRetainDevice
(
cl_device_id
device
)
CL_API_SUFFIX__VERSION_1_2
{
CL_API_SUFFIX__VERSION_1_2
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clRetainDevice
;
auto
func
=
mace
::
openclLibraryImpl
->
clRetainDevice
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clRetainDevice"
);
MACE_LATENCY_LOGGER
(
3
,
"clRetainDevice"
);
return
func
(
device
);
return
func
(
device
);
...
@@ -454,8 +438,7 @@ CL_API_ENTRY cl_int clRetainDevice(cl_device_id device)
...
@@ -454,8 +438,7 @@ CL_API_ENTRY cl_int clRetainDevice(cl_device_id device)
CL_API_ENTRY
cl_int
clReleaseDevice
(
cl_device_id
device
)
CL_API_ENTRY
cl_int
clReleaseDevice
(
cl_device_id
device
)
CL_API_SUFFIX__VERSION_1_2
{
CL_API_SUFFIX__VERSION_1_2
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clReleaseDevice
;
auto
func
=
mace
::
openclLibraryImpl
->
clReleaseDevice
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clReleaseDevice"
);
MACE_LATENCY_LOGGER
(
3
,
"clReleaseDevice"
);
return
func
(
device
);
return
func
(
device
);
...
@@ -469,8 +452,7 @@ CL_API_ENTRY cl_context clCreateContext(
...
@@ -469,8 +452,7 @@ CL_API_ENTRY cl_context clCreateContext(
void
(
CL_CALLBACK
*
pfn_notify
)(
const
char
*
,
const
void
*
,
size_t
,
void
*
),
void
(
CL_CALLBACK
*
pfn_notify
)(
const
char
*
,
const
void
*
,
size_t
,
void
*
),
void
*
user_data
,
void
*
user_data
,
cl_int
*
errcode_ret
)
CL_API_SUFFIX__VERSION_1_0
{
cl_int
*
errcode_ret
)
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clCreateContext
;
auto
func
=
mace
::
openclLibraryImpl
->
clCreateContext
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateContext"
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateContext"
);
return
func
(
properties
,
num_devices
,
devices
,
pfn_notify
,
user_data
,
return
func
(
properties
,
num_devices
,
devices
,
pfn_notify
,
user_data
,
...
@@ -483,8 +465,7 @@ CL_API_ENTRY cl_context clCreateContextFromType(
...
@@ -483,8 +465,7 @@ CL_API_ENTRY cl_context clCreateContextFromType(
void
(
CL_CALLBACK
*
pfn_notify
)(
const
char
*
,
const
void
*
,
size_t
,
void
*
),
void
(
CL_CALLBACK
*
pfn_notify
)(
const
char
*
,
const
void
*
,
size_t
,
void
*
),
void
*
user_data
,
void
*
user_data
,
cl_int
*
errcode_ret
)
CL_API_SUFFIX__VERSION_1_0
{
cl_int
*
errcode_ret
)
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clCreateContextFromType
;
auto
func
=
mace
::
openclLibraryImpl
->
clCreateContextFromType
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateContextFromType"
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateContextFromType"
);
return
func
(
properties
,
device_type
,
pfn_notify
,
user_data
,
errcode_ret
);
return
func
(
properties
,
device_type
,
pfn_notify
,
user_data
,
errcode_ret
);
...
@@ -492,8 +473,7 @@ CL_API_ENTRY cl_context clCreateContextFromType(
...
@@ -492,8 +473,7 @@ CL_API_ENTRY cl_context clCreateContextFromType(
CL_API_ENTRY
cl_int
clRetainContext
(
cl_context
context
)
CL_API_ENTRY
cl_int
clRetainContext
(
cl_context
context
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clRetainContext
;
auto
func
=
mace
::
openclLibraryImpl
->
clRetainContext
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clRetainContext"
);
MACE_LATENCY_LOGGER
(
3
,
"clRetainContext"
);
return
func
(
context
);
return
func
(
context
);
...
@@ -501,8 +481,7 @@ CL_API_ENTRY cl_int clRetainContext(cl_context context)
...
@@ -501,8 +481,7 @@ CL_API_ENTRY cl_int clRetainContext(cl_context context)
CL_API_ENTRY
cl_int
clReleaseContext
(
cl_context
context
)
CL_API_ENTRY
cl_int
clReleaseContext
(
cl_context
context
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clReleaseContext
;
auto
func
=
mace
::
openclLibraryImpl
->
clReleaseContext
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clReleaseContext"
);
MACE_LATENCY_LOGGER
(
3
,
"clReleaseContext"
);
return
func
(
context
);
return
func
(
context
);
...
@@ -514,8 +493,7 @@ CL_API_ENTRY cl_int clGetContextInfo(cl_context context,
...
@@ -514,8 +493,7 @@ CL_API_ENTRY cl_int clGetContextInfo(cl_context context,
void
*
param_value
,
void
*
param_value
,
size_t
*
param_value_size_ret
)
size_t
*
param_value_size_ret
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clGetContextInfo
;
auto
func
=
mace
::
openclLibraryImpl
->
clGetContextInfo
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clGetContextInfo"
);
MACE_LATENCY_LOGGER
(
3
,
"clGetContextInfo"
);
return
func
(
context
,
param_name
,
param_value_size
,
param_value
,
return
func
(
context
,
param_name
,
param_value_size
,
param_value
,
...
@@ -529,8 +507,7 @@ CL_API_ENTRY cl_program clCreateProgramWithSource(cl_context context,
...
@@ -529,8 +507,7 @@ CL_API_ENTRY cl_program clCreateProgramWithSource(cl_context context,
const
size_t
*
lengths
,
const
size_t
*
lengths
,
cl_int
*
errcode_ret
)
cl_int
*
errcode_ret
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clCreateProgramWithSource
;
auto
func
=
mace
::
openclLibraryImpl
->
clCreateProgramWithSource
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateProgramWithSource"
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateProgramWithSource"
);
return
func
(
context
,
count
,
strings
,
lengths
,
errcode_ret
);
return
func
(
context
,
count
,
strings
,
lengths
,
errcode_ret
);
...
@@ -544,8 +521,7 @@ clCreateProgramWithBinary(cl_context context,
...
@@ -544,8 +521,7 @@ clCreateProgramWithBinary(cl_context context,
const
unsigned
char
**
binaries
,
const
unsigned
char
**
binaries
,
cl_int
*
binary_status
,
cl_int
*
binary_status
,
cl_int
*
errcode_ret
)
CL_API_SUFFIX__VERSION_1_0
{
cl_int
*
errcode_ret
)
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clCreateProgramWithBinary
;
auto
func
=
mace
::
openclLibraryImpl
->
clCreateProgramWithBinary
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateProgramWithBinary"
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateProgramWithBinary"
);
return
func
(
context
,
num_devices
,
device_list
,
lengths
,
binaries
,
return
func
(
context
,
num_devices
,
device_list
,
lengths
,
binaries
,
...
@@ -558,8 +534,7 @@ CL_API_ENTRY cl_int clGetProgramInfo(cl_program program,
...
@@ -558,8 +534,7 @@ CL_API_ENTRY cl_int clGetProgramInfo(cl_program program,
void
*
param_value
,
void
*
param_value
,
size_t
*
param_value_size_ret
)
size_t
*
param_value_size_ret
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clGetProgramInfo
;
auto
func
=
mace
::
openclLibraryImpl
->
clGetProgramInfo
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clGetProgramInfo"
);
MACE_LATENCY_LOGGER
(
3
,
"clGetProgramInfo"
);
return
func
(
program
,
param_name
,
param_value_size
,
param_value
,
return
func
(
program
,
param_name
,
param_value_size
,
param_value
,
...
@@ -573,8 +548,7 @@ CL_API_ENTRY cl_int clGetProgramBuildInfo(cl_program program,
...
@@ -573,8 +548,7 @@ CL_API_ENTRY cl_int clGetProgramBuildInfo(cl_program program,
void
*
param_value
,
void
*
param_value
,
size_t
*
param_value_size_ret
)
size_t
*
param_value_size_ret
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clGetProgramBuildInfo
;
auto
func
=
mace
::
openclLibraryImpl
->
clGetProgramBuildInfo
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clGetProgramBuildInfo"
);
MACE_LATENCY_LOGGER
(
3
,
"clGetProgramBuildInfo"
);
return
func
(
program
,
device
,
param_name
,
param_value_size
,
param_value
,
return
func
(
program
,
device
,
param_name
,
param_value_size
,
param_value
,
...
@@ -583,8 +557,7 @@ CL_API_ENTRY cl_int clGetProgramBuildInfo(cl_program program,
...
@@ -583,8 +557,7 @@ CL_API_ENTRY cl_int clGetProgramBuildInfo(cl_program program,
CL_API_ENTRY
cl_int
clRetainProgram
(
cl_program
program
)
CL_API_ENTRY
cl_int
clRetainProgram
(
cl_program
program
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clRetainProgram
;
auto
func
=
mace
::
openclLibraryImpl
->
clRetainProgram
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clRetainProgram"
);
MACE_LATENCY_LOGGER
(
3
,
"clRetainProgram"
);
return
func
(
program
);
return
func
(
program
);
...
@@ -592,8 +565,7 @@ CL_API_ENTRY cl_int clRetainProgram(cl_program program)
...
@@ -592,8 +565,7 @@ CL_API_ENTRY cl_int clRetainProgram(cl_program program)
CL_API_ENTRY
cl_int
clReleaseProgram
(
cl_program
program
)
CL_API_ENTRY
cl_int
clReleaseProgram
(
cl_program
program
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clReleaseProgram
;
auto
func
=
mace
::
openclLibraryImpl
->
clReleaseProgram
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clReleaseProgram"
);
MACE_LATENCY_LOGGER
(
3
,
"clReleaseProgram"
);
return
func
(
program
);
return
func
(
program
);
...
@@ -606,8 +578,7 @@ CL_API_ENTRY cl_int clBuildProgram(
...
@@ -606,8 +578,7 @@ CL_API_ENTRY cl_int clBuildProgram(
const
char
*
options
,
const
char
*
options
,
void
(
CL_CALLBACK
*
pfn_notify
)(
cl_program
program
,
void
*
user_data
),
void
(
CL_CALLBACK
*
pfn_notify
)(
cl_program
program
,
void
*
user_data
),
void
*
user_data
)
CL_API_SUFFIX__VERSION_1_0
{
void
*
user_data
)
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clBuildProgram
;
auto
func
=
mace
::
openclLibraryImpl
->
clBuildProgram
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clBuildProgram"
);
MACE_LATENCY_LOGGER
(
3
,
"clBuildProgram"
);
return
func
(
program
,
num_devices
,
device_list
,
options
,
pfn_notify
,
return
func
(
program
,
num_devices
,
device_list
,
options
,
pfn_notify
,
...
@@ -619,8 +590,7 @@ CL_API_ENTRY cl_kernel clCreateKernel(cl_program program,
...
@@ -619,8 +590,7 @@ CL_API_ENTRY cl_kernel clCreateKernel(cl_program program,
const
char
*
kernel_name
,
const
char
*
kernel_name
,
cl_int
*
errcode_ret
)
cl_int
*
errcode_ret
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clCreateKernel
;
auto
func
=
mace
::
openclLibraryImpl
->
clCreateKernel
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateKernel"
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateKernel"
);
return
func
(
program
,
kernel_name
,
errcode_ret
);
return
func
(
program
,
kernel_name
,
errcode_ret
);
...
@@ -628,8 +598,7 @@ CL_API_ENTRY cl_kernel clCreateKernel(cl_program program,
...
@@ -628,8 +598,7 @@ CL_API_ENTRY cl_kernel clCreateKernel(cl_program program,
CL_API_ENTRY
cl_int
clRetainKernel
(
cl_kernel
kernel
)
CL_API_ENTRY
cl_int
clRetainKernel
(
cl_kernel
kernel
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clRetainKernel
;
auto
func
=
mace
::
openclLibraryImpl
->
clRetainKernel
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clRetainKernel"
);
MACE_LATENCY_LOGGER
(
3
,
"clRetainKernel"
);
return
func
(
kernel
);
return
func
(
kernel
);
...
@@ -637,8 +606,7 @@ CL_API_ENTRY cl_int clRetainKernel(cl_kernel kernel)
...
@@ -637,8 +606,7 @@ CL_API_ENTRY cl_int clRetainKernel(cl_kernel kernel)
CL_API_ENTRY
cl_int
clReleaseKernel
(
cl_kernel
kernel
)
CL_API_ENTRY
cl_int
clReleaseKernel
(
cl_kernel
kernel
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clReleaseKernel
;
auto
func
=
mace
::
openclLibraryImpl
->
clReleaseKernel
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clReleaseKernel"
);
MACE_LATENCY_LOGGER
(
3
,
"clReleaseKernel"
);
return
func
(
kernel
);
return
func
(
kernel
);
...
@@ -649,8 +617,7 @@ CL_API_ENTRY cl_int clSetKernelArg(cl_kernel kernel,
...
@@ -649,8 +617,7 @@ CL_API_ENTRY cl_int clSetKernelArg(cl_kernel kernel,
size_t
arg_size
,
size_t
arg_size
,
const
void
*
arg_value
)
const
void
*
arg_value
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clSetKernelArg
;
auto
func
=
mace
::
openclLibraryImpl
->
clSetKernelArg
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clSetKernelArg"
);
MACE_LATENCY_LOGGER
(
3
,
"clSetKernelArg"
);
return
func
(
kernel
,
arg_index
,
arg_size
,
arg_value
);
return
func
(
kernel
,
arg_index
,
arg_size
,
arg_value
);
...
@@ -663,8 +630,7 @@ CL_API_ENTRY cl_mem clCreateBuffer(cl_context context,
...
@@ -663,8 +630,7 @@ CL_API_ENTRY cl_mem clCreateBuffer(cl_context context,
void
*
host_ptr
,
void
*
host_ptr
,
cl_int
*
errcode_ret
)
cl_int
*
errcode_ret
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clCreateBuffer
;
auto
func
=
mace
::
openclLibraryImpl
->
clCreateBuffer
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateBuffer"
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateBuffer"
);
return
func
(
context
,
flags
,
size
,
host_ptr
,
errcode_ret
);
return
func
(
context
,
flags
,
size
,
host_ptr
,
errcode_ret
);
...
@@ -677,8 +643,7 @@ CL_API_ENTRY cl_mem clCreateImage(cl_context context,
...
@@ -677,8 +643,7 @@ CL_API_ENTRY cl_mem clCreateImage(cl_context context,
void
*
host_ptr
,
void
*
host_ptr
,
cl_int
*
errcode_ret
)
cl_int
*
errcode_ret
)
CL_API_SUFFIX__VERSION_1_2
{
CL_API_SUFFIX__VERSION_1_2
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clCreateImage
;
auto
func
=
mace
::
openclLibraryImpl
->
clCreateImage
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateImage"
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateImage"
);
return
func
(
context
,
flags
,
image_format
,
image_desc
,
host_ptr
,
errcode_ret
);
return
func
(
context
,
flags
,
image_format
,
image_desc
,
host_ptr
,
errcode_ret
);
...
@@ -686,8 +651,7 @@ CL_API_ENTRY cl_mem clCreateImage(cl_context context,
...
@@ -686,8 +651,7 @@ CL_API_ENTRY cl_mem clCreateImage(cl_context context,
CL_API_ENTRY
cl_int
clRetainMemObject
(
cl_mem
memobj
)
CL_API_ENTRY
cl_int
clRetainMemObject
(
cl_mem
memobj
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clRetainMemObject
;
auto
func
=
mace
::
openclLibraryImpl
->
clRetainMemObject
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clRetainMemObject"
);
MACE_LATENCY_LOGGER
(
3
,
"clRetainMemObject"
);
return
func
(
memobj
);
return
func
(
memobj
);
...
@@ -695,8 +659,7 @@ CL_API_ENTRY cl_int clRetainMemObject(cl_mem memobj)
...
@@ -695,8 +659,7 @@ CL_API_ENTRY cl_int clRetainMemObject(cl_mem memobj)
CL_API_ENTRY
cl_int
clReleaseMemObject
(
cl_mem
memobj
)
CL_API_ENTRY
cl_int
clReleaseMemObject
(
cl_mem
memobj
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clReleaseMemObject
;
auto
func
=
mace
::
openclLibraryImpl
->
clReleaseMemObject
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clReleaseMemObject"
);
MACE_LATENCY_LOGGER
(
3
,
"clReleaseMemObject"
);
return
func
(
memobj
);
return
func
(
memobj
);
...
@@ -708,8 +671,7 @@ CL_API_ENTRY cl_int clGetImageInfo(cl_mem image,
...
@@ -708,8 +671,7 @@ CL_API_ENTRY cl_int clGetImageInfo(cl_mem image,
void
*
param_value
,
void
*
param_value
,
size_t
*
param_value_size_ret
)
size_t
*
param_value_size_ret
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clGetImageInfo
;
auto
func
=
mace
::
openclLibraryImpl
->
clGetImageInfo
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clGetImageInfo"
);
MACE_LATENCY_LOGGER
(
3
,
"clGetImageInfo"
);
return
func
(
image
,
param_name
,
param_value_size
,
param_value
,
return
func
(
image
,
param_name
,
param_value_size
,
param_value
,
...
@@ -722,8 +684,8 @@ CL_API_ENTRY cl_command_queue clCreateCommandQueueWithProperties(
...
@@ -722,8 +684,8 @@ CL_API_ENTRY cl_command_queue clCreateCommandQueueWithProperties(
cl_device_id
device
,
cl_device_id
device
,
const
cl_queue_properties
*
properties
,
const
cl_queue_properties
*
properties
,
cl_int
*
errcode_ret
)
CL_API_SUFFIX__VERSION_2_0
{
cl_int
*
errcode_ret
)
CL_API_SUFFIX__VERSION_2_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
auto
func
=
mace
::
openclLibraryImpl
->
clCreateCommandQueueWithProperties
;
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clCreateCommandQueueWithProperties
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateCommandQueueWithProperties"
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateCommandQueueWithProperties"
);
return
func
(
context
,
device
,
properties
,
errcode_ret
);
return
func
(
context
,
device
,
properties
,
errcode_ret
);
...
@@ -731,8 +693,7 @@ CL_API_ENTRY cl_command_queue clCreateCommandQueueWithProperties(
...
@@ -731,8 +693,7 @@ CL_API_ENTRY cl_command_queue clCreateCommandQueueWithProperties(
CL_API_ENTRY
cl_int
clRetainCommandQueue
(
cl_command_queue
command_queue
)
CL_API_ENTRY
cl_int
clRetainCommandQueue
(
cl_command_queue
command_queue
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clRetainCommandQueue
;
auto
func
=
mace
::
openclLibraryImpl
->
clRetainCommandQueue
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clRetainCommandQueue"
);
MACE_LATENCY_LOGGER
(
3
,
"clRetainCommandQueue"
);
return
func
(
command_queue
);
return
func
(
command_queue
);
...
@@ -740,8 +701,7 @@ CL_API_ENTRY cl_int clRetainCommandQueue(cl_command_queue command_queue)
...
@@ -740,8 +701,7 @@ CL_API_ENTRY cl_int clRetainCommandQueue(cl_command_queue command_queue)
CL_API_ENTRY
cl_int
clReleaseCommandQueue
(
cl_command_queue
command_queue
)
CL_API_ENTRY
cl_int
clReleaseCommandQueue
(
cl_command_queue
command_queue
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clReleaseCommandQueue
;
auto
func
=
mace
::
openclLibraryImpl
->
clReleaseCommandQueue
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clReleaseCommandQueue"
);
MACE_LATENCY_LOGGER
(
3
,
"clReleaseCommandQueue"
);
return
func
(
command_queue
);
return
func
(
command_queue
);
...
@@ -758,8 +718,7 @@ CL_API_ENTRY cl_int clEnqueueReadBuffer(cl_command_queue command_queue,
...
@@ -758,8 +718,7 @@ CL_API_ENTRY cl_int clEnqueueReadBuffer(cl_command_queue command_queue,
const
cl_event
*
event_wait_list
,
const
cl_event
*
event_wait_list
,
cl_event
*
event
)
cl_event
*
event
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clEnqueueReadBuffer
;
auto
func
=
mace
::
openclLibraryImpl
->
clEnqueueReadBuffer
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clEnqueueReadBuffer"
);
MACE_LATENCY_LOGGER
(
3
,
"clEnqueueReadBuffer"
);
return
func
(
command_queue
,
buffer
,
blocking_read
,
offset
,
size
,
ptr
,
return
func
(
command_queue
,
buffer
,
blocking_read
,
offset
,
size
,
ptr
,
...
@@ -776,8 +735,7 @@ CL_API_ENTRY cl_int clEnqueueWriteBuffer(cl_command_queue command_queue,
...
@@ -776,8 +735,7 @@ CL_API_ENTRY cl_int clEnqueueWriteBuffer(cl_command_queue command_queue,
const
cl_event
*
event_wait_list
,
const
cl_event
*
event_wait_list
,
cl_event
*
event
)
cl_event
*
event
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clEnqueueWriteBuffer
;
auto
func
=
mace
::
openclLibraryImpl
->
clEnqueueWriteBuffer
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clEnqueueWriteBuffer"
);
MACE_LATENCY_LOGGER
(
3
,
"clEnqueueWriteBuffer"
);
return
func
(
command_queue
,
buffer
,
blocking_write
,
offset
,
size
,
ptr
,
return
func
(
command_queue
,
buffer
,
blocking_write
,
offset
,
size
,
ptr
,
...
@@ -795,8 +753,7 @@ CL_API_ENTRY void *clEnqueueMapBuffer(cl_command_queue command_queue,
...
@@ -795,8 +753,7 @@ CL_API_ENTRY void *clEnqueueMapBuffer(cl_command_queue command_queue,
cl_event
*
event
,
cl_event
*
event
,
cl_int
*
errcode_ret
)
cl_int
*
errcode_ret
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clEnqueueMapBuffer
;
auto
func
=
mace
::
openclLibraryImpl
->
clEnqueueMapBuffer
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clEnqueueMapBuffer"
);
MACE_LATENCY_LOGGER
(
3
,
"clEnqueueMapBuffer"
);
return
func
(
command_queue
,
buffer
,
blocking_map
,
map_flags
,
offset
,
size
,
return
func
(
command_queue
,
buffer
,
blocking_map
,
map_flags
,
offset
,
size
,
...
@@ -816,8 +773,7 @@ CL_API_ENTRY void *clEnqueueMapImage(cl_command_queue command_queue,
...
@@ -816,8 +773,7 @@ CL_API_ENTRY void *clEnqueueMapImage(cl_command_queue command_queue,
cl_event
*
event
,
cl_event
*
event
,
cl_int
*
errcode_ret
)
cl_int
*
errcode_ret
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clEnqueueMapImage
;
auto
func
=
mace
::
openclLibraryImpl
->
clEnqueueMapImage
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clEnqueueMapImage"
);
MACE_LATENCY_LOGGER
(
3
,
"clEnqueueMapImage"
);
return
func
(
command_queue
,
image
,
blocking_map
,
map_flags
,
origin
,
region
,
return
func
(
command_queue
,
image
,
blocking_map
,
map_flags
,
origin
,
region
,
...
@@ -832,8 +788,7 @@ CL_API_ENTRY cl_int clEnqueueUnmapMemObject(cl_command_queue command_queue,
...
@@ -832,8 +788,7 @@ CL_API_ENTRY cl_int clEnqueueUnmapMemObject(cl_command_queue command_queue,
const
cl_event
*
event_wait_list
,
const
cl_event
*
event_wait_list
,
cl_event
*
event
)
cl_event
*
event
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clEnqueueUnmapMemObject
;
auto
func
=
mace
::
openclLibraryImpl
->
clEnqueueUnmapMemObject
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clEnqueueUnmapMemObject"
);
MACE_LATENCY_LOGGER
(
3
,
"clEnqueueUnmapMemObject"
);
return
func
(
command_queue
,
memobj
,
mapped_ptr
,
num_events_in_wait_list
,
return
func
(
command_queue
,
memobj
,
mapped_ptr
,
num_events_in_wait_list
,
...
@@ -847,8 +802,7 @@ CL_API_ENTRY cl_int clGetKernelWorkGroupInfo(
...
@@ -847,8 +802,7 @@ CL_API_ENTRY cl_int clGetKernelWorkGroupInfo(
size_t
param_value_size
,
size_t
param_value_size
,
void
*
param_value
,
void
*
param_value
,
size_t
*
param_value_size_ret
)
CL_API_SUFFIX__VERSION_1_0
{
size_t
*
param_value_size_ret
)
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clGetKernelWorkGroupInfo
;
auto
func
=
mace
::
openclLibraryImpl
->
clGetKernelWorkGroupInfo
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clGetKernelWorkGroupInfo"
);
MACE_LATENCY_LOGGER
(
3
,
"clGetKernelWorkGroupInfo"
);
return
func
(
kernel
,
device
,
param_name
,
param_value_size
,
param_value
,
return
func
(
kernel
,
device
,
param_name
,
param_value_size
,
param_value
,
...
@@ -865,8 +819,7 @@ CL_API_ENTRY cl_int clEnqueueNDRangeKernel(cl_command_queue command_queue,
...
@@ -865,8 +819,7 @@ CL_API_ENTRY cl_int clEnqueueNDRangeKernel(cl_command_queue command_queue,
const
cl_event
*
event_wait_list
,
const
cl_event
*
event_wait_list
,
cl_event
*
event
)
cl_event
*
event
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clEnqueueNDRangeKernel
;
auto
func
=
mace
::
openclLibraryImpl
->
clEnqueueNDRangeKernel
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clEnqueueNDRangeKernel"
);
MACE_LATENCY_LOGGER
(
3
,
"clEnqueueNDRangeKernel"
);
return
func
(
command_queue
,
kernel
,
work_dim
,
global_work_offset
,
return
func
(
command_queue
,
kernel
,
work_dim
,
global_work_offset
,
...
@@ -877,24 +830,21 @@ CL_API_ENTRY cl_int clEnqueueNDRangeKernel(cl_command_queue command_queue,
...
@@ -877,24 +830,21 @@ CL_API_ENTRY cl_int clEnqueueNDRangeKernel(cl_command_queue command_queue,
// Event Object APIs
// Event Object APIs
CL_API_ENTRY
cl_int
clWaitForEvents
(
CL_API_ENTRY
cl_int
clWaitForEvents
(
cl_uint
num_events
,
const
cl_event
*
event_list
)
CL_API_SUFFIX__VERSION_1_0
{
cl_uint
num_events
,
const
cl_event
*
event_list
)
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clWaitForEvents
;
auto
func
=
mace
::
openclLibraryImpl
->
clWaitForEvents
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clWaitForEvents"
);
MACE_LATENCY_LOGGER
(
3
,
"clWaitForEvents"
);
return
func
(
num_events
,
event_list
);
return
func
(
num_events
,
event_list
);
}
}
CL_API_ENTRY
cl_int
clRetainEvent
(
cl_event
event
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_ENTRY
cl_int
clRetainEvent
(
cl_event
event
)
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clRetainEvent
;
auto
func
=
mace
::
openclLibraryImpl
->
clRetainEvent
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clRetainEvent"
);
MACE_LATENCY_LOGGER
(
3
,
"clRetainEvent"
);
return
func
(
event
);
return
func
(
event
);
}
}
CL_API_ENTRY
cl_int
clReleaseEvent
(
cl_event
event
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_ENTRY
cl_int
clReleaseEvent
(
cl_event
event
)
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clReleaseEvent
;
auto
func
=
mace
::
openclLibraryImpl
->
clReleaseEvent
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clReleaseEvent"
);
MACE_LATENCY_LOGGER
(
3
,
"clReleaseEvent"
);
return
func
(
event
);
return
func
(
event
);
...
@@ -907,8 +857,7 @@ CL_API_ENTRY cl_int clGetEventInfo(cl_event event,
...
@@ -907,8 +857,7 @@ CL_API_ENTRY cl_int clGetEventInfo(cl_event event,
void
*
param_value
,
void
*
param_value
,
size_t
*
param_value_size_ret
)
size_t
*
param_value_size_ret
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clGetEventInfo
;
auto
func
=
mace
::
openclLibraryImpl
->
clGetEventInfo
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clGetEventInfo"
);
MACE_LATENCY_LOGGER
(
3
,
"clGetEventInfo"
);
return
func
(
event
,
param_name
,
param_value_size
,
param_value
,
return
func
(
event
,
param_name
,
param_value_size
,
param_value
,
...
@@ -922,8 +871,7 @@ CL_API_ENTRY cl_int clGetEventProfilingInfo(cl_event event,
...
@@ -922,8 +871,7 @@ CL_API_ENTRY cl_int clGetEventProfilingInfo(cl_event event,
void
*
param_value
,
void
*
param_value
,
size_t
*
param_value_size_ret
)
size_t
*
param_value_size_ret
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clGetEventProfilingInfo
;
auto
func
=
mace
::
openclLibraryImpl
->
clGetEventProfilingInfo
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clGetEventProfilingInfo"
);
MACE_LATENCY_LOGGER
(
3
,
"clGetEventProfilingInfo"
);
return
func
(
event
,
param_name
,
param_value_size
,
param_value
,
return
func
(
event
,
param_name
,
param_value_size
,
param_value
,
...
@@ -933,8 +881,7 @@ CL_API_ENTRY cl_int clGetEventProfilingInfo(cl_event event,
...
@@ -933,8 +881,7 @@ CL_API_ENTRY cl_int clGetEventProfilingInfo(cl_event event,
// Flush and Finish APIs
// Flush and Finish APIs
CL_API_ENTRY
cl_int
clFlush
(
cl_command_queue
command_queue
)
CL_API_ENTRY
cl_int
clFlush
(
cl_command_queue
command_queue
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clFlush
;
auto
func
=
mace
::
openclLibraryImpl
->
clFlush
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clFlush"
);
MACE_LATENCY_LOGGER
(
3
,
"clFlush"
);
return
func
(
command_queue
);
return
func
(
command_queue
);
...
@@ -942,8 +889,7 @@ CL_API_ENTRY cl_int clFlush(cl_command_queue command_queue)
...
@@ -942,8 +889,7 @@ CL_API_ENTRY cl_int clFlush(cl_command_queue command_queue)
CL_API_ENTRY
cl_int
clFinish
(
cl_command_queue
command_queue
)
CL_API_ENTRY
cl_int
clFinish
(
cl_command_queue
command_queue
)
CL_API_SUFFIX__VERSION_1_0
{
CL_API_SUFFIX__VERSION_1_0
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clFinish
;
auto
func
=
mace
::
openclLibraryImpl
->
clFinish
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clFinish"
);
MACE_LATENCY_LOGGER
(
3
,
"clFinish"
);
return
func
(
command_queue
);
return
func
(
command_queue
);
...
@@ -959,8 +905,7 @@ CL_API_ENTRY /* CL_EXT_PREFIX__VERSION_1_1_DEPRECATED */ cl_mem clCreateImage2D(
...
@@ -959,8 +905,7 @@ CL_API_ENTRY /* CL_EXT_PREFIX__VERSION_1_1_DEPRECATED */ cl_mem clCreateImage2D(
size_t
image_row_pitch
,
size_t
image_row_pitch
,
void
*
host_ptr
,
void
*
host_ptr
,
cl_int
*
errcode_ret
)
/* CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED */
{
cl_int
*
errcode_ret
)
/* CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED */
{
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clCreateImage2D
;
auto
func
=
mace
::
openclLibraryImpl
->
clCreateImage2D
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateImage2D"
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateImage2D"
);
return
func
(
context
,
flags
,
image_format
,
image_width
,
image_height
,
return
func
(
context
,
flags
,
image_format
,
image_width
,
image_height
,
...
@@ -974,8 +919,7 @@ clCreateCommandQueue(cl_context context,
...
@@ -974,8 +919,7 @@ clCreateCommandQueue(cl_context context,
cl_command_queue_properties
properties
,
cl_command_queue_properties
properties
,
cl_int
*
errcode_ret
)
cl_int
*
errcode_ret
)
/* CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED */
{
// NOLINT
/* CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED */
{
// NOLINT
MACE_CHECK_NOTNULL
(
mace
::
openclLibraryImpl
);
auto
func
=
mace
::
runtime
::
OpenCLLibrary
::
Get
()
->
clCreateCommandQueue
;
auto
func
=
mace
::
openclLibraryImpl
->
clCreateCommandQueue
;
MACE_CHECK_NOTNULL
(
func
);
MACE_CHECK_NOTNULL
(
func
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateCommandQueue"
);
MACE_LATENCY_LOGGER
(
3
,
"clCreateCommandQueue"
);
return
func
(
context
,
device
,
properties
,
errcode_ret
);
return
func
(
context
,
device
,
properties
,
errcode_ret
);
...
...
mace/core/runtime/opencl/opencl_wrapper.h
已删除
100644 → 0
浏览文件 @
f6db015d
// Copyright 2018 Xiaomi, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef MACE_CORE_RUNTIME_OPENCL_OPENCL_WRAPPER_H_
#define MACE_CORE_RUNTIME_OPENCL_OPENCL_WRAPPER_H_
namespace
mace
{
// These functions are not thread-safe.
void
LoadOpenCLLibrary
();
void
UnloadOpenCLLibrary
();
}
// namespace mace
#endif // MACE_CORE_RUNTIME_OPENCL_OPENCL_WRAPPER_H_
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录