CANN/asc-devkit Fixpipe性能测试
Fixpipe (L0C Egress) Performance Test Example【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkitOverviewThis example tests the performance of the matrix computation egress path. It covers the data path that moves Cube computation results from the L0C Buffer to the L1 Buffer or Unified Buffer (UB).This is a non-functional performance test. It does not verify computation results and only collects the Fixpipe egress latency.Supported Products and CANN VersionsProductArchitecture CodeCANN VersionAscend 950PR/Ascend 950DTdav-3510 CANN 9.1.0Atlas A3 Training/Inference Seriesdav-2201 CANN 9.0.0Atlas A2 Training/Inference Seriesdav-2201 CANN 9.0.0Directory Structure├── fixpipe_perf │ ├── CMakeLists.txt // Build configuration file │ ├── fixpipe_perf.asc // Fixpipe egress performance test implementation and entry point │ ├── perf.sh // Performance test script │ ├── generate_roofline.py // Roofline generation script │ ├── README.md // Example documentationExample DescriptionThis example uses the runtime parameterSCENARIO_NUMto select different egress paths and data types. Matrix dimensions are passed at runtime through./demo SCENARIO_NUM M K N.The two egress paths use different interfaces:PathInterfaceHeader PathSupported ArchitectureL0C Buffer to L1 BufferDataCopybasic_api/kernel_operator_data_copy_intf.hdav-2201, dav-3510L0C Buffer to UBFixpipebasic_api/kernel_operator_fixpipe_intf.hdav-3510 onlyThe supported test scenarios vary by platform architecture:Atlas A3/A2 Training/Inference Platform ScenariosSCENARIO_NUMInput Data TypeData SourceExecution PathDescriptionTheoretical Bandwidth (Byte/cycle)Bandwidth Latency (cycle)1floatL0C BufferL0C Buffer - L1 BufferDataCopy egress with inline F322F16 conversion to half128202floatL0C BufferL0C Buffer - L1 BufferDataCopy egress with inline QF322B8_PRE quantization to int8_t6420Ascend 950PR/950DT Platform ScenariosSCENARIO_NUMInput Data TypeData SourceExecution PathDescriptionTheoretical Bandwidth (Byte/cycle)Bandwidth Latency (cycle)11floatL0C BufferL0C Buffer - L1 BufferDataCopy egress with inline F322F16 conversion to half1282612floatL0C BufferL0C Buffer - L1 BufferDataCopy egress with inline QF322B8_PRE quantization to int8_t642613floatL0C BufferL0C Buffer - UBFixpipe egress for float, non-dual-target mode1282614floatL0C BufferL0C Buffer - UBFixpipe egress for float, dual-target mode split along M dimension25626Theoretical bandwidth is calculated based on hardware egress parallelism: the egress unit processes 64 output elements per cycle, so theoretical bandwidth 64 × sizeof(destination data type) (Byte/cycle). Dual-target mode splits work across two sub-cores in parallel, effectively doubling the parallelism. The L0C Buffer to UB path is supported only on dav-3510 (scenarios 13 and 14). Scenario 14 splits the M×N matrix in the L0C Buffer along the M dimension into two halves and writes them simultaneously to the UB of two Vector cores.Build and RunRun the following steps from the root directory of this example to build and run it.Configure Environment VariablesConfigure environment variables based on the installation method of the CANN development kit on your system.source ${install_path}/cann/set_env.sh${install_path}is the CANN package installation directory. If no installation directory is specified, the default installation path is/usr/local/Ascend.Build the ExampleBuild for Atlas A3/A2 Training/Inference Platform (dav-2201):mkdir -p build cd build cmake -DCMAKE_ASC_ARCHITECTURESdav-2201 .. make -j cd ..Build for Ascend 950PR/950DT Platform (dav-3510):mkdir -p build cd build cmake -DCMAKE_ASC_ARCHITECTURESdav-3510 .. make -j cd ..Run the ExampleThe runtime parameter order isSCENARIO_NUM M K N:# Atlas A3/A2 Training/Inference Platform examples (scenarios 1, 2) ./build/demo 1 128 64 128 ./build/demo 2 128 64 128 # Ascend 950PR/950DT Platform examples (scenarios 11-14) ./build/demo 11 128 64 128 ./build/demo 12 128 64 128 ./build/demo 13 128 64 128 ./build/demo 14 128 64 128ParameterDescriptionSCENARIO_NUMTest scenario number. Use 1, 2 for Atlas A3/A2 Training/Inference Platform; use 11-14 for Ascend 950PR/950DT PlatformMNumber of matrix rowsKNumber of columns in matrix A (number of rows in matrix B)NNumber of matrix columnsMatrix dimensions must meet alignment requirements: M and N must be multiples of 16. For dual-target mode split along the M dimension, M must be a multiple of 2. For split along the N dimension, N must be a multiple of 32.Collecting Performance DataUse themsproftool to collect detailed performance data:msprof op build/demo 1 128 64 128 Themsproftool requires CANN Commercial or Community Edition. For details, refer to the msprof Tool Installation Guide.After the command completes, a folder namedOPPROF_{timestamp}_XXXis generated in the default directory. The performance data folder structure is as follows:├── dump # Raw performance data ├── ArithmeticUtilization.csv # Cube/vector instruction cycle ratio ├── L2Cache.csv # L2 Cache hit rate, which affects MTE2. Plan data movement logic carefully to increase hit rate ├── Memory.csv # UB, L1 Buffer, and main memory read/write bandwidth ├── MemoryL0.csv # L0A Buffer, L0B Buffer, and L0C Buffer read/write bandwidth ├── MemoryUB.csv # Vector and Scalar to UB read/write bandwidth ├── OpBasicInfo.csv # Operator basic information ├── PipeUtilization.csv # Computation unit and transfer unit latency and ratio ├── ResourceConflictRatio.csv # UB bank group, bank conflict, and resource conflict ratio └── visualize_data.bin # MindStudio Insight presentation fileThis example focuses on L0C Buffer egress performance data. View the specific performance data results as follows:cat ./OPPROF_*/PipeUtilization.csvKey metrics to monitor:MetricDescriptionaic_fixpipe_time(us)Latency of fixpipe-type instructions (L0C Buffer egress)Performance Test Scriptperf.shperforms batch building, runsmsprof op, extracts Fixpipe egress latency, and generates a CSV summary.# View help ./perf.sh --help # Test scenario 1, using dav-2201 by default ./perf.sh 1 # Test scenario 13, using dav-3510 by default ./perf.sh 13 # Explicitly specify the platform. The platform must match the scenario; otherwise, an error is reported ./perf.sh 1 dav-2201 ./perf.sh 13 dav-3510The script uses a built-in default shape sequence. Egress performance depends only on M and N. K is fixed at 64 to allow Mmad to produce L0C Buffer data beforehand. The sequence starts from a small M·N value and gradually increases to full capacity. The L0C Buffer size is 128 KB for dav-2201 and 256 KB for dav-3510. The saturation points differ, so the last entry differs between the two architectures:dav-2201 default shape sequence:Test_IDMKNM·NL0C Buffer Usage (float)11664162561 KB232643210244 KB3646464409616 KB4128641281638464 KB51286425632768128 KB (dav-2201 saturation)dav-3510 default shape sequence:Test_IDMKNM·NL0C Buffer Usage (float)11664162561 KB232643210244 KB3646464409616 KB4128641281638464 KB52566425665536256 KB (dav-3510 saturation)The L0C Buffer egress data volume is M × N × sizeof(destination type). K is used only to allow Mmad to produce the M×N result in the L0C Buffer beforehand and is not counted in the egress volume. Adjust K as needed.To test specific shapes, run./build/demo SCENARIO_NUM M K Ndirectly.After testing, results are saved toperf_data_${timestamp}_scenario${SCENARIO}/perf_result_scenario${SCENARIO}.csv. Rawmsprofdata is saved in thetest_${id}_${M}_${K}_${N}subdirectory under the same directory.Performance Metricsperf.shextractsaic_fixpipe_time(us)fromPipeUtilization.csvand calculates bandwidth based on the platform clock frequency and egress volume.The computed columns in the CSV are as follows:ColumnCalculationDescriptionAIC_FixPipe_Time(us)Extracted fromaic_fixpipe_time(us)inPipeUtilization.csvFixpipe egress latencyCycleTime(us) × Frequency(MHz)Cycle count converted based on platform clock frequencyBandwidth(GB/s)DataSize(bytes) / Time(us) / 1e3Data transfer bandwidthPerformance Metric Calculation MethodsTheaic_fixpipe_time(us)collected bymsprofinPipeUtilization.csvis the egress latency in microseconds.perf.shreads this time column and calculates the cycle count and measured bandwidth based on the platform clock frequency and egress data volume.Converting Time to CyclesThe clock frequency unit is MHz, which represents cycles per microsecond. No additional conversion is needed:Cycle Time(us) × Frequency(MHz)For example, the Atlas A3/A2 Training/Inference Platform has a clock frequency of 1800 MHz. Ifaic_fixpipe_time(us) 0.050000:Cycle 0.050000 × 1800 90.00 cyclesData Transfer Volume Calculationperf.shcalculates the egress volume based on the destination data type for each scenario. This value is used asDataSize(bytes)for bandwidth calculation:ScenarioData Volume CalculationData Type Size1, 11M × N × sizeof(half)2 bytes2, 12M × N × sizeof(int8_t)1 byte13, 14M × N × sizeof(float)4 bytesMeasured Bandwidth CalculationBandwidth is output in GB/s. SinceTime(us)is in microseconds,DataSize(bytes) / Time(us)yields MB/s. Dividing by1e3converts to GB/s:Bandwidth(GB/s) DataSize(bytes) / Time(us) / 1e3For example, scenario 11 with shape[128, 64, 128]and destination type half:DataSize 128 × 128 × 2 32768 bytes Time 0.050000 us Bandwidth 32768 / 0.050000 / 1e3 655.360 GB/sTheoretical Latency and Bandwidth UtilizationThe Theoretical Bandwidth (Byte/cycle) and Bandwidth Latency (cycle) in the scenario table can be used to estimate theoretical latency. Theoretical bandwidth is derived from egress parallelism (the egress unit processes 64 output elements per cycle, theoretical bandwidth 64 × sizeof(destination type), doubled for dual-target mode). The fixed latency represents the base startup overhead for a single transfer. The theoretical transfer time can be estimated as follows:TransferCycle DataSize(bytes) / TheoreticalBandwidth(Byte/cycle) TheoryCycle Latency(cycle) TransferCycle TheoryTime(us) TheoryCycle / Frequency(MHz) TheoryBandwidth(GB/s) DataSize(bytes) / TheoryTime(us) / 1e3The ratio of measured bandwidth to theoretical bandwidth can be used to evaluate bandwidth utilization:BandwidthUtilization MeasuredBandwidth(GB/s) / TheoryBandwidth(GB/s) × 100%The platform clock frequency is set automatically byperf.shbased on the scenario:PlatformArchitecture CodeClock FrequencyApplicable ScenariosAtlas A3/A2 Training/Inference Platformdav-22011800 MHz1, 2Ascend 950PR/950DT Platformdav-35101650 MHz11-14Roofline AnalysisThis example providesgenerate_roofline.py, which generates ASCII reports and charts from the CSV output produced byperf.sh.Python Package Dependenciesgenerate_roofline.pyuses Python standard libraries to read CSV and generate ASCII reports. To generate PNG/PDF charts, installmatplotlibandnumpy.python3 -m pip install --user matplotlib numpyIf these dependencies are not installed, the script still generates.txtASCII analysis reports but skips chart generation.# Automatically find the latest perf_data directory results python3 generate_roofline.py # Specify a CSV file python3 generate_roofline.py --csv perf_data_xxx_scenario11/perf_result_scenario11.csvThe script has built-in egress parallelism for each scenario. You do not need to manually specify peak bandwidth. The first-instruction overhead defaults to the scenario value (20 cycles for dav-2201, 26 cycles for dav-3510), and the clock frequency is automatically selected based on the scenario.Chart ExampleThe following is a Roofline chart example generated for scenario 1:NotesScenario numbers must match the platform: use scenarios 1, 2 for dav-2201 and scenarios 11-14 for dav-3510.perf.shvalidates the match and reports errors for mismatches.The L0C Buffer to UB path (scenarios 13, 14) is supported only on dav-3510 and uses theFixpipeinterface with the hybrid programming framework.Matrix dimensions must meet alignment requirements: M and N must be multiples of 16. For dual-target mode split along the M dimension, M must be a multiple of 2. For split along the N dimension, N must be a multiple of 32.This is a pure performance test and does not verify computation results. The kernel function does not initialize data in the L0A Buffer or L0B Buffer. It retains a minimal Mmad operation to produce L0C Buffer data beforehand.APipeBarrierPIPE_ALLis inserted between the Mmad pre-operation and the egress instruction to prevent pipeline overlap from causing inaccurateaic_fixpipe_timestatistics.【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

