[object Object][object Object][object Object]undefined
[object Object]
  • Description: Initializes and releases resources of the PMCC model obfuscation engine.

    • Resource initialization: Establishes a socket connection with the PMCC obfuscation engine CA, initializes the CA and TA, and returns the socket connection symbol.
    • Resource release: Disconnects the socket connection with the PMCC obfuscation engine CA.
  • Background: The Privacy&Model Confidential Computing (PMCC) model obfuscation feature uses the TrustZone trusted operating environment in the CPU core to isolate and store obfuscation factors, derive obfuscation masks, and dynamically add masks. Based on the NPU TrustZone, the PMCC builds the model obfuscation engine CA (Client Application in the common OS) and model obfuscation engine TA (Trusted Application in the TEE OS). To enable the model to access the model obfuscation engine TA during inference execution, the AI CPU operator mechanism and the localhost socket in the NPU are used for forwarding. The obfCoefficient parameter is added to this API. In the full-featured version of DeepSeek, the obfuscation coefficient is added to ensure that the model obfuscation performance meets the requirements. The input data is processed based on the obfuscation coefficient.

[object Object]

Each operator has calls. First, aclnnObfuscationSetupV2GetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnObfuscationSetupV2 is called to perform computation.

  • [object Object]
  • [object Object]
[object Object]
  • Parameters:

    • fdToClose (int32_t, compute input): socket connection to be closed. The data type is INT32. If cmd is 3, set this parameter to the fd value returned by this operator when cmd is 1. Otherwise, set this parameter to 0.
    • dataType (int32_t, compute input): ID of the tensor data type. The data type is INT32. A valid value is required only when cmd is set to 1 or 2. Otherwise, set this parameter to 0.
      • [object Object]Atlas inference series products[object Object]: Select a value from {0, 1}. 0 indicates FLOAT, and 1 indicates FLOAT16.
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: Select a value from {0, 1, 2, 27}. 0 indicates FLOAT; 1 indicates FLOAT16; 2 indicates INT8; 27 indicates BF16.
    • hiddenSize (int32_t, compute input): hidden layer dimension. The data type is INT32. The value ranges from 1 to 10000. A valid value is required only when cmd is set to 1 or 2. Otherwise, set this parameter to 0.
    • tpRank (int32_t, compute input): TP Rank. The data type is INT32. The value ranges from 0 to 1024. A valid value is required only when cmd is set to 1 or 2. Otherwise, set this parameter to 0.
    • modelObfSeedId (int32_t, compute input): model obfuscation factor ID, which is used by the TA to query the model obfuscation factor from the TEE KMC. The data type is INT32. A valid value is required only when cmd is set to 1 or 2. Otherwise, set this parameter to 0.
    • dataObfSeedId (int32_t, compute input): data obfuscation factor ID, which is used by the TA to query the data obfuscation factor from the TEE KMC. The data type is INT32. A valid value is required only when cmd is set to 1 or 2. Otherwise, set this parameter to 0.
    • cmd (int32_t, compute input): setup command ID, which can be selected from {1, 2, 16}. When this parameter is set to 1, resources are initialized in common mode. When this parameter is set to 2, resources are initialized in high-precision mode. When this parameter is set to 16, resources are released.
    • threadNum (int32_t, compute input): number of threads used by the CA/TA for obfuscation. Select a value from {1, 2, 3, 4, 5, 6}. A valid value is required only when cmd is set to 1 or 2. Otherwise, set this parameter to 0.
    • obfCoefficient (float, compute input): obfuscation coefficient used for obfuscation. The value range is (0.0, 1.0]. A valid value is required only when cmd is set to 1 or 2. Otherwise, set this parameter to 0.0.
    • fd (aclTensor*, compute output): socket connector. The data type is INT32, 1D, and the shape is one-dimensional. The can be ND. and empty tensors are not supported.
    • workspaceSize (uint64_t*, output): size of the workspace to be allocated on the device.
    • executor (aclOpExecutor**, output): operator executor, containing the operator computation process.
  • Returns:

    aclnnStatus status code. For details, see .

[object Object]
[object Object]
  • Parameters:

    • workspace (void*, input): address of the workspace to be allocated on the device.
    • workspaceSize (uint64_t, input): size of the workspace to be allocated on the device, which is obtained by the first-phase API aclnnObfuscationSetupV2GetWorkspaceSize.
    • executor (aclOpExecutor*, input): operator executor, containing the operator computation process.
    • stream (aclrtStream, input): stream for executing the task.
  • Returns: aclnnStatus status code. For details, see .

[object Object]
  • Deterministic compute:

    • aclnnObfuscationSetupV2 defaults to a deterministic implementation.
  • This API is used together with to obfuscate the PMCC model. The usage methods are as follows:

    • Call aclnnObfuscationSetupV2 to initialize resources. This function can be called repeatedly, but only the last initialization takes effect.
    • Call aclnnObfuscationCalculateV2 multiple times to perform tensor obfuscation.
    • Call aclnnObfuscationSetupV2 to release resources. This function can be called only once. You can also terminate the program process to release resources instead of explicitly releasing resources.
[object Object]

The following example is for reference only. For details, see .

[object Object]