Search

CN-121326791-B - Prefetch address acquisition method and device

CN121326791BCN 121326791 BCN121326791 BCN 121326791BCN-121326791-B

Abstract

The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for acquiring a prefetch address. The method comprises the steps of obtaining an access address, updating an Activity Generation Table (AGT) according to the access address, wherein the updated AGT comprises a first space access mode and a first effective access number corresponding to area information in the access address, judging whether the first effective access number in the AGT exceeds a preset threshold, and if so, obtaining a prefetching address according to an offset address corresponding to a second space access mode similar to the first space access mode in a mode history table (PHT) and the area information of the access address, wherein the second space access mode in the PHT is a kicked first space access mode in the AGT. By utilizing the embodiment of the specification, the universality and the recycling rate of the learning mode are effectively improved, and the prefetching coverage rate of the prefetcher is improved.

Inventors

  • YOU JINHAN

Assignees

  • 成都群芯微电子科技有限公司

Dates

Publication Date
20260505
Application Date
20250929

Claims (17)

  1. 1. A prefetch address acquisition method is characterized by comprising the steps of, Acquiring an access address; Updating an activity generation table AGT according to the access address, wherein the updated AGT comprises a first space access mode and a first effective access number corresponding to the area information in the access address; judging whether the first effective access number in the AGT exceeds a preset threshold value; And if the preset threshold value is exceeded, obtaining a pre-fetch address according to an offset address corresponding to a second space access mode similar to the first space access mode in a mode history table PHT and the area information of the access address, wherein the second space access mode in the PHT is a kicked first space access mode in the AGT.
  2. 2. The method of claim 1, wherein updating an activity generation table AGT based on the access address further comprises, Judging whether the area information in the access address hits in the AGT or not; If the access address does not hit, a first space access mode and a first effective access number corresponding to the area information are newly built in the AGT according to the access address; If yes, judging whether the access address is in a new first space access mode in the AGT; and if the access address is the new first space access mode, updating the first space access mode and the first effective access number corresponding to the area information in the AGT according to the access address.
  3. 3. The method of claim 2, wherein if there is a miss, then newly establishing a first spatial access pattern and a first number of valid accesses in the AGT corresponding to the region information based on the access address further comprises, Judging whether the AGT is full; If the AGT is not full, a first space access mode and a first effective access number corresponding to the area information are newly established in the AGT; and if the AGT is full, a first space access mode is kicked from the AGT to the PHT as a second space access mode according to a preset rule.
  4. 4. The method of claim 3, wherein kicking a first spatial access pattern from the AGT to the PHT as a second spatial access pattern according to a predetermined rule further comprises, After the first effective access number corresponding to the kicked first space access mode is kicked into the PHT as a second effective access number, And newly creating a first space access mode and a first effective access number corresponding to the area information in the AGT.
  5. 5. The method of claim 4, wherein obtaining the prefetch address based on the offset address corresponding to a second spatial access pattern in the PHT that is similar to the first spatial access pattern and the region information for the access address further comprises, Traversing the first spatial access pattern through a second spatial access pattern in the PHT; The first space access mode and each second space access mode are subjected to phase-wise AND, and the number of 1 after phase-wise AND is calculated; And when the number of 1 exceeds a preset number threshold, determining that the second space access mode is similar to the first space access mode.
  6. 6. The method of claim 5, wherein the step of bit-wise ANDed the first spatial access pattern with each of the second spatial access patterns, and wherein the step of counting the number of phase-wise ANDed 1's further comprises the step of, Calculating the ratio of the number of 1 s to the second effective access number; when the ratio exceeds a preset ratio threshold, determining that the second spatial access mode is similar to the first spatial access mode.
  7. 7. The method of claim 2, wherein determining if the access address is a new first spatial access pattern in the AGT if there is a hit further comprises, If the bit corresponding to the offset address of the access address in the first spatial access pattern is 0, the access address is a new first spatial access pattern in the AGT.
  8. 8. The method of claim 7, wherein updating the first space access pattern and the first effective access number corresponding to the region information in the AGT based on the access address if it is a new first space access pattern further comprises, And adding 1 to the first effective access number, wherein the position corresponding to the offset address of the access address in the first space access mode is 1.
  9. 9. The method of claim 1, further comprising, after obtaining the prefetch address, Recording a second space access mode with prefetching as a history prefetching mode corresponding to the area information; when the prefetching occurs again, the offset addresses of the second space access mode and the history prefetching mode repetition in the current prefetching are filtered.
  10. 10. The method of claim 9, wherein recording the second spatial access pattern in which the prefetching occurs as a history prefetching pattern corresponding to the region information further comprises, Marking the zone bit of the zone information; filtering offset addresses where the second spatial access pattern and the history prefetch pattern repeat at the current prefetch when the prefetch occurs again further comprises, And if the flag bit of the area information is marked, masking a second space access mode in the current prefetching by using the history prefetching mode, and obtaining a prefetching address prefetched again according to the offset address of the second space access mode after masking and the area information of the access address.
  11. 11. The method of claim 10, further comprising, after obtaining the re-prefetched prefetch address, And bitwise and the second spatial access mode after masking and the history pre-fetching mode are adopted to obtain a history pre-fetching mode corresponding to the region information.
  12. 12. The method according to claim 10, wherein the history pre-fetch pattern and a flag bit corresponding to the region information are stored in the AGT.
  13. 13. A prefetch address acquisition apparatus, characterized in that the apparatus includes, An acquisition unit configured to acquire an access address; An updating unit, configured to update an activity generation table AGT according to the access address, where the AGT includes a first space access mode and a first effective access number corresponding to area information in the access address; a judging unit for judging whether the first effective access number in the AGT exceeds a preset threshold; And the prefetching unit is used for obtaining a prefetching address according to an offset address corresponding to a second space access mode similar to the first space access mode in the mode history table PHT and the area information of the access address if the second space access mode exceeds the preset threshold, wherein the second space access mode in the PHT is a kicked first space access mode in the AGT.
  14. 14. A processor comprising a prefetcher for performing the method of any one of claims 1-12.
  15. 15. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of the preceding claims 1-12 when executing the computer program.
  16. 16. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, performs the method of any of the preceding claims 1-12.
  17. 17. A computer program product, characterized in that the computer program product comprises a computer program which, when executed by a processor, implements the method of any one of claims 1-12.

