Function: create_kernel

Applicability

Product

Supported (√/x)

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

Function Usage

Creates the kernel function of a dynamic-shape operator for operator execution.

Prototype

  • C Prototype
    1
    2
    3
    4
    5
    6
    7
    aclError aclopCreateKernel(const char *opType,
    const char *kernelId,
    const char *kernelName,
    void *binData,
    int binSize,
    aclopEngineType enginetype,
    aclDataDeallocator deallocator)
    
  • Python Function
    1
    ret = acl.op.create_kernel(op_type, kernel_id, kernel_name, bin_data, bin_size, enginetype, deallocator)
    

Parameter Description

Parameter

Description

op_type

Str, operator type.

kernel_id

Str, kernel ID.

kernel_name

Str, operator kernel name, which 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 (in bytes) of the operator kernel file.

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 Description

Return Value

Description

ret

Int, error code: 0 on success; else, failure.

Reference

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