aclSetAclOpExecutorRepeatable

Function Usage

Enables aclOpExecutor to be reusable. If you want to reuse existing aclOpExecutor, you must call this API immediately to enable the reuse after the first-phase API aclXxxGetworkspaceSize is executed. Later, you can call the second-phase API aclXxx for multiple times for operator execution.

Prototype

aclnnStatus aclSetAclOpExecutorRepeatable(aclOpExecutor *executor)

Parameters

Parameter

Input/Output

Description

executor

Input

aclOpExecutor to be reused.

Returns

0 on success; else, failure.

Constraints:

  • Currently, operators that use AI CPU and AI Core compute units support aclOpExecutor reuse.
  • When a single-operator API is called, aclOpExecutor reuse cannot be enabled in the following scenarios:
    • If L0 APIs related to host-to-device and device-to-device copy are used, such as CopyToNpu, CopyNpuToNpu, and CopyToNpuSync, aclOpExecutor cannot be reused.
    • If the L0 ViewCopy API is used and the source address and destination address of ViewCopy are the same, aclOpExecutor cannot be reused.

    For details about L0 APIs, see "Single-Operator API Execution" in Ascend C Operator Development APIs.

  • When a single-operator API is called, a device tensor cannot be created in the operator API. Only external tensors can be used.
  • aclOpExecutor that is set to the reusable state does not clear the executor resources after the second API is executed. It needs to be used in conjunction with aclDestroyAclOpExecutor to clear the resources.