相关新闻

Linux桌面PyCharm快捷方式:1个.desktop文件集成CUDA等3类环境变量

Linux桌面PyCharm快捷方式:1个.desktop文件集成CUDA等3类环境变量

Linux桌面环境下PyCharm环境变量终极配置指南 1. 为什么需要配置.desktop文件的环境变量? 在Linux桌面环境中使用PyCharm进行开发时,经常会遇到一个令人头疼的问题:明明在终端里运行正常的程序,到了PyCharm中却提示找不到动态链接…

2026/7/12 16:33:49阅读更多 →
ADS 2024 负载线型移相器仿真:3-5GHz 频段 S11<-30dB 的 3 步优化流程

ADS 2024 负载线型移相器仿真:3-5GHz 频段 S11<-30dB 的 3 步优化流程

ADS 2024负载线型移相器仿真&#xff1a;3-5GHz频段S11<-30dB的三步精密优化策略 在射频电路设计中&#xff0c;负载线型移相器因其结构简单、性能稳定而广泛应用于相控阵雷达和通信系统。本文将分享一套在ADS 2024环境中实现3-5GHz频段S11<-30dB的优化流程&#xff0c;通…

2026/7/12 16:33:49阅读更多 →
为什么93%的数据团队在AI Agent试点中失败?——2024年Gartner实测数据+7个被隐藏的底层依赖项

