A performance analysis and tuning system based on memory access intensive programs

By obtaining the actual bandwidth and memory access parameters of the GPU, and combining them with the thread startup rate to determine the ideal bandwidth, and adjusting the number and time of thread blocks under specific conditions, the problem of unclear optimization direction in existing technologies is solved, and the accuracy and efficiency of performance analysis and optimization are improved.

CN121681308BActive Publication Date: 2026-05-29METAX INTEGRATED CIRCUITS (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610172560.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-02-06
Publication Date
2026-05-29
Estimated Expiration
2046-02-06

AI Technical Summary

Technical Problem

Existing performance evaluation methods cannot accurately determine whether tuning is needed and the direction of tuning, resulting in low accuracy and efficiency in performance analysis and tuning.

Method used

By obtaining the actual bandwidth, memory access parameters, and thread startup rate of the GPU running memory-intensive programs, the ideal bandwidth is determined. Under specific constraints, the number and timing of thread blocks are adjusted, with the optimization goal of maximizing the reference value as much as possible, thus completing the performance tuning.

Benefits of technology

It improves the accuracy of performance analysis and the efficiency of tuning, provides clear tuning directions and goals, and ensures that the tuning process is constrained by limitations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121681308B_ABST
    Figure CN121681308B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of GPU performance analysis, in particular to a performance analysis and optimization system based on a memory access intensive program, which comprises a GPU, a test case corresponding to a program to be analyzed, a processor and a memory storing a computer program; when the computer program is executed by the processor, the following steps are implemented: according to memory access parameters corresponding to the test case and a thread start rate corresponding to the GPU, determining an ideal bandwidth of the GPU when the test case is run; comparing the ideal bandwidth with an actual bandwidth of the GPU when the test case is run; determining whether optimization is needed; after it is determined that optimization is needed, judging whether parameter optimization is needed according to a first limitation condition; and providing an optimization target and a limitation condition of the optimization, thereby providing an optimization direction for performance optimization, so that the accuracy and efficiency of performance analysis and optimization are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of GPU performance analysis, and particularly to a performance analysis and optimization system based on memory-intensive programs. Background Art

[0002] Benchmark is a process of measuring the performance of hardware or software through a series of tests and evaluations. Memory-intensive programs can be used as a benchmark test set for analyzing the memory access performance of GPUs. Common memory-intensive programs can access an extended address space in GPU memory without limitation.

[0003] When using memory-intensive programs for performance evaluation, bandwidth is usually used as an evaluation index. However, in existing performance evaluation methods, after obtaining the actual bandwidth during performance evaluation, the theoretical maximum bandwidth cannot be known, so it is impossible to determine whether optimization is needed by comparing the theoretical bandwidth with the actual bandwidth. Only the experience of the debugger can be used to judge whether optimization is needed. Moreover, after determining that optimization is needed, the optimization direction cannot be effectively determined, resulting in low accuracy and efficiency of performance analysis and optimization. Therefore, how to improve the accuracy and efficiency of performance analysis and optimization has become an urgent problem to be solved. Summary of the Invention

[0004] In view of the above technical problems, the technical solution adopted by the present invention is as follows:

[0005] A performance analysis and optimization system based on memory-intensive programs, the system includes: a GPU, a test case A corresponding to the program to be analyzed, a processor, and a memory storing a computer program. When the computer program is executed by the processor, the following steps are implemented: <�

[0006] S101, use the GPU to run A, and obtain the actual bandwidth B of the GPU when running A.

[0007] S102, obtain the memory access parameter C corresponding to A and the thread launch rate D corresponding to the GPU.

[0008] S103, determine the ideal bandwidth E of the GPU when running A according to C and D. [[ID=३०]]

[0009] S104, when B < E, obtain the number of thread blocks n1 in the first state and the time t1 corresponding to the first state, the number of thread blocks n2 in the second state and the time t2 corresponding to the second state, and the number of thread blocks n3 in the third state and the time t3 corresponding to the first state when A is running.

[0010] S105, analyze whether n1, t1, n2, t2, n3, and t3 satisfy the first constraint condition, where the first constraint condition is:

[0011] n1 / t1 = n2 / t2 = n3 / t3.

[0012] S106, if n1, t1, n2, t2, n3, and t3 satisfy the first constraint condition, then let k = n1 / t1 = n2 / t2 = n3 / t3, where k is a reference value.

[0013] S107, under the condition of satisfying the first constraint condition, adjust n1, t1, n2, t2, n3, and t3 to make k as large as possible, and complete the optimization when k converges.

[0014] Compared with the prior art, the present invention has obvious beneficial effects. Through the above technical solutions, a performance analysis and optimization system based on memory access intensive programs provided by the present invention can achieve considerable technical progressiveness and practicality, and has wide industrial utilization value. It has at least the following beneficial effects:

[0015] The present invention provides a performance analysis and optimization system based on memory access intensive programs. The system includes: a GPU, a test case A corresponding to the program to be analyzed, a processor, and a memory storing a computer program. When the computer program is executed by the processor, the following steps are implemented: run A using the GPU, obtain the actual bandwidth B of the GPU when running A, obtain the memory access parameter C corresponding to A and the thread startup rate D corresponding to the GPU, determine the ideal bandwidth E of the GPU when running A according to C and D. When B < E, obtain the number of thread blocks n1 in the first state and the corresponding time t1, the number of thread blocks n2 in the second state and the corresponding time t2, the number of thread blocks n3 in the third state and the corresponding time t3 when A is running, analyze whether n1, t1, n2, t2, n3, and t3 satisfy the first constraint condition, where the first constraint condition is: n1 / t1 = n2 / t2 = n3 / t3. If n1, t1, n2, t2, n3, and t3 satisfy the first constraint condition, then let k = n1 / t1 = n2 / t2 = n3 / t3, where k is a reference value. Under the condition of satisfying the first constraint condition, adjust n1, t1, n2, t2, n3, and t3 to make k as large as possible, and complete the optimization when k converges.

[0016] It can be seen that by determining the ideal bandwidth of the GPU when running the test cases based on the memory access parameters corresponding to the test cases and the thread startup rate corresponding to the GPU, the actual bandwidth of the GPU when running the test cases can be compared during performance evaluation, thereby accurately determining whether optimization is needed, improving the accuracy of performance analysis. Parameter optimization is performed when the first constraint condition is met, with the reference value being as large as possible as the optimization target. The optimization process is also constrained by the first constraint condition, providing optimization targets and constraints for performance optimization, that is, providing optimization direction for performance optimization, thereby improving the accuracy and efficiency of performance analysis and optimization. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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.

[0018] Figure 1 This is a flowchart illustrating the process of a computer program being executed by a processor in a performance analysis and tuning system based on memory-intensive programs, as provided in an embodiment of the present invention. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] This embodiment provides a performance analysis and optimization system for memory-intensive programs. The system includes: a GPU, test case A corresponding to the program to be analyzed, a processor, and a memory storing the computer program. See [link to documentation]. Figure 1 This is a flowchart illustrating the execution of a computer program by a processor in a performance analysis and tuning system based on memory-intensive programs, as provided in an embodiment of the present invention. When the computer program is executed by the processor, the following steps are implemented:

