Prediction Method, Device, Equipment and Storage Medium for Prefetching Data

By using the virtual address and offset list to calculate the score when prefetching data, selecting the target virtual address offset, and determining the matching physical address, the spreading problem is solved and the success rate and continuity of data prefetching is improved.

CN119782206BActive Publication Date: 2025-05-30BEIJING INSTITUTE OF OPEN SOURCE CHIP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510262559.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-06
Publication Date
2025-05-30
Estimated Expiration
2045-03-06

AI Technical Summary

Technical Problem

The prior art is prone to the problem of prefetching address spreading pages when prefetching data, resulting in the inability to prefetch data.

Method used

By receiving the first-level cached memory request and obtaining the second-level cached stored data, the first training data, including missing data and stored prefetch data. Then, based on the virtual address of the first training data and the virtual address offset in the offset list, the score of each offset is calculated to obtain the offset score list, thereby selecting the target virtual address offset, determining the matching physical address, and prefetching.

Benefits of technology

It solves the problem of spreading the page, increases the probability of data being successfully prefetched, and ensures the continuity and effectiveness of prefetched data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119782206B_ABST
    Figure CN119782206B_ABST
Patent Text Reader

Abstract

The present application provides a prediction method, apparatus, electronic device and computer-readable storage medium for prefetching data, including: receiving a memory access request, obtaining stored data in a secondary cache, determining first training data according to a comparison result between memory access data corresponding to the memory access request and the stored data, extracting virtual addresses of the first training data, calculating scores corresponding to each virtual address offset according to the virtual addresses of the first training data and virtual address offsets included in a first offset list, selecting a target virtual address offset according to the scores, and determining a first physical address according to the virtual address of the first training data, the target virtual address offset, and a mapping relationship between the virtual address and the physical address, and using data corresponding to the first physical address as second prefetch data predicted for subsequent access requests. It can fundamentally eliminate the problem of cross-page and increase the probability of successful data prefetching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technologies, and in particular, to a prediction method, apparatus, electronic device, and computer-readable storage medium for prefetching data. Background Art

[0002] By learning the access pattern of data, predicting the data that may be accessed next, and then prefetching it into the cache in advance, this process is called prefetching.

[0003] Related technologies use the physical addresses of the prefetch data in the secondary (L2, Level 2) cache to train each address offset in the offset list. After the training is completed, the target address offset is obtained, and the data corresponding to the prefetch address corresponding to the target address offset is extracted into the L2 cache.

[0004] For the prefetch address corresponding to the target address offset obtained by related technologies, there will be a problem that the prefetch address crosses pages and data cannot be prefetched. Summary of the Invention

[0005] Embodiments of the present application provide a prediction method, apparatus, electronic device, and computer-readable storage medium for prefetching data to solve the problems in related technologies.

[0006] In a first aspect, embodiments of the present application provide a prediction method for prefetching data, and the method includes:

[0007] Receiving a memory access request sent by a primary cache, and obtaining the stored data in a secondary cache, and determining first training data in the secondary cache according to a comparison result between the memory access data corresponding to the memory access request and the stored data; the first training data includes first missing data that is missing and first prefetch data that is stored; the first missing data is the data that the memory access data is missing in the secondary cache; the first prefetch data is the data added to the secondary cache by a historical prefetch operation;

[0008] Extracting the virtual address of the first training data from the memory access request, and calculating the score corresponding to each virtual address offset according to the virtual address of the first training data and the virtual address offsets included in a first offset list, to obtain a first offset score list including virtual address offsets and the scores corresponding to the virtual address offsets;

[0009] Selecting a target virtual address offset from the first offset score list according to the score, and determining a first physical address according to the virtual address of the first training data, the target virtual address offset, and the mapping relationship between the virtual address and the physical address, and using the data corresponding to the first physical address as the predicted second prefetch data for subsequent access requests.

[0010] In a second aspect, an embodiment of the present application provides a prediction device for prefetching data, the device including:

[0011] A first determination module, configured to receive a memory access request sent by a first-level cache, obtain stored data in a second-level cache, and determine first training data in the second-level cache according to a comparison result between memory access data corresponding to the memory access request and the stored data; the first training data includes first missing data that is missing and first prefetch data that is stored; the first missing data is data that the memory access data is missing in the second-level cache; the first prefetch data is data added to the second-level cache by a historical prefetch operation;

[0012] A first calculation module, configured to extract a virtual address of the first training data from the memory access request, and calculate a score corresponding to each virtual address offset according to the virtual address of the first training data and virtual address offsets included in a first offset list, to obtain a first offset score list including virtual address offsets and scores corresponding to the virtual address offsets;

[0013] A second determination module, configured to select a target virtual address offset according to the score from the first offset score list, and determine a first physical address according to the virtual address of the first training data, the target virtual address offset, and a mapping relationship between a virtual address and a physical address, and use data corresponding to the first physical address as predicted second prefetch data for a subsequent access request.

[0014] In a third aspect, an embodiment of the present application further provides an electronic device, including a processor; a memory for storing executable instructions of the processor; wherein, the processor is configured to execute the instructions to implement the method of the first aspect.

[0015] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enabling the electronic device to execute the method of the first aspect.

[0016] In the embodiment of the present application, by calculating a score corresponding to each virtual address offset in the first offset list according to the virtual address of the first training data, a first offset score list is obtained. Since the virtual addresses are consecutive, therefore, the virtual addresses matching the first physical address determined according to the virtual address of the first training data and the target virtual address offset selected from the first offset score list are consecutive, that is, there is no cross-page problem, so that the second prefetch data can be prefetched according to the first physical address to handle the cross-page problem and increase the probability of successful data prefetch.

[0017] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features, and advantages of this application more obvious and understandable, the following specifically illustrates the specific implementation manners of this application. Description of the Drawings

[0018] In order to more clearly illustrate the technical solutions in the embodiments of this application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of this application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0019] Figure 1 It is an implementation scenario architecture diagram provided by an embodiment of this application;

