Benchmark method and system for NPU processing core computing capability, memory and PCIe bandwidth

By optimizing the NPU's testing logic and combining the DP4A operator and convolution operation, the accuracy issues of NPU module computing power and memory bandwidth testing were resolved, achieving high-precision PCIe bandwidth testing, adapting to simulation and actual platforms, and improving testing efficiency and accuracy.

CN123138043APending Publication Date: 2026-11-20SHANGHAI QUSU CHAOWEI TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202611296855.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-25
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

In existing technologies, the computing power and memory bandwidth tests of the NPU's CC module are not specifically optimized based on hardware characteristics. The computing power and memory bandwidth of the TC module cannot be tested, the PCIe bandwidth test results have large deviations, and the test tools cannot adapt to simulation and actual platforms, resulting in low test accuracy and excessive test time.

Method used

The test logic is optimized based on the hardware and packaging characteristics of the NPU. The computing power test of the CC module is carried out by optimizing the DP4A operator and compiler. The memory read and write operation time is separated. The computing power of the TC module is tested by using convolution operation. The PCIe bandwidth test is carried out by removing redundant data copies through paged memory. The adaptive function of test parameters is implemented.

Benefits of technology

The test accuracy of the CC module's computing power, memory bandwidth, and PCIe bandwidth has been significantly improved, with test results reaching more than 90% of the theoretical values. This has shortened the test time and met the needs of simulation and actual platforms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123138043A_ABST
    Figure CN123138043A_ABST
Patent Text Reader

Abstract

The application discloses a benchmark test method for NPU processing core computing capacity, memory and PCIe bandwidth, and belongs to the technical field of AI chip benchmark test. The application optimizes the computing power and memory bandwidth test logic of the general parallel computing unit CC of the NPU, self-developes the computing power and memory bandwidth test process suitable for the hardware packaging design of the tensor processing unit TC, optimizes the PCIe bandwidth test logic, and realizes the software and hardware self-adaption function of the test parameters. The application greatly improves the test accuracy and efficiency of the computing power, memory bandwidth and PCIe bandwidth of each module of the NPU, and can comprehensively cover the full-process performance and stability test requirements of the NPU chip from the pre-silicon simulation to the post-silicon application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of AI chip software development, benchmarking and performance analysis, and in particular to a benchmarking method and system for NPU processing core computing power, memory and PCIe bandwidth. Background Technology

[0002] The NPU is dedicated hardware for accelerating parallel computing in machine learning within the field of artificial intelligence. Compared to traditional GPUs (Graphics Processing Units), it emphasizes parallel computing capabilities. Compared to GPGPUs (General Purpose GPUs), its hardware and software are customized and optimized for neural network computation, achieving relatively high performance with relatively low power consumption. The Tensor Core (TC) is a customized hardware circuit, requiring specially designed benchmark programs to accurately test its computing power (computing capacity) to assess whether it meets theoretical values ​​and evaluate hardware stability. The Compute Core (CC) is a general-purpose parallel computing unit; mature computing power testing solutions already exist, and this invention optimizes and improves upon them. Regarding memory bandwidth testing, because it uses HBM-like storage (BBCUBE solution), directly encapsulating the customized storage chip within the computing core, unlike traditional GPGPUs where HBM and GC (computing cores) are encapsulated separately in the Silicon Interposer, traditional memory bandwidth testing methods in current products can only test the memory attached to the CC module, not the memory of the TC module. Benchmark testing also needs to cover PCIe bandwidth to evaluate the performance of data interaction between the chip and the CPU.

[0003] The existing open-source benchmark framework code repository is: https: / / github.com / ProjectPhysX / OpenCL-Benchmark. OpenCL Benchmark provides an open-source benchmark framework that can measure multi-precision computing power, memory bandwidth, and PCIe bandwidth of GPGPU / NPU chips. This tool was developed in 2019 and is relatively outdated; some functions no longer meet current product requirements. This tool can only test CC (Vector Computing Core) computing power, and its testing logic has room for further optimization (FP8 accuracy can only reach 20% of the theoretical value). The CC memory bandwidth testing logic can be further optimized (actual accuracy reaches ~90% of the theoretical value, and 93% after optimization). TC computing power and memory bandwidth cannot be measured. Currently, the PCIe bandwidth test only reaches 10% of the theoretical value.

[0004] In existing patent literature, the testing method mentioned in patent publication number CN116010222 is limited to CPU; the method listed in patent publication number CN112231158A only tests floating-point computing power and is for GPGPU, so it cannot be applied to the NPU of this product.

[0005] In summary, the existing technology has the following drawbacks:

[0006] First, the accuracy of the CC module's computing power and memory bandwidth tests for NPU products is insufficient, and no specific optimizations have been made for the characteristics of NPU hardware.

[0007] Secondly, it is impossible to effectively test the computing power and memory bandwidth of the NPU's TC module, and it cannot be adapted to the NPU's exclusive hardware and packaging design.

[0008] Third, the PCIe bandwidth test results have a large deviation and cannot accurately reflect the real data interaction performance between the CPU and NPU.

[0009] Fourth, the testing tools cannot adapt to the software and hardware simulation platform and the actual product platform. The simulation platform test takes too long and is not practical for engineering applications. Summary of the Invention

[0010] The technical problem to be solved by this invention is to address the above-mentioned shortcomings of the prior art by providing a benchmark testing method and system for NPU processing core computing power, memory, and PCIe bandwidth, in order to solve the following technical problems:

[0011] 1. Existing benchmark testing schemes do not perform dedicated optimization for testing the INT8 computing power and memory bandwidth of the NPU's CC module, resulting in low test accuracy and failure to reflect true hardware performance.

