Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Alibaba MNN OpenCL CL Ext Intel Header

From Leeroopedia


Knowledge Sources
Domains GPU_Computing, OpenCL
Last Updated 2026-02-10 12:00 GMT

Overview

Vendored Intel-specific OpenCL extension header declaring accelerator objects, motion estimation, device partitioning, media sharing, and driver diagnostics extensions for MNN's OpenCL backend.

Description

cl_ext_intel.h defines Intel-specific OpenCL extensions that expose hardware acceleration features found on Intel GPUs and processors. The header declares the cl_intel_accelerator extension for creating hardware accelerator objects (used for motion estimation and advanced video processing), cl_intel_motion_estimation and cl_intel_advanced_motion_estimation for video analytics workloads, cl_intel_device_partition_by_names for fine-grained device partitioning, cl_intel_simultaneous_sharing for concurrent interop, cl_intel_egl_image_yuv and cl_intel_packed_yuv for media format support, cl_intel_required_subgroup_size for kernel tuning, and cl_intel_driver_diagnostics for debug output. MNN vendors this header to enable compile-time support for Intel GPU acceleration paths when available.

Usage

This header is included internally by MNN's OpenCL backend. It is not directly imported by end users.

Code Reference

Source Location

Signature

// Intel accelerator extensions
#define cl_intel_accelerator 1
#define cl_intel_motion_estimation 1
#define cl_intel_advanced_motion_estimation 1

typedef struct _cl_accelerator_intel* cl_accelerator_intel;
typedef cl_uint cl_accelerator_type_intel;
typedef cl_uint cl_accelerator_info_intel;

typedef struct _cl_motion_estimation_desc_intel {
    cl_uint mb_block_type;
    cl_uint subpixel_mode;
    cl_uint sad_adjust_mode;
    cl_uint search_path_type;
} cl_motion_estimation_desc_intel;

// Accelerator lifecycle functions
extern CL_API_ENTRY cl_accelerator_intel CL_API_CALL
clCreateAcceleratorINTEL(
    cl_context                  context,
    cl_accelerator_type_intel   accelerator_type,
    size_t                      descriptor_size,
    const void*                 descriptor,
    cl_int*                     errcode_ret) CL_EXT_SUFFIX__VERSION_1_2;

extern CL_API_ENTRY cl_int CL_API_CALL
clGetAcceleratorInfoINTEL(
    cl_accelerator_intel        accelerator,
    cl_accelerator_info_intel   param_name,
    size_t                      param_value_size,
    void*                       param_value,
    size_t*                     param_value_size_ret) CL_EXT_SUFFIX__VERSION_1_2;

Import

#include "3rd_party/OpenCLHeaders/CL/cl_ext_intel.h"

I/O Contract

Inputs

Name Type Required Description
N/A N/A N/A Header-only; no runtime inputs

Outputs

Name Type Description
API declarations C functions/typedefs Intel-specific OpenCL extension function declarations, accelerator type definitions, motion estimation structures, and hardware feature constants

Usage Examples

// MNN internal usage (not user-facing)
#include "CL/cl_ext_intel.h"

// Create a motion estimation accelerator
cl_motion_estimation_desc_intel desc;
desc.mb_block_type   = CL_ME_MB_TYPE_16x16_INTEL;
desc.subpixel_mode   = CL_ME_SUBPIXEL_MODE_QPEL_INTEL;
desc.sad_adjust_mode = CL_ME_SAD_ADJUST_MODE_NONE_INTEL;
desc.search_path_type = CL_ME_SEARCH_PATH_RADIUS_4_4_INTEL;

cl_int err;
cl_accelerator_intel accel = clCreateAcceleratorINTEL(
    context,
    CL_ACCELERATOR_TYPE_MOTION_ESTIMATION_INTEL,
    sizeof(desc), &desc, &err);

// Query accelerator info
cl_accelerator_type_intel type;
clGetAcceleratorInfoINTEL(accel, CL_ACCELERATOR_TYPE_INTEL,
                          sizeof(type), &type, NULL);

// Cleanup
clReleaseAcceleratorINTEL(accel);

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment