文档
注册

GetSystemCycle

功能说明

获取当前系统cycle数,若换算成时间需要按照50MHz的频率,时间单位为us,换算公式为:time = (cycle数/50) us 。

函数原型

__aicore__ inline int64_t GetSystemCycle()

参数说明

返回值

返回int64类型的系统cycle数。

支持的型号

Atlas A2训练系列产品/Atlas 800I A2推理产品

约束说明

调用示例

如下样例通过GetSystemCycle获取系统cycle数,并换算成时间(单位:us)。
#include "kernel_operator.h"
__aicore__ inline void InitTilingParam(int32_t& totalSize, int32_t& loopSize)
{
    int64_t systemCycleBefore= GetSystemCycle();//调用GetBlockNum指令前的cycle数
    loopSize = totalSize / GetBlockNum();
    int64_t systemCycleAfter= GetSystemCycle();//调用GetBlockNum指令后的cycle数
    int64_t GetBlockNumCycle = systemCycleBefore - systemCycleAfter;//执行GetBlockNum指令所用的cycle数
    int64_t CycleToTimeBase = 50;//cycle数转换成时间的基准单位,固定为50
    int64_t GetBlockNumTime = GetBlockNumCycle/CycleToTimeBase;//执行GetBlockNum指令所用时间,单位为us
};
搜索结果
找到“0”个结果

当前产品无相关内容

未找到相关内容,请尝试其他搜索词