[0012] 2. Existing solutions cannot effectively test the computing power and dedicated memory bandwidth of the NPU's TC module, and cannot be adapted to the NPU's 3D packaging and independent memory controller architecture;

[0013] 3. Existing PCIe bandwidth tests suffer from redundant data copying overhead, resulting in significant discrepancies between test results and actual bandwidth, and failing to accurately reflect the data interaction performance between the CPU and NPU;

[0014] 4. Existing testing tools cannot adapt to pre-silicon simulation platforms and post-silicon actual hardware platforms. Testing in the simulation environment takes too long and is not practical for engineering applications.

[0015] To address the shortcomings of the existing technologies, this invention provides a benchmark testing method and system for NPU processing core computing power, memory, and PCIe bandwidth. The test logic is optimized based on the hardware and packaging characteristics of the NPU, enabling accurate testing of the computing power and memory bandwidth of the CC and TC modules across all dimensions, significantly improving the accuracy of PCIe bandwidth testing, and simultaneously achieving adaptive testing parameters to meet the testing needs of both simulation platforms and actual products.

[0016] The benchmark testing method proposed in this invention, which focuses on the computing power, memory, and PCIe bandwidth of the NPU processing core, includes the following functions and steps:

[0017] Step 1, CC module computing power test optimization: Execute INT8 precision computing power test by using the DP4A operator and combining it with compiler optimization for the target NPU;

[0018] Step 2, CC module memory bandwidth test optimization: By adding an immediate value accumulation operation and configuring compiler anti-optimization instructions in the test program, the time consumed by memory read operation and the time consumed by calculation operation are separated;

[0019] Step 3, TC module computing power test: Based on the NPU, the TC module has hardware characteristics optimized for convolution operations. The convolution operation is used as the test operator. The computing power of the TC module is tested by configuring test parameters that match the hardware specifications.

[0020] Step 4, TC module memory bandwidth test: Construct three sets of test cases with different data paths through the TC module calculation instructions, measure the TC memory read time and TC memory write time respectively, and calculate the TC module memory bandwidth;

[0021] Step 5, PCIe bandwidth test optimization: By creating and mapping paged memory on the host side, redundant data copy operations are removed to achieve accurate testing of PCIe bandwidth between the CPU and NPU;

[0022] Step 6, Test Parameter Adaptation: By reading the NPU hardware specifications and the clock information of the running platform, the test parameters are automatically set according to the preset adaptation rules to adapt to the software and hardware simulation platform and the actual product platform.

[0023] In this invention, the specific steps for optimizing the computing power test of the CC module are as follows:

[0024] Step 11: Place every four INT8 elements from input matrices A and B into two 32-bit INT type data registers in sequence;

[0025] Step 12: The four sets of INT8 type data in the corresponding positions of the two registers are multiplied simultaneously and then immediately accumulated. The result is stored in the buffer register.

[0026] Step 13: Add the accumulated value to the INT32 format matrix C, and store the final result in the INT32 format output matrix D;

[0027] In this case, matrices A and B are in INT8 format, and matrices C and D are in INT32 format. The result of matrix A*B is obtained through a single multiplication-addition operation.

[0028] In this invention, the specific steps for optimizing the memory bandwidth test of the CC module are as follows:

[0029] Step 21: Start timing;

[0030] Step 22: Continuously write data to a memory region on the device side;

[0031] Step 23: Perform the immediate value accumulation operation. The test program is pre-configured with compiler anti-optimization instructions to ensure that the immediate value accumulation operation is not removed by compiler optimization.

[0032] Step 24: Stop the timer and obtain the NPU-optimized write operation time;

[0033] Step 25: Start timing;

[0034] Step 26: Continuously read values ​​from a segment of memory region from the device;

[0035] Step 27: Perform an accumulation operation on the values;

[0036] Step 28: Write back the accumulated value;

[0037] Step 29: Stop the timer and obtain the time taken for NPU read and write operations;

[0038] Step 210: Subtract the results from Step 29 and Step 24 to obtain the NPU optimized read operation time. Calculate the CC module memory read bandwidth based on the test memory size and the optimized read operation time.

[0039] In this invention, the specific steps for testing the computing power of the TC module are as follows:

[0040] Step 31: Start timing;

[0041] Step 32: The CPU host sends instructions from the TC module to the NPU;

[0042] Step 33: Inside the NPU, the CC module parses the TC module instructions, sets the number of output channels according to the input data parameters, and performs computation task scheduling and allocation based on the actual number of CC cores;

[0043] Step 34: The TC module performs convolution calculations according to the task schedule, and the calculation results are stored back to the device-side memory. The width of the output result is set to a multiple of the TC pulse array logic processing cores, and the number of output channels is set to an integer multiple of the number of CC cores.

[0044] Step 35: Stop the timer;

[0045] Step 36: Calculate the number of multiply-accumulate operations performed during the test, divide by the time consumed, and obtain the computing power of the NPU TC module.

[0046] The present invention further measures peak performance by configuring the input data format to all zeros, and measures actual performance by configuring it to random numbers.

[0047] In this invention, the specific steps for testing the memory bandwidth of the TC module are as follows:

[0048] Step 41: Start timing and execute the TC module calculation instructions;

[0049] Step 42: Using global memory as input, data is written from the device-side memory to the NPU TC module cache and TC operation is performed. After the calculation is completed, the result data is written back to the device-side memory.

[0050] Step 43: End the timer and obtain time T1;

[0051] Step 44: Start timing and execute the TC module calculation instructions;

