Function: create_kernel

C Prototype

aclError aclopCreateKernel(const char *opType,

const char *kernelId,

const char *kernelName,

void *binData,

int binSize,

aclopEngineType enginetype,

aclDataDeallocator deallocator)

Python Function

ret = acl.op.create_kernel(op_type, kernel_id, kernel_name, bin_data, bin_size, enginetype, deallocator)

Function Usage

Creates the kernel function of an operator in dynamic shape scenarios for operator running.

Input Description

op_type: str, operator type.

kernel_id: str, kernel ID.

kernel_name: str, operator kernel name. It must be the same as the kernelName argument in the operator binary file.

bin_data: int, memory address of the operator kernel file.

bin_size: int, memory size of the operator kernel file, in bytes.

enginetype: int, operator execution engine. This parameter is valid only when compile_flag of acl.op.update.params is set to ACL_COMPILE_SYS.

  • 0: ACL_ENGINE_SYS, set when the execution target is not concerned.
  • 1: ACL_ENGINE_AICORE, compiles the operator into an AI Core operator.
  • 2: ACL_ENGINE_VECTOR, compiles the operator into a Vector Core operator.

deallocator: int, whether to automatically release the bin_data memory.

  • 0: Data is not automatically released. The caller compiles the code to release the data.
  • 1: The bin_data memory is automatically released. A callback function is set internally to release the bin_data memory.

Return Value

ret: int, error code.

Restrictions

None

Reference

For details about the API call sequence and example, see Single-Operator with Dynamic Shape (Operator Selector Registered).