GPGPU memory data prefetching method and device based on block CTA scheduling and storage medium

Through the block CTA scheduling method, the spatial locality of thread blocks is analyzed and its allocation strategy is optimized, which solves the problems of low cache hit rate and memory access latency in the existing GPGPU data prefetching technology, and achieves more efficient data access and performance promote.

CN118964233APending Publication Date: 2024-11-15SHANDONG INSPUR SCI RES INST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411096231.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

The existing GPGPU data prefetching technology fails to fully consider the dynamic characteristics of thread execution and the spatial locality of data access, resulting in low cache hit rate, memory access latency becomes a key factor in performance improvement, and lacks consideration of thread block scheduling strategies. Failed to effectively utilize hardware resources.

Method used

Using the block CTA scheduling method, by tracing and analyzing thread blocks, judging their spatial locality, and allocating thread blocks with spatial locality to the same processing core for execution, selecting appropriate hardware or software control strategies. , load data from main memory or slow storage media into cache.

Benefits of technology

It improves the data prefetch hit rate, reduces the risk of cache pollution, reduces unnecessary prefetch operations and energy consumption, improves system memory access efficiency, and reduces memory access latency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118964233A_ABST
    Figure CN118964233A_ABST
Patent Text Reader

Abstract

The invention discloses a GPGPU memory data prefetching method and device based on block CTA scheduling and a storage medium, and relates to the technical field of GPGPUs, a block CTA scheduling method is combined with data prefetching, and thread blocks with spatial locality are distributed into the same processing core by utilizing a BCS strategy, so that the possibility that prefetched data are actually accessed is increased, and the data prefetching efficiency is improved. The prefetched data is more likely to be actually used, and the proportion of invalid data in the cache is reduced, so that the prefetch hit rate is improved, and the possibility that the data is polluted is reduced; meanwhile, the application of the BCS strategy can simplify a prefetch algorithm and operation, reduce unnecessary prefetch operation and optimization of a data access mode, and effectively reduce the energy consumption of the system while the prediction is relatively stable; and thirdly, the enhancement of the spatial locality means that the memory access delay is reduced, and the memory access efficiency of the system is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of GPGPU technology, and in particular to a GPGPU memory data pre-fetching method, device and storage medium based on block CTA scheduling. Background Art

[0002] In modern parallel computing, GPGPU, as a powerful computing resource, is widely used in fields such as scientific computing and deep learning. However, the application of existing data prefetching technology in GPGPU has significant limitations. Traditional data prefetching methods are often based on simple prediction models and fail to fully consider the dynamic characteristics of thread execution and the spatial locality of data access in GPGPU. This leads to a low cache hit rate during execution, and memory access latency becomes a key factor restricting performance improvement. Especially when dealing with large-scale parallel tasks, resource competition and cache misses between thread blocks are particularly prominent. In addition, existing prefetching technologies lack consideration of thread block scheduling strategies, fail to effectively utilize GPGPU hardware resources, and thus fail to achieve the optimal data access pattern. Summary of the invention

[0003] In order to overcome the shortcomings of the above technologies, the present invention provides a GPGPU memory data prefetching method, device and storage medium based on block CTA scheduling, which can reduce system energy consumption and improve system memory access efficiency. The method is suitable for high-performance computing environments that need to process a large number of parallel tasks and data-intensive operations.

[0004] The technical solution adopted by the present invention to overcome the technical problems is: A GPGPU memory data prefetching method based on block CTA scheduling, comprising: S1.GPGPU starts the program and initializes the required hardware resources; S2. Decompose the computing task into multiple threads to obtain thread blocks distributed in a two-dimensional grid; S3. Track and analyze data for each thread block; S4. Determine whether there is spatial locality between the thread blocks. If yes, execute step S5; if no, execute step S6; S5. Allocate the thread blocks with spatial locality to the same processing core of the GPGPU for execution; S6. The thread block executes the computing task and monitors the current memory access mode, and selects a hardware control strategy or a software control strategy; S7. Loading data from the main memory or other slow storage medium into the cache of the GPGPU according to the result of the hardware control strategy or the software control strategy; S8. Determine whether the computing task of the thread block has been completed. If not, return to step S6.