[0020] Figure 2 It is a flowchart of steps for using physical address training and prefetching in related technologies provided by an embodiment of this application;

[0021] Figure 3 It is a flowchart of steps for a method of predicting prefetch data provided by an embodiment of this application;

[0022] Figure 4 It is a specific flowchart of steps for a method of predicting prefetch data provided by an embodiment of this application;

[0023] Figure 5 It is a flowchart of steps for virtual address training and prefetching provided by an embodiment of this application;

[0024] Figure 6 It is a flowchart of steps for joint training and prefetching of virtual addresses and physical addresses provided by an embodiment of this application;

[0025] Figure 7 It is a block diagram of a device for predicting prefetch data provided by an embodiment of this application;

[0026] Figure 8 It is a block diagram of an electronic device provided by an embodiment of this application;

[0027] Figure 9 It is a block diagram of another electronic device provided by another embodiment of this application. Detailed Embodiments

[0028] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the scope of protection of the present application.

[0029] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects and are not used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are usually of the same type and do not limit the number of objects. For example, the first object can be one or more. In addition, the term "and / or" in the specification and claims is used to describe the association relationship of associated objects and indicates that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. In the embodiments of the present application, the term "plurality" refers to two or more, and other quantifiers are similar.

[0030] Figure 1 is an implementation scenario architecture diagram provided by an embodiment of the present application. Referring to Figure 1 , in order to improve the execution efficiency and reduce the interaction between the processor and the memory, modern processors can integrate a multi-level cache architecture on the processor. A common architecture is the Figure 1 three-level cache structure, including: a first-level cache, a second-level cache, and a third-level cache. The first-level cache is the cache closest to the processor. It has the smallest capacity and the fastest speed. The second-level cache has a larger capacity, but its speed is relatively slower than that of the first-level cache. The second-level cache is the buffer of the first-level cache. The function of the second-level cache is to store the data that the processor needs to use during processing but cannot be stored in the first-level cache. The third-level cache has the largest capacity and is also the slowest level. The third-level cache and the memory can be regarded as the buffers of the second-level cache.

[0031] When the processor operates, the processor will first look for the required data in the first-level cache according to the memory access instruction, then go to the second-level cache, and then go to the third-level cache. If the data it needs is not found in the third-level cache, it will obtain the data from the memory. The longer the search path, the longer the time-consuming. Therefore, if certain data needs to be obtained very frequently, ensuring that these data are in the first-level cache will make the speed very fast. Among them, the memory access instruction is an instruction to obtain data from a specified address in the memory or store data at a specified address in the memory.

[0032] Figure 2The following is a flowchart of steps for training and prefetching using a physical address in a related technology provided by an embodiment of the present application. As Figure 2 shown, the method may include:

[0033] Step S1: Obtain the physical address of the first training data;

[0034] Step S2: Subtract the physical address offset currently being tested from the physical address of the first training data to obtain an offset physical address;

[0035] Step S3: Determine whether the offset physical address is recorded in the request list.

[0036] Step S4: If the offset physical address is recorded in the request list, increment by one the score corresponding to the physical address offset currently being tested and record it in the second offset score list.

[0037] Step S5: If the offset physical address is not recorded in the request list, the score corresponding to the physical address offset currently being tested remains unchanged.

[0038] Step S6: When the maximum score in the second offset score list reaches the threshold or after N rounds of training are completed, obtain the target physical address offset.

[0039] Step S7: Add the physical address of the first training data to the target physical address offset to obtain a second physical address;

[0040] Step S8: Send a prefetch request to the tertiary cache and store the data corresponding to the obtained second physical address in the secondary cache.

[0041] Step S9: Update the physical address of the first training data in the request list.

[0042] The related technology uses the physical address of the first training data in the secondary cache to train the address offsets in the offset list and prefetch the prefetch data into the secondary cache. Each time, an address offset is trained, and one round of training is completed when an offset list is trained. The prefetch address obtained by the related technology through training the address offsets in the offset list using the physical address may cross pages, resulting in the inability to prefetch the data corresponding to the prefetch address.

[0043] In the embodiment of the present application, by calculating the virtual address offset corresponding to each virtual address offset in the first offset list according to the virtual address of the first training data, a first offset score list is obtained. Since the virtual addresses are consecutive, therefore, according to the virtual address of the first training data and the target virtual address offset selected from the first offset score list, the determined virtual addresses matching the first physical address are consecutive, that is, there is no cross-page problem. Thus, the second prefetch data can be prefetched according to the first physical address to handle the cross-page problem, increasing the probability of successful data prefetching.

[0044] Figure 3 is a flowchart of the steps of a method for predicting prefetch data provided by an embodiment of the present application. As Figure 3 shown, the method may include:

[0045] Step 101, receive a memory access request sent by a first-level cache, and obtain the stored data in a second-level cache, and determine the first training data in the second-level cache according to a comparison result between the memory access data corresponding to the memory access request and the stored data; the first training data includes first missing data that is missing and first prefetch data that is stored; the first missing data is the data missing for the memory access data in the second-level cache; the first prefetch data is the data added to the second-level cache by a historical prefetch operation.

[0046] Exemplarily, the central processing unit (CPU) is the operation and control core of a computer system and is the final execution unit for information processing and program running. The CPU calculates very fast, but the speed of data communication between the CPU and the memory is very slow. To alleviate this speed difference, a cache is added between the CPU and the memory. Among them, the cache is generally a static random access memory (SRAM), which is close to the CPU and has a relatively fast access speed. There are a first-level cache, a second-level cache, and a third-level cache in the hierarchical cache. The larger the level number, the farther away from the CPU and the slower the access.

