cl_wrapper.h 23.6 KB
Newer Older
Y
Yan Chunwei 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/* Copyright (c) 2018 PaddlePaddle Authors. 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. */

#pragma once

17
#include "lite/backends/opencl/cl_include.h"
Y
Yan Chunwei 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572
#include "lite/utils/cp_logging.h"

#if CL_HPP_TARGET_OPENCL_VERSION < 200
#define CL_API_SUFFIX__VERSION_2_0
#endif

namespace paddle {
namespace lite {

class CLWrapper final {
 public:
  static CLWrapper *Global();
  // Platform APIs
  using clGetPlatformIDsType = cl_int (*)(cl_uint, cl_platform_id *, cl_uint *);
  using clGetPlatformInfoType =
      cl_int (*)(cl_platform_id, cl_platform_info, size_t, void *, size_t *);
  using clBuildProgramType = cl_int (*)(cl_program,
                                        cl_uint,
                                        const cl_device_id *,
                                        const char *,
                                        void (*pfn_notify)(cl_program, void *),
                                        void *);
  using clEnqueueNDRangeKernelType = cl_int (*)(cl_command_queue,
                                                cl_kernel,
                                                cl_uint,
                                                const size_t *,
                                                const size_t *,
                                                const size_t *,
                                                cl_uint,
                                                const cl_event *,
                                                cl_event *);
  using clSetKernelArgType = cl_int (*)(cl_kernel,
                                        cl_uint,
                                        size_t,
                                        const void *);
  using clRetainMemObjectType = cl_int (*)(cl_mem);
  using clReleaseMemObjectType = cl_int (*)(cl_mem);
  using clEnqueueUnmapMemObjectType = cl_int (*)(
      cl_command_queue, cl_mem, void *, cl_uint, const cl_event *, cl_event *);
  using clRetainCommandQueueType = cl_int (*)(cl_command_queue command_queue);
  using clCreateContextType = cl_context (*)(const cl_context_properties *,
                                             cl_uint,
                                             const cl_device_id *,
                                             void(CL_CALLBACK *)(  // NOLINT
                                                 const char *,
                                                 const void *,
                                                 size_t,
                                                 void *),
                                             void *,
                                             cl_int *);
  using clCreateContextFromTypeType =
      cl_context (*)(const cl_context_properties *,
                     cl_device_type,
                     void(CL_CALLBACK *)(  // NOLINT
                         const char *,
                         const void *,
                         size_t,
                         void *),
                     void *,
                     cl_int *);
  using clReleaseContextType = cl_int (*)(cl_context);
  using clWaitForEventsType = cl_int (*)(cl_uint, const cl_event *);
  using clReleaseEventType = cl_int (*)(cl_event);
  using clEnqueueWriteBufferType = cl_int (*)(cl_command_queue,
                                              cl_mem,
                                              cl_bool,
                                              size_t,
                                              size_t,
                                              const void *,
                                              cl_uint,
                                              const cl_event *,
                                              cl_event *);
  using clEnqueueReadBufferType = cl_int (*)(cl_command_queue,
                                             cl_mem,
                                             cl_bool,
                                             size_t,
                                             size_t,
                                             void *,
                                             cl_uint,
                                             const cl_event *,
                                             cl_event *);
  using clEnqueueReadImageType = cl_int (*)(cl_command_queue,
                                            cl_mem,
                                            cl_bool,
                                            const size_t *,
                                            const size_t *,
                                            size_t,
                                            size_t,
                                            void *,
                                            cl_uint,
                                            const cl_event *,
                                            cl_event *);
  using clGetProgramBuildInfoType = cl_int (*)(cl_program,
                                               cl_device_id,
                                               cl_program_build_info,
                                               size_t,
                                               void *,
                                               size_t *);
  using clRetainProgramType = cl_int (*)(cl_program program);
  using clEnqueueMapBufferType = void *(*)(cl_command_queue,
                                           cl_mem,
                                           cl_bool,
                                           cl_map_flags,
                                           size_t,
                                           size_t,
                                           cl_uint,
                                           const cl_event *,
                                           cl_event *,
                                           cl_int *);
  using clEnqueueMapImageType = void *(*)(cl_command_queue,
                                          cl_mem,
                                          cl_bool,
                                          cl_map_flags,
                                          const size_t *,
                                          const size_t *,
                                          size_t *,
                                          size_t *,
                                          cl_uint,
                                          const cl_event *,
                                          cl_event *,
                                          cl_int *);
  using clCreateCommandQueueType = cl_command_queue(CL_API_CALL *)(  // NOLINT
      cl_context,
      cl_device_id,
      cl_command_queue_properties,
      cl_int *);
  using clCreateCommandQueueWithPropertiesType = cl_command_queue (*)(
      cl_context, cl_device_id, const cl_queue_properties *, cl_int *);
  using clReleaseCommandQueueType = cl_int (*)(cl_command_queue);
  using clCreateProgramWithBinaryType = cl_program (*)(cl_context,
                                                       cl_uint,
                                                       const cl_device_id *,
                                                       const size_t *,
                                                       const unsigned char **,
                                                       cl_int *,
                                                       cl_int *);
  using clRetainContextType = cl_int (*)(cl_context context);
  using clGetContextInfoType =
      cl_int (*)(cl_context, cl_context_info, size_t, void *, size_t *);
  using clReleaseProgramType = cl_int (*)(cl_program program);
  using clFlushType = cl_int (*)(cl_command_queue command_queue);
  using clFinishType = cl_int (*)(cl_command_queue command_queue);
  using clGetProgramInfoType =
      cl_int (*)(cl_program, cl_program_info, size_t, void *, size_t *);
  using clCreateKernelType = cl_kernel (*)(cl_program, const char *, cl_int *);
  using clRetainKernelType = cl_int (*)(cl_kernel kernel);
  using clCreateBufferType =
      cl_mem (*)(cl_context, cl_mem_flags, size_t, void *, cl_int *);
  using clCreateImage2DType = cl_mem(CL_API_CALL *)(cl_context,  // NOLINT
                                                    cl_mem_flags,
                                                    const cl_image_format *,
                                                    size_t,
                                                    size_t,
                                                    size_t,
                                                    void *,
                                                    cl_int *);
  using clCreateImageType = cl_mem (*)(cl_context,
                                       cl_mem_flags,
                                       const cl_image_format *,
                                       const cl_image_desc *,
                                       void *,
                                       cl_int *);
  using clCreateUserEventType = cl_event (*)(cl_context, cl_int *);
  using clCreateProgramWithSourceType = cl_program (*)(
      cl_context, cl_uint, const char **, const size_t *, cl_int *);
  using clReleaseKernelType = cl_int (*)(cl_kernel kernel);
  using clGetDeviceInfoType =
      cl_int (*)(cl_device_id, cl_device_info, size_t, void *, size_t *);
  using clGetDeviceIDsType = cl_int (*)(
      cl_platform_id, cl_device_type, cl_uint, cl_device_id *, cl_uint *);
  using clRetainDeviceType = cl_int (*)(cl_device_id);
  using clReleaseDeviceType = cl_int (*)(cl_device_id);
  using clRetainEventType = cl_int (*)(cl_event);
  using clGetKernelWorkGroupInfoType = cl_int (*)(cl_kernel,
                                                  cl_device_id,
                                                  cl_kernel_work_group_info,
                                                  size_t,
                                                  void *,
                                                  size_t *);
  using clGetEventInfoType = cl_int (*)(cl_event event,
                                        cl_event_info param_name,
                                        size_t param_value_size,
                                        void *param_value,
                                        size_t *param_value_size_ret);
  using clGetEventProfilingInfoType = cl_int (*)(cl_event event,
                                                 cl_profiling_info param_name,
                                                 size_t param_value_size,
                                                 void *param_value,
                                                 size_t *param_value_size_ret);
  using clGetImageInfoType =
      cl_int (*)(cl_mem, cl_image_info, size_t, void *, size_t *);