[0005] Furthermore, the hardware resources required in step S1 include cores, caches, and memory controllers.

[0006] Furthermore, in step S2, the decomposed threads are organized into thread warps, and the thread warps are organized into thread blocks (CTAs) distributed in a two-dimensional grid.

[0007] Furthermore, the data tracking and analysis of each thread block in step S3 includes: tracking and recording the start time, execution time, and completion time of each thread block; and analyzing the access pattern of each thread block to the memory. Furthermore, the access pattern of the memory includes the access address, access frequency, and data size.

[0008] Furthermore, the above hardware control strategy is a hardware control strategy based on online prediction of historical records.

[0009] Furthermore, the above software control strategy is a hardware control strategy prepared in advance by a programmer or a compiler.

[0010] On the other hand, the present invention also relates to a GPGPU memory data pre-fetching device based on block CTA scheduling, comprising: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein: The memory is used to store computer programs; The processor is configured to execute, by running a program stored in the memory: GPGPU starts the program and initializes the required hardware resources; Decompose the computing task into multiple threads to obtain thread blocks distributed in a two-dimensional grid; Perform data tracking and analysis on each thread block; Determine whether there is spatial locality between thread blocks; Allocate thread blocks with spatial locality to the same processing core of GPGPU for execution; The thread block executes the computing task and monitors the current memory access mode, and selects the hardware control strategy or the software control strategy; Loading data from main memory or other slow storage media into a cache of the GPGPU according to a result of a hardware control strategy or a software control strategy; Determine whether the computational tasks of the thread block have been completed.

[0011] On the other hand, the present invention also relates to a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements: GPGPU starts the program and initializes the required hardware resources; Decompose the computing task into multiple threads to obtain thread blocks distributed in a two-dimensional grid; Perform data tracking and analysis on each thread block; Determine whether there is spatial locality between thread blocks; Allocate thread blocks with spatial locality to the same processing core of GPGPU for execution; The thread block executes the computing task and monitors the current memory access mode, and selects the hardware control strategy or the software control strategy; Loading data from main memory or other slow storage media into a cache of the GPGPU according to a result of a hardware control strategy or a software control strategy; Determine whether the computational tasks of the thread block have been completed.

[0012] The beneficial effects of the present invention are as follows: the block CTA scheduling method is combined with data prefetching, and the thread blocks with spatial locality are allocated to the same processing core by using the BCS strategy, which increases the possibility that the prefetched data is actually accessed, and the prefetched data is more likely to be actually used, thereby reducing the proportion of invalid data in the cache, thereby improving the prefetch hit rate and reducing the possibility of data pollution; at the same time, the application of the BCS strategy can simplify the prefetch algorithm and operation, reduce unnecessary prefetch operations and optimize the data access mode, and effectively reduce the energy consumption of the system while making the prediction more stable; thirdly, the enhancement of spatial locality means the reduction of memory access latency, which greatly improves the efficiency of system memory access. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 This is a schematic diagram of block CTA scheduling; Figure 2 The present invention is a flow chart of the method. DETAILED DESCRIPTION

[0014] The following is combined with Figure 1 , Attachment Figure 2 The preferred embodiments of the present invention are described in detail so that the advantages and features of the present invention can be more easily understood by those skilled in the art, thereby making a clearer and more definite definition of the protection scope of the present invention.

[0015] In the description of the present invention, it should be noted that the embodiments described in the present invention are only part of the embodiments of the present invention, rather than all of the embodiments; based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present invention.

[0016] The terms "first", "second", etc. in the specification and claims of this article and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of this article described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0017] Example 1 A GPGPU memory data prefetching method based on block CTA scheduling, comprising: S1.GPGPU starts the program and initializes the required hardware resources.

[0018] S2. Decompose the computing task into multiple threads to obtain thread blocks distributed in a two-dimensional grid.

[0019] S3. Perform data tracking and analysis on each thread block.