[0047] Exemplarily, the size of the cache is limited, and the amount of data that can be stored under the same index is limited. When it is full, a miss will occur, and then data will be fetched from the next-level storage structure. For example, an access request is a request sent from the first-level cache to the second-level cache to obtain data from the second-level cache. If the memory access data corresponding to the access request is stored in the second-level cache, the data is obtained from the second-level cache. If the memory access data corresponding to the access request is not stored in the second-level cache, the data is obtained from the third-level cache. For example, the memory access data is 1, 2, 3, 4, 5, and the data 1, 2, 3 are stored in the second-level cache, then the data 1, 2, 3 are obtained from the second-level cache. Since the data 4, 5 are not stored in the second-level cache, when executing this memory access request, the data 4, 5 need to be obtained from the third-level cache.

[0048] Exemplarily, in order to reduce the overhead caused by misses, considering that the program itself has temporal and spatial locality, it is possible to predict the data that may be accessed next by learning the access pattern, and then fetch it into the second-level cache in advance. This process is called prefetching. Prefetching is one of the important algorithm modules for performance improvement in architecture design. Hitting the prefetch block next time will not cause a miss and saves the access time.

[0049] Exemplarily, the memory access requests that the second-level cache needs to process are generally of two types. One is the memory access request generated by the program; the other is the memory access request generated by the prefetcher, which may be used in the future. There are three results for the memory access request: hitting the data fetched normally from the second-level cache, hitting the data prefetched from the second-level cache, and missing. For example, the memory access data is 1, 2, 3, 4, 5, and the data 1, 2, 3, 4 are stored in the second-level cache. The data 1, 2, 3 are the data fetched normally from the second-level cache. The memory access request generated by the prefetcher is the data 4, then the data 4 is the data prefetched from the second-level cache. The data 5 is not stored in the second-level cache, then the data 5 is the missed data. Therefore, when executing the memory access request, the data 5 needs to be obtained from the third-level cache.

[0050] Step 102: Extract the virtual address of the first training data from the memory access request, and calculate the score corresponding to each virtual address offset according to the virtual address of the first training data and the virtual address offsets included in the first offset list, to obtain a first offset score list including the virtual address offsets and the scores corresponding to the virtual address offsets.

[0051] Exemplarily, the virtual address of the first training data can be the virtual address passed simultaneously when the first-level cache initiates a memory access request to the second-level cache, or it can be carried in the access request.

[0052] Exemplarily, the virtual address offsets included in the first offset list can be preset. For example, the range of the virtual address offsets can be [-256, 250]. Specifically, it can be (-117, -147, -91, 117,... 243, 250).

[0053] Exemplarily, the first offset score list includes virtual address offsets and the scores corresponding to the virtual address offsets. Among them, the scores corresponding to the virtual address offsets are calculated based on the virtual addresses and virtual address offsets of the first training data. For example, it can be subtracting the virtual address offset from the virtual address of the first training data and determining whether the result of the subtraction has been accessed within a certain period of time. If it has been accessed, the score corresponding to the virtual address offset is incremented by 1 based on the original value; otherwise, it remains unchanged.

[0054] Step 103: Select a target virtual address offset from the first offset score list according to the score, and determine a first physical address based on the virtual address of the first training data, the target virtual address offset, and the mapping relationship between the virtual address and the physical address, and use the data corresponding to the first physical address as the predicted second prefetch data for subsequent access requests.

[0055] Exemplarily, a physical page is generally 4KB, that is, the virtual-to-physical address mapping relationship changes every 4KB. The mapping relationship between the virtual address and the physical address can be set. For example, the virtual:physical address mapping relationship is 0 - 3999:10000 - 13999, 4000 - 7999:70000 - 73999.

[0056] Exemplarily, a first physical address is determined based on the virtual address of the first training data, the target virtual address offset, and the mapping relationship between the virtual address and the physical address. Specifically, first, an offset virtual address is determined based on the virtual address of the first training data and the target virtual address offset. Then, based on the mapping relationship between the virtual address and the physical address and the offset virtual address, an offset physical address that matches the offset virtual address is determined. Finally, the offset physical address is used as the first physical address. A physical page is generally 4KB. Assume that the virtual address of the first training data is 3996 and the target virtual address offset is 10. Then, the virtual address of the first training data plus the target virtual address offset is 4006, that is, the virtual address for the next access should be 4006. According to the mapping relationship between the virtual address and the physical address, the physical address for the next access can be obtained as 70006, that is, the first physical address is 70006.

[0057] Exemplarily, virtual addresses are generally continuous and are not isolated in units of pages like physical addresses due to physical page partitioning. Therefore, using virtual addresses for training can ensure the continuity of address offset training, thereby enabling cross-physical-page prefetching. Specifically, using the virtual addresses of the first training data to train the virtual address offsets in the first offset list can not only expand the offset list but also eliminate the need to determine whether the first physical address spans pages.

[0058] In summary, in the embodiments of the present application, by calculating the scores corresponding to each virtual address offset based on the virtual addresses of the first training data and the virtual address offsets in the first offset list, a first offset score list is obtained. Since virtual addresses are continuous, the virtual addresses determined based on the virtual addresses of the first training data and the target virtual address offsets selected from the first offset score list and matching the first physical address are continuous, that is, there is no cross-page problem. Thus, the second prefetch data can be prefetched based on the first physical address to handle the cross-page problem and increase the probability of successful data prefetching.

[0059] Figure 4 is a specific step flowchart of a method for predicting prefetch data provided by an embodiment of the present application. As Figure 4 shown, the method may include:

[0060] Step 201, receive a memory access request sent by a first-level cache, obtain the stored data in a second-level cache, and determine the first training data in the second-level cache according to the comparison result between the memory access data corresponding to the memory access request and the stored data; the first training data includes first missing data that is missing and first prefetch data that is stored; the first missing data is the data missing from the memory access data in the second-level cache; the first prefetch data is the data added to the second-level cache by a historical prefetch operation.

[0061] This step may specifically refer to the above step 101 and will not be elaborated here.

[0062] Optionally, each stored data in the second-level cache has a corresponding field; the field is used to characterize the source of the stored data; step 201 may specifically include:

[0063] Sub-step 2011, find the target stored data that matches the memory access data from the stored data;

