Memory access control method, device and equipment
By adjusting the access order of the physical memory address, avoiding continuous memory access by the same Bank Group, the problem of high memory access delay is solved and more efficient memory data access is achieved.
Patent Information
- Application Number
- CN202411033721.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-29
AI Technical Summary
In the prior art, the memory access delay is high, which affects the access speed. The scheduling of the access address during continuous reading and writing affects the access speed. It is necessary to improve the access scheduling mechanism to reduce latency and improve the speed.
By obtaining multiple memory fetch instructions, determine the memory physical address to be fetched and the initial memory fetch order. According to the first rule, avoid accessing two memory physical addresses in sequence with the same memory bank group address, and adjust the memory physical address. Access order, the continuous memory access of the same Bank Group is turned into different Bank Group memory access, reducing memory access delay.
It effectively reduces memory access delay, improves memory access rate, reduces unnecessary delays, and improves memory access speed.
Smart Images

Figure CN119046181A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a memory access control method, device and equipment. Background Art
[0002] The hierarchical architecture of memory determines the time-sharing multiplexing behavior of the memory controller for physical addresses. That is, the memory controller addresses the Bank Group, Bank, Row, and Column in sequence based on the physical address. Since the row address is in a relative position, after continuous read and write operations, the address signal jumps to a low position first, and the data is distributed in the same Bank Group or the same Bank first. In other words, the system needs to frequently read and write different rows of the same Bank. From the timing characteristics of the memory, it can be seen that this will cause the memory to repeatedly execute activation and precharge commands, increasing the delay.
[0003] The related technology optimizes the address mapping mechanism according to the characteristics of memory timing, reduces redundant operations during the reading and writing process, and improves the memory access speed. However, the scheduling of memory access addresses during the continuous reading and writing of memory will also affect the memory access speed. Therefore, how to improve the memory access scheduling mechanism to reduce delays and improve memory access speed is a technical problem that technicians in this field need to solve urgently. Summary of the invention
[0004] The present invention provides a memory access control method, device and equipment, which are used to solve the problem of high memory access delay in the prior art.
[0005] The present invention provides a memory access control method, comprising the following steps.
[0006] Get multiple memory access instructions to memory; Determine the memory physical addresses of the memories to be accessed and the initial memory access order of the memory physical addresses of the memories to be accessed according to the sequence of the memory access instructions and the system addresses in the memory access instructions; Determine the target memory access order of each memory physical address to be accessed according to the memory physical address of each memory to be accessed, the initial memory access order and the first rule; the first rule is used to indicate that in the memory access process, two memory physical addresses to be accessed sequentially should avoid having the same memory bank group Bank Group address; Memory access operations are performed according to the target memory access order of each memory physical address.
[0007] According to a memory access control method provided by the present invention, the method determines the memory physical addresses to be accessed and the initial memory access order of the memory physical addresses to be accessed according to the sequence of the memory access instructions and the system addresses in the memory access instructions, including: According to the sequence of each memory access instruction, the memory access sequence of the memory physical address corresponding to the system address in each memory access instruction is determined.
[0008] According to a memory access control method provided by the present invention, the target memory access order of each memory physical address to be accessed is determined according to each memory physical address to be accessed, the initial memory access order of each memory physical address to be accessed and a first rule, including: Determine the second memory physical address according to the initial memory access order of each memory physical address to be accessed, the first memory physical address and the first rule; the first memory physical address is the memory physical address of the current memory access; the second memory physical address is the memory physical address that needs to be accessed after the first memory access physical address performs the memory access operation; the second memory physical address and the first memory physical address correspond to different bank group addresses; The access order of the remaining memory physical addresses to be accessed is determined according to the second memory physical address, the initial memory access order of each memory physical address to be accessed, and the first rule.
[0009] According to a memory access control method provided by the present invention, the second memory physical address is determined according to the initial memory access order of each memory physical address to be accessed, the first memory physical address and the first rule, including: Determine a second candidate memory physical address according to the initial memory access sequence of each memory physical address to be accessed and the first memory physical address; the second candidate memory physical address is a memory physical address of the to-be-performed access operation adjacent to the first memory physical address in the initial memory access sequence; The second memory physical address is determined according to the Bank Group address corresponding to the second candidate memory physical address and the Bank Group address corresponding to the first memory physical address.
[0010] According to a memory access control method provided by the present invention, the second memory physical address is determined according to the Bank Group address corresponding to the second candidate memory physical address and the Bank Group address corresponding to the first memory physical address, including: In the case where the second candidate memory physical address corresponds to a different Bank Group address from the first memory physical address, the second candidate memory physical address is determined as the second memory physical address; In the case that the second candidate memory physical address corresponds to the same Bank Group address as the first memory physical address, the second memory physical address is determined from memory physical addresses other than the second candidate memory physical address according to the initial memory access order and the first rule.
[0011] A memory access control method provided according to the present invention also includes: determining the waiting time of the memory access task corresponding to the memory physical address to be accessed; if the waiting time of the memory access task corresponding to the memory physical address to be accessed is greater than a preset value, updating the execution order of the memory access task corresponding to the memory physical address to be accessed.
[0012] The present invention also provides a memory access control device, comprising the following modules: An acquisition module, used for acquiring multiple memory access instructions to the memory; A first determination module, used to determine each memory physical address to be accessed and an initial memory access order of each memory physical address to be accessed according to the sequence of each memory access instruction and the system address in each memory access instruction; The second determination module is used to determine the target memory access order of each memory physical address to be accessed according to the memory physical address of each memory to be accessed, the initial memory access order and the first rule; the first rule is used to indicate that in the memory access process, two memory physical addresses accessed sequentially should avoid having the same memory bank group Bank Group address; The memory access module is used to perform memory access operations according to the target memory access sequence of each memory physical address.
[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-mentioned memory access control methods is implemented.
[0014] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the memory access control method described in any one of the above is implemented.
[0015] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned memory access control methods.
[0016] The memory access control method, device and equipment provided by the present invention adjust the initial memory access order of the memory physical address according to the first rule to obtain the target memory access order of each memory physical address; that is, by adjusting and optimizing the memory physical address access order, it is achieved that the original two consecutive memory accesses of the same Bank Group are converted into two memory accesses of different Bank Groups, avoiding the situation where two memory physical addresses accessed sequentially have the same memory library group Bank Group address, thereby effectively reducing the memory access delay and improving the access rate of memory data. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 This is one of the flow charts of the memory access control method provided by the present invention.
[0019] Figure 2 This is the second flow chart of the memory access control method provided by the present invention.
[0020] Figure 3 This is the third flow chart of the memory access control method provided by the present invention.
[0021] Figure 4 It is a structural schematic diagram of the memory access control device provided by the present invention.
[0022] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0024] Combine the following Figure 1-Figure 5 The memory access control method, device and equipment of the present invention are described.
[0025] In order to facilitate a clearer understanding of the technical solutions of the embodiments of the present application, some technical contents related to the embodiments of the present application are first introduced.
[0026] The popularity of generative artificial intelligence models represented by ChatGPT indicates that a new round of technological revolution based on massive data, with intelligent algorithms as the core and high-performance computing power as the support is imminent. Modern computer architecture determines that the key to achieving high-performance computing power lies in increasing the operating frequency of the CPU and memory. The CPU is mainly responsible for the execution of instructions, while the memory is responsible for reading and writing data. As a bridge between the CPU and the memory, the memory controller is responsible for processing data transmission between the CPU and the memory. DDR4 is the most mainstream memory product on the market. Designing a memory controller based on its functional characteristics is of great significance to give full play to the performance of DDR4 and improve its interaction with the CPU. The main function of the memory controller is to receive the system's memory access requirements, complete internal conversion and scheduling, and then send them to the memory.
[0027] The basic storage unit of DDR memory is Bank, which is a tabular circuit composed of row address lines and column address lines. The storage units are located on the row address lines and column address lines, and correspond one to one with the two-dimensional coordinates composed of the row address and column address. Read and write commands store or read data from the corresponding storage unit by specifying the row address and column address information. The storage hierarchy of DDR memory can be divided from small to large: Channel-DIMM-Rank-Chip-Bank-Row / Column. Among them, channel is the memory channel, DIMM is the memory plug-in, Rank refers to all memory particles (Chips) connected to the same CS (ChipSelect chip select), and Bank is a logical concept. One chip can contain multiple banks, or one bank can be distributed to multiple chips. Compared with DDR3, DDR4 has added the concept of Bank Group, which is further subdivided in the chip-Bank hierarchy, and one Bank Group corresponds to multiple Banks.
[0028] The read and write addresses sent by the system to the memory controller are all system addresses, while the addresses for reading and writing DDR4 memory must be the physical addresses of the memory, which requires the memory controller to accurately map the system addresses to the physical addresses.
[0029] The physical address information of DDR4 memory includes Rank address, Bank Group address, Bank address, Row address and Column address. The mapped address information must contain the physical address information of DDR4 to ensure that every available storage unit in the memory is addressed.
[0030] Exemplarily, the physical composition of the memory is shown in Table 1.
[0031] Table 1
[0032] The reading and writing of memory must comply with certain timing requirements. The switching of read and write operations also has different time delays, which is an important factor affecting the efficiency of memory data transmission. Designing a good memory access scheduling mechanism to reduce data transmission delay and improve bus utilization is an important part of high-performance memory controller design. The Bank Group concept added to DDR4 not only leads to changes in memory structure and physical address information, but also changes memory timing accordingly. Obviously, optimizing the memory access scheduling mechanism based on the structure and read and write characteristics of BankGroup is of great significance to improving the performance of memory controllers. The introduction of the Bank Group concept adds two important timing parameters tCCD_S and tCCD_L. tCCD_S represents the delay of consecutive column selection commands of different Bank Groups, and tCCD_L represents the delay of consecutive column selection commands of the same Bank Group. tCCD_S is a delay of 4 clock cycles at different frequencies of DDR4 memory. tCCD_L changes with the change of clock frequency, and its delay at different clock frequencies is greater than tCCD_S.
[0033] Generally speaking, after the address mapping is completed, the memory controller can perform corresponding memory access operations according to the mapped physical address. The hierarchical architecture characteristics of the memory determine the time-sharing multiplexing behavior of the memory controller for the physical address. That is, the memory controller addresses the Bank Group, Bank, Row and Column in sequence according to the physical address. Since the row address is in a relative position, after continuous read and write operations, the address signal jumps to a low position first, and the data is distributed in the same Bank Group or the same Bank first. In other words, the system needs to frequently read and write different rows of the same Bank. From the timing characteristics of the memory, it can be seen that this will cause the memory to repeatedly execute activation and precharge commands, increasing the delay. The existing address interleaving mapping mechanism (address interleaving) (for example: CN105426324B) places the Bank address at a relatively low position, so that access to continuous addresses occurs in different Banks, and since the Row is at a relatively high position, it will also increase the probability of accessing the same Row, which can avoid performing precharge and activation operations and reduce redundant operations during the read and write process.
[0034] Exemplarily, the address interleaving mapping mechanism is shown in Table 2: Table 2
[0035] The existing technology optimizes the address mapping mechanism according to the memory timing characteristics, reduces redundant operations during the reading and writing process, and improves the memory access speed. However, the scheduling of memory access addresses during the continuous reading and writing of memory will also affect the memory access speed. Therefore, it is necessary to improve the memory access scheduling mechanism to reduce latency and improve memory access speed.
[0036] Figure 1 It is one of the flow charts of the memory access control method provided by the present invention, such as Figure 1 As shown, the method includes the following: Step 101: Obtain multiple memory access instructions for the memory.
[0037] Specifically, in order to improve the memory access efficiency and reduce the memory access latency, in the embodiment of the present application, multiple memory access instructions for the memory are first obtained. Optionally, the memory access instruction of the memory can be a memory read and write instruction for performing read and write operations on the memory.
[0038] Step 102: Determine the memory physical addresses to be accessed and the initial memory access order of the memory physical addresses to be accessed according to the sequence of the memory access instructions and the system address in the memory access instructions.
[0039] Specifically, the read and write addresses in the memory access instructions sent by the system are both system addresses, and the addresses for reading and writing to the DDR4 memory must be the physical addresses of the memory, so the system addresses need to be accurately mapped to the physical addresses.
[0040] Optionally, after obtaining multiple memory access instructions to the memory, in an embodiment of the present application, the system address in each memory access instruction is mapped to obtain each memory physical address to be accessed; and the order in which the memory access instructions are received is used as the initial memory access order of the system address in the memory access instructions, and the initial memory access order of the system address is further used as the initial memory access order of the corresponding memory physical address, thereby accurately determining the initial memory access order of the memory physical address to be accessed corresponding to the system address in each memory access instruction.
[0041] Step 103, determine the target memory access order of each memory physical address to be accessed according to the memory physical address of each memory to be accessed, the initial memory access order and the first rule; the first rule is used to indicate that during the memory access process, avoid two memory physical addresses accessed sequentially having the same memory bank group Bank Group address.
[0042] Specifically, after determining the memory physical addresses of each memory to be accessed and the initial memory access order of each memory physical address to be accessed according to the sequence of each memory access instruction and the system address in each memory access instruction, the embodiment of the present application further determines the target memory access order of each memory physical address to be accessed according to the memory physical address of each memory to be accessed, the initial memory access order and the first rule; wherein the first rule is used to indicate that in the memory access process, avoid two memory physical addresses accessed sequentially having the same memory bank group Bank Group address. That is, after determining the initial memory access order of each memory physical address to be accessed, the present application adjusts the memory access order of each memory physical address to be accessed to obtain the target memory access order of each memory physical address to be accessed; wherein, the adjustment principle and method of the memory access order of each memory physical address to be accessed is to avoid two memory physical addresses accessed sequentially having the same memory bank group Bank Group address, thereby realizing the conversion of the original two consecutive memory accesses of the same Bank Group into two memory accesses of different Bank Groups, that is, by adjusting and optimizing the memory physical address access order, the effect of reducing the memory access latency is achieved.
[0043] Step 104: Execute memory access operations according to the target memory access order of each memory physical address.
[0044] Specifically, the target memory access order of each memory physical address to be accessed is determined according to the memory physical address of each memory to be accessed, the initial memory access order and the first rule. That is, under the principle of avoiding two memory physical addresses accessed sequentially having the same memory bank group Bank Group address, the memory access order of each memory physical address to be accessed is adjusted. After the target memory access order of each memory physical address to be accessed is obtained, the memory access operation can be executed according to the target memory access order of each memory physical address obtained after the adjustment, thereby reducing the memory access latency and improving the access rate of memory data.
[0045] The method of the above embodiment adjusts the initial memory access order of the memory physical address according to the first rule to obtain the target memory access order of each memory physical address; that is, by adjusting and optimizing the access order of the memory physical address, it is achieved that the original two consecutive memory accesses of the same Bank Group are converted into two memory accesses of different Bank Groups, avoiding the situation where two memory physical addresses accessed sequentially have the same memory bank group Bank Group address, thereby effectively reducing the memory access latency and improving the access rate of memory data.
[0046] In one embodiment, determining each memory physical address to be accessed and the initial memory access order of each memory physical address to be accessed according to the sequence of each memory access instruction and the system address in each memory access instruction includes: According to the sequence of each memory access instruction, the memory access sequence of the memory physical address corresponding to the system address in each memory access instruction is determined.
[0047] Specifically, after obtaining multiple memory access instructions to the memory, in the embodiment of the present application, the system address in each memory access instruction is mapped to obtain the physical memory address of each memory to be accessed; and according to the sequence of each memory access instruction, the initial memory access sequence of the system address in each memory access instruction can be determined, and then the initial memory access sequence of the memory physical address to be accessed corresponding to the system address can be further determined. Optionally, if the order of receiving memory access instruction A is 1, and the order of receiving memory access instruction B is 2, then it can be determined that the initial memory access sequence of the system address x in memory access instruction A is 1, and the initial memory access sequence of the system address y in memory access instruction B is 2; further, it can be determined that the initial memory access sequence of the memory physical address X corresponding to the system address x in memory access instruction A is 1, and the initial memory access sequence of the memory physical address Y corresponding to the system address y in memory access instruction B is 2.
[0048] The method of the above embodiment uses the order of receiving memory access instructions as the initial memory access order of the system address in the memory access instructions, and further uses the initial memory access order of the system address as the initial memory access order of the corresponding memory physical address, so as to quickly and accurately determine the initial memory access order of the memory physical address to be accessed corresponding to the system address in each memory access instruction, and then the memory access order of the memory physical address can be efficiently adjusted to reduce the memory access latency.
[0049] In one embodiment, determining a target memory access order of each memory physical address to be accessed according to each memory physical address to be accessed, an initial memory access order of each memory physical address to be accessed, and a first rule includes: Determine the second memory physical address according to the initial memory access order of each memory physical address to be accessed, the first memory physical address and the first rule; the first memory physical address is the memory physical address of the current memory access; the second memory physical address is the memory physical address that needs to be accessed after the first memory access physical address performs the memory access operation; the second memory physical address and the first memory physical address correspond to different bank group addresses; The access order of the remaining memory physical addresses to be accessed is determined according to the second memory physical address, the initial memory access order of each memory physical address to be accessed, and the first rule.
[0050] Specifically, after determining the first memory physical address, the second memory physical address can be determined according to the initial memory access order of the memory physical address and the first rule; wherein the first memory physical address is the memory physical address currently accessed, and can also be the memory physical address ranked first in the initial memory access order; the second memory physical address must correspond to a different Bank Group address from the first memory physical address; optionally, the Bank Group addresses corresponding to each memory physical address in the initial memory access order of the memory physical address can be judged and screened one by one, and a memory physical address different from the Bank Group address corresponding to the first memory physical address can be screened out as the second memory physical address, thereby effectively avoiding that two memory physical addresses accessed sequentially have the same memory bank group Bank Group, thereby achieving the effect of reducing memory access latency. Optionally, after determining the second memory physical address, the access order of the remaining memory physical addresses to be accessed can also be determined according to this method. Optionally, the remaining memory physical addresses to be accessed do not include the first memory physical address and the second memory physical address.
[0051] The method of the above embodiment, after determining the first memory physical address, determines the second memory physical address according to the initial memory access order of the memory physical address and the first rule; that is, screens out a memory physical address that is different from the BankGroup address corresponding to the first memory physical address as the second memory physical address, thereby effectively avoiding that two memory physical addresses accessed sequentially have the same memory bank group Bank Group, thereby achieving the effect of reducing the memory access latency.
[0052] In one embodiment, determining the second memory physical address according to the initial memory access order of each memory physical address to be accessed, the first memory physical address and the first rule includes: Determine a second candidate memory physical address according to the initial memory access sequence of each memory physical address to be accessed and the first memory physical address; the second candidate memory physical address is a memory physical address of the to-be-performed access operation adjacent to the first memory physical address in the initial memory access sequence; The second memory physical address is determined according to the Bank Group address corresponding to the second candidate memory physical address and the Bank Group address corresponding to the first memory physical address.
[0053] Specifically, in the process of determining the second memory physical address, the present application can first determine the second candidate memory physical address based on the initial memory access order of each memory physical address to be accessed and the first memory physical address; wherein the second candidate memory physical address is the memory physical address of the access operation to be performed that is adjacent to the first memory physical address in the initial memory access order.
[0054] For example, the initial memory access order of the memory physical addresses to be accessed is memory physical address m, memory physical address n, memory physical address x, memory physical address y, memory physical address z, and memory physical address w, where the first memory physical address is memory physical address m, and the adjacent memory physical address to be accessed after the first memory physical address m in the initial memory access order is memory physical address n, then memory physical address n can be determined as the second candidate memory physical address.
[0055] Optionally, after determining the second candidate memory physical address, the second memory physical address can be determined based on the Bank Group address corresponding to the second candidate memory physical address and the Bank Group address corresponding to the first memory physical address; that is, by judging whether the Bank Group address corresponding to the second candidate memory physical address is the same as the Bank Group address corresponding to the first memory physical address, it is determined whether to use the second candidate memory physical address as the second memory physical address.
[0056] The method of the above embodiment first determines the second candidate memory physical address based on the initial memory access order of each memory physical address to be accessed and the first memory physical address, and then determines whether the Bank Group address corresponding to the second candidate memory physical address is the same as the Bank Group address corresponding to the first memory physical address, thereby accurately determining whether to use the second candidate memory physical address as the second memory physical address, thereby accurately and efficiently realizing the adjustment of the memory access order of the memory physical address and effectively reducing the memory access delay.
[0057] In one embodiment, determining the second memory physical address according to the bank group address corresponding to the second candidate memory physical address and the bank group address corresponding to the first memory physical address includes: In the case where the second candidate memory physical address corresponds to a different Bank Group address from the first memory physical address, the second candidate memory physical address is determined as the second memory physical address; In the case that the second candidate memory physical address corresponds to the same Bank Group address as the first memory physical address, the second memory physical address is determined from memory physical addresses other than the second candidate memory physical address according to the initial memory access order and the first rule.
[0058] Specifically, when the second candidate memory physical address corresponds to a different Bank Group address from the first memory physical address, the second candidate memory physical address is determined as the second memory physical address, thereby screening out a memory physical address different from the Bank Group address corresponding to the first memory physical address as the second memory physical address, effectively avoiding the situation where two memory physical addresses accessed sequentially have the same memory bank group Bank Group, thereby reducing memory access latency.
[0059] Optionally, when the second candidate memory physical address corresponds to the same Bank Group address as the first memory physical address, the second memory physical address is determined from the memory physical addresses other than the second candidate memory physical address according to the initial memory access order and the first rule; that is, if the second candidate memory physical address is used as the second physical address at this time, the Bank Group address corresponding to the first physical address is the same as the Bank Group address corresponding to the second physical address, which will increase the memory access latency. Therefore, it is necessary to postpone the access to the second candidate memory physical address, and continue to determine the second memory physical address from the memory physical addresses other than the second candidate memory physical address according to the initial memory access order and the first rule, so as to avoid the problem that the two memory physical addresses accessed sequentially have the same memory bank group Bank Group, thereby achieving the effect of reducing the memory access latency.
[0060] For example, the initial memory access order of the memory physical addresses to be accessed is memory physical address m, memory physical address n, memory physical address x, memory physical address y, memory physical address z, and memory physical address w, where the first memory physical address is memory physical address m, and the adjacent memory physical address to be accessed after the first memory physical address m in the initial memory access order is memory physical address n, then memory physical address n can be determined as the second candidate memory physical address.
[0061] Optionally, if the first memory physical address m and the second candidate memory physical address n correspond to different Bank Group addresses, the second candidate memory physical address n is determined as the second memory physical address; that is, after accessing the memory physical address m, the memory physical address n continues to be accessed.
[0062] Optionally, if the first memory physical address m and the second candidate memory physical address n correspond to the same Bank Group address, the access to the second candidate memory physical address n is postponed, and the second memory physical address is determined from the memory physical address x, the memory physical address y, the memory physical address z, and the memory physical address w. Optionally, if the memory physical address x and the first memory physical address m also correspond to the same Bank Group address, and the memory physical address y and the first memory physical address m correspond to different Bank Group addresses, the memory physical address y is used as the second memory physical address, that is, after accessing the memory physical address m, the memory physical address y is continued to be accessed, so that the original two consecutive accesses to the same Bank Group are converted into two different Bank Group accesses, effectively reducing the latency of memory access.
[0063] According to the method of the above embodiment, when the second candidate memory physical address and the first memory physical address correspond to different Bank Group addresses, the second candidate memory physical address is determined as the second memory physical address; when the second candidate memory physical address and the first memory physical address correspond to the same Bank Group address, the second memory physical address is determined from the memory physical addresses other than the second candidate memory physical address according to the initial memory access order and the first rule, thereby realizing the adjustment and optimization of the memory physical address access order in different scenarios, effectively avoiding that two memory physical addresses accessed sequentially have the same memory library group Bank Group address, and quickly and accurately realizing the conversion of the original two consecutive memory accesses of the same Bank Group into two different Bank Group memory accesses, and effectively reducing the memory access latency by adjusting and optimizing the memory physical address access order.
[0064] For example, the process of the memory access control method in the embodiment of the present application is as follows: Figure 2 As shown, the details are as follows: 1. The system sends a continuous read or write command. After address mapping, the physical address of the memory contains different bank groups. Assume that the bank groups corresponding to this memory access operation are BG3, BG2, BG2, BG0, BG0, and BG1. Store BG0, BG1, BG2, and BG3 in bank_group_ram0, bank_group_ram1, bank_group_ram2, and bank_group_ram3 respectively. Optionally, after the address mapping is completed, the physical address of the memory is stored in bank_group_ram, and the number of rams is the same as the number of bank groups in the memory. The physical address of the memory currently performing the memory access task is stored in the address_reg register.
[0065] 2. BG3 has priority in entering RAM, so the Arbiter sends BG3 to the address_reg register to perform the corresponding memory access operation.
[0066] 3. After BG3 is executed, Arbiter chooses to send BG2 to the address_reg register to perform memory access operations based on the priority arbitration principle.
[0067] 4. After BG2 is executed, the Arbiter gives priority to different Bank Groups to perform memory access operations. Therefore, the Arbiter sends BG0 instead of BG2 to address_reg. Since BG0 is before BG1, BG0 instead of BG1 is sent to address_reg. That is, by adjusting and optimizing the access sequence of the memory physical address, the original two consecutive memory accesses of the same Bank Group can be quickly and accurately converted into two different Bank Group memory accesses, effectively avoiding the two memory physical addresses accessed sequentially having the same memory bank group Bank Group address, and effectively reducing the memory access latency.
[0068] 5. After BG0 is executed, Arbiter sends BG2, BG0, and BG1 to address_reg to perform memory access operations until the continuous memory access task is completed. That is, after the current memory access task is completed, it is determined whether there is a memory physical address in the bank_group_ram different from the bank_group_ram to which the current memory access task belongs. If so, the memory physical address in the corresponding bank_group_ram is taken out according to the order in which the memory access address is sent, and sent to the address_reg register to perform the memory access task, that is, non-continuous bank groups are given priority.
[0069] 6. After optimization by this arbitration scheme, the memory access order is adjusted from BG3, BG2, BG2, BG0, BG0, BG1 before optimization to BG3, BG2, BG0, BG2, BG0, BG1, and the original two consecutive memory accesses of the same Bank Group are changed to two memory accesses of different Bank Groups, reducing the timing delay to 2*(tCCD_L-tCCD_S). Since the address length of continuous read and write is very long in actual application, the timing delay reduced by optimization of this arbitration scheme will be very considerable.
[0070] The method of the above embodiment designs a new memory access scheduling mechanism based on the difference in timing delays of memory access behaviors of different Bank Groups. Through priority arbitration, the memory access behaviors of Bank Groups are reasonably arranged to optimize the memory access operations during continuous reading and writing, reduce unnecessary delays during continuous reading and writing of the memory, and effectively improve the access rate of memory data.
[0071] In one embodiment, after determining the target memory access order of each memory physical address to be accessed according to each memory physical address to be accessed, the initial memory access order of each memory physical address to be accessed and the first rule, the method further includes: Determine the waiting time of the memory access task corresponding to the memory physical address to be accessed; If the waiting time of the memory access task corresponding to the physical address of the memory to be accessed is greater than a preset value, the execution order of the memory access task corresponding to the physical address of the memory to be accessed is updated.
[0072] Specifically, after the embodiment of the present application changes the original two consecutive memory accesses of the same Bank Group into two memory accesses of different Bank Groups, and realizes the adjustment and optimization of the memory physical address access order, it is also considered that the adjustment of the physical address memory access order will also cause the memory physical address to wait for memory access to change. In order to avoid a single bankGroup waiting time being too long, the continuous Bank Group memory access order is reasonably arranged. In the embodiment of the present application, the waiting time of the memory access task corresponding to the memory physical address to be accessed is judged, and when the waiting time of the memory access task corresponding to the memory physical address is greater than the preset value, the execution order of the memory access task corresponding to the memory physical address to be accessed is updated, that is, the memory access order of the memory physical address with a waiting time that is too long is adjusted forward, thereby effectively reducing the overall memory access delay and effectively avoiding the problem of a single memory physical address waiting time being too long. Optionally, a critical waiting value can be set for each memory physical address, and it can also be determined by a preset rule whether the waiting time of the memory access task corresponding to each memory physical address is too long, which is not limited in the embodiment of the present application.
[0073] The method of the above embodiment determines the waiting time of the memory access task corresponding to the memory physical address to be accessed, and updates the execution order of the memory access task corresponding to the memory physical address to be accessed when the waiting time of the memory access task corresponding to the memory physical address is greater than a preset value, thereby effectively reducing the overall memory access delay and avoiding the occurrence of the problem of too long waiting time of the memory access task corresponding to a single memory physical address.
[0074] For example, the process of the memory access control method in the embodiment of the present application is as follows: Figure 3 As shown, the details are as follows: 1. The system sends a continuous read or write command. After address mapping, the physical addresses of the memory correspond to different Bank Groups. Assume that the Bank Groups corresponding to this memory access operation are BG1, BG3, BG2.0, BG2.1, BG2.2, BG2.3, BG1, BG0, and BG0. (BG2.0, BG2.1, BG2.2, and BG2.3 all correspond to Bank Group 2, only to distinguish different memory access tasks).
[0075] 2. If only the non-continuous bank group memory access priority principle is used, the memory access order arbitrated by the arbiter should be: BG1, BG3, BG2.0, BG1, BG2.1, BG0, BG2.2, BG0, BG2.3. In this way, the BG2.3 memory access task needs to wait for the completion of the three memory access tasks before it can be executed.
[0076] 3. When address_reg executes BG2.2, Arbiter determines that the waiting time of BG2.3 memory access task is too long and exceeds the waiting critical value (assuming it is 2 memory access task times). After the memory access task in address_reg is completed, the memory access task that exceeds the waiting critical value is sent to address_reg for execution, that is, the task executed at this time is BG2.3 instead of BG0. That is, by judging the waiting time of the memory access task corresponding to the memory physical address to be accessed, and when the waiting time of the memory access task corresponding to the memory physical address to be accessed is greater than the preset value, the execution order of the memory access task corresponding to the memory physical address to be accessed is updated, thereby effectively reducing the overall memory access delay and avoiding the problem of too long waiting time for a single memory physical address.
[0077] 4. Based on the principle of giving priority to memory access tasks whose waiting time exceeds the critical value, the final memory access order is: BG1, BG3, BG2.0, BG1, BG2.1, BG0, BG2.2, BG2.3, BG0. That is, for multiple memory access tasks of consecutive bank groups, a waiting time critical value is set; once the waiting time of a task exceeds the critical value, this task will be executed first, regardless of whether its bank group is continuous. This method can effectively avoid the problem that the waiting time of a single memory access task is too long, which makes it difficult to implement certain functions of the system.
[0078] The method of the above embodiment, based on the memory access characteristics and key timing delay information of DDR4 memory, introduces an arbitration mechanism of non-continuous Bank Group priority and memory access tasks exceeding the waiting threshold priority, reasonably arranges the memory access order in the continuous reading and writing process, effectively reduces the number of unnecessary continuous accesses to the same Bank Group, and then effectively reduces the memory access delay, improves the memory reading and writing rate, and effectively reduces the delay and jamming caused by insufficient memory bandwidth.
[0079] The memory access control device provided by the present invention is described below. The memory access control device described below and the memory access control method described above can be referred to in correspondence with each other. Figure 4 As shown, including: An acquisition module 410 is used to acquire multiple memory access instructions to the memory; A first determination module 420, configured to determine the memory physical addresses to be accessed and the initial memory access order of the memory physical addresses to be accessed according to the sequence of the memory access instructions and the system address in the memory access instructions; The second determination module 430 is used to determine the target memory access order of each memory physical address to be accessed according to the memory physical address of each memory to be accessed, the initial memory access order and the first rule; the first rule is used to indicate that in the memory access process, two memory physical addresses to be accessed sequentially should avoid having the same memory bank group Bank Group address; The memory access module 440 is used to perform memory access operations according to the target memory access sequence of each memory physical address.
[0080] Optionally, the first determining module 420 is specifically configured to determine the memory access order of the memory physical addresses corresponding to the system addresses in each memory access instruction according to the sequence of each memory access instruction.
[0081] Optionally, the second determination module 430 is specifically used to determine the second memory physical address according to the initial memory access order of each memory physical address to be accessed, the first memory physical address and the first rule; the first memory physical address is the memory physical address of the current memory access; the second memory physical address is the memory physical address that needs to be accessed after the first memory access physical address performs the memory access operation; the second memory physical address corresponds to a different BankGroup address from the first memory physical address; The access order of the remaining memory physical addresses to be accessed is determined according to the second memory physical address, the initial memory access order of each memory physical address to be accessed, and the first rule.
[0082] Optionally, the second determination module 430 is specifically used to determine the second candidate memory physical address according to the initial memory access order of each memory physical address to be accessed and the first memory physical address; the second candidate memory physical address is the memory physical address of the to-be-performed access operation adjacent to the first memory physical address in the initial memory access order; The second memory physical address is determined according to the Bank Group address corresponding to the second candidate memory physical address and the Bank Group address corresponding to the first memory physical address.
[0083] Optionally, the second determination module 430 is specifically configured to determine the second candidate memory physical address as the second memory physical address when the second candidate memory physical address corresponds to a different Bank Group address from the first memory physical address; In the case that the second candidate memory physical address corresponds to the same Bank Group address as the first memory physical address, the second memory physical address is determined from memory physical addresses other than the second candidate memory physical address according to the initial memory access order and the first rule.
[0084] Optionally, the second determination module 430 is also used to determine the waiting time of the memory access task corresponding to the physical address of the memory to be accessed; if the waiting time of the memory access task corresponding to the physical address of the memory to be accessed is greater than a preset value, the execution order of the memory access task corresponding to the physical address of the memory to be accessed is updated.
[0085] Figure 5 The physical structure diagram of an electronic device is illustrated, and the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the memory access control method, and the method includes: obtaining multiple memory access instructions for the memory; determining each memory physical address to be accessed and the initial memory access order of each memory physical address to be accessed according to the sequence of each memory access instruction and the system address in each memory access instruction; determining the target memory access order of each memory physical address to be accessed according to each memory physical address to be accessed, the initial memory access order and the first rule; the first rule is used to indicate that in the memory access process, two memory physical addresses accessed sequentially should be avoided from having the same memory bank group Bank Group address; and performing the memory access operation according to the target memory access order of each memory physical address.
[0086] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0087] On the other hand, the present invention also provides a computer program product, which includes a computer program, and the computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the memory access control method provided by the above methods, and the method includes: obtaining multiple memory access instructions to the memory; determining each memory physical address to be accessed and the initial memory access order of each memory physical address to be accessed according to the sequence of each memory access instruction and the system address in each memory access instruction; determining the target memory access order of each memory physical address to be accessed according to each memory physical address to be accessed, the initial memory access order and a first rule; the first rule is used to indicate that in the memory access process, avoid two memory physical addresses accessed sequentially having the same memory bank group Bank Group address; and perform memory access operations according to the target memory access order of each memory physical address.
[0088] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the memory access control method provided by the above-mentioned methods, the method comprising: obtaining multiple memory access instructions to the memory; determining each memory physical address to be accessed and the initial memory access order of each memory physical address to be accessed according to the sequence of each memory access instruction and the system address in each memory access instruction; determining the target memory access order of each memory physical address to be accessed according to each memory physical address to be accessed, the initial memory access order and a first rule; the first rule is used to indicate that in the memory access process, two memory physical addresses accessed sequentially should be avoided from having the same memory bank group Bank Group address; and performing memory access operations according to the target memory access order of each memory physical address.
[0089] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.
[0090] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0091] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A memory access control method, characterized in that: include: Get multiple memory access instructions to memory; Determining each memory physical address to be accessed and an initial memory access order of each memory physical address to be accessed according to the sequence of each memory access instruction and the system address in each memory access instruction; Determine the target memory access order of each memory physical address to be accessed according to each of the memory physical addresses to be accessed, the initial memory access order and a first rule; the first rule is used to indicate that in the memory access process, two memory physical addresses to be accessed sequentially should avoid having the same memory bank group Bank Group address; Execute memory access operations of the memory according to the target memory access order of each memory physical address.
2. The memory access control method according to claim 1, characterized in that: Determining each memory physical address to be accessed and an initial memory access order of each memory physical address to be accessed according to the sequence of each memory access instruction and the system address in each memory access instruction includes: According to the sequence of each of the memory access instructions, the memory access sequence of the memory physical addresses corresponding to the system addresses in each of the memory access instructions is determined.
3. The memory access control method according to claim 1, characterized in that: Determining the target memory access order of each memory physical address to be accessed according to each memory physical address to be accessed, the initial memory access order of each memory physical address to be accessed, and the first rule includes: Determine the second memory physical address according to the initial memory access order of each memory physical address to be accessed, the first memory physical address and the first rule; the first memory physical address is the memory physical address of the current memory access; the second memory physical address is the memory physical address that needs to be accessed after the first memory access physical address performs the memory access operation; the second memory physical address and the first memory physical address correspond to different bank group addresses; The access order of the remaining memory physical addresses to be accessed is determined according to the second memory physical address, the initial access order of each of the memory physical addresses to be accessed, and the first rule.
4. The memory access control method according to claim 3, characterized in that: The determining the second memory physical address according to the initial memory access order of each of the memory physical addresses to be accessed, the first memory physical address and the first rule comprises: Determine a second candidate memory physical address according to the initial memory access order of each of the memory physical addresses to be accessed and the first memory physical address; the second candidate memory physical address is a memory physical address of the to-be-performed access operation adjacent to the first memory physical address in the initial memory access order; The second memory physical address is determined according to the Bank Group address corresponding to the second candidate memory physical address and the Bank Group address corresponding to the first memory physical address.
5. The memory access control method according to claim 4, characterized in that: The determining the second memory physical address according to the bank group address corresponding to the second candidate memory physical address and the bank group address corresponding to the first memory physical address includes: In the case where the second candidate memory physical address and the first memory physical address correspond to different Bank Group addresses, the second candidate memory physical address is determined as the second memory physical address; In the case that the second candidate memory physical address corresponds to the same Bank Group address as the first memory physical address, the second memory physical address is determined from memory physical addresses other than the second candidate memory physical address according to the initial memory access order and the first rule.
6. The memory access control method according to any one of claims 3 to 5, characterized in that: After determining the target memory access order of each memory physical address to be accessed according to each memory physical address to be accessed, the initial memory access order of each memory physical address to be accessed and the first rule, the method further includes: Determine the waiting time of the memory access task corresponding to the memory physical address to be accessed; If the waiting time of the memory access task corresponding to the physical address of the memory to be accessed is greater than a preset value, the execution order of the memory access task corresponding to the physical address of the memory to be accessed is updated.
7. A memory access control device, characterized in that: include: An acquisition module, used for acquiring multiple memory access instructions to the memory; A first determination module, used to determine each memory physical address to be accessed and an initial memory access order of each memory physical address to be accessed according to the sequence of each memory access instruction and the system address in each memory access instruction; A second determination module is used to determine the target memory access order of each memory physical address to be accessed according to each memory physical address to be accessed, the initial memory access order and a first rule; the first rule is used to indicate that in the memory access process, two memory physical addresses accessed sequentially should avoid having the same memory bank group Bank Group address; The memory access module is used to perform memory access operations of the memory according to the target memory access sequence of each memory physical address.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the memory access control method as described in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the memory access control method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the memory access control method according to any one of claims 1 to 6 is implemented.