[0020] S4. Determine whether there is spatial locality between the thread blocks. If yes, execute step S5; if not, execute step S6.

[0021] S5. Allocate thread blocks with spatial locality to the same processing core of the GPGPU for execution.

[0022] S6. The thread block executes the computing task and monitors the current memory access mode, and selects a hardware control strategy or a software control strategy.

[0023] S7. According to the result of the hardware control strategy or software control strategy, load the data from the main memory or other slow storage media into the GPGPU cache. Implement data prefetching. Through data prefetching, not only can the resource management of GPGPU be optimized and the prefetch hit rate be improved, but also the cache pollution risk can be reduced, the memory access efficiency can be improved, unnecessary prefetch operations can be reduced, and the system energy consumption can be reduced. The principle of data prefetching technology is: If a data request fails to hit the cache, it will trigger a data request to access a lower level cache or memory. This cache miss will cause a lot of time to be wasted waiting for data. Data prefetching technology refers to loading data from slow storage devices to fast cache in advance through a specific data prefetching strategy, so that the data required by the processor has been prefetched into the cache when the processor needs it, which can save a lot of processor cycles wasted waiting for data, reduce the time the processor waits for memory data, and thus improve the overall performance of the system.

[0024] Data prefetching requires monitoring the program execution behavior first, and identifying possible temporal locality and spatial locality by analyzing the current memory access pattern. For example, the prediction strategy of hardware control can be based on online prediction of historical records, that is, the prediction module also makes judgments based on the observed access history and buffer history: if the value span is constant, the next address is calculated according to the constant span and prefetched. However, if the value-taking method is not fixed, the expected effect cannot be achieved; the prediction strategy of software control requires the programmer or compiler to add prefetch instructions to the program in advance, but this requires the programmer or compiler to have sufficient understanding of the entire system.

[0025] After the system selects an appropriate prefetch strategy, it prefetches data. At this time, the system will take out the data of the corresponding address calculated by the prefetch strategy in advance, and load the data from the main memory or other slow storage media to the cache closer to the processor before the actual access occurs.

[0026] It can be seen that data prefetching needs to be based on corresponding prefetching strategies, such as streaming prefetching, loop prefetching, etc. If the prefetching strategy is not appropriate enough, prediction errors are likely to occur, causing unnecessary data to be loaded into the cache, which does not save time and increases the risk of cache pollution. Designing an effective prefetching algorithm requires complex logic and a deep understanding of program behavior, which will undoubtedly increase the complexity of system design.

[0027] S8. Determine whether the computing task of the thread block has been completed. If not, return to step S6.

[0028] It can more accurately predict data access patterns, reduce cache misses, lower memory access latency, and fully utilize GPGPU hardware resources. Through the optimization of the BCS strategy, the execution mode and data access mode of thread blocks with higher spatial limitations are realized, thereby achieving more efficient data prefetching. This method not only optimizes the data access process, but also significantly improves the performance of GPGPU when processing complex parallel tasks. Through this comprehensive scheduling and prefetching strategy, the present invention aims to achieve more efficient GPGPU resource management and performance optimization.

[0029] In this embodiment, the hardware resources required in step S1 include a core, a cache, and a memory controller.

[0030] In this embodiment, in step S2, the decomposed threads are organized into thread warps, and the thread warps are organized into thread blocks distributed in a two-dimensional grid.

[0031] In this embodiment, data tracking and analysis of each thread block in step S3 includes: tracking and recording the start time, execution time, and completion time of each thread block; analyzing the access mode of each thread block to the memory. The above-mentioned memory access mode includes the access address, access frequency, and data size. In order to identify thread block groups that have continuity or proximity in memory access mode, these thread blocks usually show spatial locality. Using this information, a block CTA scheduling (BCS) strategy is implemented to assign thread block groups with spatial locality to the same processing core for execution, thereby increasing the probability of cache line hits and reducing memory access delays. The present invention is based on a block CTA scheduling method (Block CTA Scheduling, referred to as BCS), which is an advanced thread block scheduling strategy. The core idea of ​​this strategy is to utilize the spatial locality between thread blocks to improve data access efficiency and computing performance through reasonable scheduling.