[0021] S101, Use the GPU to run A, and obtain the actual bandwidth B of the GPU when running A;

[0022] S102, obtain the memory access parameter C corresponding to A and the thread startup rate D corresponding to the GPU;

[0023] S103, Based on C and D, determine the ideal bandwidth E of the GPU when running A;

[0024] S104. When B < E, obtain the number of thread blocks n1 in the first state during the operation of A, the time t1 corresponding to the first state, the number of thread blocks n2 in the second state, the time t2 corresponding to the second state, the number of thread blocks n3 in the third state, and the time t3 corresponding to the first state.

[0025] S105. Analyze whether n1, t1, n2, t2, n3, and t3 satisfy the first constraint condition, where the first constraint condition is:

[0026] n1 / t1 = n2 / t2 = n3 / t3;

[0027] S106. If n1, t1, n2, t2, n3, and t3 satisfy the first constraint condition, let k = n1 / t1 = n2 / t2 = n3 / t3, where k is a reference value.

[0028] S107. Under the condition of satisfying the first constraint condition, adjust n1, t1, n2, t2, n3, and t3 to make k as large as possible. When k converges, the optimization is completed.

[0029] Among them, the memory access intensive program can refer to a program that accesses an infinitely long address space in the GPU memory without restriction, and the memory access parameter C can refer to the memory access amount of a single thread block.