  using clEnqueueCopyBufferType = cl_int (*)(cl_command_queue,
                                             cl_mem,
                                             cl_mem,
                                             size_t,
                                             size_t,
                                             size_t,
                                             cl_uint,
                                             const cl_event *,
                                             cl_event *);
  using clEnqueueWriteImageType = cl_int (*)(cl_command_queue,
                                             cl_mem,
                                             cl_bool,
                                             const size_t *,
                                             const size_t *,
                                             size_t,
                                             size_t,
                                             const void *,
                                             cl_uint,
                                             const cl_event *,
                                             cl_event *);
  using clEnqueueCopyImageType = cl_int (*)(cl_command_queue,
                                            cl_mem,
                                            cl_mem,
                                            const size_t *,
                                            const size_t *,
                                            const size_t *,
                                            cl_uint,
                                            const cl_event *,
                                            cl_event *);

  clGetPlatformIDsType clGetPlatformIDs() {
    CHECK(clGetPlatformIDs_ != nullptr) << "Cannot load clGetPlatformIDs!";
    return clGetPlatformIDs_;
  }

  clGetPlatformInfoType clGetPlatformInfo() {
    CHECK(clGetPlatformInfo_ != nullptr) << "Cannot load clGetPlatformInfo!";
    return clGetPlatformInfo_;
  }