[0052] Step 45: Using global memory as input, data is written from the device-side memory to the NPU TC module cache and TC operation is performed. After the calculation is completed, the result data is written back to the local cache on the NPU side.

[0053] Step 46: End the timer and obtain time T2;

[0054] Step 47: Start timing and execute the TC module calculation instructions;

[0055] Step 48: The NPU performs TC operation using immediate values, and the result data is written back to the device-side memory after the calculation is completed;

[0056] Step 49: End the timer and obtain time T3;

[0057] Step 410: Take the difference between T1 and T2 as the TC memory write time, and take the difference between T1 and T3 as the TC memory read time. Divide the TC data transfer size by the corresponding time to obtain the TC module memory bandwidth value.

[0058] In this invention, the specific steps for optimizing the PCIe bandwidth test are as follows:

[0059] Step 51: Host-side hardware / software initialization;

[0060] Step 52: Create host-side page lock memory;

[0061] Step 53: Map the host-side paged memory so that the device-side NPU can directly access the host-side memory;

[0062] Step 54: The NPU continuously executes memory read and write operations on the host side via the PCIe link, and records the time taken for each round of operations;

[0063] Step 55: Calculate the read / write time for each round based on the measurement time, and divide the amount of data read / written each time by the corresponding time to obtain the corresponding PCIe read / write bandwidth;

[0064] Step 56: Unmap the memory and release the memory.

[0065] The specific implementation of the adaptive test parameters described in this invention is as follows: read the NPU clock, NPU device-side memory / cache size, and NPU core specifications, combine them with the simulation platform clock, and automatically set the test input / output data volume and the number of test rounds according to preset adaptation rules to ensure that reasonable test results are obtained within a reasonable time range in different environments.

[0066] This invention automatically sets the amount of test input / output data and the number of test rounds according to preset adaptation rules, so that the test is completed within 10 minutes and the test results reach more than 80% of the theoretical value.

[0067] Based on the above, the present invention also proposes a benchmark testing system for NPU processing core computing power, memory and PCIe bandwidth, characterized in that the system includes a CC module test optimization unit, a TC module test unit, a PCIe bandwidth test optimization unit and a test parameter adaptive unit.

[0068] The CC module test optimization unit is used to perform CC module computing power test optimization and CC module memory bandwidth test optimization.

[0069] The TC module testing unit is used to perform TC module computing power testing and TC module memory bandwidth testing;

[0070] The PCIe bandwidth test optimization unit is used to perform PCIe bandwidth test optimization;

[0071] The test parameter adaptive unit is used to read hardware and platform information, automatically match and set test parameters, and adapt to the software and hardware simulation platform and the actual product platform.

[0072] The beneficial effects of this invention compared to the prior art include:

[0073] 1. Before optimization, the CC module's computing power only reached about 20% of the theoretical value; after optimization using specified operators and compilers, the performance reached about 90% of the theoretical value.

[0074] 2. Before optimization, the CC module's memory bandwidth reached approximately 90% of the theoretical value; after optimization, the performance reached 93% of the theoretical value.

[0075] 3. TC module computing power test: Using a self-developed testing program, the performance reached 90% of the theoretical value, and the peak performance reached 99% of the theoretical value.

[0076] 4. TC module memory bandwidth test; using a self-developed testing program, the performance reached approximately 90% of the theoretical value.

[0077] 5. Before optimization, the PCIe bandwidth test reached approximately 10% of the theoretical value; using the optimized test program, the performance on the NVIDIA A100 platform reached approximately 87% of the theoretical value, and the performance on the simulation platform reached approximately 80% of the theoretical value (limited by simulation hardware resources and the target NPU model generated by the simulation). Attached Figure Description

[0078] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0079] Figure 1 This is a schematic diagram illustrating the principle of the DP4A instruction of the present invention when performing INT8 multiplication and addition operations;

[0080] Figure 2 This is a schematic diagram illustrating the principle of non-DP4A instructions in this invention when performing INT8 multiplication and addition operations;

[0081] Figure 3 This is a schematic diagram illustrating the principle of the unoptimized and optimized memory read bandwidth test of the CC module of this invention;

[0082] Figure 4 This is a schematic diagram illustrating the principle of the computing matrix in a traditional GPGPU computing core.

[0083] Figure 5 This is a schematic diagram illustrating the principle of the TC calculation matrix of this invention;

[0084] Figure 6 This is a schematic diagram of the architecture of the hardware computing core CC / TC of this invention;

[0085] Figure 7 This is a schematic diagram comparing the packaging methods of the NPU of this invention with those of traditional GPGPUs;

[0086] Figure 8 This is a schematic diagram of the data path of a traditional GPGPU;

[0087] Figure 9 This is a schematic diagram of the data path of the NPU of the present invention;

[0088] Figure 10 This is a schematic diagram of the data path for different commands in the TC of this invention;

[0089] Figure 11This is a schematic diagram of the process for testing PCIe bandwidth using the unoptimized program of this invention;

[0090] Figure 12 This is a schematic diagram of the optimized program for testing PCIe bandwidth according to the present invention.

[0091] Figure 13 This is a schematic diagram of the unoptimized and optimized data paths in the PCIe bandwidth test of this invention;

[0092] Figure 14 This is a schematic diagram of the input and output of the convolution operator and the dimensions of the convolution kernel in this invention;

[0093] Figure 15 This is a schematic diagram illustrating the hardware execution process of the convolution operator of the present invention;

[0094] Figure 16 This is a flowchart of the software API processing of the TC calculation instructions of the present invention. Detailed Implementation

