Description: Sends tensor x and configuration parameters (such as param and cmd) to the PMCC obfuscation engine. The CA module of the engine calls the TA module to perform tensor obfuscation and returns the obfuscated tensor y with the same shape as x.
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.
Each operator has calls. First, aclnnObfuscationCalculateV2GetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnObfuscationCalculateV2 is called to perform computation.
[object Object][object Object]
Parameters:
- fd (int32_t, compute input): socket connection symbol. The data type is INT32. Set this parameter to fd[0] in the output of aclnnObfuscationSetupV2 during resource initialization.
- x (aclTensor*, compute input): tensor to be obfuscated. The shape is (,, ..., hiddenSize). The size of the last dimension is the hiddenSize configured by aclnnObfuscationSetupV2 during resource initialization. The can be ND. and empty tensors are not supported.
- [object Object]Atlas inference series products[object Object]: The data type can be FLOAT, FLOAT16, or INT8.
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: The tensor data type can be FLOAT, FLOAT16, INT8, or BFLOAT16.
- param (int32_t, compute input): reserved parameter field. The data type is INT32. The current version supports only 0.
- cmd (int32_t, compute input): obfuscation operator instruction ID. The current version supports only 1.
- obfCoefficient (float, compute input): obfuscation coefficient used for obfuscation. The value range is (0.0, 1.0].
- y (aclTensor*, compute output): tensor after obfuscation. The data type and shape are the same as those of x. 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:
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 aclnnObfuscationCalculateV2GetWorkspaceSize.
- executor (aclOpExecutor*, input): operator executor, containing the operator computation process.
- stream (aclrtStream, input): stream for executing the task.
Deterministic compute:
- aclnnObfuscationCalculateV2 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.
The following example is for reference only. For details, see .