[0064] Sub-step 2012, if the field of the target stored data is a preset field, use the target stored data as the first training data; the preset fields include: a field for characterizing prefetch data and a field for characterizing missing data.

[0065] For sub-step 2011 - sub-step 2012, there will be a source field in the secondary cache to indicate where the data comes from. For example, the values of the source field include: memload, L2bop. Among them, the memload field is used to indicate that the data comes from a normal data fetch, and L2bop is used to indicate that the data is prefetched from the secondary cache normally. For example, the stored data in the secondary cache includes: 1, 2, 3, 4. Among them, the fields corresponding to data 1, 2, 3 are all the memload field, and the field corresponding to data 4 is the L2bop field. It should be noted that data 1, 2, 3 are the data stored in the secondary cache itself, and data 4 is the data prefetched by the secondary cache.

[0066] Exemplarily, the memory access data includes: 1, 2, 3, 4, 5. The target stored data that matches the memory access data is found from the stored data 1, 2, 3, 4, that is: 1, 2, 3, 4. Since the field of data 4 is the L2bop field, data 4 is used as the first prefetched data.

[0067] Step 202: Extract the virtual address of the first training data from the memory access request, and calculate the score corresponding to each virtual address offset according to the virtual address of the first training data and the virtual address offsets included in the first offset list, to obtain a first offset score list including the virtual address offsets and the scores corresponding to the virtual address offsets.

[0068] This step can specifically refer to the above step 102 and will not be elaborated here.

[0069] Optionally, step 202 may specifically include:

[0070] Sub-step 2021: Subtract the virtual address offset from the virtual address of the first training data to obtain the offset virtual address corresponding to the virtual address;

[0071] Sub-step 2022: If the offset virtual address is recorded in the request list, update the score of the virtual address offset in the first offset list output by the previous round of calculation operations by adding a preset value, and output the updated first offset list of the current round to the next round; the request list is used to record the virtual addresses that have been accessed within a preset time interval;

[0072] Sub-step 2023: If the offset virtual address is not recorded in the request list, ignore it;

[0073] Sub-step 2024: Loop through sub-steps 2021 to 2023. When the number of times of the calculation operation exceeds a preset number of rounds, stop the calculation operation, and obtain the first offset score list according to the scores calculated for each of the virtual address offsets in the preset number of rounds; or, when the highest score in the first offset score list exceeds a second threshold, stop the calculation operation, and obtain the first offset score list according to the scores calculated for each of the virtual address offsets in the last iteration.

[0074] For sub-steps 2021 - 2024, taking the virtual address offset as 10 and the preset value as 1 as an example, subtract the virtual address offset 10 from the virtual address 3996 of the first training data to obtain the offset virtual address 3986 corresponding to the virtual address. If the offset virtual address is recorded in the request list, obtain the score of the virtual address offset 10 in the first offset list output by the previous round of calculation operation. If the score of the virtual address offset 10 in the first offset list output by the previous round of calculation operation is 2, then add the preset value 1 to this score 2 to update the score corresponding to the virtual address offset 10 in the first offset list of the current round, update it to 3, and output the updated first offset list to the next round.

[0075] For example, if the offset virtual address 3986 is not recorded in the request list, it is ignored, and the score of the virtual address offset 3996 in the first offset list is not updated in this round. Taking the preset number of rounds as 10 times as an example, one round means that all offsets are trained once. When the number of times of the calculation operation exceeds 10 times, stop the calculation operation, and obtain the first offset score list according to the scores calculated for each virtual address offset in the 10th time.

[0076] For example, taking the second threshold as 2, if the offset virtual address 3986 is not recorded in the request list, it is ignored. If the highest score in the first offset score list exceeds 2, stop the calculation operation, and obtain the first offset score list according to the scores calculated for each of the virtual address offsets in the last iteration.

[0077] Step 203: Determine the virtual address offset with the highest score in the first offset score list as the target virtual address offset.

[0078] For example, in the first offset score list, the score corresponding to each virtual address offset indicates the access pattern of the virtual offset address within a preset time. The virtual address offset with the highest score indicates the highest access frequency of the virtual offset address corresponding to this virtual address. Therefore, determining the virtual address offset with the highest score in the first offset score list as the target virtual address offset can increase the accuracy of virtual address offset selection.

[0079] Step 204: Add the virtual address of the first training data to the target virtual address offset to obtain the virtual address of the prefetch data.

[0080] Exemplarily, assume that the virtual address of the first training data is 3996 and the target virtual address offset is 10. Then, adding the virtual address of the first training data to the target virtual address offset gives 4006. That is, the virtual address of the prefetch data is 4006.

[0081] Step 205: According to the mapping relationship between the virtual address and the physical address, obtain the physical address of the prefetch data that matches the virtual address of the prefetch data, determine the physical address of the prefetch data as the first physical address, and use the data corresponding to the first physical address as the predicted second prefetch data for subsequent access requests.

[0082] Exemplarily, the mapping relationship between the virtual address and the physical address is 0 - 3999: 10000 - 13999, 4000 - 7999: 70000 - 73999. Then, the physical address of the prefetch data that matches the virtual address 4006 of the prefetch data is 70006. Use the data corresponding to the physical address 70006 as the predicted second prefetch data for subsequent access requests.

[0083] Optionally, after step 205, the method further includes:

[0084] Step A: Update the virtual address of the first training data in the request list; the request list is used to record the virtual addresses that have been accessed within a preset time interval.

[0085] Exemplarily, after determining the physical address corresponding to the predicted second prefetch data for subsequent access requests, add the virtual address 3996 of the first training data to the request list.

[0086] Optionally, the method further includes:

[0087] Step 206: Extract the physical address of the first training data from the memory access request, and calculate the score corresponding to each physical address offset according to the physical address of the first training data and the physical address offsets included in the second offset list, to obtain a second offset score list including the physical address offsets and the scores corresponding to the physical address offsets;

[0088] Step 207: Select the target physical address offset from the second offset score list according to the score, and add the physical address of the first training data and the target physical address offset to obtain the second physical address;