[0095] The invention will be further described in detail below with reference to the specific embodiments and accompanying drawings. Except for the contents specifically mentioned below, the processes, conditions, and experimental methods for implementing the invention are all common knowledge and general knowledge in the art, and the invention does not have any particular limitations.

[0096] NPU is a dedicated hardware for accelerating parallel computing in machine learning within the field of artificial intelligence. Compared to traditional GPUs (Graphics Processing Units), it emphasizes parallel computing capabilities. Compared to GPGPUs (General Purpose GPUs), its hardware and software are customized and optimized for neural network computation, achieving relatively high performance with relatively low power consumption. The Tensor Core (TC) is a customized hardware circuit, requiring specially designed benchmark programs to accurately test its computing power (computing strength) to assess whether it meets theoretical values ​​and evaluate hardware stability. The Compute Core (CC) is a general-purpose parallel computing unit; mature computing power testing solutions already exist, and this invention optimizes and improves upon them. Regarding memory bandwidth testing, because it uses HBM-like storage (BBCUBE solution), directly encapsulating the customized storage chip within the computing core, unlike traditional GPGPUs where HBM and GC (computing cores) are encapsulated separately in the Silicon Interposer, traditional memory bandwidth testing methods in current products can only test the memory attached to the CC module, not the memory of the TC module. This invention designs a testing process to implement TC memory bandwidth testing. Benchmark tests also need to cover PCIe bandwidth to evaluate the performance of data interaction between the chip and the CPU. Existing tools have extremely low test accuracy during the test process, only 23% of the theoretical value; after optimization by this invention, the measured value can reach 80%.

[0097] The benchmark testing method and system of this invention comprises six core technical solutions: CC module computing power test optimization, CC module memory bandwidth test optimization, TC module computing power test, TC module memory bandwidth test, PCIe bandwidth test optimization, and test parameter adaptive testing. The specific technical solutions for each part are as follows:

[0098] 1. CC module computing power test optimization

[0099] The OpenCL Benchmark open-source tool's INT8 precision test has compiler and operator optimizations for AMD / NVIDIA / INTEL products, but the target NPU is not specifically optimized, only achieving 20% ​​of the theoretical value. It does not use DP4A (Dot Product4 Accumulate). The INT8 precision test pads the data to INT32 format in the logic unit because the NPU's ALU (Arithmetic Logic Unit) registers are 32-bit for INT types. This is a fixed hardware design, resulting in wasted register storage space and requiring four multiply-accumulate operations to obtain the specified result.

[0100] Using the DP4A operator and combining it with compiler optimizations for the target NPU, one INT value register will be filled with four INT8 values. Within a single register, a single multiply-accumulate operation can yield the calculation result of matrix A*B, improving test accuracy. Combined with... Figure 1 Understanding: Given input matrices A and B, perform matrix multiplication, add the result to matrix C, and obtain the final result matrix D. Matrices A and B are in INT8 format, while matrices C and D are in INT32 format. The specific steps are as follows:

[0101] Step 1: Place every four INT8 elements from input matrices A and B into two 32-bit INT type data registers in sequence;

[0102] Step 2: The four sets of INT8 type data in the corresponding positions of the two registers are multiplied simultaneously and then immediately accumulated. The result is stored in the buffer register.

[0103] Step 3: Add the accumulated value to the INT32 format matrix C, and store the final result in the INT32 format output matrix D.

[0104] 2. CC module memory bandwidth test optimization

[0105] The OpenCL Benchmark open-source tool for testing memory bandwidth has errors in its read test. This invention addresses this issue by optimizing the test logic. The original method for testing read operation memory bandwidth involved two steps:

[0106] The first step involves continuously writing data to a memory region on the device side and measuring the time taken for this step.

[0107] The second step of the test involves continuously reading values ​​from a segment of memory on the device, accumulating these values, and then writing them back. The time taken for this second step is measured. The final bandwidth is calculated by dividing the memory size by the time difference between the first and second steps. The error lies in the fact that the difference between the first and second steps represents the total time spent by the NPU in calculating and reading from the device-side memory, rather than the time spent reading from the device-side memory alone.

[0108] This invention adds an immediate value accumulation operation to the optimized write program, and uses compiler anti-optimization instructions to ensure that the accumulation operation will always run in the code and will not be optimized away during compilation. This makes the time difference measured by the read / write program more accurately reflect the actual hardware memory consumption on the device side, where the immediate value calculation process does not perform any read operations on the device side memory. Figure 3 To understand, the specific steps are as follows:

[0109] Step 1: Start timing;

[0110] Step 2: Continuously write data to a segment of memory on the device side;

[0111] Step 3: Perform the immediate value accumulation operation. The test program is pre-configured with compiler anti-optimization instructions to ensure that the immediate value accumulation operation is not removed by compiler optimization.

[0112] Step 4: Stop the timer and obtain the NPU-optimized write operation time;

[0113] Step 5: Start timing;

[0114] Step 6: Continuously read values ​​from a segment of memory region from the device;

[0115] Step 7: Accumulate the values;

[0116] Step 8: Write back the accumulated value;

[0117] Step 9: Stop the timer and obtain the time taken for NPU read and write operations;

[0118] Step 10: Subtract the result from Step 9 from the result from Step 4 to obtain the NPU optimized read operation time. Calculate the CC module memory read bandwidth based on the test memory size and the optimized read operation time.

[0119] 3. TC Module Computing Power Test