为什么93%的数据团队在AI Agent试点中失败?——2024年Gartner实测数据+7个被隐藏的底层依赖项

更多请点击&#xff1a; https://codechina.net 第一章&#xff1a;AI Agent 自动数据分析 AI Agent 正在重塑数据分析的范式——它不再依赖人工编写 SQL 或手动配置可视化图表&#xff0c;而是通过自然语言理解业务意图&#xff0c;自主调用数据源、执行清洗、建模与解释&…

2026/7/12 16:33:49阅读更多 →
PrimoToon社区贡献指南:如何为开源Shader项目做出贡献

PrimoToon社区贡献指南:如何为开源Shader项目做出贡献

PrimoToon社区贡献指南&#xff1a;如何为开源Shader项目做出贡献 【免费下载链接】PrimoToon Shader for Unity (Built-in Rendering Pipeline) attempting to replicate the shading of Genshin Impact developed by miHoYo. This is for datamined assets, not custom-made …

2026/7/12 18:44:29阅读更多 →
RT-Thread快速入门(五)之邮箱

RT-Thread快速入门(五)之邮箱

前言 在上一篇中&#xff0c;我们学习了消息队列——它可以传递任意大小的数据&#xff0c;非常灵活。但它的内部涉及链表操作和 memcpy&#xff0c;如果只是传递一些很小的数据&#xff08;比如状态码、计数值、指针地址&#xff09;&#xff0c;用消息队列就有点"杀鸡用…