[0030] When A runs on the GPU, it needs to call different thread blocks, and the states corresponding to the thread blocks can include the first state, the second state, and the third state.

[0031] Specifically, when B < E, it means that the actual bandwidth is less than the ideal bandwidth, and performance optimization can be performed. After determining to perform performance optimization, then analyze whether n1, t1, n2, t2, n3, and t3 satisfy the first constraint condition. Generally, n1, t1, n2, t2, n3, and t3 should satisfy the first constraint condition. If n1, t1, n2, t2, n3, and t3 do not satisfy the first constraint condition, it means that there is a situation of bubbles in at least one state. Bubbles will also affect the operation of other states, resulting in unstable overall performance evaluation, that is, the actual bandwidth cannot be adjusted to the theoretical bandwidth. At this time, the optimization strategy is to first make n1, t1, n2, t2, n3, and t3 satisfy the first constraint condition.

[0032] When n1, t1, n2, t2, n3, and t3 satisfy the first constraint condition, use the values corresponding to n1 / t1, n2 / t2, and n3 / t3 as the reference value k. At this time, the optimization strategy is to make k as large as possible under the condition of satisfying the constraint condition. When k remains fixed and cannot grow after multiple adjustments, it can be considered that k converges and the optimization is completed.

[0033] In particular, if B is still less than E after k converges, then optimization can be performed from the perspective of GPU hardware design.

[0034] In one specific implementation, the ideal bandwidth E is determined according to E=C / D.

[0035] In one specific implementation, adjusting n1, t1, n2, t2, n3, and t3 under the first constraint condition to maximize k, and completing the optimization after k converges, includes:

[0036] Under the conditions of satisfying the first constraint and the preset second constraint, adjust n1, t1, n2, t2, n3, and t3 to make k as large as possible. The optimization is completed when k converges.

[0037] In one specific implementation, the second constraint is k ≤ 1 / D.

[0038] The second constraint can be used to constrain the upper limit of the k value adjustment, which is 1 / D.

[0039] In one specific implementation, adjusting n1, t1, n2, t2, n3, and t3 under the first constraint and a preset second constraint to maximize k, and completing the optimization after k converges, includes:

[0040] Under the conditions of satisfying the first constraint, the preset second constraint, and the preset third constraint, adjust n1, t1, n2, t2, n3, and t3 to make k as large as possible. The optimization is completed when k converges.

[0041] In one specific implementation, the third constraint is n1+n2+n3≤P×Q, where P is the maximum number of thread blocks in a single stream processor in the GPU, and Q is the number of stream processors in the GPU.

[0042] The third constraint can be used to limit the upper limit of the total number of thread blocks, which is n1+n2+n3.

[0043] In one specific implementation, the first state is an address calculation state, the second state is a read data state, and the third state is a write data state.

[0044] It should be noted that, since the first constraint in this embodiment is n1 / t1=n2 / t2=n3 / t3, the first state, the second state, and the third state are equivalent. Any correspondence between the first state, the second state, and the third state and the address calculation state, the read data state, and the write data state adopted by the implementer is within the protection scope of this invention.

[0045] Specifically, the implementer can determine Z states based on the actual situation of the program to be analyzed, where Z is an integer greater than 1. In this case, the first constraint can be adjusted so that the ratio of the number of thread blocks and the time corresponding to any two states is the same. Correspondingly, although the target for optimization is still k, the adjustable parameters include the number of thread blocks and the time corresponding to each state.

[0046] In one specific implementation, the program to be analyzed is a BabelStream program.

[0047] BabelStream is an open-source benchmark suite that can serve as a representative program for memory-intensive programs. Implementers can also determine the program to be analyzed based on their actual performance analysis needs.

