aclrtFuncAttribute

1
2
3
4
5
typedef enum {
    ACL_FUNC_ATTR_KERNEL_TYPE = 1,        // Kernel type
    ACL_FUNC_ATTR_KERNEL_RATIO = 2,       // Ratio of Cube Cores to Vector Cores required for kernel execution
    ACL_FUNC_ATTR_KERNEL_SCHED_MODE = 3,  // Kernel scheduling mode
} aclrtFuncAttribute;
  • When the attribute is set to ACL_FUNC_ATTR_KERNEL_TYPE, check its value descriptions in aclrtKernelType.
  • When the attribute is set to ACL_FUNC_ATTR_KERNEL_RATIO, obtain the attribute value in the following way:
    1
    2
    3
    uint16_t* ratioArr = reinterpret_cast<uint16_t*>(&attrValue);
    uint16_t aicratio = ratioArr[1];   // Ratio of Cube Cores
    uint16_t aivratio = ratioArr[0];   // Ratio of Vector Cores
    

    The support for this attribute varies depending on product models:

    • Ascend 950PR/Ascend 950DT: not supported
    • Atlas A3 training products/Atlas A3 inference products: supported
    • Atlas A2 training products/Atlas A2 inference products: supported
    • Atlas 200I/500 A2 inference products: not supported
    • Atlas inference products: supported
    • Atlas training products: not supported
  • When the attribute is set to ACL_FUNC_ATTR_KERNEL_SCHED_MODE, check its values as follows:
    • 0: common scheduling mode. If there is an idle core, the operator execution is started. For example, if numBlocks is set to 8, the operator kernel function will be executed on eight cores. If the common scheduling mode is specified, the operator execution is started as long as one core is idle.
    • 1: batch scheduling mode. The operator execution is started only when all required cores are idle. For example, if numBlocks is set to 8, the operator kernel function will be executed on eight cores. If the batch scheduling mode is specified, the operator execution is started only when all the eight cores are idle.