[0032] In the GPGPU architecture, computing tasks are usually decomposed into many threads, which are organized into warps, and multiple warps are further composed of multiple thread blocks (Cooperative Thread Arrays, CTA for short). Traditional thread block scheduling methods may not fully utilize the parallel processing capabilities of modern GPUs, especially when dealing with thread blocks with high spatial correlation. Block CTA Scheduling (BCS) proposes a new thread block allocation and execution strategy to address this problem.

[0033] As attached Figure 1 As shown in (a), CTAs are distributed in a two-dimensional grid format. For such distributed thread blocks, if a common polling strategy is used to schedule thread blocks, as shown in the attached figure, Figure 1 As shown in (b), adjacent thread blocks cannot be assigned to the same processing core, which means the loss of spatial locality. The BCS strategy identifies thread block groups with spatial locality by analyzing the execution patterns of thread blocks. This process usually requires tracking the start, execution, and completion time of thread blocks, while analyzing the memory access patterns of each thread block, such as the access address, frequency, and data size. After the analysis determines which thread blocks have continuity or proximity in memory access patterns, as shown in the attached figure. Figure 1As shown in (c), assigning them to the same processing core ensures that continuous thread blocks can be executed continuously, which can greatly increase the probability of cache line hits and reduce memory access latency. By properly allocating thread blocks, resource waste and contention are avoided, and core utilization is improved. At the same time, the continuous execution of continuous thread blocks also reduces thread scheduling overhead and improves execution efficiency. The implementation of BCS provides a more favorable execution environment for subsequent data prefetching technology and lays the foundation for further improving GPGPU performance.

[0034] In this embodiment, the hardware control strategy is a hardware control strategy based on online prediction of historical records.

[0035] In this embodiment, the software control strategy is a hardware control strategy prepared in advance by a programmer or a compiler.

[0036] In the final stage of implementing the GPGPU memory data prefetching method based on block CTA scheduling, the execution progress of the thread blocks can be continuously monitored. Once a thread block is detected to have completed its computational task, the system removes it from the list of active thread blocks and confirms whether the memory resources required by it have been correctly released. At the same time, check whether there are other thread blocks still executing. If there are unfinished thread blocks, the system will continue to apply BCS policies and data prefetching techniques to optimize these thread blocks. This includes re-evaluating their memory access patterns, adjusting prefetching algorithm parameters, and optimizing prefetching operations based on the latest execution data.

[0037] Example 2 A GPGPU memory data pre-fetching device based on block CTA scheduling, comprising: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein: The memory is used to store computer programs; The processor is configured to execute, by running a program stored in the memory: GPGPU launcher and initializes the required hardware resources.

[0038] The computing task is decomposed into multiple threads to obtain thread blocks distributed in a two-dimensional grid.

[0039] Perform data tracking and analysis for each thread block.

[0040] Determine whether there is spatial locality between thread blocks.

[0041] Thread blocks with spatial locality are assigned to the same processing core of GPGPU for execution.

[0042] The thread block executes the computing task and monitors the current memory access pattern, selecting either hardware control strategy or software control strategy.

[0043] According to the result of the hardware control policy or the software control policy, the data is loaded from the main memory or other slow storage media into the cache of the GPGPU.

[0044] Determine whether the computational tasks of the thread block have been completed.

[0045] Example 3 A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the computer program implements: GPGPU launcher and initializes the required hardware resources.

[0046] The computing task is decomposed into multiple threads to obtain thread blocks distributed in a two-dimensional grid.

[0047] Perform data tracking and analysis for each thread block.

[0048] Determine whether there is spatial locality between thread blocks.

[0049] Thread blocks with spatial locality are assigned to the same processing core of GPGPU for execution.

[0050] The thread block executes the computing task and monitors the current memory access pattern, selecting either hardware control strategy or software control strategy.

[0051] According to the result of the hardware control policy or the software control policy, the data is loaded from the main memory or other slow storage media into the cache of the GPGPU.