  clBuildProgramType clBuildProgram() {
    CHECK(clBuildProgram_ != nullptr) << "Cannot load clBuildProgram!";
    return clBuildProgram_;
  }

  clEnqueueNDRangeKernelType clEnqueueNDRangeKernel() {
    CHECK(clEnqueueNDRangeKernel_ != nullptr)
        << "Cannot load clEnqueueNDRangeKernel!";
    return clEnqueueNDRangeKernel_;
  }

  clSetKernelArgType clSetKernelArg() {
    CHECK(clSetKernelArg_ != nullptr) << "Cannot load clSetKernelArg!";
    return clSetKernelArg_;
  }

  clRetainMemObjectType clRetainMemObject() {
    CHECK(clRetainMemObject_ != nullptr) << "Cannot load clRetainMemObject!";
    return clRetainMemObject_;
  }

  clReleaseMemObjectType clReleaseMemObject() {
    CHECK(clReleaseMemObject_ != nullptr) << "Cannot load clReleaseMemObject!";
    return clReleaseMemObject_;
  }

  clEnqueueUnmapMemObjectType clEnqueueUnmapMemObject() {
    CHECK(clEnqueueUnmapMemObject_ != nullptr)
        << "Cannot load clEnqueueUnmapMemObject!";
    return clEnqueueUnmapMemObject_;
  }

  clRetainCommandQueueType clRetainCommandQueue() {
    CHECK(clRetainCommandQueue_ != nullptr)
        << "Cannot load clRetainCommandQueue!";
    return clRetainCommandQueue_;
  }

  clCreateContextType clCreateContext() {
    CHECK(clCreateContext_ != nullptr) << "Cannot load clCreateContext!";
    return clCreateContext_;
  }

  clCreateContextFromTypeType clCreateContextFromType() {
    CHECK(clCreateContextFromType_ != nullptr)
        << "Cannot load clCreateContextFromType!";
    return clCreateContextFromType_;
  }

  clReleaseContextType clReleaseContext() {
    CHECK(clReleaseContext_ != nullptr) << "Cannot load clReleaseContext!";
    return clReleaseContext_;
  }

  clWaitForEventsType clWaitForEvents() {
    CHECK(clWaitForEvents_ != nullptr) << "Cannot load clWaitForEvents!";
    return clWaitForEvents_;
  }

  clReleaseEventType clReleaseEvent() {
    CHECK(clReleaseEvent_ != nullptr) << "Cannot load clReleaseEvent!";
    return clReleaseEvent_;
  }

