TileVmuls【免费下载链接】catlass本项目是CANN的算子模板库提供NPU上高性能矩阵乘及其相关融合类算子模板样例。项目地址: https://gitcode.com/cann/catlass代码位置[TOC]功能说明TileVmuls实现 GEMV 场景下向量乘以标量的操作。通过AscendC::Muls对 UB 上指定长度的向量逐元素乘以标量值。适用范围所有架构无架构特化使用AscendC::SetVectorMaskElement, MaskMode::COUNTER(len)控制有效长度模板原型template class ArchTag, class VType_ struct TileVmuls;模板参数说明ArchTag架构标签VType_向量数据类型通过VType_::Element获取元素类型调用接口void operator()( AscendC::LocalTensorElement dstTensor, // 目的 UB LocalTensor AscendC::LocalTensorElement srcTensor, // 源 UB LocalTensor Element scalar, // 标量值 uint32_t len // 向量长度 )调用示例#include catlass/gemv/tile/tile_vmuls.hpp using namespace Catlass::Gemv::Tile; using Element half; using VType Gemm::GemmTypeElement, layout::VectorLayout; uint32_t len 64; Element scale 0.5f; AscendC::LocalTensorElement dstTensor, srcTensor; using VmulsOp TileVmulsArch::AtlasA2, VType; VmulsOp vmuls; vmuls(dstTensor, srcTensor, scale, len);【免费下载链接】catlass本项目是CANN的算子模板库提供NPU上高性能矩阵乘及其相关融合类算子模板样例。项目地址: https://gitcode.com/cann/catlass创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考