# mxmaca-performance-tuning-guide **Repository Path**: metax-maca/mxmaca-performance-tuning-guide ## Basic Information - **Project Name**: mxmaca-performance-tuning-guide - **Description**: Kernel性能优化和编写指南 - **Primary Language**: C++ - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 5 - **Forks**: 1 - **Created**: 2024-12-16 - **Last Updated**: 2025-09-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # MACA Performance Optimization Guide - ./guide: 性能优化文档 - ./case: 文档对应实例代码 - ./microbenchmark: 文档中测试MetaX C500/Nvidia A100微架构参数的工程 # 跨平台兼容 库中所有代码都在NVIDIA A100和MetaX C500上测试。为了保证代码在不同平台上的兼容性,需要注意以下几点: 1. 部分代码需要手动修改kWarpSize,A100上为`32`,C500上为`64`。 2. 部分代码在不同平台上需要手动切换宏定义中的NVIDIA或者METAX 例如[microbenchmark/common/common.mk](microbenchmark/common/common.mk)中, ## 性能优化文档大纲 本文档希望能够帮助大家更好地理解MetaX C500的架构,以及如何在C500上进行性能优化。同时汇总了一些常用的性能优化技巧,以及一些常用的编译参数和环境变量。 目前sw-wiki上的内容大而全。本文档希望能将跟性能优化有关的内容汇总并维护一个最新版本,方便大家查阅。 1. [初探异构编程.vectoradd](guide/ch1.初探异构编程.vectoradd.md):host代码的编写。Host memory与Device Memory的区别。Kernel launch,threadIdx与blockIdx。计时。抓取运行时错误。 2. [曦云C500芯片架构](guide/ch2.曦云C500芯片架构.md):GPU的并行性与局域性,硬件编程抽象模型与硬件执行流程,microbenchmark写法。 3.[Kernel编程入门.reduction](guide/ch3.Kernel编程入门.reduction.md):以reduction为例,介绍kernel基本编程技巧,以及访存密集型应用的性能上界。 4. [Kernel性能建模.SGEMM](guide/ch4.Kernel性能建模.sgemm.md):Amdahl's Law,屋檐模型,延迟隐藏模型。优化单精度矩阵乘法。 5. 性能优化技巧。 6. 性能分析工具:探针,Tracer, Cycle trace, performance counter, compiler explorer。 7. Host代码性能优化(施工中) 8. 张量编程.HGEMM(施工中) 9. C500 HW Limitation相关。 10. 常用Compiler参数和Driver环境变量(施工中) 阅读顺序: - 熟悉C500 kernel开发的同学,直接阅读ch5开头的表格,查缺补漏。 - 熟悉CUDA的同学,跳过ch1, ch3。 - 不熟悉CUDA的同学,按顺序阅读。 欢迎大家提Issue和pull request。小错误也可以直接钉钉找李兆石。 ## 词汇表 ## 参与贡献 Pull request - Fork 本仓库 - 新建 Feat_xxx 分支 - 提交代码 - 新建 Pull Request