[0052] Determine whether the computational tasks of the thread block have been completed.

[0053] It should be understood that in the various embodiments of this document, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this document.

[0054] It should also be understood that in the embodiments of this document, the term "and / or" is only a description of the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this document generally indicates that the associated objects before and after are in an "or" relationship.

[0055] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this article.

[0056] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0057] In the several embodiments provided herein, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or can be electrical, mechanical or other forms of connection.

[0058] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of this article.

[0059] In addition, each functional unit in each embodiment of this invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional unit.

[0060] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this article is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of this article. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0061] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A GPGPU memory data prefetching method based on block CTA scheduling, characterized in that: include: S1.GPGPU starts the program and initializes the required hardware resources; S2. Decompose the computing task into multiple threads to obtain thread blocks distributed in a two-dimensional grid; S3. Track and analyze data for each thread block; S4. Determine whether there is spatial locality between the thread blocks. If yes, execute step S5; if no, execute step S6; S5. Allocate the thread blocks with spatial locality to the same processing core of the GPGPU for execution; S6. The thread block executes the computing task and monitors the current memory access mode, and selects a hardware control strategy or a software control strategy; S7. Loading data from the main memory or other slow storage medium into the cache of the GPGPU according to the result of the hardware control strategy or the software control strategy; S8. Determine whether the computing task of the thread block has been completed. If not, return to step S6.

2. The GPGPU memory data prefetching method based on block CTA scheduling according to claim 1, characterized in that: The hardware resources required in step S1 include cores, caches, and memory controllers.

3. The GPGPU memory data prefetching method based on block CTA scheduling according to claim 1, characterized in that: In step S2, the decomposed threads are organized into thread bundles, and the thread bundles are organized into thread blocks distributed in a two-dimensional grid.

4. The GPGPU memory data prefetching method based on block CTA scheduling according to claim 1, characterized in that: The data tracking and analysis of each thread block in step S3 includes: tracking and recording the start time, execution time, and completion time of each thread block; and analyzing the access mode of each thread block to the memory.

5. The GPGPU memory data prefetching method based on block CTA scheduling according to claim 4, characterized in that: The memory access mode includes the access address, access frequency, and data size.

6. The GPGPU memory data prefetching method based on block CTA scheduling according to claim 6, characterized in that: The hardware control strategy is a hardware control strategy based on online prediction of historical records.

7. The GPGPU memory data prefetching method based on block CTA scheduling according to claim 6, characterized in that: The software control strategy is a hardware control strategy prepared in advance by a programmer or a compiler.

8. A GPGPU memory data prefetching device based on block CTA scheduling, characterized in that: include: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein: The memory is used to store computer programs; The processor is configured to execute, by running a program stored in the memory: GPGPU starts the program and initializes the required hardware resources; Decompose the computing task into multiple threads to obtain thread blocks distributed in a two-dimensional grid; Perform data tracking and analysis on each thread block; Determine whether there is spatial locality between thread blocks; Allocate thread blocks with spatial locality to the same processing core of GPGPU for execution; The thread block executes the computing task and monitors the current memory access mode, and selects the hardware control strategy or the software control strategy; Loading data from main memory or other slow storage media into a cache of the GPGPU according to a result of a hardware control strategy or a software control strategy; Determine whether the computational tasks of the thread block have been completed.

9. A computer-readable storage medium, characterized in that: The computer readable storage medium stores a computer program, which, when executed by a processor, implements: GPGPU starts the program and initializes the required hardware resources; Decompose the computing task into multiple threads to obtain thread blocks distributed in a two-dimensional grid; Perform data tracking and analysis on each thread block; Determine whether there is spatial locality between thread blocks; Allocate thread blocks with spatial locality to the same processing core of GPGPU for execution; The thread block executes the computing task and monitors the current memory access mode, and selects the hardware control strategy or the software control strategy; Loading data from main memory or other slow storage media into a cache of the GPGPU according to a result of a hardware control strategy or a software control strategy; Determine whether the computational tasks of the thread block have been completed.