Memory access method and device
Dynamically adjusting the memory access queue through the weighting method and machine learning algorithm solves the problem of memory access conflicts in multi-core processors and improves memory access efficiency and system performance.
Patent Information
- Application Number
- CN202411045702.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-08-01
AI Technical Summary
In multi-core processors, memory access delays increase due to conflicts and resource competition during memory access. Cache consistency issues seriously affect system performance. Traditional memory access scheduling algorithms lack dynamic perception and adaptability, making it difficult to make optimal scheduling decisions.
Calculate the priority score of each memory access request through the weighting method, dynamically adjust the memory access queue based on the access request type, cache status, request urgency and core activity, use machine learning algorithms to build a memory access pattern prediction model, and monitor performance indicators Adjust priority assignments in real time and divide the memory issue queue into subqueues to optimize request distribution.
It improves memory access efficiency and system throughput, ensures fast response to high-priority requests, and optimizes the performance of multi-core processors.
Smart Images

Figure CN118567869B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a memory access method and device. Background Art
[0002] In modern computing systems, multi-core processors have become one of the key technologies to improve computing performance. However, as the number of cores increases, conflicts and resource competition will inevitably occur when multiple processor cores access shared memory resources at the same time. This situation will not only increase memory access latency, but may also cause cache consistency issues, which will seriously affect the performance of the entire system.
[0003] Traditional memory access scheduling algorithms, such as static priority scheduling and fixed policy scheduling, are usually designed with simplification and ease of implementation in mind. These algorithms often determine the order of memory access based on some preset rules or static parameters, and lack the ability to dynamically perceive and adapt to the current system state and memory access patterns. When faced with complex and changing memory access patterns and dynamically changing system loads, these algorithms are unable to cope with the situation and find it difficult to make optimal scheduling decisions, thus limiting the full performance of the processor. Summary of the invention
[0004] The problem solved by the present invention is to provide a memory access method and device, which calculates the priority score of the access request type, cache status, request urgency and core activity of the request source for each memory access request through a weight method, dynamically adjusts the memory access queue, and improves the memory access efficiency.
[0005] To solve the above problem, the present invention provides a memory access method, which is applied to a multi-core processor, and the multi-core processor processes multiple current memory access requests. The method includes:
[0006] Step 1: Assign the access request type, cache status, request urgency, and core activity priority of each memory access request to w1, w2, w3, and w4 respectively;
[0007] Step 2: Calculate the priority score of each memory access request according to the following formula:
[0008] The priority score = w1×access request type weight + w2×cache status weight + w3×request urgency weight + w4×core activity weight;
[0009] Step 3: Sort the current multiple memory access requests according to the priority score values from high to low;
[0010] Step 4: The memory transmit queue schedules the memory access request in the order sorted as described in step S3;
[0011] Step 5: Repeat steps S1 to S4 in each unit time.
[0012] Optionally, in the access request type weight, the read operation weight is 3 and the write operation weight is 2.
[0013] Optionally, in the cache status weight, the cache miss weight is 3, and the cache hit weight is 1.
[0014] Optionally, in the request urgency weights, the real-time task weight is 5, the ordinary task weight is 2, and the background task weight is 1.
[0015] Optionally, among the core activity weights, high activity is 3, medium activity is 2, and low activity is 1.
[0016] Optionally, the method further includes: constructing a memory access pattern prediction model based on historical access data, wherein the prediction model is used to predict memory access trends, and the memory access trends include: access locations and time windows.
[0017] Optionally, the prediction model is constructed based on a machine learning algorithm; wherein the machine learning algorithm includes: Markov Chain, LSTM.
[0018] Optionally, the historical access data includes: access address data, request type data, request time data, and belonging process data.
[0019] Optionally, the method further includes: monitoring memory performance indicators to form real-time data of memory performance indicators, and dynamically adjusting the priority assignment described in step 1 based on the real-time data of memory performance indicators.
[0020] Optionally, the memory performance indicator data includes: memory access latency data and core utilization data.
[0021] Optionally, the method further includes: dividing the memory transmission queue into a plurality of sub-queues, and dynamically adjusting the memory access request allocation according to the memory access mode data and current load condition data of each core.
[0022] Optionally, the step of dynamically adjusting memory access request allocation further includes: adjusting the number of the sub-queues and service objects; including merging, splitting or reallocating the sub-queues.
[0023] Optionally, the memory access mode data includes: read-write ratio data, cache hit rate data.
[0024] Optionally, the load condition data includes: CPU utilization and task urgency data.
[0025] The present invention also provides a memory access device, applied to a multi-core processor, the device comprising:
[0026] A memory controller, the memory controller comprising:
[0027] A dynamic transmission queue scheduling logic module is used to implement the above-mentioned memory s access method;
[0028] Access pattern analysis module, used for analyzing memory access patterns;
[0029] Prediction algorithm interface, used to communicate with users or system administrators to implement scheduling strategies;
[0030] Intelligent scheduling algorithm module is used by users or system administrators to adjust scheduling strategies according to needs.
[0031] Compared with the prior art, the technical solution of the embodiment of the present invention has the following advantages:
[0032] In the technical solution of the implementation mode of the present invention, the memory access method is applied to a multi-core processor. First, the access request type, cache status, request urgency and core activity priority of each memory access request are assigned. Based on the priority assignment, the priority score is calculated by the weighting method. The memory transmission queue dynamically adjusts the scheduling strategy according to the ranking of the priority scores, so that high-priority requests are responded to more quickly, thereby improving the memory access efficiency and overall system throughput of the multi-core processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a flowchart of a memory access method provided by an embodiment of the present invention;
[0034] Figure 2 is a schematic diagram of a memory access method provided by an embodiment of the present invention;
[0035] Figure 3 is a schematic diagram of another memory access method provided by an embodiment of the present invention;
[0036] Figure 4 is a schematic diagram of another memory access method provided by an embodiment of the present invention;
[0037] Figure 5 An embodiment of the present invention further provides a schematic diagram of a memory access device. DETAILED DESCRIPTION
[0038] 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.
[0039] 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.
[0040] refer to Figure 1 , Figure 1 A flowchart of a memory access method provided by an embodiment of the present invention. The memory access method is applied to a multi-core processor, and the multi-core processor processes multiple current memory access requests. The method includes the following steps:
[0041] Step S1: assigning values w1, w2, w3, and w4 to the access request type, cache status, request urgency, and core activity of each memory access request;
[0042] Step S2: Calculate the priority score of each memory access request according to the following formula:
[0043] The priority score = w1×access request type weight + w2×cache status weight + w3×request urgency weight + w4×core activity weight;
[0044] Step S3: sorting the current multiple memory access requests from high to low according to the priority score values;
[0045] Step S4: the memory transmission queue schedules the memory access request in the order sorted in step S3;
[0046] Step S5: Repeat steps S1 to S4 in each unit time.
[0047] Assume that three memory access requests occur simultaneously in the multi-core processor system in the embodiment of the present invention:
[0048] Request A: comes from core 1 with higher activity. The access request type is a read operation, the cache status is a miss, and the data is used for a real-time task.
[0049] Request B: comes from core 2 with lower activity. The access request type is a write operation, the cache status is a hit, and the data belongs to a background processing task.
[0050] Request C: comes from core 3 with medium activity. The access request type is a read operation, the cache status is a miss, and the data is used for a normal task.
[0051] Assume that w1, w2, w3, and w4 of memory access request A, request B, and request C are assigned the following values respectively:
[0052] Request A: w1=30, w2=20, w3=30, w4=10;
[0053] Request B: w1=20, w2=10, w3=10, w4=20;
[0054] Request C: w1=30, w2=20, w3=20, w4=30.
[0055] In the embodiment of the present invention, in the access request type weight, the read operation weight is 3, and the write operation weight is 2. In the cache status weight, the cache miss weight is 3, and the cache hit weight is 1. In the request urgency weight, the real-time task weight is 5, the ordinary task weight is 2, and the background task weight is 1. In the core activity weight, the high activity is 3, the medium activity is 2, and the low activity is 1.
[0056] According to the above priority score calculation formula, in unit time, we have:
[0057] The priority score of request A = 3*w1+3*w2+5*w3 +1*w4=310;
[0058] Request B's priority score = 2*w1+1*w2 +1*w3 +2*w4=100;
[0059] The priority score of request C = 3*w1+2*w2 +2*w3 +3*w4=260.
[0060] According to the priority score values of the request A, the request B, and the request C, the current multiple memory access requests are sorted from high to low as: request A, request C, and request B;
[0061] The memory transmit queue schedules access requests in the order of request A, request C, and request B.
[0062] refer to Figure 2 , Figure 2 FIG. 1 is a schematic diagram of a memory access method provided by an embodiment of the present invention. Figure 2,It can be seen that in each unit time, the above steps are repeated, and the priority score is calculated according to the access request type, cache status, request urgency and core activity of each memory access request. The memory controller dynamically adjusts the memory emission queue scheduling according to the priority score in each unit time to ensure that high-priority requests are responded to more quickly, thereby improving the memory access efficiency.
[0063] refer to Figure 3 , Figure 3 It is a schematic diagram of another memory access method provided by an embodiment of the present invention.
[0064] The method comprises: constructing a memory access pattern prediction model based on historical access data, wherein the prediction model is used to predict a memory access trend, and the memory access trend comprises: an access location and a time window.
[0065] In the embodiment of the present invention, the feature extraction in the process of building the prediction model includes the following aspects: access sequence, timestamp, core activity, etc.
[0066] The prediction model is constructed based on a machine learning algorithm; wherein the machine learning algorithm includes: MarkovChain, LSTM.
[0067] The above historical access data includes: access address data, request type data, request time data, and process data.
[0068] By building a prediction model based on historical access data, we can predict future memory access trends, schedule prefetch operations in advance, reduce waiting time during actual access, and improve the continuity and efficiency of memory access.
[0069] refer to Figure 4 , Figure 4 It is a schematic diagram of another memory access method provided by an embodiment of the present invention.
[0070] Combination Figure 4 The method further includes: dividing the memory transmission queue into a plurality of sub-queues, and dynamically adjusting the memory access request allocation according to the memory access mode data of each core (including: read-write ratio data, cache hit rate data) and the current load condition data (including: CPU utilization, task urgency data). Adjusting the number and service objects of the sub-queues; including merging, splitting or reallocating the sub-queues to ensure that the queue configuration always matches the system status.
[0071] The memory access method further includes: monitoring memory performance indicators to form memory performance indicator real-time data, and dynamically adjusting the priority assignment in step 1 based on the memory performance indicator real-time data. The memory performance indicator data includes: memory access latency data and core utilization data.
[0072] Assume that in a memory access request process, a core that frequently generates cache status miss requests can be assigned to a queue that specifically processes miss requests, and a core that performs a large number of read operations can be assigned to a queue for read operations.
[0073] By automatically adjusting the request allocation of subqueues according to the memory access pattern data of each core and the current load, balanced distribution of memory access requests can be achieved, queue blocking and resource contention can be reduced, and memory access efficiency can be further improved.
[0074] refer to Figure 5 , Figure 5 The present invention also provides a schematic diagram of a memory access device. The device is applied to a multi-core processor, and the device includes:
[0075] A memory controller, the memory controller comprising:
[0076] A dynamic transmission queue scheduling logic module, used to implement the above-mentioned memory access method;
[0077] Access pattern analysis module, used for analyzing memory access patterns, including building prediction models;
[0078] Prediction algorithm interface, used to communicate with users or system administrators to implement scheduling strategies; specifically, the communication between the prediction model algorithm and users or administrators to adjust strategies in real time;
[0079] Intelligent scheduling algorithm module is used by users or system administrators to adjust scheduling strategies according to needs.
[0080] In this specification, each embodiment is 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 embodiments can be referred to each other. For the memory access device disclosed in the embodiment, since it corresponds to the memory access method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the memory access method part.
[0081] 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.
[0082] 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 access method, characterized in that: Applied to a multi-core processor, the multi-core processor processes multiple current memory access requests, the method includes: Step 1: Assign the access request type, cache status, request urgency, and core activity priority of each memory access request to w1, w2, w3, and w4 respectively; Step 2: Calculate the priority score of each memory access request according to the following formula: The priority score = w1×access request type weight + w2×cache status weight + w3×request urgency weight + w4×core activity weight; Step 3: Sort the current multiple memory access requests according to the priority score values from high to low; Step 4: The memory transmit queue schedules the memory access request in the order sorted as described in step S3; Step 5: Repeat steps S1 to S4 in each unit time.
2. The memory access method according to claim 1, characterized in that: Among the access request type weights, the read operation weight is 3 and the write operation weight is 2.
3. The memory access method according to claim 1, characterized in that: In the cache status weights, the cache miss weight is 3, and the cache hit weight is 1.
4. The memory access method according to claim 1, characterized in that: Among the request urgency weights, the real-time task weight is 5, the common task weight is 2, and the background task weight is 1.
5. The memory access method according to claim 1, characterized in that: Among the core activity weights, high activity is 3, medium activity is 2, and low activity is 1.
6. The memory access method according to claim 1, characterized in that: The method further includes: constructing a memory access pattern prediction model based on historical access data, wherein the prediction model is used to predict a memory access trend, and the memory access trend includes: an access location and a time window.
7. The memory access method according to claim 6, characterized in that: The prediction model is constructed based on a machine learning algorithm; wherein the machine learning algorithm includes: Markov Chain, LSTM.
8. The memory access method according to claim 6, characterized in that: The historical access data includes: access address data, request type data, request time data, and process data.
9. The memory access method according to claim 1, characterized in that: The method further includes: monitoring memory performance indicators to form real-time data of memory performance indicators, and dynamically adjusting the priority assignment described in step 1 based on the real-time data of memory performance indicators.
10. The memory access method according to claim 9, characterized in that: The memory performance indicator data includes: memory access latency data and core utilization data.
11. The memory access method according to claim 1, characterized in that: The method further includes: dividing the memory transmission queue into a plurality of sub-queues, and dynamically adjusting the memory access request allocation according to the memory access mode data and the current load condition data of each core.
12. The memory access method according to claim 11, characterized in that: The step of dynamically adjusting the allocation of memory access requests also includes: adjusting the number of the sub-queues and service objects; including merging, splitting or reallocating the sub-queues.
13. The memory access method according to claim 11, characterized in that: The memory access mode data includes: read-write ratio data and cache hit rate data.
14. The memory access method according to claim 11, characterized in that: The load condition data includes: CPU utilization and task urgency data.
15. A memory access device, characterized in that: Applied to a multi-core processor, the device comprises: A memory controller, the memory controller comprising: A dynamic transmission queue scheduling logic module, used to implement the method in claim 1; Access pattern analysis module, used for analyzing memory access patterns; Prediction algorithm interface, used to communicate with users or system administrators to implement scheduling strategies; Intelligent scheduling algorithm module is used by users or system administrators to adjust scheduling strategies according to needs.
Citation Information
Patent Citations
Bus monitor-based system chip bus priority dynamic configuration device
CN102012881A
A method and device for accessing graph data based on a grouping association table
CN109255055A
Memory scheduling method and device and readable storage medium
CN114490012A
Memory control scheduling method and device, computer equipment and storage medium
CN115357377A
Memory scheduling method and storage medium storing memory scheduling program
JP2000148515A