2026/7/12 18:44:29阅读更多 →
SmartPack-Kernel-Manager安全指南:安全调优Android内核的7个关键步骤

SmartPack-Kernel-Manager安全指南:安全调优Android内核的7个关键步骤

SmartPack-Kernel-Manager安全指南&#xff1a;安全调优Android内核的7个关键步骤 【免费下载链接】SmartPack-Kernel-Manager Source code of SmartPack-Kernel Manager, the Ultimate Tool to Manage your Kernel 项目地址: https://gitcode.com/gh_mirrors/smar/SmartPack…

2026/7/12 18:44:29阅读更多 →
Chopper代码生成原理揭秘:source_gen如何简化HTTP客户端开发

Chopper代码生成原理揭秘:source_gen如何简化HTTP客户端开发

Chopper代码生成原理揭秘&#xff1a;source_gen如何简化HTTP客户端开发 【免费下载链接】chopper Chopper is an http client generator using source_gen and inspired from Retrofit. 项目地址: https://gitcode.com/gh_mirrors/ch/chopper Chopper是一个基于source_…

2026/7/12 18:44:29阅读更多 →
哈佛大学联合罗氏制药团队在Nat Med发表泛癌AI基础模型,仅通过肿瘤批量转录组数据就能预测免疫治疗效果

