Function: create_kernel

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas training product

Atlas inference product

Atlas 200I/500 A2 inference product

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)
    

Parameters

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.

Returns

Return Value

Description

ret

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