[0120] This invention uses a self-developed operator design test program to select the optimal computational operations and parameters to accurately test the actual computing power of the TC core. Other GPGPU hardware cores are designed based on matrix operations and use GEMM (General Matrix Multiplication) to test their computing power. The TC core of the target NPU is optimized for convolution operations in neural networks, and using convolution testing can improve the accuracy of TC computing power testing. Specifically, other tools use GEMM to test CC computing power, but when matrix multiplication and addition operations are directly applied to the TC core of the target NPU, the hardware will convert it into convolution before the operation (hardware TC characteristics, cannot directly execute GEMM), increasing the test time; directly using convolution operations as the test operator can improve test efficiency and accuracy.

[0121] The selection of test parameters also helps improve test accuracy. TC calculations differ significantly from CC calculations: CC allows for finer granularity control, while TC cannot achieve the same level of granularity. Therefore, the CC core can "warm up" the hardware using loops, reducing the impact of hardware and software initialization time on the test. The TC test program cannot use the same logic as the CC hardware; it needs to achieve the same warm-up effect through parameter configuration. In the TC test function, the width and number of channels of the output result dimension are configured to fully utilize the hardware computing power: the number of output channels should be a multiple of the CC core count, referencing... Figure 6 The target NPU architecture diagram shows that the hardware splits computational tasks based on the number of CC cores. Using integer multiples of the number of CC cores effectively balances the load. The output width is related to the TC systolic array; for INT8 precision, it is set to a multiple of the TC systolic array's logic processing cores, and for INT16 / FP16 precision, it is set to an integer multiple of the systolic array's dimension (half that of INT8), ensuring sufficient load balancing for the TC cores. Furthermore, configuring the input data format to all zeros allows for measuring peak performance (performance ceiling), while configuring it to random numbers allows for measuring actual performance. Combined with... Figure 5 , Figure 6 The specific steps to understand the TC computing power test process are as follows:

[0122] Step 1: Start timing;

[0123] Step 2: The CPU (host) sends instructions from the TC module to the NPU core;

[0124] Step 3: Inside the NPU, the CC module parses the TC module instructions, refers to the number of output channels set in the input data parameters, and performs computation task scheduling and allocation according to the actual number of CC cores;

[0125] Step 4: The TC module performs convolution calculations according to the task schedule, and the calculation results are stored back to the device-side memory. The output result width is set to a multiple of the TC pulse array logic processing cores, and the number of output channels is set to an integer multiple of the number of CC cores, so as to make full use of hardware performance.

[0126] Step 5: Stop the timer;

[0127] Step 6: Calculate the number of multiply-accumulate operations performed during the test, divide by the time consumed, and obtain the computing power of the NPU TC module.

[0128] The specific structure of the convolution operator of this invention is as follows: Figure 14 As shown, the operator requires two inputs: an input matrix and a convolution kernel. The input matrix A has dimensions of h_in (height), w_in (width), and c_in (number of channels). The convolution kernel has dimensions of k_x, k_y, k_z, and c_out (number of output channels), where k_x and k_y are fixed at 3x3 in the test program; k_z is set to c_in (hardware requirement). The operator's output is an output matrix with dimensions of h_out (height), w_out (width), and c_out (number of channels).

[0129] In the configuration rules parameters for the input and output data dimensions, since the convolution kernel is fixed at 3x3, the corresponding w_in,h_in and w_out,h_out are the same. In the test program, only w_out,h_out,c_in, and c_out need to be configured. w_out,h_out, and c_in are the sizes of the input matrices, which need to be configured reasonably according to the hardware specifications of the test platform.

[0130] The ratio of output channel count to CC core count: Figure 15 Further describing the hardware's handling of input data, the CC module's scheduler splits the input matrix A into tiles of equal size, combines them with kpc*#core (number of NPU cores) convolutional kernels, schedules them, and distributes them to different task processors (TCs) for computation. Finally, the computation results of each tile are combined and returned as the output. This process is automatically executed by the hardware; the tile size cannot be defined by software. The scheduler allocates data to kpc*#core (number of NPU cores) cores each time, so configuring c_out to an integer multiple of kpc*#core ensures all cores are active, preventing inaccurate test results due to idle cores in non-integer multiples. kpc is the computational core scheduling parameter, representing the number of tasks launched per clock cycle; its value must be determined based on the specific hardware design.

[0131] Test parameter adaptation rules for INT16 / FP16 precision: During hardware convolution calculations, the TC core uses a systolic array for computation, and the results are temporarily stored in a fixed-size hardware accumulator and cache. Therefore, appropriate parameters help to fully utilize hardware resources. The INT16 / FP16 data format is twice the size of the INT8 data format. Therefore, when configuring the w_out parameter, attention must be paid to setting the dimension. With the total data volume remaining constant, the dimension w_out in INT16 / FP16 should be half that of INT8. Simultaneously, w_out should be an integer multiple of the systolic array dimension. The target NPU's systolic array is 32x32, therefore w_out should be set to a multiple of 32 to fully utilize computing resources.

[0132] 4. TC module memory bandwidth test

[0133] The target NPU is designed differently from traditional GPGPUs; its memory and computing core packaging methods are as follows: Figure 7 As shown, the data path of a traditional GPGPU is as follows: Figure 8 As shown, it copies data from the compute core to device-side memory (HBM) via the CC core. Since CC and TC are within the same compute core, memory access is handled by the GPU's unified memory controller. Therefore, the memory bandwidth of the GPGPU product can be tested simply by using the CC module to move data. The target NPU uses BBCUBE memory for storage, and its packaging method differs from traditional GPGPUs, such as... Figure 7 As shown. Reference Figure 9 The packaging details and NPU memory access data path diagram shown indicate that CC and TC each have independent memory controllers and access their own memory spaces, unlike traditional GPGPUs which access all device-side memory spaces through the CC module. Furthermore, as mentioned in the CC / TC computing power test section, the test programs for the two modules are different, and TC requires a separate implementation; for example... Figure 10 As shown, the competitor's Tensor Core design has an async-copy function, which can be used alone to move memory data belonging to TC. Since the target NPU hardware design does not reserve this function, the entire TC command directly copies the data from the device-side memory to the TC core; therefore, a similar async-copy function needs to be implemented in software.