  clEnqueueWriteBufferType clEnqueueWriteBuffer() {
    CHECK(clEnqueueWriteBuffer_ != nullptr)
        << "Cannot loadcl clEnqueueWriteBuffer!";
    return clEnqueueWriteBuffer_;
  }

  clEnqueueReadBufferType clEnqueueReadBuffer() {
    CHECK(clEnqueueReadBuffer_ != nullptr)
        << "Cannot load clEnqueueReadBuffer!";
    return clEnqueueReadBuffer_;
  }

  clEnqueueReadImageType clEnqueueReadImage() {
    CHECK(clEnqueueReadImage_ != nullptr) << "Cannot load clEnqueueReadImage!";
    return clEnqueueReadImage_;
  }

  clGetProgramBuildInfoType clGetProgramBuildInfo() {
    CHECK(clGetProgramBuildInfo_ != nullptr)
        << "Cannot load clGetProgramBuildInfo!";
    return clGetProgramBuildInfo_;
  }

  clRetainProgramType clRetainProgram() {
    CHECK(clRetainProgram_ != nullptr) << "Cannot load clRetainProgram!";
    return clRetainProgram_;
  }

  clEnqueueMapBufferType clEnqueueMapBuffer() {
    CHECK(clEnqueueMapBuffer_ != nullptr) << "Cannot load clEnqueueMapBuffer!";
    return clEnqueueMapBuffer_;
  }

  clEnqueueMapImageType clEnqueueMapImage() {
    CHECK(clEnqueueMapImage_ != nullptr) << "Cannot load clEnqueueMapImage!";
    return clEnqueueMapImage_;
  }

  clCreateCommandQueueType clCreateCommandQueue() {
    CHECK(clCreateCommandQueue_ != nullptr)
        << "Cannot load clCreateCommandQueue!";
    return clCreateCommandQueue_;
  }

  clCreateCommandQueueWithPropertiesType clCreateCommandQueueWithProperties() {
    CHECK(clCreateCommandQueueWithProperties_ != nullptr)
        << "Cannot load clCreateCommandQueueWithProperties!";
    return clCreateCommandQueueWithProperties_;
  }

  clReleaseCommandQueueType clReleaseCommandQueue() {
    CHECK(clReleaseCommandQueue_ != nullptr)
        << "Cannot load clReleaseCommandQueue!";
    return clReleaseCommandQueue_;
  }

  clCreateProgramWithBinaryType clCreateProgramWithBinary() {
    CHECK(clCreateProgramWithBinary_ != nullptr)
        << "Cannot load clCreateProgramWithBinary!";
    return clCreateProgramWithBinary_;
  }

  clRetainContextType clRetainContext() {
    CHECK(clRetainContext_ != nullptr) << "Cannot load clRetainContext!";
    return clRetainContext_;
  }

  clGetContextInfoType clGetContextInfo() {
    CHECK(clGetContextInfo_ != nullptr) << "Cannot load clGetContextInfo!";
    return clGetContextInfo_;
  }

  clReleaseProgramType clReleaseProgram() {
    CHECK(clReleaseProgram_ != nullptr) << "Cannot load clReleaseProgram!";
    return clReleaseProgram_;
  }

  clFlushType clFlush() {
    CHECK(clFlush_ != nullptr) << "Cannot load clFlush!";
    return clFlush_;
  }

  clFinishType clFinish() {
    CHECK(clFinish_ != nullptr) << "Cannot load clFinish!";
    return clFinish_;
  }

  clGetProgramInfoType clGetProgramInfo() {
    CHECK(clGetProgramInfo_ != nullptr) << "Cannot load clGetProgramInfo!";
    return clGetProgramInfo_;
  }

  clCreateKernelType clCreateKernel() {
    CHECK(clCreateKernel_ != nullptr) << "Cannot load clCreateKernel!";
    return clCreateKernel_;
  }

  clRetainKernelType clRetainKernel() {
    CHECK(clRetainKernel_ != nullptr) << "Cannot load clRetainKernel!";
    return clRetainKernel_;
  }