[0089] Step 208: If the second physical address and the physical address of the first training data are not in the same page table, enter the step of selecting a target virtual address offset according to the scores from the first offset score list.

[0090] For steps 206 - 208, the physical address offsets included in the second offset list can be preset. For example, the range of the physical address offset can be [-32, 31]. Specifically, it can be (-32, -30, -27, 10,... 27, 30).

[0091] Exemplarily, currently when training using the physical address of the first training data and the virtual address of the first training data, there will be an overlap between the first offset list and the second offset list. Therefore, there will be a certain overlap in the short distance during the training process. To ensure the continuity of training, when training using the physical address of the first training data and the virtual address of the first training data, their respective offset lists are still used. When the second physical address and the physical address of the first training data are not in the same page table, that is, when a cross-page situation occurs, the first physical address is used for prefetching. Because the physical address of the first training data must be trained before the virtual address of the first training data, a signal indicating whether there is a cross-page can be obtained in advance. When receiving the cross-page signal, enter the step of selecting a target virtual address offset according to the scores from the first offset score list. Using the first physical address for prefetching can maximize the prefetch coverage rate.

[0092] Exemplarily, taking the physical address of the first training data as 13996, according to the physical address of the first training data and the physical address offsets included in the second offset list, calculate the scores corresponding to each physical address offset to obtain the second offset score list. From the second offset score list, take the physical address offset with the highest score as the target physical address offset. If the target physical address offset is 10, then add the physical address 13996 of the first training data and the target physical address offset 10 to get the second physical address 14006.

[0093] Exemplarily, since the second physical address 14006 and the physical address 13996 of the first training data are not in the same page table, enter the step of selecting a target virtual address offset according to the scores from the first offset score list. That is to say, when a cross-page occurs in the second physical address, the virtual address offsets in the first offset list are trained by the virtual address of the first training data, and the first physical address obtained from the training is used for prefetching.

[0094] Optionally, the method further includes:

[0095] Step 209: If the second physical address and the physical address of the first training data are in the same page table, and it is necessary to prefetch the data corresponding to the first physical address and the second physical address from the tertiary cache simultaneously, then preferentially prefetch the data corresponding to the second physical address from the tertiary cache.

[0096] Exemplarily, if the second physical address and the physical address of the first training data are in the same page table, it indicates that the second physical address obtained by training with the physical address of the first training data does not cross pages, and the data corresponding to the second physical address can be prefetched. If it is necessary to prefetch the data corresponding to the first physical address and the second physical address from the tertiary cache simultaneously, then preferentially prefetch the data corresponding to the second physical address from the tertiary cache. The prefetch method combining virtual address and physical address proposed in this application, that is, using the physical address of the first training data to train a smaller second offset list, has a short training period, can quickly learn patterns with a small stride and generate prefetch, so as to initiate timely prefetch, and using the virtual address of the first training data to train a complete first offset list, has a long training period, and can learn longer address access patterns. Combining the two can fully learn the characteristics of short and long address access patterns and maximize the timeliness issue.

[0097] Optionally, the method further includes:

[0098] Step 210: If the scores in the second offset score list are all lower than the first threshold, then stop entering the step of selecting the target physical address offset according to the scores from the second offset score list.

[0099] Exemplarily, currently when training with the physical address of the first training data and the virtual address of the first training data, there will be an overlap between the first offset list and the second offset list. Therefore, there will be a certain overlap in the short distance during the training process. To ensure the continuity of training, when training with the physical address of the first training data and the virtual address of the first training data, their respective offset lists are still used. When the scores in the second offset score list are all lower than the first threshold, that is, it is shut down, then the first physical address is used for prefetch. Because training with the physical address of the first training data must be completed earlier than training with the virtual address of the first training data, the signal of whether to shut down can be obtained in advance. When receiving the shutdown signal, stop entering the step of selecting the target physical address offset according to the scores from the second offset score list, and use the first physical address for prefetch, which can maximize the prefetch coverage rate.

[0100] Exemplarily, to ensure the continuity of training, the values in the first offset list that are repeated in the second offset list can be deleted. For example, the physical address offset in the second offset list can be set to [-32, 31], and the virtual address offset in the first offset list can be set to [-256, -20] ∪ [20, 250]. This solution is simple to implement.

[0101] Optionally, the method further includes:

[0102] Step 211: Obtain the data corresponding to the first physical address from the tertiary cache and store the data corresponding to the first physical address in the secondary cache.

[0103] Exemplarily, after obtaining the first physical address, a prefetch request can be sent to the tertiary cache to obtain the data corresponding to the first physical address from the tertiary cache and store the data corresponding to the first physical address in the secondary cache.

[0104] In summary, in the embodiments of the present application, by calculating the score corresponding to each virtual address offset according to the virtual address of the first training data for the virtual address offsets in the first offset list, a first offset score list is obtained. Since the virtual addresses are continuous, therefore, the virtual addresses determined according to the virtual address of the first training data and the target virtual address offset selected from the first offset score list and matching the first physical address are continuous, that is, there is no cross-page problem. Thus, the second prefetch data can be prefetched according to the first physical address to handle the cross-page problem, increasing the probability of successful data prefetch.

[0105] Figure 5 is a flowchart of steps for virtual address training and prefetch provided by an embodiment of the present application. As Figure 5 shown, the method may include:

[0106] Step M1: Obtain the virtual address of the first training data;

[0107] Step M2: Subtract the currently tested virtual address offset from the virtual address of the first training data to obtain an offset virtual address;

[0108] Step M3: Determine whether the offset virtual address is recorded in the request list.

[0109] Step M4: If the offset virtual address is recorded in the request list, increment the score corresponding to the currently tested virtual address offset by one and record it in the offset score list.

[0110] Step M5: If the offset virtual address is not recorded in the request list, the score corresponding to the currently tested virtual address offset remains unchanged.

[0111] Step M6. When the maximum score in the offset score list reaches the threshold or after N rounds of training are completed, obtain the target virtual address offset.