[0134] On the software side, this invention utilizes TC calculation commands to construct three sets of test cases with differentiated data paths: the first set uses global memory as input for calculation and returns the result to global memory; the second set uses global memory as input for calculation and returns the result to the NPU local cache; the third set uses immediate values ​​as input for calculation and returns the result to global memory. This method ensures consistency of the data path in the output stage. In the input stage, one set uses immediate values ​​as input, while the other retrieves data from global memory (device-side memory). Measuring the time difference between the two sets of operations represents the data transfer time from device-side memory to the computing core (similar to an async-copy operation). The computing module reuses the convolution operator from the TC module's computing power test implementation. The specific steps are as follows:

[0135] Step 1: Start timing and execute the TC module calculation instructions;

[0136] The specific format of the TC calculation command is as follows: Figure 16 As shown, its hardware working principle has been explained. Figure 14 , Figure 15 Note: When using TC commands, the required parameters need to be set according to the steps; after creating the operator, the host sends a command to the device to trigger the calculation signal, and then the NPU performs the calculation.

[0137] Step 2: Using global memory as input, data is written from the device-side memory to the NPU TC module cache and TC operation is performed. After the calculation is completed, the result data is written back to the device-side memory. The entire operation is designed to be inseparable from the hardware.

[0138] Step 3: End the timer and obtain time T1;

[0139] Step 4: Start timing and execute the TC module calculation instructions;

[0140] Step 5: Using global memory as input, data is written from the device-side memory to the NPU TC module cache and TC operation is performed. After the calculation is completed, the result data is written back to the local cache on the NPU side. The entire operation is designed to be inseparable from the hardware.

[0141] Step 6: End the timer and obtain time T2;

[0142] Step 7: Start timing and execute the TC module calculation instructions;

[0143] Step 8: The NPU uses immediate values ​​to perform TC calculation. After the calculation is completed, the result data is written back to the device-side memory (equivalent to TC memory write operation). The entire operation is not split into separate hardware components.

[0144] Step 9: End the timer and obtain time T3;

[0145] Step 10: Take the difference between T1 and T2 as the TC memory write time, and take the difference between T1 and T3 as the TC memory read time. Divide the TC data transfer size by the corresponding time to obtain the TC module memory bandwidth value.

[0146] 5. PCIe bandwidth test optimization

[0147] The open-source tool method uses bidirectional data copying between the CPU and NPU, with a fixed total amount of test data. After collecting the test data over time, the PCIe bandwidth is calculated. Due to the program's high versatility, the actual measured PCIe bandwidth is only about 20% of the theoretical value. The principle is as follows: Figure 11 As shown, open-source tools copy data multiple times during testing, resulting in redundant overhead in the testing time and causing the test results to deviate from the expected values. Figure 12 This is a flowchart of a program optimized based on OpenCL. By using paged memory and memory mapping, as well as reasonable parameter configuration, all time overhead that may cause data copying has been removed. Figure 13 This is a diagram illustrating the data access path before and after program optimization. After optimization, the NPU and CPU directly transmit data via the PCIe data link, avoiding unnecessary data copying operations. The specific steps are as follows:

[0148] Step 1: Host-side hardware / software initialization;

[0149] Step 2: Create pinned memory on the host side.

[0150] Step 3: Map the host-side paged memory, allowing the device-side (NPU) to directly access the host-side memory;

[0151] Step 4: Repeatedly execute memory read and write operations on the host side via the PCIe link, and record the time taken for each round of operations;

[0152] Step 5: Calculate the read / write time for each round based on the measurement time. Divide the amount of data read / written each time by the corresponding time to get the corresponding PCIe read / write bandwidth.

[0153] Step 6: Unmap the memory and release the memory.

[0154] Page-locked memory creation parameters: Use OpenCL standard macros to allocate memory in a host-accessible memory region, usually page-locked (pinned) memory (requires NPU underlying driver support), and enable memory read / write macros to ensure that the region is readable and writable; after creation, it needs to be mapped as read-only / write-only memory, and the physical address on the device side is returned after mapping.

[0155] Standard configuration for the number of rounds of iterative testing: Simulation platform testing typically involves 10 rounds; actual product (NVIDIA A100) typically involves 100 rounds. Two warm-up rounds are conducted before the formal testing and are not included in the final results. The final results return the best, worst, average, and median values, which are provided to system-level testers for product acceptance.

[0156] 6. Test parameters are adaptive

[0157] This invention reads the NPU clock, NPU device-side memory / cache size, and NPU core specifications, and combines them with the simulation platform clock. Based on preset adaptation rules, it automatically sets the amount of test input / output data and the number of test rounds to ensure a reasonable test result is obtained within a reasonable time range in different environments.

[0158]

[0159]

[0160]

[0161]

[0162] The threshold standard for reasonable time consumption in this invention is: obtaining a relatively reasonable result within 10 minutes, and the test result reaching more than 80% of the theoretical value.

[0163] This invention also provides a benchmark testing system for NPU processing core computing power, memory, and PCIe bandwidth, including a CC module test optimization unit, a TC module test unit, a PCIe bandwidth test optimization unit, and a test parameter adaptive unit.