哈佛大学联合罗氏制药团队在Nat Med发表泛癌AI基础模型,仅通过肿瘤批量转录组数据就能预测免疫治疗效果

小罗碎碎念参考来源&#xff1a;Wanxiang Shen, Intae Moon, Thinh H. Nguyen, et al. Generalizable AI predicts immunotherapy outcomes across cancers and treatments. Nature Medicine, 2026.研究团队&#xff1a;哈佛大学医学院Marinka Zitnik实验室、罗氏制药研发团队如…

2026/7/12 18:44:29阅读更多 →
10|把一个 ESP32-S3 环境感知原型跑顺:从硬件、网页到后续改进

10|把一个 ESP32-S3 环境感知原型跑顺:从硬件、网页到后续改进

一个硬件原型真正跑顺&#xff0c;不是看某一张页面截图&#xff0c;也不是看某一次串口日志。它更像一条路&#xff1a;传感器能稳定读数&#xff0c;开发板能显示状态&#xff0c;WiFi 能连上&#xff0c;网页能看到数据&#xff0c;接口能区分来源&#xff0c;算法能解释为什…

2026/7/12 18:39:29阅读更多 →
VSCode TypeScript 环境配置对比:全局安装 vs 项目本地安装的4个关键差异

VSCode TypeScript 环境配置对比:全局安装 vs 项目本地安装的4个关键差异

VSCode TypeScript 环境配置对比&#xff1a;全局安装 vs 项目本地安装的4个关键差异当你在VSCode中启动一个新的TypeScript项目时&#xff0c;第一个技术决策往往从安装方式开始。这个看似简单的选择——全局安装还是项目本地安装——实际上会深刻影响你的开发流程、团队协作和…

2026/7/12 0:02:11阅读更多 →
智慧树刷课插件:5分钟实现自动化学习的智能助手

智慧树刷课插件:5分钟实现自动化学习的智能助手

智慧树刷课插件&#xff1a;5分钟实现自动化学习的智能助手 【免费下载链接】zhihuishu 智慧树刷课插件&#xff0c;自动播放下一集、1.5倍速度、无声 项目地址: https://gitcode.com/gh_mirrors/zh/zhihuishu 智慧树刷课插件是一款专为智慧树在线教育平台设计的Chrome浏…

2026/7/12 0:02:11阅读更多 →
Steam创意工坊下载器WorkshopDL:跨平台游戏模组获取的终极解决方案