  clCreateBufferType clCreateBuffer() {
    CHECK(clCreateBuffer_ != nullptr) << "Cannot load clCreateBuffer!";
    return clCreateBuffer_;
  }

  clCreateImage2DType clCreateImage2D() {
    CHECK(clCreateImage2D_ != nullptr) << "Cannot load clCreateImage2D!";
    return clCreateImage2D_;
  }

  clCreateImageType clCreateImage() {
    CHECK(clCreateImage_ != nullptr) << "Cannot load clCreateImage!";
    return clCreateImage_;
  }

  clCreateUserEventType clCreateUserEvent() {
    CHECK(clCreateUserEvent_ != nullptr) << "Cannot load clCreateUserEvent!";
    return clCreateUserEvent_;
  }

  clCreateProgramWithSourceType clCreateProgramWithSource() {
    CHECK(clCreateProgramWithSource_ != nullptr)
        << "Cannot load clCreateProgramWithSource!";
    return clCreateProgramWithSource_;
  }

  clReleaseKernelType clReleaseKernel() {
    CHECK(clReleaseKernel_ != nullptr) << "Cannot load clReleaseKernel!";
    return clReleaseKernel_;
  }

  clGetDeviceInfoType clGetDeviceInfo() {
    CHECK(clGetDeviceInfo_ != nullptr) << "Cannot load clGetDeviceInfo!";
    return clGetDeviceInfo_;
  }

  clGetDeviceIDsType clGetDeviceIDs() {
    CHECK(clGetDeviceIDs_ != nullptr) << "Cannot load clGetDeviceIDs!";
    return clGetDeviceIDs_;
  }

  clRetainDeviceType clRetainDevice() {
    CHECK(clRetainDevice_ != nullptr) << "Cannot load clRetainDevice!";
    return clRetainDevice_;
  }

  clReleaseDeviceType clReleaseDevice() {
    CHECK(clReleaseDevice_ != nullptr) << "Cannot load clReleaseDevice!";
    return clReleaseDevice_;
  }

  clRetainEventType clRetainEvent() {
    CHECK(clRetainEvent_ != nullptr) << "Cannot load clRetainEvent!";
    return clRetainEvent_;
  }

  clGetKernelWorkGroupInfoType clGetKernelWorkGroupInfo() {
    CHECK(clGetKernelWorkGroupInfo_ != nullptr)
        << "Cannot load clGetKernelWorkGroupInfo!";
    return clGetKernelWorkGroupInfo_;
  }

  clGetEventInfoType clGetEventInfo() {
    CHECK(clGetEventInfo_ != nullptr) << "Cannot load clGetEventInfo!";
    return clGetEventInfo_;
  }

  clGetEventProfilingInfoType clGetEventProfilingInfo() {
    CHECK(clGetEventProfilingInfo_ != nullptr)
        << "Cannot load clGetEventProfilingInfo!";
    return clGetEventProfilingInfo_;
  }

  clGetImageInfoType clGetImageInfo() {
    CHECK(clGetImageInfo_ != nullptr) << "Cannot load clGetImageInfo!";
    return clGetImageInfo_;
  }

  clEnqueueCopyBufferType clEnqueueCopyBuffer() {
    CHECK(clEnqueueCopyBuffer_ != nullptr)
        << "Cannot load clEnqueueCopyBuffer!";
    return clEnqueueCopyBuffer_;
  }

  clEnqueueWriteImageType clEnqueueWriteImage() {
    CHECK(clEnqueueWriteImage_ != nullptr)
        << "Cannot load clEnqueueWriteImage!";
    return clEnqueueWriteImage_;
  }

  clEnqueueCopyImageType clEnqueueCopyImage() {
    CHECK(clEnqueueCopyImage_ != nullptr) << "Cannot load clEnqueueCopyImage!";
    return clEnqueueCopyImage_;
  }

