aclmdlConfigAttr
|
Model Loading Configuration Type |
Description |
|---|---|
|
ACL_MDL_PRIORITY_INT32 = 0 |
Priority of model execution. A smaller value indicates a higher priority. This parameter is optional. Its value is [0, 7]. Defaults to 0. For the Atlas Training Series Product, this enumeration does not take effect when CANN is installed in a Docker container with computing power allocation configured. |
|
ACL_MDL_LOAD_TYPE_SIZET = 1 |
Model loading mode. For details, see Table 1. This parameter is required. |
|
ACL_MDL_PATH_PTR = 2 |
(Required if the model is loaded from a file) Pointer address of the offline model file path. |
|
ACL_MDL_MEM_ADDR_PTR = 3 |
(Required if the model is loaded from memory) Start address of the model in the memory. |
|
ACL_MDL_MEM_SIZET = 4 |
(Required if the model is loaded from memory) Size of the model in the memory. Must be used in conjunction with ACL_MDL_MEM_ADDR_PTR. |
|
ACL_MDL_WEIGHT_ADDR_PTR = 5 |
(Required if the weight memory is managed by the user) Pointer address of the model weight memory on the device. If this parameter is not set, the system manages the memory. |
|
ACL_MDL_WEIGHT_SIZET = 6 |
Required if the weight memory is managed by the user) Size of the weight memory on the device, in bytes. If this parameter is not set, the system manages the memory. Must be used in conjunction with ACL_MDL_WEIGHT_ADDR_PTR. |
|
ACL_MDL_WORKSPACE_ADDR_PTR = 7 |
(Required if the workspace is managed by the user) Pointer address of the model workspace on the device. If this parameter is not set, the system manages the memory. |
|
ACL_MDL_WORKSPACE_SIZET = 8 |
(Required if the workspace is managed by the user) Size of the workspace on the device, in bytes. If this parameter is not set, the system manages the memory. Must be used in conjunction with ACL_MDL_WORKSPACE_ADDR_PTR. |
|
ACL_MDL_INPUTQ_NUM_SIZET = 9 |
(Required if the model is loaded by using a queue) Size of the model input queue. Must be used in conjunction with ACL_MDL_INPUTQ_ADDR_PTR. |
|
ACL_MDL_INPUTQ_ADDR_PTR = 10 |
(Required if the model is loaded by using a queue) Pointer address of the model input queue ID. |
|
ACL_MDL_OUTPUTQ_NUM_SIZET = 11 |
(Required if the model is loaded by using a queue) Size of the model output queue. Must be used in conjunction with ACL_MDL_OUTPUTQ_ADDR_PTR. |
|
ACL_MDL_OUTPUTQ_ADDR_PTR = 12 |
(Required if the model is loaded by using a queue) Pointer address of the model output queue ID. One model output corresponds to one queue ID. |
|
ACL_MDL_WORKSPACE_MEM_OPTIMIZE = 13 |
Whether to enable model buffer optimization. The value 1 indicates that the function is enabled, and the value 0 indicates that the function is disabled. If buffer planning is considered or resources are limited, you are advised to enable the buffer optimization function before model loading to reduce the buffer size. In this case, the buffer does not contain the part for storing the input and output data of the model. Before model execution, you need to apply for the buffer for storing the input and output data of the model. Therefore, even if buffer optimization is enabled during model loading, subsequent model execution is not affected. |
|
ACL_MDL_WEIGHT_PATH_PTR = 14 |
Pointer address to the directory where weight files are located. If the size of an .om model file is limited, this parameter can be used to implement the function of externalizing weight files. If ACL_MDL_LOAD_TYPE_SIZET is set to ACL_MDL_LOAD_FROM_MEM, model data is loaded from the memory. You can also use ACL_MDL_WEIGHT_PATH_PTR to specify the weight file directory. Generally, if the size of an .om model file is limited or the model file is encrypted, you need to specify the weight file directory separately. The prerequisite is that when using the ATC tool to generate the .om file, set the --external_weight parameter to 1 (1 indicates that the weights of the Const/Constant nodes on the original network are saved in a separate file). |
|
Model Loading Mode |
Description |
|---|---|
|
ACL_MDL_LOAD_FROM_FILE = 1 |
Loads an offline model from a file. The memory is managed by the system. |
|
ACL_MDL_LOAD_FROM_FILE_WITH_MEM = 2 |
Loads an offline model from a file. The model workspace is managed by the user. |
|
ACL_MDL_LOAD_FROM_MEM = 3 |
Loads an offline model from memory. The model workspace is managed by the system. |
|
ACL_MDL_LOAD_FROM_MEM_WITH_MEM = 4 |
Loads an offline model from memory. The model workspace is managed by the user. |
|
ACL_MDL_LOAD_FROM_FILE_WITH_Q = 5 |
Loads an offline model from a file. The inputs and outputs of a model are stored in queues. |
- For details about how to obtain the .om file, see Model Building.
- When you use ATC to generate an .om file whose size is limited, set --external_weight to 1, indicating that the weight of the Const/Constant node on the original network is saved in a separate file in the weight directory. Ensure that the weight directory is at the same level as the .om file so that pyACL can automatically search for the weight file in the weight directory when you call this API to load the .om file. If the weight directory is not placed in the correct location, the weight file may fail to be loaded.