当前位置: 首页 > news >正文

CANN/catlass稀疏矩阵乘法示例

SparseMatmulTla Example Readme

【免费下载链接】catlass本项目是CANN的算子模板库,提供NPU上高性能矩阵乘及其相关融合类算子模板样例。项目地址: https://gitcode.com/cann/catlass

Code Organization

├── 41_sparse_matmul_tla │ ├── CMakeLists.txt #CMake build file │ ├── README.md │ ├── sparse_gen_data.py │ └── sparse_matmul_tla.cpp # Main file

Example

  • After obtaining the code, compile the operator executable file. For details, see Template Library Quick Start.

  • Runsparse_gen_data.pyto generate a test sample. The test sample needs to be input from the command line. After the command is executed, theinputandoutputdirectories are generated in the specified path, including the input data of the operator and the golden data used for precision verification.

  • Then, execute the operator. Note that the input shape of the operator must match the shape of the data generated in the first step. In addition, this sample supports only theint8_tdata type for the input of matrix A or B.

The following is a complete shell script example (run in the project directory):

m=160 n=320 k=64 device=0 function build() { bash scripts/build.sh 41_sparse_matmul_tla } function gen_data() { cd examples/41_sparse_matmul_tla python3 sparse_gen_data.py $m $n $k echo "Data gen finished" } function run_kernel { echo 'Case: m=' $m ' k=' $k ' n=' $n cd ../../output/bin/ cp -r ../../examples/41_sparse_matmul_tla/input . cp -r ../../examples/41_sparse_matmul_tla/output . ./41_sparse_matmul_tla $m $n $k $device } build gen_data run_kernel

If the following result is displayed, precision verification is successful.

Compare success.

【免费下载链接】catlass本项目是CANN的算子模板库,提供NPU上高性能矩阵乘及其相关融合类算子模板样例。项目地址: https://gitcode.com/cann/catlass

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

http://www.jsqmd.com/news/1073079/

相关文章:

  • sccache编译缓存终极指南:如何用云端缓存加速你的构建速度
  • Atomic Docs分类与组织系统:如何高效管理数百个前端组件
  • SpacetimeGaussians实战案例:烹饪、火焰、生日场景的完整实现流程
  • Ngx-restangular 核心功能解析:all、one、several 方法深度指南
  • UI.Vision RPA:免费开源自动化工具的完整指南
  • 终极指南:3步掌握Nextcloud外部存储功能
  • HiApp用户体验设计:打造流畅移动应用的7个界面与交互技巧
  • BlenderMCP:基于MCP协议的AI驱动3D建模解决方案
  • 5步终极方案:将闲置电视盒子改造为专业Armbian服务器
  • Contra.js在浏览器端的最佳实践:提升前端性能的7种方法
  • 30分钟从零开始:用LSPosed框架开发你的第一个Android钩子模块
  • Node.js环境下使用pouchdb-authentication:服务端用户认证实现指南
  • 技术架构解析:Awesome Claude Skills项目的模块化技能集成平台实现
  • 超强libphonenumber实战指南:一站式解决国际电话号码解析难题
  • Atomic Docs自定义主题与样式:打造个性化样式指南界面
  • 在macOS上实现Intel RealSense深度相机高效配置的完整技术指南
  • BabelDOC:专业PDF文档翻译的终极解决方案
  • Cap开源录屏工具终极指南:从零开始到专业录制的完整教程
  • RARS终极指南:如何扩展RISC-V汇编器模拟器的系统调用功能
  • PixLoc部署教程:从本地环境到云端服务的完整实现方案
  • ETNavBarTransparent实战项目:从零构建一个完整的企业级iOS应用
  • Javinizer多语言支持实战:日语、英语、中文元数据翻译配置指南
  • 如何利用Claude Code Action解决代码文档同步难题:5个实用技巧
  • BabelDOC完整指南:如何用AI技术实现PDF学术论文的精准翻译
  • 如何快速搭建你的本地AI浏览助手:Page Assist完整使用指南
  • AccessGranted集成指南:如何与Devise、Pundit等其他认证授权库协同工作
  • 音乐信号处理新突破:基于Deep Complex Networks的MusicNet数据集实战教程
  • 3层架构解密mimalloc:从内存碎片优化到40%性能提升的技术实现
  • 响应式设计必备:cssplot让你的图表在任何设备上都完美展示
  • 终极指南:如何在10分钟内用DeepSeek Coder提升编程效率300%