[0164] The CC module test optimization unit is used to perform CC module computing power test optimization and CC module memory bandwidth test optimization: it uses the DP4A operator and combines it with compiler optimization for the target NPU to perform INT8 precision computing power test; it adds an immediate value accumulation operation and configures compiler anti-optimization instructions in the test program to separate the memory read operation time from the calculation operation time.

[0165] The TC module testing unit is used to perform TC module computing power testing and TC module memory bandwidth testing: based on the hardware characteristics of the TC core optimized for convolution operations, convolution operations are used as the test operator, and TC computing power testing is performed by configuring test parameters that match the hardware specifications; three sets of test cases with different data paths are constructed through TC calculation instructions, and the TC memory read time and TC memory write time are measured respectively, and the TC memory bandwidth is calculated.

[0166] The PCIe bandwidth test optimization unit performs PCIe bandwidth tests between the CPU and NPU by creating and mapping paged memory on the host side and removing redundant data copy operations.

[0167] The test parameter adaptive unit reads the NPU hardware specifications and the operating platform clock information, and automatically sets the test parameters according to the preset adaptation rules to adapt to the software and hardware simulation platform and the actual product platform.

[0168] Example

[0169] This invention discloses a benchmark testing method and system for the computing power, memory, and PCIe bandwidth of an NPU processing core, belonging to the field of AI chip performance testing technology. This invention optimizes the computing power and memory bandwidth testing logic for the NPU's General Parallel Computing Unit (CC), and develops a computing power and memory bandwidth testing process adapted to the hardware packaging design for the Tensor Processing Unit (TC). It also optimizes the PCIe bandwidth testing logic and implements hardware and software adaptive functionality for test parameters. This invention improves the testing accuracy of computing power, memory bandwidth, and PCIe bandwidth for various NPU modules, comprehensively covering the full-process performance and stability testing needs of NPU chips from pre-silicon simulation to post-silicon applications.

[0170] Throughout the entire design process of a chip product, designers can utilize this invention to test the chip's baseline performance on a pre-silicon simulation platform to evaluate whether the hardware design meets design expectations. It can also be used for stability testing to verify potential stability issues in the simulation platform / hardware design. During the product delivery and power-on phase, development / testing personnel can use this tool to quickly test chip performance and then perform stability testing, providing chip acceptance performance standards. It can also be provided to packaging and testing personnel for screening large numbers of chips and evaluating chip quality. In the post-silicon stage, this tool can be provided to customers / application developers to assess product operating status, analyze performance bottlenecks, and debug various application software. This invention automatically adapts to the simulation / production environment, appropriately adjusts parameters, and accurately collects performance information within a reasonable timeframe.

[0171] Compared to open-source tools, this invention provides more accurate test results, avoids errors caused by tool defects that prevent accurate evaluation of hardware performance, and adds support for specific data format computing power / memory bandwidth of the target NPU TC.

[0172] This invention was verified and tested on a hardware and software simulation platform and the NVIDIA A100 platform. The test data after executing the tool is as follows:

[0173] Table 1: Comparison of INT8 computing power test results for CC modules

[0174]

[0175] Table 2: Comparison of CC module memory bandwidth test results

[0176]

[0177] Table 3: Comparison of TC computing power tests

[0178]

[0179] Table 4: Comparison of TC memory bandwidth tests

[0180]

[0181] Table 5: Comparison of PCIe bandwidth tests

[0182]

[0183] Table 6: Comparison of Parameter Adaptive Function Tests

[0184]

[0185] Unless otherwise defined, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.

[0186] As used in this invention, the term "comprising" is an open-ended expression, meaning it includes the contents specified in this invention but does not exclude other aspects.

[0187] As used in this invention, the term "and / or" includes any one or more of the related listed items and all combinations thereof.

[0188] The scope of protection of this invention is not limited to the above embodiments. All variations and advantages that can be conceived by those skilled in the art within the technical scope disclosed in this invention are included in this invention and are protected by the appended claims.

Claims

1. A benchmark testing method for NPU processing core computing power, memory, and PCIe bandwidth, characterized in that, Includes the following functions and steps: Step 1, CC module computing power test optimization: Execute INT8 precision computing power test by using the DP4A operator and combining it with compiler optimization for the target NPU; Step 2, CC module memory bandwidth test optimization: By adding an immediate value accumulation operation and configuring compiler anti-optimization instructions in the test program, the time consumed by memory read operation and the time consumed by calculation operation are separated; Step 3, TC module computing power test: Based on the NPU, the TC module has hardware characteristics optimized for convolution operations. The convolution operation is used as the test operator. The computing power of the TC module is tested by configuring test parameters that match the hardware specifications. Step 4, TC module memory bandwidth test: Construct three sets of test cases with different data paths through the TC module calculation instructions, measure the TC memory read time and TC memory write time respectively, and calculate the TC module memory bandwidth; Step 5, PCIe bandwidth test optimization: By creating and mapping paged memory on the host side, redundant data copy operations are removed, enabling accurate testing of PCIe bandwidth between the CPU and NPU; Step 6, Test Parameter Adaptation: By reading the NPU hardware specifications and the clock information of the running platform, the test parameters are automatically set according to the preset adaptation rules to adapt to the software and hardware simulation platform and the actual product platform.

2. The benchmark testing method for NPU processing core computing power, memory, and PCIe bandwidth according to claim 1, characterized in that, The specific steps for optimizing the computing power test of the CC module are as follows: Step 11: Place every four INT8 elements from input matrices A and B into two 32-bit INT type data registers in sequence; Step 12: The four sets of INT8 type data in the corresponding positions of the two registers are multiplied simultaneously and then immediately accumulated. The result is stored in the buffer register. Step 13: Add the accumulated value to the INT32 format matrix C, and store the final result in the INT32 format output matrix D; In this case, matrices A and B are in INT8 format, and matrices C and D are in INT32 format. The result of matrix A*B is obtained through a single multiplication-addition operation.