[0112] Step M7. Add the first training data virtual address to the target virtual address offset to obtain the offset virtual address;

[0113] Step M8. Determine whether the offset virtual address can be converted into an offset physical address;

[0114] Step M9. If the offset virtual address can be converted into an offset physical address, determine the offset physical address as the first physical address, send a prefetch request to the tertiary cache, and store the data corresponding to the obtained first physical address in the secondary cache;

[0115] Step M10. Update the first training data virtual address in the request list;

[0116] Step M11. If the offset virtual address cannot be converted into an offset physical address, no prefetch is performed.

[0117] Figure 6 It is a flowchart of steps for joint training and prefetching of virtual addresses and physical addresses provided by an embodiment of the present application. As Figure 6 shown, the method may include:

[0118] Step N1. Obtain the virtual address and physical address of the first training data;

[0119] Step N2. Perform training and prefetching using the virtual address of the first training data to generate an offset virtual address, and obtain the first physical address after conversion. Perform training and prefetching using the physical address of the first training data to generate the second physical address.

[0120] Step N3. If prefetch requests are initiated simultaneously, preferentially prefetch the data corresponding to the second physical address, and discard the prefetch request for the first physical address.

[0121] Figure 7 It is a block diagram of a prefetch data prediction device 30 provided by an embodiment of the present application. The device includes:

[0122] A first determination module 301, configured to receive a memory access request sent by a primary cache, obtain the stored data in the secondary cache, and determine the first training data in the secondary cache according to the comparison result between the memory access data corresponding to the memory access request and the stored data; the first training data includes first missing data that is missing and first prefetch data that is stored; the first missing data is the data missing from the memory access data in the secondary cache; the first prefetch data is the data added to the secondary cache by a historical prefetch operation;

[0123] The first calculation module 302 is configured to extract the virtual address of the first training data from the memory access request, and calculate the score corresponding to each virtual address offset according to the virtual address of the first training data and the virtual address offsets included in the first offset list, so as to obtain a first offset score list including the virtual address offsets and the scores corresponding to the virtual address offsets;

[0124] The second determination module 303 is configured to select a target virtual address offset from the first offset score list according to the score, and determine a first physical address according to the virtual address of the first training data, the target virtual address offset, and the mapping relationship between the virtual address and the physical address, and use the data corresponding to the first physical address as the predicted second prefetch data for subsequent access requests.

[0125] Optionally, each stored data in the secondary cache has a corresponding field; the field is used to characterize the source of the stored data; the first determination module includes:

[0126] The first determination sub-module is configured to find target stored data that matches the memory access data from the stored data;

[0127] The second determination sub-module is configured to, if the field of the target stored data is a preset field, use the target stored data as the first training data; the preset fields include: a field for characterizing prefetch data and a field for missing data.

[0128] Optionally, the first calculation module includes:

[0129] The execution sub-module is configured to perform multiple rounds of calculation operations to obtain a first offset score list including the virtual address offsets and the scores corresponding to the virtual address offsets;

[0130] Each round of calculation operation includes:

[0131] The subtraction sub-module is configured to subtract the virtual address offset from the virtual address of the first training data to obtain an offset virtual address corresponding to the virtual address;

[0132] The update sub-module is configured to, if the offset virtual address is recorded in the request list, update the score of the virtual address offset in the first offset list output by the previous round of calculation operation by adding a preset value, and output the first offset list updated in the current round to the next round; the request list is used to record the virtual addresses that have been accessed within a preset time interval;

[0133] The ignore sub-module is configured to ignore if the offset virtual address is not recorded in the request list.

[0134] Optionally, the second determination module includes:

[0135] A third determination sub-module, configured to determine, as the target virtual address offset, the virtual address offset with the highest score in the first offset score list;

[0136] An addition sub-module, configured to add the virtual address of the first training data to the target virtual address offset to obtain the virtual address of the prefetch data;

[0137] A fourth determination sub-module, configured to obtain, according to the mapping relationship between the virtual address and the physical address, the physical address of the prefetch data that matches the virtual address of the prefetch data, and determine the physical address of the prefetch data as the first physical address.

[0138] Optionally, the apparatus further includes:

[0139] A second calculation module, configured to extract the physical address of the first training data from the memory access request, and calculate, according to the physical address of the first training data and the physical address offsets included in the second offset list, the score corresponding to each physical address offset, to obtain a second offset score list including the physical address offsets and the scores corresponding to the physical address offsets;

[0140] An addition module, configured to select, from the second offset score list, a target physical address offset according to the score, and add the physical address of the first training data to the target physical address offset to obtain a second physical address;

[0141] A first judgment module, configured to, if the second physical address and the physical address of the first training data are not in the same page table, enter the step of selecting, from the first offset score list, a target virtual address offset according to the score.

[0142] Optionally, the apparatus further includes:

[0143] A prefetch module, configured to, if the second physical address and the physical address of the first training data are in the same page table, and it is necessary to prefetch the data corresponding to the first physical address and the second physical address from the tertiary cache at the same time, preferentially prefetch the data corresponding to the second physical address from the tertiary cache.

[0144] Optionally, the apparatus further includes:

[0145] A stop module, configured to, if the scores in the second offset score list are all lower than a first threshold, stop entering the step of selecting, from the second offset score list, a target physical address offset according to the score.

[0146] Optionally, the execution sub-module includes:

[0147] An obtaining module, configured to stop the calculation operation when the number of times of the calculation operation exceeds a preset number of rounds, and obtain the first offset score list according to the scores calculated for each virtual address offset in the preset number of rounds;

[0148] Or, configured to stop the calculation operation when the highest score in the first offset score list exceeds a second threshold, and obtain the first offset score list according to the scores calculated for each virtual address offset in the last sequence.

[0149] Optionally, the apparatus further includes:

[0150] An updating module, configured to update the virtual address of the first training data in a request list; the request list is used to record virtual addresses that have been accessed within a preset time interval.