 private:
  CLWrapper();
  CLWrapper(const CLWrapper &) = delete;
  CLWrapper &operator=(const CLWrapper &) = delete;
  bool InitHandle();
  void InitFunctions();
  void *handle_{nullptr};
  clGetPlatformIDsType clGetPlatformIDs_{nullptr};
  clGetPlatformInfoType clGetPlatformInfo_{nullptr};
  clBuildProgramType clBuildProgram_{nullptr};
  clEnqueueNDRangeKernelType clEnqueueNDRangeKernel_{nullptr};
  clSetKernelArgType clSetKernelArg_{nullptr};
  clRetainMemObjectType clRetainMemObject_{nullptr};
  clReleaseMemObjectType clReleaseMemObject_{nullptr};
  clEnqueueUnmapMemObjectType clEnqueueUnmapMemObject_{nullptr};
  clRetainCommandQueueType clRetainCommandQueue_{nullptr};
  clCreateContextType clCreateContext_{nullptr};
  clCreateContextFromTypeType clCreateContextFromType_{nullptr};
  clReleaseContextType clReleaseContext_{nullptr};
  clWaitForEventsType clWaitForEvents_{nullptr};
  clReleaseEventType clReleaseEvent_{nullptr};
  clEnqueueWriteBufferType clEnqueueWriteBuffer_{nullptr};
  clEnqueueReadBufferType clEnqueueReadBuffer_{nullptr};
  clEnqueueReadImageType clEnqueueReadImage_{nullptr};
  clGetProgramBuildInfoType clGetProgramBuildInfo_{nullptr};
  clRetainProgramType clRetainProgram_{nullptr};
  clEnqueueMapBufferType clEnqueueMapBuffer_{nullptr};
  clEnqueueMapImageType clEnqueueMapImage_{nullptr};
  clCreateCommandQueueType clCreateCommandQueue_{nullptr};
  clCreateCommandQueueWithPropertiesType clCreateCommandQueueWithProperties_{
      nullptr};
  clReleaseCommandQueueType clReleaseCommandQueue_{nullptr};
  clCreateProgramWithBinaryType clCreateProgramWithBinary_{nullptr};
  clRetainContextType clRetainContext_{nullptr};
  clGetContextInfoType clGetContextInfo_{nullptr};
  clReleaseProgramType clReleaseProgram_{nullptr};
  clFlushType clFlush_{nullptr};
  clFinishType clFinish_{nullptr};
  clGetProgramInfoType clGetProgramInfo_{nullptr};
  clCreateKernelType clCreateKernel_{nullptr};
  clRetainKernelType clRetainKernel_{nullptr};
  clCreateBufferType clCreateBuffer_{nullptr};
  clCreateImage2DType clCreateImage2D_{nullptr};
  clCreateImageType clCreateImage_{nullptr};
  clCreateUserEventType clCreateUserEvent_{nullptr};
  clCreateProgramWithSourceType clCreateProgramWithSource_{nullptr};
  clReleaseKernelType clReleaseKernel_{nullptr};
  clGetDeviceInfoType clGetDeviceInfo_{nullptr};
  clGetDeviceIDsType clGetDeviceIDs_{nullptr};
  clRetainDeviceType clRetainDevice_{nullptr};
  clReleaseDeviceType clReleaseDevice_{nullptr};
  clRetainEventType clRetainEvent_{nullptr};
  clGetKernelWorkGroupInfoType clGetKernelWorkGroupInfo_{nullptr};
  clGetEventInfoType clGetEventInfo_{nullptr};
  clGetEventProfilingInfoType clGetEventProfilingInfo_{nullptr};
  clGetImageInfoType clGetImageInfo_{nullptr};
  clEnqueueCopyBufferType clEnqueueCopyBuffer_{nullptr};
  clEnqueueWriteImageType clEnqueueWriteImage_{nullptr};
  clEnqueueCopyImageType clEnqueueCopyImage_{nullptr};
};
}  // namespace lite
}  // namespace paddle