CANN/asc-devkit Fixpipe性能测试

发布时间:2026/9/10 9:47:15

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),仅供参考
延伸阅读

更多相关文章

2026/9/2 7:18:40

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

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

2026/9/10 9:47:07

Python实现Token认证与管理的完整指南

1. Python登录接口获取Token的完整流程解析 在Web开发和安全认证领域,Token机制已经成为现代应用身份验证的主流方案。最近在实现一个自动化测试系统时,我需要处理多个服务的身份认证问题。通过Python获取登录接口的Token并持久化存储,这个看…

2026/9/10 9:47:07

无线传感器网络LEACH协议Matlab仿真与优化

1. 无线传感器网络路由协议概述无线传感器网络(WSN)作为物联网的基础设施之一,其路由协议的设计直接影响着网络性能和能耗效率。在众多路由协议中,LEACH(Low-Energy Adaptive Clustering Hierarchy)因其简单…

2026/9/10 9:47:07

SpringBoot物流管理系统:WMS仓储调度与运单状态机实战

简介:本资源是一套面向计算机专业本科生的Java毕业设计实战材料,聚焦物流行业信息化管理需求,为毕设选题、系统开发与论文撰写提供完整闭环参考。压缩包为RAR格式,大小20.3MB,包含毕业论文文档与Spring Boot源代码工程…

2026/9/10 9:47:07

PHP二手源码安全重构实战:从代练系统看Web架构升级

简介:这是一套仿游戏代练服务的PHP网站源码,面向Web开发初学者与中小型游戏服务创业者,用于快速搭建游戏代练接单平台,解决订单管理、用户注册登录、服务展示等核心业务需求。资源包共2000个文件,主体为947个JavaScrip…

2026/9/10 9:42:06

Simulink仿真生成输电线路故障数据的技术实践

1. 项目背景与核心价值在电力系统运行维护中,输电线路故障数据的获取与分析一直是行业痛点。传统方式依赖现场实测,不仅成本高昂,且难以覆盖所有故障类型。这个项目通过Simulink仿真批量生成六类典型故障数据(单相接地、两相接地、…

2026/9/9 13:11:35

超人会飞不算本事:系统稳定依赖清晰规则与边界设计

开头先不绕弯子。“#斯坦李吐槽dc 所以超人是无缘无故会飞的嘛哈哈哈哈哈哈哈锤哥真是技术人才啊!#雷神 #复联”这类调侃式短标题,第一波冲击力在于它把两个宇宙的角色塞进同一个吐槽箱里,但细想一下就能发现,它真正碰到的根本不是…

2026/9/8 7:15:15

超人VS蜘蛛侠:拆解超级IP的影响力与传播方法论

把“蜘蛛侠 vs 超人”放在 CSDN 上聊,可能很多人第一反应是走错片场了。但如果把这两个角色看成“两个持续运营了 80 多年的文化产品”,你会发现,这场比较本质上是两个不同 IP 策略的长期结果对比:超人赢在定义了整个超级英雄题材…

2026/9/9 16:31:09

基于CNN的调制信号识别:MATLAB实现时频图分类实战

简介:本资源是一套面向通信工程与信号处理方向学习者、研究者的深度学习实践方案,聚焦调制信号自动检测与识别这一典型无线通信任务,解决传统方法依赖人工特征、低信噪比下性能下降等痛点。压缩包共12个文件(10.73MB)&…

2026/9/10 0:00:55

目录对比去重实战:用哈希算法精准清理重复文件

我电脑里现在还有一块换了三次机的“数据墓地”硬盘,里面存着2016年以前所有旧笔记本的完整备份。平时不觉得有什么,直到前阵子想把它整理归档,发现同一个安装包、同一批照片、同一份论文草稿,在几个不同的备份目录里反复出现。更…

2026/9/10 0:00:55

Leaflet离线地图完整Demo合集:内网部署与坐标纠偏实战

简介:这是一份面向Web GIS开发者的LeafLet离线地图示例合集,帮助开发者快速掌握离线地图从搭建到交互的完整流程。压缩包共723个文件,大小14.06MB,以319个js脚本、175个html页面和29个css样式文件为主体,配合png/svg图…

2026/9/10 0:00:55

MATLAB读取Rinex 3.02观测文件:多系统GNSS数据解析实战

简介:基于MATLAB开发的Rinex3.02版观测文件(o文件)读取代码包,面向卫星定位导航方向的学习者与研究人员,用于解决新版观测文件的数据解析、历元提取与时间转换问题。压缩包共4个文件,包含两个m脚本、一个19…

2026/9/7 16:23:03

USB Type-C PCB布局分区设计:电源、高速信号与PD协议全攻略

做硬件这行,Type-C接口算是典型的“看着简单,做起来全坑”的东西。光引脚就24个,高低速信号、电源、控制线全部塞在一个小小的连接器里,如果PCB布局不做规划,打样回来基本就是“插上没反应”、“高速掉线”、“静电一打…

2026/9/7 22:46:00

系统编程学习原型如何补齐稳定性边界

系统编程学习原型如何补齐稳定性边界预算有限时&#xff0c;我先优化明显多余的复制&#xff0c;而不是猜测性地换容器。用借用传递只读数据通常就能减少分配&#xff1a; fn parse(line: &str) -> Result<Item, Error> { /* ... */ }用基准确认热点确实在分配&am…

2026/9/9 10:21:54

雨花区哪家财务公司代理记账比较好?

在雨花区&#xff0c;企业处理财税事务常常面临诸多挑战&#xff0c;选择一家靠谱的财务公司至关重要。湖南巨勤财务管理咨询有限公司就是本地正规实体财税服务机构&#xff0c;深耕本地工商财税行业多年&#xff0c;熟悉当地工商局、税务局最新政策与申报流程。主营公司注册、…

还想了解更多?直接咨询顾问

免费诊断 + 免费方案 + 透明报价。

全国咨询热线400-8866-253
免费获取方案
咨询二维码