Description

Prefetch address acquisition method and device Technical Field The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for acquiring a prefetch address. Background With the wide deployment of multi-core processors in data-intensive applications such as servers and databases, memory system performance has become a bottleneck limiting overall performance. In commercial database systems and transaction processing (OLTP/DSS) and like workloads, memory-related latency accounts for more than half of the total execution time. Although modern servers provide a large memory bandwidth, memory systems fail to fully utilize the bandwidth due to the large amount of data dependency in the access chain, resulting in a serious shortage of Memory Level Parallelism (MLP). To alleviate this bottleneck, various types of data prefetching techniques are proposed for loading data into a cache in advance of its actual access to hide high latency. For example, in database systems, cache misses are a key factor affecting query performance, and thus hardware prefetchers are considered to be one of the important means to improve data access performance of multi-core servers. Spatial memory streaming (Spatial Memory Streaming, SMS) data prefetching is a program counter (PC-based) based hardware data prefetching technique for spatial locality, whose core is to predict and prefetch future likely accessed cache blocks by dynamically learning the spatial correlation pattern of program access memory. A Spatial-locality (Spatial-locality) data prefetcher (DATA PREFETCHER, DP) attaches importance to the regularity of access addresses within a Region, observes and records the relative addresses of access addresses within the Region, and the address range divided into the smallest learning units is the "Region". Within a region, each access Address (ACCESS ADDRESS) with the smallest granularity of cache lines (CACHE LINE) relative to the region base Address is recorded as an "Offset Address", and all Offset Addresses constitute an access Offset Pattern (Offset Pattern) within the region. SMS binds the spatial pattern index to the PC at the time of triggering so that each spatial pattern training and prediction is only valid under the same PC path. This locality dependence makes it difficult for trained patterns to migrate when the data access paths change (e.g., caused by different threads, functions, or conditional branches), resulting in severe cold start problems, long training time, limited prefetch coverage, and poor performance especially in one-time access scenarios such as database scanning, complex intermediate query operations, etc. How to use the PC-based SMS prefetching scheme in a less versatile manner and with a low prefetch coverage is a problem that needs to be addressed. Disclosure of Invention In order to solve the problems in the prior art, the embodiment of the specification provides a method and a device for acquiring a prefetch address, which solve the problems that in the prior art, based on learning and prediction of a PC, the related information of an area in an access address is adopted for learning and prediction, the global property is enhanced, and the prefetch hit rate and the generalization capability of an untrained path are improved. The embodiment of the specification provides a prefetch address acquisition method, which comprises the following steps of, Acquiring an access address; Updating an activity generation table AGT according to the access address, wherein the updated AGT comprises a first space access mode and a first effective access number corresponding to the area information in the access address; judging whether the first effective access number in the AGT exceeds a preset threshold value; And if the preset threshold value is exceeded, obtaining a pre-fetch address according to an offset address corresponding to a second space access mode similar to the first space access mode in a mode history table PHT and the area information of the access address, wherein the second space access mode in the PHT is a kicked first space access mode in the AGT. As a further aspect of the present description, updating the activity generation table AGT based on the access address further comprises, Judging whether the area information in the access address hits in the AGT or not; If the access address does not hit, a first space access mode and a first effective access number corresponding to the area information are newly built in the AGT according to the access address; If yes, judging whether the access address is in a new first space access mode in the AGT; and if the access address is the new first space access mode, updating the first space access mode and the first effective access number corresponding to the area information in the AGT according to the access address. As a further aspect of the present specification, if there is a miss, newly est