[0151] Optionally, the apparatus further includes:

[0152] A storage module, configured to obtain data corresponding to the first physical address from a tertiary cache and store the data corresponding to the first physical address in the secondary cache

[0153] In summary, in the embodiments of the present application, by calculating the scores corresponding to each virtual address offset for the virtual address offsets in the first offset list according to the virtual address of the first training data, a first offset score list is obtained. Since the virtual addresses are consecutive, therefore, the virtual addresses determined to match the first physical address according to the virtual address of the first training data and the target virtual address offset selected from the first offset score list are consecutive, that is, there is no cross-page problem. Thus, the second prefetch data can be prefetched according to the first physical address to handle the cross-page problem, increasing the probability of successful data prefetch.

[0154] For the apparatus embodiments, since they are basically similar to the method embodiments, the description is relatively simple. For the relevant parts, please refer to the partial description of the method embodiments.

[0155] Each embodiment in this specification is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other.

[0156] Regarding the apparatus in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated herein.

[0157] An embodiment of the present application provides a prediction device for prefetching data, including a memory and more than one program, where the more than one program is stored in the memory and configured to be executed by more than one processor. The more than one program includes instructions for performing the methods described in the above one or more embodiments.

[0158] Figure 8 FIG. 400 is a block diagram of an electronic device 400 shown according to an exemplary embodiment. For example, the electronic device 400 can be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0159] Referring to Figure 8 , the electronic device 400 may include one or more of the following components: a processing component 402, a memory 404, a power supply component 406, a multimedia component 408, an audio component 410, an input / output (I / O) interface 412, a sensor component 414, and a communication component 416.

[0160] The processing component 402 generally controls the overall operation of the electronic device 400, such as operations associated with display, telephone calls, data communication, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to complete all or part of the steps of the above methods. In addition, the processing component 402 may include one or more modules to facilitate the interaction between the processing component 402 and other components. For example, the processing component 402 may include a multimedia module to facilitate the interaction between the multimedia component 408 and the processing component 402.

[0161] The memory 404 is used to store various types of data to support the operation of the electronic device 400. Examples of such data include instructions for any application or method operating on the electronic device 400, contact data, phone book data, messages, pictures, multimedia, etc. The memory 404 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disk.

[0162] The power supply component 406 provides power to various components of the electronic device 400. The power supply component 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 400.

[0163] The multimedia component 408 includes a screen that provides an output interface between the electronic device 400 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can sense not only the boundaries of touch or swipe actions but also detect the duration and pressure associated with the touch or swipe operation. In some embodiments, the multimedia component 408 includes a front camera and / or a rear camera. When the electronic device 400 is in an operating mode, such as a shooting mode or a multimedia mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.

[0164] The audio component 410 is configured to output and / or input audio signals. For example, the audio component 410 includes a microphone (MIC) that is used to receive external audio signals when the electronic device 400 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 404 or transmitted via the communication component 416. In some embodiments, the audio component 410 further includes a speaker for outputting audio signals.

[0165] The I / O interface 412 provides an interface between the processing component 402 and a peripheral interface module, and the peripheral interface module can be a keyboard, a click wheel, buttons, etc. These buttons can include but are not limited to: a home button, a volume button, a power button, and a lock button.

[0166] The sensor component 414 includes one or more sensors for providing an assessment of the various aspects of the state of the electronic device 400. For example, the sensor component 414 can detect the on / off state of the electronic device 400, the relative positioning of components, such as the display and the keypad of the electronic device 400. The sensor component 414 can also detect a change in the position of the electronic device 400 or a component of the electronic device 400, the presence or absence of user contact with the electronic device 400, the orientation or acceleration / deceleration of the electronic device 400, and the temperature change of the electronic device 400. The sensor component 414 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor component 414 can also include a light sensor, such as a CMOS or a CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 414 can further include an acceleration sensor, a gyro sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0167] The communication component 416 facilitates communication between the electronic device 400 and other devices in a wired or wireless manner. The electronic device 400 can access a communication standard-based wireless network, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 416 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0168] In an exemplary embodiment, the electronic device 400 can be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to implement the methods provided in the embodiments of the present application.

[0169] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 404 including instructions, and the above instructions can be executed by a processor 420 of the electronic device 400 to complete the above methods. For example, the non-transitory storage medium can be a ROM, Random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0170] Figure 9 is a block diagram of an electronic device 500 shown according to an exemplary embodiment. For example, the electronic device 500 can be provided as a server. Referring to Figure 9 , the electronic device 500 includes a processing component 522, which further includes one or more processors, and memory resources represented by a memory 532 for storing instructions executable by the processing component 522, such as application programs. The application programs stored in the memory 532 can include one or more modules each corresponding to a set of instructions. In addition, the processing component 522 is configured to execute instructions to perform the methods provided in the embodiments of the present application.

[0171] The electronic device 500 may further include a power supply component 526 configured to perform power management of the electronic device 500, a wired or wireless network interface 550 configured to connect the electronic device 500 to a network, and an input / output (I / O) interface 558. The electronic device 500 may operate based on an operating system stored in the memory 532, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSD TM or the like.

[0172] An embodiment of the present application also provides a computer program product, including a computer program which, when executed by a processor, implements the method described in the above embodiment.

[0173] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the application disclosed herein. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include known common knowledge or conventional technical means in the technical field not disclosed in the present disclosure. The specification and embodiments are only to be considered as exemplary, and the true scope and spirit of the present application are pointed out by the following claims.

[0174] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.

Claims