[0048] In this embodiment, the ideal bandwidth of the GPU when running test cases is determined based on the memory access parameters corresponding to the test cases and the thread startup rate corresponding to the GPU. This allows for comparison with the actual bandwidth of the GPU when running test cases during performance evaluation, thereby accurately determining whether optimization is needed and improving the accuracy of performance analysis. Parameter optimization is performed when the first constraint condition is met, with the reference value being as large as possible as the optimization target. The optimization process is also constrained by the first constraint condition, providing optimization targets and constraints for performance optimization, that is, providing optimization direction for performance optimization, thereby improving the accuracy and efficiency of performance analysis and optimization.

[0049] While specific embodiments of the invention have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of the invention. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of the invention. The scope of this invention is defined by the appended claims.

Claims

1. A performance analysis and tuning system based on memory-intensive programs, characterized in that, The system includes: a GPU, a test case A corresponding to the program to be analyzed, a processor, and a memory storing a computer program. When the computer program is executed by the processor, the following steps are implemented: S101, run A using the GPU, and obtain the actual bandwidth B of the GPU when running A; S102, obtain the memory access parameter C corresponding to A and the thread launch rate D corresponding to the GPU; S103, determine the ideal bandwidth E of the GPU when running A according to C and D; S104, when B < E, obtain the number of thread blocks n1 in the first state when A is running, the time t1 corresponding to the first state, the number of thread blocks n2 in the second state, the time t2 corresponding to the second state, the number of thread blocks n3 in the third state, and the time t3 corresponding to the first state; S105, analyze whether n1, t1, n2, t2, n3, t3 satisfy the first constraint condition, where the first constraint condition is: n1 / t1 = n2 / t2 = n3 / t3; S106, if n1, t1, n2, t2, n3, t3 satisfy the first constraint condition, then let k = n1 / t1 = n2 / t2 = n3 / t3, where k is a reference value; S107, under the condition of satisfying the first constraint condition, iteratively adjust n1, t1, n2, t2, n3, t3 to maximize the value of k until the value of k converges, and complete the optimization.

2. The performance analysis and optimization system based on memory-intensive programs according to claim 1, characterized in that, The ideal bandwidth E is determined according to E = C / D.

3. The performance analysis and optimization system based on memory-intensive programs according to claim 1, characterized in that, The iteratively adjusting n1, t1, n2, t2, n3, t3 under the condition of satisfying the first constraint condition to maximize the value of k until the value of k converges and completing the optimization includes: Under the condition of satisfying the first constraint condition and a preset second constraint condition, iteratively adjust n1, t1, n2, t2, n3, t3 to maximize the value of k until the value of k converges, and complete the optimization.

4. The performance analysis and optimization system based on memory-intensive programs according to claim 3, characterized in that, The second constraint condition is k ≤ 1 / D.

5. The performance analysis and optimization system based on memory-intensive programs according to claim 3, characterized in that, The iteratively adjusting n1, t1, n2, t2, n3, t3 under the condition of satisfying the first constraint condition and a preset second constraint condition to maximize the value of k until the value of k converges and completing the optimization includes: Under the condition of satisfying the first constraint condition, a preset second constraint condition, and a preset third constraint condition, iteratively adjust n1, t1, n2, t2, n3, t3 to maximize the value of k until the value of k converges, and complete the optimization.

6. The performance analysis and optimization system based on memory-intensive programs according to claim 5, characterized in that, The third constraint condition is n1 + n2 + n3 ≤ P × Q, where P is the maximum number of thread blocks of a single stream processor in the GPU, and Q is the number of stream processors in the GPU.

7. The performance analysis and optimization system based on memory-intensive programs according to claim 1, characterized in that, The first state is the address calculation state, the second state is the read data state, and the third state is the write data state.

8. The performance analysis and tuning system based on memory-intensive programs according to claim 1, characterized in that, The program to be analyzed is the BabelStream program.

Citation Information

Patent Citations

  • High-performance server GPU performance bottleneck tuning method and device and storage medium

    CN112000472A

  • Service proxy method and system based on Dores front-end node

    CN119938335A