Muls
产品支持情况
产品 |
是否支持 |
|---|---|
Atlas 350 加速卡 |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
函数原型
1 2 | template <typename T = DefaultType, typename U, MaskMergeMode mode = MaskMergeMode::ZEROING, typename S> __simd_callee__ inline void Muls(S& dstReg, S& srcReg, U scalarValue, MaskReg& mask) |
参数说明
参数名 |
描述 |
|---|---|
T |
矢量目的操作数和源操作数的数据类型。 Atlas 350 加速卡,支持的数据类型为:int16_t/uint16_t/half/int32_t/uint32_t/float/complex32/int64_t/uint64_t/complex64 |
S |
标量源操作数的数据类型 Atlas 350 加速卡,支持的数据类型为:int16_t/uint16_t/half/int32_t/uint32_t/float/complex32/int64_t/uint64_t/complex64 |
mode |
选择MERGING模式或ZEROING模式。
|
U |
目的操作数的RegTensor类型,例如RegTensor<half>,由编译器自动推导,用户不需要填写。 |
返回值说明
无
约束说明
无
调用示例
template<typename T>
__simd_vf__ inline void MulsVF(__ubuf__ T* dstAddr, __ubuf__ T* srcAddr, T scalarValue, uint32_t count, uint32_t oneRepeatSize, uint16_t repeatTimes)
{
AscendC::Reg::RegTensor<T> srcReg;
AscendC::Reg::RegTensor<T> dstReg;
AscendC::Reg::MaskReg mask;
for (uint16_t i = 0; i < repeatTimes; i++) {
mask = AscendC::Reg::UpdateMask<T>(count);
AscendC::Reg::LoadAlign(srcReg, srcAddr + i * oneRepeatSize);
AscendC::Reg::Muls(dstReg, srcReg, scalarValue, mask);
AscendC::Reg::StoreAlign(dstAddr + i * oneRepeatSize, dstReg, mask);
}
}
父主题: 基础算术