1. A method for predicting pre-fetched data, characterized in that: The method comprises: Receive a memory access request sent by a first-level cache, and obtain stored data in a second-level cache, and determine first training data in the second-level cache according to a comparison result between the memory access data corresponding to the memory access request and the stored data; the first training data includes first missing data that has been missing and first pre-fetched data that has been stored; the first missing data is data that is missing from the memory access data in the second-level cache; the first pre-fetched data is data added to the second-level cache by a historical pre-fetch operation; Extracting a virtual address of the first training data from the memory access request, and calculating a score corresponding to each virtual address offset according to the virtual address of the first training data and the virtual address offsets included in the first offset list, to obtain a first offset score list including the virtual address offsets and the scores corresponding to the virtual address offsets; From the first offset score list, a target virtual address offset is selected according to the score, and a first physical address is determined according to the virtual address of the first training data, the target virtual address offset, and a mapping relationship between the virtual address and the physical address, and data corresponding to the first physical address is used as second prefetched data for prediction of subsequent access requests.

2. The method according to claim 1, characterized in that: Each stored data in the secondary cache has a one-to-one corresponding field; the field is used to characterize the source of the stored data; The determining, according to a comparison result between the memory access data corresponding to the memory access request and the stored data, the first training data in the secondary cache comprises: Finding target stored data matching the accessed data from the stored data; If the field of the target stored data is a preset field, the target stored data is used as the first training data; the preset field includes: a field for representing pre-fetched data and a field for missing data.

3. The method according to claim 1, characterized in that The step of calculating the score corresponding to each virtual address offset according to the virtual address of the first training data and the virtual address offset included in the first offset list, and obtaining a first offset score list including the virtual address offset and the score corresponding to the virtual address offset, comprises: Perform multiple rounds of calculation operations to obtain a first offset score list including virtual address offsets and scores corresponding to the virtual address offsets; Each round of calculation operations includes: Subtract the virtual address offset from the virtual address of the first training data to obtain an offset virtual address corresponding to the virtual address; If the offset virtual address is recorded in the request list, the score of the virtual address offset in the first offset list output by the previous round of calculation operation is added with a preset value for update, and the first offset list updated in the current round is output to the next round; the request list is used to record the virtual addresses that have been visited within a preset time interval; If the offset virtual address is not recorded in the request list, it is ignored.

4. The method according to claim 1, characterized in that: The step of selecting a target virtual address offset from the first offset score list according to a score, and determining a first physical address according to the virtual address of the first training data, the target virtual address offset, and a mapping relationship between a virtual address and a physical address includes: Determine the virtual address offset with the highest score in the first offset score list as the target virtual address offset; Adding the virtual address of the first training data to the target virtual address offset to obtain the virtual address of the pre-fetched data; According to the mapping relationship between the virtual address and the physical address, a physical address of the pre-fetched data matching the virtual address of the pre-fetched data is obtained, and the physical address of the pre-fetched data is determined as the first physical address.

5. The method according to claim 1, characterized in that The method further comprises: Extracting the physical address of the first training data from the memory access request, and calculating the score corresponding to each physical address offset according to the physical address of the first training data and the physical address offset included in the second offset list, to obtain a second offset score list including the physical address offset and the score corresponding to the physical address offset; Selecting a target physical address offset from the second offset score list according to the score, and adding the physical address of the first training data and the target physical address offset to obtain a second physical address; If the second physical address and the physical address of the first training data are not in the same page table, the step of selecting the target virtual address offset according to the score from the first offset score list is entered.

6. The method according to claim 5, characterized in that The method further comprises: If the second physical address and the physical address of the first training data are in the same page table, and the data corresponding to the first physical address and the second physical address need to be pre-fetched from the third-level cache at the same time, the data corresponding to the second physical address is preferentially pre-fetched from the third-level cache.

7. The method according to claim 5, characterized in that The method further comprises: If the scores in the second offset score list are all lower than the first threshold, the process stops and proceeds to the step of selecting the target physical address offset according to the scores from the second offset score list.

8. The method according to claim 3, characterized in that The performing of multiple rounds of calculation operations to obtain a first offset score list including a virtual address offset and a score corresponding to the virtual address offset includes: When the number of the calculation operation exceeds a preset round, the calculation operation is stopped, and the first offset score list is obtained according to the score calculated for each of the virtual address offsets in the preset round; Alternatively, when the highest score in the first offset score list exceeds the second threshold, the calculation operation is stopped, and the first offset score list is obtained according to the scores finally calculated for each of the virtual address offsets in sequence.

9. The method according to claim 1, characterized in that: After determining the first physical address according to the virtual address of the first training data, the target virtual address offset, and the mapping relationship between the virtual address and the physical address, the method further includes: The virtual address of the first training data is updated in a request list; the request list is used to record the virtual addresses that have been accessed within a preset time interval.

10. The method according to claim 1, characterized in that The method further comprises: Data corresponding to the first physical address is obtained from the third-level cache, and the data corresponding to the first physical address is stored in the second-level cache.

11. A prediction device for prefetching data, characterized in that: The device comprises: A first determination module is used to receive a memory access request sent by a first-level cache, obtain stored data in a second-level cache, and determine first training data in the second-level cache according to a comparison result between the memory access data corresponding to the memory access request and the stored data; the first training data includes first missing data that has been missing and first pre-fetched data that has been stored; the first missing data is data that is missing from the memory access data in the second-level cache; the first pre-fetched data is data added to the second-level cache by a historical pre-fetch operation; a first calculation module, configured to extract a virtual address of first training data from the memory access request, and calculate a score corresponding to each virtual address offset according to the virtual address of the first training data and the virtual address offset included in the first offset list, so as to obtain a first offset score list including the virtual address offset and the score corresponding to the virtual address offset; The second determination module is used to select a target virtual address offset from the first offset score list according to the score, and determine the first physical address according to the virtual address of the first training data, the target virtual address offset, and the mapping relationship between the virtual address and the physical address, and use the data corresponding to the first physical address as the second pre-fetched data for predicting a subsequent access request.

12. An electronic device, characterized in that: include: processor; A memory for storing the processor executable instructions; wherein the processor is configured to execute the instructions to implement the method according to any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the method as claimed in any one of claims 1 to 10.

Citation Information

Patent Citations

  • Prefetching method, information processing device, device and storage medium

    CN112416817A

  • Page table prediction method, storage access operation method, electronic device and electronic equipment

    CN115292214A