3. The benchmark testing method for NPU processing core computing power, memory, and PCIe bandwidth according to claim 1, characterized in that, The specific steps for optimizing the memory bandwidth test of the CC module are as follows: Step 21: Start timing; Step 22: Continuously write data to a memory region on the device side; Step 23: Perform the immediate value accumulation operation. The test program is pre-configured with compiler anti-optimization instructions to ensure that the immediate value accumulation operation is not removed by compiler optimization. Step 24: Stop the timer and obtain the NPU-optimized write operation time; Step 25: Start timing; Step 26: Read values ​​continuously from a memory region; Step 27: Perform an accumulation operation on the values; Step 28: Write back the accumulated value; Step 29: Stop the timer and obtain the time taken for NPU read and write operations; Step 210: Subtract the results from Step 29 and Step 24 to obtain the NPU optimized read operation time. Calculate the CC module memory read bandwidth based on the test memory size and the optimized read operation time.

4. The benchmark testing method for NPU processing core computing power, memory, and PCIe bandwidth according to claim 1, characterized in that, The specific steps for the TC module computing power test are as follows: Step 31: Start timing; Step 32: The CPU host sends TC module instructions to the NPU core; Step 33: Inside the NPU, the CC module parses the TC module instructions, sets the number of output channels according to the input data parameters, and schedules and allocates computing tasks based on the actual number of CC cores; Step 34: The TC module performs convolution calculations according to the task schedule, and the calculation results are stored back to the device-side memory. The width of the output result is set to a multiple of the TC pulse array logic processing cores, and the number of output channels is set to an integer multiple of the number of CC cores. Step 35: Stop the timer; Step 36: Calculate the number of multiply-accumulate operations performed during the test, divide by the time consumed, and obtain the computing power of the NPU TC module.

5. The benchmark testing method for NPU processing core computing power, memory, and PCIe bandwidth according to claim 4, characterized in that, Furthermore, peak performance can be measured by configuring the input data format to all zeros, and actual performance can be measured by configuring it to random numbers.

6. The benchmark testing method for NPU processing core computing power, memory, and PCIe bandwidth according to claim 1, characterized in that, The specific steps for the TC module memory bandwidth test are as follows: Step 41: Start timing and execute the TC module calculation instructions; Step 42: Using global memory as input, data is written from the device-side memory to the NPU TC module cache and TC operation is performed. After the calculation is completed, the result data is written back to the device-side memory. Step 43: End the timer and obtain time T1; Step 44: Start timing and execute the TC module calculation instructions; Step 45: Using global memory as input, data is written from the device-side memory to the NPU TC module cache and TC operation is performed. After the calculation is completed, the result data is written back to the local cache on the NPU side. Step 46: End the timer and obtain time T2; Step 47: Start timing and execute the TC module calculation instructions; Step 48: The NPU performs TC operation using immediate values, and the result data is written back to the device-side memory after the calculation is completed; Step 49: End the timer and obtain time T3; Step 410: Take the difference between T1 and T2 as the TC memory write time, and take the difference between T1 and T3 as the TC memory read time. Divide the TC data transfer size by the corresponding time to obtain the TC module memory bandwidth value.

7. The benchmark testing method for NPU processing core computing power, memory, and PCIe bandwidth according to claim 1, characterized in that, The specific steps for optimizing the PCIe bandwidth test are as follows: Step 51: Host-side hardware / software initialization; Step 52: Create host-side page lock memory; Step 53: Map the host-side paged memory so that the device-side NPU can directly access the host-side memory; Step 54: The NPU continuously executes memory read and write operations on the host side via the PCIe link, and records the time taken for each round of operations; Step 55: Calculate the read / write time for each round based on the measurement time, and divide the amount of data read / written each time by the corresponding time to obtain the corresponding PCIe read / write bandwidth; Step 56: Unmap the memory and release the memory.

8. The benchmark testing method for NPU processing core computing power, memory, and PCIe bandwidth according to claim 1, characterized in that, The specific implementation of the adaptive test parameters is as follows: read the NPU clock, NPU device-side memory / cache size, and NPU core specifications, and combine them with the simulation platform clock to automatically set the test input / output data volume and the number of test rounds according to preset adaptation rules, so as to ensure that reasonable test results are obtained within a reasonable time range in different environments.

9. The benchmark testing method for NPU processing core computing power, memory, and PCIe bandwidth according to claim 8, characterized in that, The test input / output data volume and number of test rounds are automatically set according to preset adaptation rules, so that the test is completed within 10 minutes and the test results reach more than 80% of the theoretical value.

10. A benchmark testing system for NPU processing core computing power, memory, and PCIe bandwidth, characterized in that, The system is used to perform the benchmark testing method according to any one of claims 1-9, and the system includes a CC module test optimization unit, a TC module test unit, a PCIe bandwidth test optimization unit, and a test parameter adaptive unit; The CC module test optimization unit is used to perform CC module computing power test optimization and CC module memory bandwidth test optimization. The TC module testing unit is used to perform TC module computing power testing and TC module memory bandwidth testing; The PCIe bandwidth test optimization unit is used to perform PCIe bandwidth test optimization; The test parameter adaptive unit is used to read hardware and platform information, automatically match and set test parameters, and adapt to the software and hardware simulation platform and the actual product platform.

Citation Information

Patent Citations

  • Method and device for testing floating point operation performance of multi-card GPGPU cluster

    CN112231158A