Steam创意工坊下载器WorkshopDL:跨平台游戏模组获取的终极解决方案

Steam创意工坊下载器WorkshopDL&#xff1a;跨平台游戏模组获取的终极解决方案 【免费下载链接】WorkshopDL WorkshopDL - The Best Steam Workshop Downloader 项目地址: https://gitcode.com/gh_mirrors/wo/WorkshopDL 你是否在GOG或Epic Games Store购买了心仪的游戏…

2026/7/12 0:02:11阅读更多 →
VSCode TypeScript 环境配置对比:全局安装 vs 项目本地安装的4个关键差异

VSCode TypeScript 环境配置对比:全局安装 vs 项目本地安装的4个关键差异

VSCode TypeScript 环境配置对比&#xff1a;全局安装 vs 项目本地安装的4个关键差异当你在VSCode中启动一个新的TypeScript项目时&#xff0c;第一个技术决策往往从安装方式开始。这个看似简单的选择——全局安装还是项目本地安装——实际上会深刻影响你的开发流程、团队协作和…

2026/7/12 0:02:11阅读更多 →
智慧树刷课插件:5分钟实现自动化学习的智能助手

智慧树刷课插件:5分钟实现自动化学习的智能助手

智慧树刷课插件&#xff1a;5分钟实现自动化学习的智能助手 【免费下载链接】zhihuishu 智慧树刷课插件&#xff0c;自动播放下一集、1.5倍速度、无声 项目地址: https://gitcode.com/gh_mirrors/zh/zhihuishu 智慧树刷课插件是一款专为智慧树在线教育平台设计的Chrome浏…

2026/7/12 0:02:11阅读更多 →
Steam创意工坊下载器WorkshopDL:跨平台游戏模组获取的终极解决方案

Steam创意工坊下载器WorkshopDL:跨平台游戏模组获取的终极解决方案

Steam创意工坊下载器WorkshopDL&#xff1a;跨平台游戏模组获取的终极解决方案 【免费下载链接】WorkshopDL WorkshopDL - The Best Steam Workshop Downloader 项目地址: https://gitcode.com/gh_mirrors/wo/WorkshopDL 你是否在GOG或Epic Games Store购买了心仪的游戏…

2026/7/12 0:02:11阅读更多 →
YOLOv8推理性能优化:从1.2FPS到35FPS的全链路加速实践

YOLOv8推理性能优化:从1.2FPS到35FPS的全链路加速实践

如果你在部署 YOLOv8 时&#xff0c;发现推理速度只有可怜的 1-2 FPS&#xff0c;而别人的演示视频却能跑到 30 FPS 以上&#xff0c;那么问题很可能不在模型本身&#xff0c;而在于你的整个处理链路。很多开发者拿到一个训练好的 YOLOv8 模型后&#xff0c;会直接使用官方示例…

2026/7/11 16:20:28阅读更多 →
Coze与Dify对比指南:低代码AI应用开发从入门到实战

Coze与Dify对比指南:低代码AI应用开发从入门到实战

1. 从零到一&#xff1a;为什么你需要了解 Coze 和 Dify&#xff1f;如果你对 AI 应用开发感兴趣&#xff0c;但一看到“大模型”、“智能体”、“工作流”这些词就头疼&#xff0c;觉得门槛太高&#xff0c;那这篇文章就是为你准备的。很多开发者&#xff0c;包括我自己&#…

2026/7/11 23:15:38阅读更多 →
AI生图工具怎么选?2026年6月版实测对比

AI生图工具怎么选?2026年6月版实测对比

做自媒体的朋友应该都有体会&#xff1a;配图一直是个让人头疼的问题。2026年&#xff0c;AI生图工具已经非常成熟了&#xff0c;但工具太多反而不知道怎么选。以下是截至2026年6月我对主流AI生图工具的实测对比。Midjourney V8.1&#xff1a;速度之王2026年6月11日&#xff0c…

2026/7/11 18:12:23阅读更多 →