Memory data pre-fetching method, device, electronic device and readable storage medium
By building a conflict probability prediction model and a dynamic sorting strategy, the data access of multiple storage unit groups is optimized, which solves the problem of high data access delay in the traditional prefetch strategy and improves memory performance.
Patent Information
- Application Number
- CN202410910453.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-09
AI Technical Summary
Traditional memory prefetching strategies fail to fully utilize the potential of parallel processing of multiple storage unit groups, resulting in high data access latency and affecting system performance.
Construct a storage unit group conflict probability prediction model, combine it with the dynamic reordering prefetch method, predict the access conflicts of subsequent data blocks through machine learning algorithms, optimize the distribution and access sequence of data in multiple storage unit groups, reduce conflicts, and improve prefetching efficiency.
It significantly reduces access conflicts in multi-storage unit group systems, improves data prefetch efficiency and memory bandwidth utilization, and ensures system performance optimization.
Smart Images

Figure CN118467408B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a memory data pre-fetching method, device, electronic device and readable storage medium. Background Art
[0002] Memory is the core component responsible for storing data in a computer system. It provides necessary data support for the execution of all programs. In modern computer systems, dynamic random access memory (DRAM) is the main memory component, and its performance directly affects the operating efficiency of the entire system. Modern DRAM adopts a multi-bank design to improve data throughput. The multi-bank design allows multiple data access requests to be made simultaneously, reducing waiting time and improving memory access speed. However, traditional prefetching strategies usually only operate on a single bank and fail to fully utilize the potential of multi-bank parallel processing. Therefore, it is particularly important to study and develop prefetching strategies that can adapt to multi-bank parallel operations. Summary of the invention
[0003] The problem solved by the present invention is to provide a memory data pre-fetching method, device, electronic device and readable storage medium, which significantly reduces data access delay and improves system performance by building a machine learning model combined with a dynamic reordering multi-strategy pre-fetching method.
[0004] In order to solve the above problems, the present invention provides a method for reading memory data, comprising:
[0005] Construct a storage unit group conflict probability prediction model and output conflict probability prediction data;
[0006] According to the key operation data of the hardware, a memory monitoring module is constructed to output monitoring data, wherein the monitoring data is used to construct the conflict probability prediction model;
[0007] When the first CPU core detects repeated access to a certain data block, it predicts subsequent data blocks according to the conflict probability prediction model;
[0008] The first CPU core generates a prefetch request, wherein the prefetch request includes the subsequent data block address;
[0009] The pre-fetch request retrieves the subsequent data block data in the private cache space of the second CPU core in the upper DRAM memory space through the memory controller of the first CPU core;
[0010] The subsequent data block address is updated to the private cache space of the first CPU core through the DRAM controller.
[0011] Before prefetching data, a data distribution scheme is constructed so that the data to be prefetched is evenly distributed in different storage unit groups;
[0012] Sorting the pre-fetch access sequence according to the current conflict probability prediction data and the monitoring data;
[0013] Every T time, the pre-fetch access order is reordered according to the current conflict probability prediction data and the monitoring data.
[0014] Optionally, the conflict probability prediction model is constructed by a machine learning algorithm; wherein the machine learning algorithm includes a recurrent neural network algorithm.
[0015] Optionally, the conflict probability prediction model extracts features through the following data: the periodic access pattern, access burstiness, access density, data locality, access sequence, access interval time, and access pattern entropy of the storage unit group; and the hit rate improvement data and delay reduction data after pre-fetching the data.
[0016] Optionally, the conflict probability prediction model also includes a storage unit group outlier detection mechanism.
[0017] Optionally, the data distribution scheme is implemented based on a graph theory clustering method of a genetic algorithm.
[0018] Optionally, the step of sorting the pre-fetch access order according to the current conflict probability prediction data and the monitoring data further includes: marking the storage unit group with a higher conflict shown by the conflict probability prediction data as a low priority.
[0019] Optionally, the step of sorting the pre-fetch access sequence according to the current conflict probability prediction data and the monitoring data further includes: preferentially pre-fetching storage unit groups for which the conflict probability prediction data indicates a lower conflict.
[0020] Optionally, the monitoring module is stored in a hardware module that can execute the monitoring instruction.
[0021] Optionally, the monitoring module tracks memory controller data in real time, including: bus bandwidth utilization data, storage unit group load data.
[0022] Optionally, the conflict probability prediction model is implemented using hardware, and the hardware includes: a hardware accelerator or FPGA.
[0023] The present invention also provides a memory data pre-fetching device, the device comprising:
[0024] A storage unit group conflict probability prediction module, used to output conflict probability prediction data; wherein the conflict probability prediction module constructs a conflict probability prediction model, and the model extracts features through the following data: the storage unit group periodic access mode, access burstiness, access density, data locality, access sequence, access interval time, access pattern entropy; the hit rate improvement data and delay reduction data after pre-fetching data;
[0025] A memory monitoring module, used to output monitoring data; the monitoring data includes: bus bandwidth utilization data, storage unit group load data;
[0026] A data distribution control module is used to construct a data distribution scheme so that the data to be pre-fetched is evenly distributed in different storage unit groups;
[0027] The data pre-fetch module is used to sort the pre-fetch access sequence according to the current conflict probability prediction data and the monitoring data.
[0028] The present invention also provides an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement any one of the above methods.
[0029] The present invention also provides a computer-readable storage medium. When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute any one of the above methods.
[0030] Compared with the prior art, the technical solution of the embodiment of the present invention has the following advantages:
[0031] In the technical solution of the implementation mode of the present invention, a conflict probability prediction model is constructed by applying an algorithm to the storage unit group, combined with a dynamic reordering prefetch strategy. Specifically, the data only changes the address inside the DRAM, and there is no need to update the data between registers between the CPU network, which significantly reduces the access conflicts in the system of multiple storage unit groups and improves the data prefetching efficiency and the effective utilization of memory bandwidth. In addition, the algorithm is implemented through hardware and works in conjunction with the existing memory management system to ensure smooth system integration and performance optimization. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is a flow chart of a method for pre-fetching memory data provided by an embodiment of the present invention;
[0033] Figure 2 A schematic diagram of a memory data pre-fetching device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the embodiments in the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0035] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0036] refer to Figure 1 , Figure 1 A flow chart of a method for prefetching memory data provided by an embodiment of the present invention.
[0037] The method for reading memory data comprises:
[0038] Step S1: constructing a storage unit group conflict probability prediction model based on memory access record data, and outputting conflict probability prediction data;
[0039] Step S2: constructing a memory monitoring module according to the key hardware operation data, and outputting monitoring data, wherein the monitoring data is used to construct the conflict probability prediction model;
[0040] Step S3: when the first CPU core detects repeated access to a certain data block, predicting subsequent data blocks according to the conflict probability prediction model;
[0041] Step S4: the first CPU core generates a pre-fetch request, wherein the pre-fetch request includes the address of the subsequent data block;
[0042] Step S5: the pre-fetch request retrieves the subsequent data block data in the private cache space of the second CPU core in the upper DRAM memory space through the memory controller of the first CPU core;
[0043] Step S6: updating the subsequent data block address to the private cache space of the first CPU core through the DRAM controller;
[0044] Step S7: before pre-fetching data, construct a data distribution scheme so that the data to be pre-fetched is evenly distributed in different storage unit groups;
[0045] Step S8: sorting the pre-fetch access sequence according to the current conflict probability prediction data and the monitoring data;
[0046] Step S9: every T time, reorder the pre-fetch access order according to the current conflict probability prediction data and the monitoring data.
[0047] It should be noted that, in the embodiment of the present invention, the step S1 and the step S2 are performed in no particular order in the memory data pre-fetching method. The step S1 and the step S2 are always in operation during the entire memory data pre-fetching process.
[0048] In the solution of the embodiment of the present invention, the memory space is equivalent to the global storage shared by each CPU node, and each CPU core is configured with an independent private cache space. The data address is only changed inside the DRAM, and there is no need to update the data between the registers between the CPU network, which greatly improves the pre-fetching efficiency.
[0049] Specifically, in an embodiment of the present invention, the conflict probability prediction model is constructed by a machine learning algorithm; wherein the machine learning algorithm includes a recurrent neural network algorithm. The recurrent neural network algorithm is used in combination with time series analysis to learn from the access record data of multiple storage unit groups (Banks). The conflict probability prediction model not only considers the access frequency of a single Bank, but also captures the mutual influence and time dependency of access between Banks.
[0050] Specifically, the conflict probability prediction model extracts features through the following data: the periodic access pattern and access burstiness of the storage unit group; at the same time, it forms multi-dimensional input features for the real-time characteristic data of the current workload, including access density, data locality, etc., and outputs the conflict probability prediction data more accurately.
[0051] In an embodiment of the present invention, the feature extraction of the conflict probability prediction model also includes a Bank outlier detection mechanism, that is, it includes extracting the following data: access sequence, access interval time, access pattern entropy; adding an outlier detection mechanism to eliminate or correct unreasonable access patterns to ensure the robustness of the conflict probability prediction model.
[0052] In addition, in an embodiment of the present invention, the feature extraction data of the conflict probability prediction model also includes: hit rate improvement data and delay reduction data after the pre-fetched data; a closed-loop feedback control is formed, and the pre-fetching strategy parameters are continuously fine-tuned by analyzing the actual effect after the pre-fetched data operation. The conflict probability prediction model can realize continuous iteration and optimization of the strategy.
[0053] The data distribution scheme in step S7 is planned based on the graph clustering method of genetic algorithm. Banks are regarded as nodes in the graph and access requests are regarded as edges. The goal is to minimize the number of conflicts on the prefetch path. The algorithm calculates the optimal data distribution scheme before each prefetch to ensure that the data blocks to be prefetched are evenly distributed on different banks, effectively avoiding the conflict bottleneck caused by concentrated access.
[0054] In an embodiment of the present invention, the step of sorting the pre-fetch access order according to the current conflict probability prediction data and the monitoring data further includes: marking the storage unit group with a higher conflict as a low priority according to the conflict probability prediction data; and giving priority to pre-fetching the Bank with a lower conflict according to the conflict probability prediction data. According to the current Bank conflict probability prediction result, the access order of the pre-fetch data can be dynamically adjusted to further optimize the pre-fetch efficiency.
[0055] In an embodiment of the present invention, the monitoring module is stored in a hardware module that can execute the monitoring instruction; the monitoring module tracks the memory controller data in real time, including: bus bandwidth utilization data, storage unit group load data. Based on the above data, the conflict probability prediction model can dynamically adjust the pre-fetch parameters, such as increasing the amount of pre-fetched data when bandwidth is sufficient, and reducing pre-fetching when resources are tight to avoid aggravating congestion.
[0056] refer to Figure 2 , Figure 2 A schematic diagram of a memory data pre-fetching device provided by an embodiment of the present invention. The device comprises:
[0057] The bank conflict probability prediction module 20 is used to output conflict probability prediction data; wherein the conflict probability prediction module 20 constructs a conflict probability prediction model. The conflict probability prediction module 20 is implemented by hardware, and the hardware includes: a hardware accelerator or FPGA. In the embodiment of the present invention, the hardware is FPGA.
[0058] The memory module 21 includes a data distribution control module 23 for constructing a data distribution scheme so that the data to be pre-fetched is evenly distributed in different banks; and a data pre-fetch module 24 for sorting the pre-fetch access order according to the current conflict probability prediction data and the monitoring data.
[0059] The memory monitoring module 22 is used to output monitoring data; the monitoring data includes: bus bandwidth utilization data and storage unit group load data.
[0060] The model extracts features from the data generated by the memory 21 and the monitoring module 22, and the data includes: the periodic access pattern, access burstiness, access density, data locality, access sequence, access interval time, and access pattern entropy of the storage unit group; the hit rate improvement data, delay reduction data, bus bandwidth utilization data, and storage unit group load data after pre-fetching the data.
[0061] An embodiment of the present invention further provides an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the above-mentioned memory data prefetching method.
[0062] An embodiment of the present invention further provides a computer-readable storage medium. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the above-mentioned memory data pre-fetching method.
[0063] As for the memory data pre-fetching device disclosed in the embodiment, since it corresponds to the memory data pre-fetching method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the memory data pre-fetching method.
[0064] It can be seen from the above description that in the technical solution provided by the technical solution of the present invention, by applying a machine learning algorithm to the storage unit group to construct a conflict probability prediction model, combined with a dynamic reordering prefetching strategy, the access conflict in the system of multiple storage unit groups is significantly reduced, and the data prefetching efficiency and the effective utilization rate of the memory bandwidth are improved; specifically, in the solution of the embodiment of the present invention, the memory space is equivalent to the global storage shared by each CPU node, and each CPU core is configured with an independent private cache space. The data is only changed in address within the DRAM, and there is no need to update the data between registers between the CPU network, which greatly improves the prefetching efficiency. In addition, the algorithm is implemented through hardware and works in conjunction with the existing memory management system to ensure smooth system integration and performance optimization.
[0065] The various embodiments in this specification are described in a progressive, parallel, or progressive and parallel manner. Each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referenced to each other.
[0066] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that an article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such article or device. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the existence of other identical elements in the article or device including the above elements.
[0067] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A memory prefetching method, applied to a stacked architecture of a multi-core CPU and DRAM, characterized in that: include: According to the memory access record data, a storage unit group conflict probability prediction model is constructed, and conflict probability prediction data is output; According to the key operation data of the hardware, a memory monitoring module is constructed to output monitoring data, wherein the monitoring data is used to construct the conflict probability prediction model; When the first CPU core detects repeated access to a certain data block, it predicts subsequent data blocks according to the conflict probability prediction model; The first CPU core generates a prefetch request, wherein the prefetch request includes the subsequent data block address; The pre-fetch request retrieves the subsequent data block data in the private cache space of the second CPU core in the upper DRAM memory space through the memory controller of the first CPU core; Updating the subsequent data block address to the private cache space of the first CPU core through the DRAM controller; Before prefetching data, a data distribution scheme is constructed so that the data to be prefetched is evenly distributed in different storage unit groups; Sorting the pre-fetch access sequence according to the current conflict probability prediction data and the monitoring data; Every T time, reorder the pre-fetch access order according to the current conflict probability prediction data and the monitoring data; The conflict probability prediction model is constructed by a machine learning algorithm; wherein the machine learning algorithm includes a recurrent neural network algorithm; the recurrent neural network algorithm is used in combination with time series analysis to learn from access record data of multiple storage unit groups; the conflict probability prediction model not only considers the access frequency of a single storage unit group, but also captures the mutual influence and time dependency of access between storage unit groups; The conflict probability prediction model extracts features through the following data: the periodic access mode and access burstiness of the storage unit group; at the same time, based on the real-time characteristic data of the current workload, including access density, data locality, etc., a multi-dimensional input feature is formed to more accurately output the conflict probability prediction data; The feature extraction of the conflict probability prediction model also includes a storage unit group outlier detection mechanism, that is, extracting the following data: access sequence, access interval time, access pattern entropy; adding an outlier detection mechanism to eliminate or correct unreasonable access patterns to ensure the robustness of the conflict probability prediction model; The feature extraction data of the conflict probability prediction model also includes: hit rate improvement data and delay reduction data after the pre-fetched data; a closed-loop feedback control is formed, and the pre-fetch strategy parameters are continuously fine-tuned by analyzing the actual effect after the pre-fetched data operation. The conflict probability prediction model can realize continuous iteration and optimization of the strategy; The data distribution plan is constructed based on the graph clustering method of genetic algorithm. The storage unit groups are regarded as nodes in the graph and the access requests are regarded as edges. The goal is to minimize the number of conflicts on the prefetch path. The algorithm calculates the optimal data distribution plan before each prefetch to ensure that the data blocks to be prefetched are evenly distributed on different storage unit groups, effectively avoiding the conflict bottleneck caused by concentrated access.
2. The method according to claim 1, characterized in that The conflict probability prediction model is constructed by a machine learning algorithm; wherein the machine learning algorithm includes a recurrent neural network algorithm.
3. The method according to claim 1, characterized in that The conflict probability prediction model extracts features through the following data: the periodic access pattern, access burstiness, access density, data locality, access sequence, access interval time, and access pattern entropy of the storage unit group; the hit rate improvement data and delay reduction data after pre-fetching data.
4. The method according to claim 1, characterized in that: The conflict probability prediction model also includes a storage unit group outlier detection mechanism.
5. The method according to claim 1, characterized in that: The data distribution scheme is implemented based on a graph theory clustering method of a genetic algorithm.
6. The method according to claim 1, characterized in that The step of sorting the pre-fetch access sequence according to the current conflict probability prediction data and the monitoring data further includes: marking the storage unit group with a higher conflict indicated by the conflict probability prediction data as a low priority.
7. The method according to claim 1, characterized in that The step of sorting the pre-fetch access sequence according to the current conflict probability prediction data and the monitoring data further comprises: preferentially pre-fetching the storage unit group with lower conflict indicated by the conflict probability prediction data.
8. The method according to claim 1, characterized in that The monitoring module is stored in a hardware module that can execute monitoring instructions.
9. The method according to claim 1, characterized in that: The monitoring module tracks the memory controller data in real time, including bus bandwidth utilization data and storage unit group load data.
10. The method according to claim 1, characterized in that The conflict probability prediction model is implemented by hardware, and the hardware includes: a hardware accelerator or FPGA.
11. A memory data pre-fetching device, characterized in that: The device comprises: A storage unit group conflict probability prediction module, used to output conflict probability prediction data; wherein the conflict probability prediction module constructs a conflict probability prediction model, and the model extracts features through the following data: the storage unit group periodic access mode, access burstiness, access density, data locality, access sequence, access interval time, access pattern entropy; the hit rate improvement data and delay reduction data after pre-fetching data; A memory monitoring module, used to output monitoring data; the monitoring data includes: bus bandwidth utilization data, storage unit group load data; A data distribution control module is used to construct a data distribution scheme so that the data to be pre-fetched is evenly distributed in different storage unit groups; A data pre-fetch module, used for sorting the pre-fetch access sequence according to the current conflict probability prediction data and the monitoring data; The conflict probability prediction model is constructed by a machine learning algorithm; wherein the machine learning algorithm includes a recurrent neural network algorithm; the recurrent neural network algorithm is used in combination with time series analysis to learn from access record data of multiple storage unit groups; the conflict probability prediction model not only considers the access frequency of a single storage unit group, but also captures the mutual influence and time dependency of access between storage unit groups; The conflict probability prediction model extracts features through the following data: the periodic access mode and access burstiness of the storage unit group; at the same time, based on the real-time characteristic data of the current workload, including access density, data locality, etc., a multi-dimensional input feature is formed to more accurately output the conflict probability prediction data; The feature extraction of the conflict probability prediction model also includes a storage unit group outlier detection mechanism, that is, extracting the following data: access sequence, access interval time, access pattern entropy; adding an outlier detection mechanism to eliminate or correct unreasonable access patterns to ensure the robustness of the conflict probability prediction model; The feature extraction data of the conflict probability prediction model also includes: hit rate improvement data and delay reduction data after the pre-fetched data; a closed-loop feedback control is formed, and the pre-fetch strategy parameters are continuously fine-tuned by analyzing the actual effect after the pre-fetched data operation. The conflict probability prediction model can realize continuous iteration and optimization of the strategy; The data distribution plan is constructed based on the graph clustering method of genetic algorithm. The storage unit groups are regarded as nodes in the graph and the access requests are regarded as edges. The goal is to minimize the number of conflicts on the prefetch path. The algorithm calculates the optimal data distribution plan before each prefetch to ensure that the data blocks to be prefetched are evenly distributed on different storage unit groups, effectively avoiding the conflict bottleneck caused by concentrated access.
12. An electronic device, characterized in that: include: processor; A memory for storing instructions executable by the processor; 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
Conflict permission determination method and device, computer equipment and storage medium
CN111159719A
CPU (Central Processing Unit) shared cache division method for real-time tasks of embedded system
CN115658344A
