Histograms
产品支持情况
|
产品 |
是否支持 |
|---|---|
|
Atlas 350 加速卡 |
√ |
|
|
x |
|
|
x |
|
|
x |
|
|
x |
|
|
x |
|
|
x |
功能说明
对直方图数据进行统计,在目的操作数dstReg的基础数据上加上源操作数srcReg数据的统计结果,包括数据的频率统计和累计统计。
函数原型
template <typename T = DefaultType, typename U = DefaultType, HistogramsBinType mode, HistogramsType type, typename S, typename V> __simd_callee__ inline void Histograms(V& dstReg, S& srcReg, MaskReg& mask)
参数说明
|
参数名 |
描述 |
|---|---|
|
T |
源操作数的数据类型。 Atlas 350 加速卡,支持的数据类型为:uint8_t |
|
U |
目的操作数的数据类型。 Atlas 350 加速卡,支持的数据类型为:uint16_t |
|
mode |
HistogramsBinType枚举类型,用于控制统计src前半部分还是后半部分的数据。VL长度为256Byte,dst数据类型为uint16_t,一个dst可以存储128个数据,因此需要两个dst。
|
|
type |
HistogramsType 枚举类型,表示统计模式。
|
|
S |
目的操作数RegTensor类型,由编译器自动推导,用户不需要填写。 |
|
V |
源操作数RegTensor类型,由编译器自动推导,用户不需要填写。 |
返回值说明
无
约束说明
无
调用示例
template <typename T, typename U>
__simd_vf__ inline void HistogramsVF(__ubuf__ U* dstAddr, __ubuf__ T* srcAddr, uint32_t oneRepeatSize, uint16_t repeatTimes, AscendC::Reg::HistogramsBinType mode, AscendC::Reg::HistogramsType type)
{
AscendC::Reg::RegTensor<T> srcReg;
AscendC::Reg::RegTensor<U> dstReg;
AscendC::Reg::MaskReg mask0 = AscendC::Reg::CreateMask<T>();
AscendC::Reg::MaskReg mask1 = AscendC::Reg::CreateMask<T>();
for (uint16_t i = 0; i < repeatTimes; ++i){
AscendC::Reg::LoadAlign(srcReg, srcAddr + oneRepeatSize * i);
AscendC::Reg::Histograms<T, U, mode, type>(dstReg, srcReg, mask0);
AscendC::Reg::StoreAlign(dstAddr, dstReg, mask1);
}
}
父主题: 直方图计算

