Memory page access method and related device
By comprehensively determining the memory access strategy in the command queue and page table and dynamically adjusting the memory page configuration, the problem of low memory access efficiency is solved, and a higher hit rate and lower latency are achieved.
Patent Information
- Application Number
- PCT/CN2024/096209
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-29
- Filing Date
- 2024-05-30
- Publication Date
- 2025-10-02
AI Technical Summary
In the existing technology, memory access efficiency is low. Especially in the case of good spatial locality, static page opening strategy or page closing strategy cannot effectively improve the page hit rate, resulting in access delay and increased power consumption.
By obtaining the target access command in the command queue and combining it with the historical information of the page table, the first page strategy and the second page strategy are comprehensively determined, the memory page configuration is dynamically adjusted, and the corresponding memory access command is generated to reduce page misses and conflicts and improve the hit rate.
It realizes dynamic adjustment of page strategy during memory access, reduces latency and power consumption, and improves memory access efficiency.
Smart Images

Figure CN2024096209_02102025_PF_FP_ABST
Abstract
Description
Memory page access method and related device
[0001] This application claims priority to Chinese patent application No. 202410381176.X filed on March 29, 2024. The contents of the above-mentioned Chinese patent application disclosure are hereby incorporated by reference in their entirety as a part of this application. Technical Field
[0002] The embodiments of the present disclosure relate to a memory page access method and related devices. Background Art
[0003] Memory is a component of a computer used to store data and programs and is an essential component of the computer. The smallest unit of memory storage is a column, with multiple columns forming a row. Data can be stored in memory in units of pages / rows. During computer operation, based on the data storage function of memory pages, memory pages can be accessed to perform corresponding operations on the data, such as reading and writing data. In this context, how to improve memory access efficiency has become a technical problem that those skilled in the art urgently need to solve.
[0004] Summary of the Invention
[0005] In view of this, embodiments of the present disclosure provide a memory page access method and related devices to improve memory access efficiency.
[0006] To achieve the above objectives, the embodiments of the present disclosure provide the following technical solutions.
[0007] An embodiment of the present disclosure provides a memory page access method, including:
[0008] Obtaining a target access command from a command queue, the target access command including at least a target physical address corresponding to a target memory page, the command queue storing a to-be-executed access command including a to-be-accessed physical address corresponding to a to-be-accessed memory page;
[0009] Obtaining page history information corresponding to the target physical address in the page table;
[0010] Determining a first page strategy according to the physical address to be accessed and the target physical address, where the first page strategy indicates a hit decision of the memory page to be accessed corresponding to the target physical address;
[0011] determining a second page strategy according to the page history information, where the second page strategy indicates a hit decision corresponding to the target memory page estimated based on the page history information;
[0012] Among the first page policy and the second page policy, a page policy is determined to be sent as a target page policy, so as to generate a corresponding memory access command based on the target page policy.
[0013] Optionally, determining the first page strategy according to the to-be-accessed physical address and the target physical address is specifically:
[0014] Comparing the physical address to be accessed with the target physical address to obtain an address comparison result;
[0015] A first page strategy is determined according to the address comparison result.
[0016] Optionally, the physical address includes a chip select address, a bank address, and a page address;
[0017] The comparison of the physical address to be accessed and the target physical address is specifically: respectively comparing the chip select address in the physical address to be accessed and the chip select address in the target physical address, the library address in the physical address to be accessed and the library address in the target physical address, and the page address in the physical address to be accessed and the page address in the target physical address.
[0018] Optionally, the first page strategy includes an open page strategy, a close page strategy, and an irrelevant strategy;
[0019] If the physical address to be accessed is the same as the chip select address in the target physical address, the bank address is the same, and the page address is the same, determining the page opening strategy;
[0020] If the physical address to be accessed is the same as the chip select address in the target physical address, the bank address is the same, and the page address is different, determining a closed page strategy;
[0021] If the chip select address in the to-be-accessed physical address is the same as the target physical address but the bank address is different, or if the chip select address in the to-be-accessed physical address is different from the target physical address but the bank address is the same, an irrelevant strategy is determined.
[0022] Optionally, determining a page policy among the first page policy and the second page policy to be sent as the target page policy includes: the priority of the first page policy is higher than the second page policy, and determining the first page policy among the first page policy and the second page policy to be sent as the target page policy.
[0023] Optionally, determining a page policy among the first page policy and the second page policy and sending it as the target page policy also includes: if the first page policy is an unrelated policy, determining the second page policy among the first page policy and the second page policy and sending it as the target page policy.
[0024] Optionally, determining the second page strategy according to the page history information includes:
[0025] Determining a first value and a second value based on the page history information, wherein the first value is obtained by weighted summing the page history information using the information type corresponding to the page history information as a weight; and the second value is obtained by adjusting an initial value based on the information type corresponding to the page history information;
[0026] The first value and the second value are compared to determine a second page strategy.
[0027] Optionally, the page history information includes: page history hit information, page history conflict information and page history miss information.
[0028] Optionally, when the first value is obtained by weighted summing the page history information using the information type corresponding to the page history information as a weight,
[0029] If the page address of the previous access command of the target access command recorded in the page history information is the same as the page address of the target access command, then the weight of the page history hit information is used as the weight of the page history miss information, and the page history information is weighted and summed up using the information type corresponding to the page history information as the weight to obtain the first value; or
[0030] If the page address of the previous access command of the target access command recorded in the page history information is different from the page address of the target access command, the weight of the page history conflict information is used as the weight of the page history miss information, and the page history information is weighted and summed up with the information type corresponding to the page history information as the weight to obtain the first value.
[0031] Optionally, adjusting the initial value according to the information type corresponding to the page history information includes:
[0032] If page history hit information is added to the page history information, the initial value is correspondingly reduced by a preset ratio; wherein the number of times the initial value is reduced by the preset ratio corresponds to the number of times the page history hit information is added;
[0033] If page history conflict information and / or page history miss information are added to the page history information, the initial value is increased by a preset ratio; wherein the number of times the initial value is increased by the preset ratio corresponds to the number of times the page history conflict information and / or the page history miss information are added.
[0034] Optionally, the second page strategy includes an opening page strategy and a closing page strategy;
[0035] The comparing the first value and the second value to determine the second page strategy includes:
[0036] Based on the forward calculation of page hits, if the first value is greater than or equal to the second value, an open page strategy is determined; if the first value is less than the second value, a close page strategy is determined; or,
[0037] Based on the reverse calculation of the page hit, if the first value is less than the second value, the page opening strategy is determined; if the first value is greater than or equal to the second value, the page closing strategy is determined.
[0038] Optionally, while obtaining the target access command from the command queue, the method further includes:
[0039] The target access command is sent to the page table so that the page table records the access information corresponding to the target physical address, and compares whether the command type of the target access command is the same as the command type of the recorded historical access command. If different, clear the recorded access information corresponding to the historical access command.
[0040] Optionally, obtaining the target access command in the command queue is specifically:
[0041] A target access command is obtained from the access commands to be executed stored in the command queue according to the access priority and / or address access efficiency of the access command to be executed.
[0042] An embodiment of the present disclosure provides an arbitration module, including:
[0043] a command acquisition unit, configured to acquire a target access command from a command queue, the target access command including at least a target physical address corresponding to a target memory page, the command queue storing access commands to be executed, the access commands to be executed including a physical address to be accessed corresponding to a memory page to be accessed;
[0044] An information acquisition unit, configured to acquire page history information corresponding to the target physical address in a page table;
[0045] a first determining unit, configured to determine a first page strategy according to the physical address to be accessed and the target physical address, wherein the first page strategy indicates a hit decision of the memory page to be accessed corresponding to the target physical address;
[0046] A second determination unit group is configured to determine a second page strategy based on the page history information, where the second page strategy indicates a hit decision corresponding to the target memory page estimated based on the page history information;
[0047] The policy determination unit is configured to determine a page policy from among the first page policy and the second page policy and send it as a target page policy, so as to generate a corresponding memory access command based on the target page policy.
[0048] Optionally, the first determining unit determines a first page strategy according to the to-be-accessed physical address and the target physical address, specifically:
[0049] Comparing the physical address to be accessed with the target physical address to obtain an address comparison result;
[0050] A first page strategy is determined according to the address comparison result.
[0051] Optionally, the second determination unit group includes: a page history information calculation unit and a page hit prediction unit;
[0052] The page history information calculation unit is configured to determine a first value and a second value based on the page history information, wherein the first value is obtained by weighted summing the page history information using the information type corresponding to the page history information as a weight; and the second value is obtained by adjusting an initial value based on the information type corresponding to the page history information;
[0053] The page hit prediction unit is used to compare the first value and the second value to determine a second page strategy.
[0054] Optionally, the command acquisition unit is further configured to:
[0055] The target access command is sent to the page table so that the page table records the access information corresponding to the target access command, and compares whether the command type of the target access command is the same as the command type of the recorded historical access command. If different, clear the recorded access information corresponding to the historical access command.
[0056] An embodiment of the present disclosure provides a memory page access method, including:
[0057] Obtaining a target page policy, the target page policy being a page policy determined between a first page policy and a second page policy, the first page policy being determined based on a physical address to be accessed and a target physical address, and the second page policy being determined based on page history information, wherein the target physical address is obtained based on a target access command obtained in a command queue, the target access command including at least the target physical address corresponding to a target memory page, the command queue storing access commands to be executed, the access commands to be executed including the physical address to be accessed corresponding to the memory page to be accessed; and the page history information is obtained from a page table based on the target physical address.
[0058] Based on the target page policy, a corresponding memory access command is generated.
[0059] The present disclosure provides a command generation module, including:
[0060] a target policy acquisition unit, configured to acquire a target page policy, the target page policy being a page policy determined between a first page policy and a second page policy, the first page policy being determined based on a physical address to be accessed and a target physical address, and the second page policy being determined based on page history information, wherein the target physical address is obtained based on a target access command obtained from a command queue, the target access command including at least the target physical address corresponding to a target memory page, the command queue storing access commands to be executed, the access commands to be executed including the physical address to be accessed corresponding to the memory page to be accessed; and the page history information is obtained from a page table based on the target physical address;
[0061] A memory access command generating unit is used to generate a corresponding memory access command based on the target page policy.
[0062] An embodiment of the present disclosure provides a memory controller, comprising: an arbitration module and a command generation module;
[0063] The arbitration module is configured to obtain a target access command from a command queue, the target access command including at least a target physical address corresponding to a target memory page, the command queue storing a to-be-executed access command including a to-be-accessed physical address corresponding to a to-be-accessed memory page; and obtain page history information corresponding to the target physical address from a page table; and send a target page policy based on the target physical address and the page history information;
[0064] The command generation module is used to obtain the target page policy and generate a corresponding memory access command based on the target page policy.
[0065] An embodiment of the present disclosure provides a memory system, including a memory controller as provided in any of the above embodiments.
[0066] An embodiment of the present disclosure provides an electronic device, comprising at least one memory and at least one processor, wherein the memory stores one or more computer-executable instructions, and the processor calls the one or more computer-executable instructions to execute a memory page access method as provided in any of the above embodiments.
[0067] An embodiment of the present disclosure provides a storage medium, which stores one or more computer-executable instructions. When the one or more computer-executable instructions are executed, the memory page access method provided in any of the above embodiments is implemented.
[0068] An embodiment of the present disclosure provides a computer program product, comprising one or more computer-executable instructions, which, when executed, implement the memory page access method provided in any of the above embodiments.
[0069] A memory page access method provided by an embodiment of the present disclosure obtains a target access command in a command queue, wherein the target access command includes at least a target physical address corresponding to a target memory page, and the command queue stores access commands to be executed, wherein the access commands to be executed include a physical address to be accessed corresponding to the memory page to be accessed; and, obtains page history information corresponding to the target physical address in a page table; and then, determines a first page strategy based on the physical address to be accessed and the target physical address; determines a second page strategy based on the page history information; and thus, determines a page strategy among the first page strategy and the second page strategy to be sent as the target page strategy, so as to generate a corresponding memory access command based on the target page strategy.
[0070] The target page policy sent by the embodiment of the present disclosure comprehensively considers the access commands stored in the command queue and the page history information of the target physical address included in the target access command, so that the determination of the target page policy is more flexible, thereby being able to dynamically adjust the memory page configuration; furthermore, when generating the corresponding memory access command based on the target page policy, the delay of memory access can be reduced, thereby improving the memory access efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are merely embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without any creative work.
[0072] FIG1 is a schematic diagram of a process for accessing a memory page;
[0073] FIG2 is a schematic diagram of an optional flow chart of a memory page access method provided by an embodiment of the present disclosure;
[0074] FIG3 is a schematic diagram of an optional structure of a page table provided in an embodiment of the present disclosure;
[0075] FIG4 is another optional flow diagram of the memory page access method provided by an embodiment of the present disclosure;
[0076] FIG5 is a schematic diagram of an optional structure of a memory controller provided in an embodiment of the present disclosure;
[0077] FIG6 is another optional flowchart of the memory page access method provided by an embodiment of the present disclosure;
[0078] FIG7 is a schematic diagram of an optional structure of a command generation module provided in an embodiment of the present disclosure;
[0079] FIG8 is a schematic diagram of an optional structure of a memory system provided by an embodiment of the present disclosure; and
[0080] FIG9 is an optional block diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0081] The following will be combined with the accompanying drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the embodiments described are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of the present disclosure.
[0082] Memory is a component in a computer used to store data and programs and is an essential component of a computer. With the advancement of computer technology, Double Data Rate (DDR) memory, such as Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM), has become widely used in memory. Furthermore, with the continuous improvement of memory technology, DDR memory chips have evolved into memory chips such as DDR4 (Double Data Rate 4, the fourth generation of DDR memory) and DDR5 (Double Data Rate 5, the fifth generation of DDR memory). In an optional implementation, DDR SDRAM can also be simply referred to as DDR.
[0083] In DDR, data is stored in units of pages / rows. The area where data is stored is called a bank. Each bank has a corresponding page cache, which can temporarily store a row / page of data in the bank. Figure 1 shows a schematic diagram of the process of accessing a memory page, where the grid part is the bank. Read and write access commands are transmitted to the DDR through the data channel. When performing read / write access to the DDR, the memory page cannot be accessed directly. The page cache corresponding to the bank must be accessed. The data corresponding to the page to be accessed is first loaded into the page cache, and then the data read or write operation is performed based on the page cache.
[0084] Furthermore, in DDR, the smallest addressable unit of memory is the column. As shown in Figure 1, a page (row) can correspond to multiple columns of data. When the memory reads commands concurrently, such as in DDR4, it can read eight columns of data in a row into the page cache at once, according to the actual column address specified by the command.
[0085] As an optional implementation, when the page corresponding to the data loaded into the page cache by a Bank corresponds to the page of the access command accessing the Bank, it is called a page hit.
[0086] As an optional implementation, when the page corresponding to the data loaded into the page cache by a Bank is different from the page of the access command to access the Bank, it is called a page conflict.
[0087] As an optional implementation, when a bank fails to load the data corresponding to any page into the page cache, it is called a page miss.
[0088] Among them, when the page corresponding to the data loaded by the Bank into the page cache corresponds to the page of the access command to access the Bank, that is, the page hit, the corresponding data can be read / written from the page cache; when the Bank does not load the data corresponding to any page into the page cache, that is, the page miss, the corresponding page needs to be opened. In an optional example, the Activate command can be used to open the page and load the data of the corresponding page into the page cache before a read or write operation can be performed based on the data in the page cache; when the page corresponding to the data loaded by the Bank into the page cache is different from the page of the access command to access the Bank, that is, the page conflict, the opened page needs to be closed first. In an optional example, the Precharge command can be used to close the page and then load the data of the corresponding page into the page cache before a read or write operation can be performed based on the data in the page cache.
[0089] It should be noted that based on the continuous improvement of memory technology, the derived DDR4 (Double Data Rate 4, i.e., the 4th generation DDR memory) and DDR5 (Double Data Rate 5, i.e., the 5th generation DDR memory) protocols can support automatic closing of the page after reading and writing data on the memory page, that is, using the automatic precharge command (Auto Precharge). Corresponding to the data read command and the data write command, the automatic precharge command can be a read auto precharge (RdAp, Read Auto Precharge) command and a write auto precharge (WrAp, Write Auto Precharge) command, respectively. Among them, the strategy of using RdAp / WrAp to automatically close the memory page can be called a page-closing strategy. Conversely, the strategy of keeping the memory page open can be called an open page strategy.
[0090] It's understandable that in a memory system, the Activate command (opening a memory page) and the Precharge command (closing a page) consume a certain amount of memory power. This is primarily because the Activate and Precharge commands require signals to be sent to the memory chip via the memory controller, which results in current flow and voltage changes. Furthermore, the sending of the Activate and Precharge commands also takes a certain amount of time to open and close the memory page, increasing memory access latency and reducing memory access efficiency.
[0091] To reduce memory power consumption and access latency, as an optional implementation, a page-closing strategy can be adopted for the memory, that is, after each read / write access to the memory, the currently accessed page is closed through an automatic precharge command. By adopting the page-closing strategy, page conflicts can be effectively avoided for memory accesses with poor spatial locality, that is, when accessing memory, there is a possibility of accessing nearby memory space, and memory access latency and bandwidth can be reduced. However, the page-closing strategy cannot identify memory accesses with good spatial locality, that is, it cannot identify the data that tends to be accessed in the memory space with relatively close addresses during memory access, resulting in the inability to improve the page hit rate, and the improvement in memory access efficiency is not obvious.
[0092] Therefore, in order to improve the page hit rate and enhance the memory access efficiency, as an optional implementation, a static page opening strategy or page closing strategy can be adopted for the memory, that is, after performing a data read / write operation on a memory page, the memory page is kept in an open state, or the memory page is kept in a closed state. However, not all access commands are only for a fixed memory page, which makes the memory access efficiency improvement of the static page opening strategy not high. Moreover, when the memory page is in a closed state, the page hit rate cannot be improved, which makes the memory access efficiency improvement of the static page closing strategy not high. Moreover, when the page is in a closed state, an activation command still needs to be sent to open the memory page, which also increases the delay of memory access to a certain extent.
[0093] It can be seen that how to achieve access to memory pages and improve memory access efficiency is particularly important.
[0094] In view of this, the embodiment of the present disclosure proposes an improved memory page access scheme, which determines the target page strategy by comprehensively considering the access commands stored in the command queue and the page history information of the target physical address, so that the determination of the target page strategy is more flexible, thereby dynamically adjusting the page configuration; furthermore, when generating the corresponding memory access command based on the target page strategy, the memory access delay can be reduced, thereby improving the memory access efficiency.
[0095] Based on the above ideas, FIG2 shows an optional flow diagram of a memory page access method according to an embodiment of the present disclosure. The memory page access method can be implemented by a memory controller. As shown in FIG2 , the memory page access method may include:
[0096] Step S100: Obtain a target access command in a command queue.
[0097] When the upstream device sends an access command to the memory controller to access the memory, the memory controller can store the memory access command in a command queue. Since the upstream device can send multiple access commands to the memory controller at the same time, the command queue can store multiple access commands to be executed, and the access commands to be executed can include the physical address to be accessed corresponding to the memory page to be accessed.
[0098] As an optional implementation, based on multiple pending access commands stored in a command queue, a target access command can be obtained from the pending access commands stored in the command queue according to the access priority of the pending access commands, wherein the target access command at least includes a target physical address corresponding to a target memory page.
[0099] Step S200: Obtain page history information corresponding to the target physical address in the page table.
[0100] The page table can store the access history information of each Bank page of the memory, so as to predict the status of page hits, misses and conflicts of future memory accesses. The page table can include multiple storage units, and the information stored in each storage unit can be, for example: the specific address of the current Bank, whether the Bank is in active state (the data of a row of memory is loaded in the buffer), and the row address loaded when the page table was opened by the most recent active command. After the Bank is closed by the pre-charge command (pre-charge), the row address will not be cleared until it is activated next time and directly written to a new row address to overwrite it. The access history information may include a historical status code, based on which the historical status of the accessed memory page can be determined, wherein different historical status codes can respectively represent page hits, page conflicts, and page misses (including page misses but the row address of the previously opened Bank is the same as the current command, or page misses but the row address of the previously opened Bank is different from the current command). Furthermore, the access history information may also maintain historical age information of the memory page, which refers to the access status information type (eg, hit, miss, conflict) of the corresponding memory page and the length of time recorded in the page history information up to the current time.
[0101] In an optional example, based on the page table's storage function for access history information of each Bank page, Figure 3 exemplifies an optional structural diagram of the page table. As shown in Figure 3, the page table can record the chip select address, library address, page address of the corresponding memory page in the access command, and the page history hit information corresponding to the memory page. For example, if the page table records the page history information of N+1 access commands, there may be N+1 corresponding page history hit information, namely page history hit 0, page history hit 1, page history hit 2,..., page history hit N, and the page status corresponding to the access command.
[0102] Therefore, based on the storage function of the page table for the access history information of each Bank page, the page history information of the corresponding target physical address can be obtained in the page table according to the obtained target access command.
[0103] Step S300: Determine a first page strategy according to the physical address to be accessed and the target physical address.
[0104] The first page strategy may indicate a hit decision of the memory page to be accessed corresponding to the target physical address, so as to reduce the probability of page misses and conflicts of the memory page and increase the page hit probability.
[0105] Since the target physical address is included in the target access command, based on the acquisition of the target access command, the target access command can be used to execute the memory access process, and the physical address to be accessed is included in the access command to be executed stored in the command queue. Therefore, based on the connection between the physical address to be accessed and the target physical address, for example: the physical address to be accessed and the target physical address are the same address, rules and decisions for memory pages can be determined to reduce the probability of page misses and conflicts of memory pages and increase the probability of page hits, that is, the first page strategy is determined based on the physical address to be accessed and the target physical address.
[0106] As an optional implementation, the first page strategy can be based on the execution of the target access command to consider improving the probability of page hits and configure the decision information such as using the automatic precharge command (Auto Precharge) to keep the memory page open or automatically close it, or not operate it.
[0107] Step S400: Determine a second page strategy based on page history information.
[0108] The second page strategy may indicate a hit decision corresponding to the target memory page estimated based on the page history information, so as to reduce the probability of page misses and conflicts of the memory page and increase the page hit probability.
[0109] Since the page table stores the access history information of each Bank page, the second page strategy can be determined according to the page history information recorded in the page table.
[0110] As an optional implementation, the second page strategy can be configured to use an automatic precharge command (Auto Precharge) to keep the memory page open or automatically close based on the execution of the target access command in order to improve the probability of page hits.
[0111] Step S500: Determine a page policy among the first page policy and the second page policy and send it as the target page policy.
[0112] Based on the determined first page strategy and second page strategy, a page strategy can be further determined in the first page strategy and the second page strategy to be sent to the outside as a target page strategy, so that based on the obtained target page strategy, a corresponding memory access command is generated to perform memory access based on the generated memory access command. When the data operation corresponding to the memory page is completed, the memory page state can be automatically configured to be open or closed according to the target page strategy. Compared with the static open page strategy or closed page strategy, the power consumption and delay of memory access can be reduced, thereby improving the memory access efficiency.
[0113] It can be seen that in the embodiment of the present disclosure, when determining the target page strategy based on the obtained target access command, the access commands stored in the command queue and the page history information of the target physical address are comprehensively considered, so that the determination of the target page strategy is more flexible, thereby being able to dynamically adjust the memory page configuration; furthermore, when generating the corresponding memory access command based on the target page strategy, the memory access delay can be reduced and the memory access efficiency can be improved.
[0114] In some embodiments, since the first page policy can indicate a hit decision for the memory page to be accessed corresponding to the target physical address, thereby reducing the probability of page misses and conflicts of the memory page and increasing the probability of page hits, when determining the first page policy based on the physical address to be accessed and the target physical address, the first page policy can be determined by comparing the physical address to be accessed with the target physical address to obtain an address comparison result, and then determining the first page policy based on the address comparison result.
[0115] Furthermore, in some embodiments, the physical address is used to uniquely identify a specific location in the memory and may include a chip select address, a bank address, and a page address.
[0116] The chip select address is used to select a memory chip or a memory module. In a memory composed of multiple memory chips, each chip has a unique chip select address, and the chip select address can be used to determine the specific chip to be accessed.
[0117] The bank address is used to select the corresponding bank in the memory chip. Through the bank address, the specific bank to be accessed can be determined.
[0118] The page address is used to select a specific page in the library. Through the page address, the specific page to be accessed can be determined.
[0119] Based on the chip select address, library address and page address contained in the physical address, when comparing the physical address to be accessed with the target physical address, the chip select address in the physical address to be accessed and the chip select address in the target physical address can be compared respectively; the library address in the physical address to be accessed and the library address in the target physical address; and the page address in the physical address to be accessed and the page address in the target physical address can be compared respectively.
[0120] In some embodiments, since the determination of the first page policy takes into account the association between the physical address to be accessed and the target physical address, the first page policy may include an open page policy, a closed page policy, and an irrelevant policy. Among them, based on the access execution of the memory page corresponding to the target physical address, and the association between the physical address to be accessed and the target physical address, the open page policy indicates that the memory page accessed by the target access command remains open after the operation is completed; the closed page policy indicates that the memory page accessed by the target access command is closed after the operation is completed; the irrelevant policy indicates that the memory page accessed by the target access command is irrelevant to the memory page corresponding to the access command stored in the command queue, for example: all pages in the library address corresponding to the target access command are in a closed state relative to the access command stored in the command queue.
[0121] Based on the fact that the physical address includes a chip select address, a bank address, and a page address, when determining the first page strategy based on the comparison result between the target physical address and the physical address to be accessed, as an optional implementation, if the chip select address, bank address, and page address of the physical address to be accessed are the same as those of the target physical address, then an open page strategy can be determined. The fact that the chip select address, bank address, and page address of the physical address to be accessed are the same as those of the target physical address indicates that the physical address to be accessed and the target physical address correspond to the same memory page of the same bank of the same memory chip. After accessing the memory page based on the target physical address, the memory page can be kept open to facilitate subsequent access to the memory page based on the physical address to be accessed, thereby determining an open page strategy.
[0122] As another optional implementation, if the chip select address and bank address in the to-be-accessed physical address are the same as those in the target physical address, but the page addresses are different, a closed page strategy can be determined. If the chip select address and bank address in the to-be-accessed physical address and the target physical address are the same, but the page addresses are different, this indicates that the to-be-accessed physical address and the target physical address correspond to different memory pages in the same bank of the same memory chip. After accessing the memory page according to the target physical address, the memory page can be closed to ensure subsequent data read / write operations, thus determining a closed page strategy.
[0123] As another optional implementation, if the chip select address in the physical address to be accessed is the same as that in the target physical address, but the bank address is different, or if the chip select address in the physical address to be accessed is different from that in the target physical address, but the bank address is the same, an irrelevant strategy is determined. Wherein, if the chip select address in the physical address to be accessed is the same as that in the target physical address, but the bank address is different, it means that the physical address to be accessed and the target physical address correspond to different banks of the same memory chip; if the chip select address in the physical address to be accessed is different from that in the target physical address, but the bank address is the same, it means that the physical address to be accessed and the target physical address correspond to different memory chips. Accordingly, the page address of the physical address to be accessed cannot be the same as that of the target physical address, then the memory page of the bank to be accessed by the physical address to be accessed of the access command to be executed is irrelevant to the memory page of the bank corresponding to the target physical address, and thus it can be determined as an irrelevant strategy.
[0124] It should be noted that the command queue may store multiple pending access commands, each of which includes a pending physical address of the corresponding memory page to be accessed. Therefore, as long as the pending physical address of at least one pending access command in the command queue (i.e., other pending access commands other than the target access command) is the same as the chip select address, bank address, and page address in the target physical address, the first page strategy is determined to be the open page strategy.
[0125] In some embodiments, the first page strategy indicates a hit decision of the memory page to be accessed corresponding to the target physical address, and the second page strategy indicates a hit decision of the corresponding target memory page estimated based on page history information, so as to improve the hit rate of the memory page. As an optional implementation, the decision importance corresponding to the first page strategy is different from the decision importance corresponding to the second page strategy, and the priority of the first page strategy can be higher than that of the second page strategy.
[0126] In order to achieve a higher priority for the first page policy than the second page policy, in an optional example, the probability that the target physical address is the same as the physical address to be accessed stored in the command queue can be set to be greater than the ratio of the access commands corresponding to the physical address to be accessed that is the same as the target physical address stored in the command queue to the total number of access commands. For example, if the probability that the target physical address is the same as the physical address to be accessed stored in the command queue is set to 55%, and the ratio of the access commands corresponding to the physical address to be accessed that is the same as the target physical address stored in the command queue to the total number of access commands is 50%, since 55% is greater than 50%, the first page policy has a higher priority than the second page policy.
[0127] In another optional example, the proportion of the first page policy can be preset to be greater than the proportion of the second page policy. For example, the proportion of the first page policy is set to 60%, and the proportion of the second page policy is set to 40%. Since the proportion of the first page policy is 60% and the proportion of the second page policy is 40%, the first page policy has a higher priority than the second page policy.
[0128] Therefore, when determining a page policy to be sent as the target page policy among the first page policy and the second page policy, based on the fact that the priority of the first page policy is higher than that of the second page policy, the first page policy can be determined to be sent as the target page policy among the first page policy and the second page policy.
[0129] As another optional implementation, since the irrelevant policy indicates that the memory page accessed by the target access command is irrelevant to the memory page corresponding to the access command stored in the command queue, in order to improve the hit rate of the memory page, when a page policy is determined to be sent as the target page policy among the first page policy and the second page policy, if the first page policy is an irrelevant policy, the second page policy is sent as the target page policy among the first page policy and the second page policy.
[0130] It should be noted that the above example is only an optional implementation of determining the target page strategy, and corresponding settings can also be made according to actual needs. As long as a page strategy is determined as the target page strategy to be sent in the first page strategy and the second page strategy, the embodiment of the present disclosure does not limit the specific content of implementing the determination of the target page strategy.
[0131] In some embodiments, since the second page policy indicates a hit decision corresponding to the target memory page estimated based on the page history information, and the page history information is a record of the execution of the corresponding access command, such as a memory page hit, miss, or conflict, in order to ensure the accuracy of the determined second page policy, when determining the second page policy based on the page history information, the first value and the second value can be first determined based on the page history information; then, the first value and the second value are compared to determine the second page policy.
[0132] Furthermore, in some embodiments, since the page history information is the execution of the corresponding access command and records the situation of hitting the memory page based on the switch state of the memory page, the page history information may include page history hit information, page history conflict information and page history miss information.
[0133] The page hit history information is the page hit information recorded when the access command is executed. The page conflict history information is the page conflict information recorded when the access command is executed. The page miss history information is the page miss information recorded when the access command is executed.
[0134] As an optional implementation, when determining the first value and the second value based on the page history information, the first value can be obtained by weighted summing the page history information with the information type corresponding to the page history information as the weight. For example: the page history hit information, page history conflict information and page history miss information correspond to weight values P1, P2 and P3 respectively, the number of page history hit information corresponding to the target physical address recorded in the page table is H1, the number of page history conflict information is H2, and the number of page history miss information is H3, and the weighted summation obtains the first value A=ΣPiHi. Among them, Pi is P1, P2, P3, which can be a value in the range of [0,1], and Hi is H1, H2, H3. Among them, the greater the weight, the greater the impact on the total. The weighted summation can reflect the contribution of the information type corresponding to the page history information to the total, indicating that the hit situation of the memory page recorded in the page history information accounts for a relatively large proportion, reflecting the short-term expectation of the inner page being hit continuously.
[0135] It should be noted that in the embodiment of the present disclosure, in the method of obtaining the first numerical value based on weighted summation, the selection of weights can also exist in other forms according to actual needs, and is not limited to the information type corresponding to the page history information as the weight. For example: different weights are set according to the corresponding information type and the length of time recorded in the page history information (that is, different weights are given according to the historical age of the corresponding information type), wherein information with shorter time intervals can be given higher weight values, and information with longer time intervals can be given lower weight values. Based on the multiple dimensions of weight selection, the weighted sum of the page history information forms a multi-dimensional weight summation, avoiding the situation where a single weight value is zero.
[0136] In a further example, when the first value is obtained by weighting and summing the page history information using the information type corresponding to the page history information as a weight, if the page address of the previous access command of the target access command recorded in the page history information is the same as the page address of the target access command, then the weight of the page history hit information is used as the weight of the page history miss information, and the page history information is weighted and summed using the information type corresponding to the page history information as a weight to obtain the first value. Among them, the page address of the previous access command is the same as the page address of the target access command, indicating that the user has repeatedly accessed the same page, so that the weight of the page history hit information can be used as the weight of the page history miss information to achieve a more accurate assessment of the hit probability of the memory page corresponding to the target access command.
[0137] If the page address of the previous access command of the target access command recorded in the page history information is different from the page address of the target access command, the weight of the page history conflict information is used as the weight of the page history miss information, and the page history information is weighted and summed up using the information type corresponding to the page history information as the weight to obtain the first value. Among them, the page address of the previous access command is different from the page address of the target access command, indicating that the user's target access command is for another memory page. Therefore, the weight of the page history conflict information can be used as the weight of the page history miss information to achieve a more accurate assessment of the conflict probability of the memory page corresponding to the target access command.
[0138] The second numerical value may be obtained by adjusting the initial value according to the information type corresponding to the page history information. The initial value may be a threshold value related to page hit information set based on system initialization. By adjusting the initial value according to the information type corresponding to the page history information, the cumulative expectation of the number of consecutive hits of the memory page over a long period of time can be reflected. The larger the initial value, the greater the expectation of memory page conflicts / misses over a long period of time; otherwise, the smaller the initial value.
[0139] When adjusting the initial value based on the type of information corresponding to the page history information upon execution of the access command, as an optional implementation, if page history hit information is added to the page history information, the initial value may be reduced by a corresponding preset ratio. For example, if the initial value is 10, and when page history hit information is recorded in the page table once, 10 is reduced by 1, resulting in a second value T of 9. The number of times the initial value is reduced by the preset ratio may correspond to the number of times the page history hit information is added.
[0140] As another optional implementation, if page history conflict information and / or page history miss information are added to the page history information, the initial value may be increased by a corresponding preset ratio. For example, if the initial value is 10, and when page history conflict information or page history miss information is recorded in the page table once, 10 is increased by 2, resulting in a second value T of 12. The number of times the initial value is increased by the preset ratio may correspond to the number of times the page history conflict information and / or page history miss information is added.
[0141] It is understood that since the determination of the second value is associated with the page history information recorded in the page table, the second value obtained by adjusting the initial value according to the information type corresponding to the page history information is a dynamic threshold that is dynamically adjusted based on the initial value. The maximum value of the second value can be associated with the number of memory accesses, for example, the maximum value of the second value is ΣHi, and the minimum value of the second value can be 0.
[0142] It should be noted that, based on the information storage function of the page table, in order to facilitate adjustment of the initial value according to the information type corresponding to the page history information, when an access command is executed, a second value serving as the dynamic threshold can be recorded in the page table, as shown in FIG3 , as the dynamic threshold T. The specific content of the page table in the embodiment of the present disclosure can also be set accordingly according to actual needs, and the embodiment of the present disclosure is not limited thereto.
[0143] In some embodiments, since the second page policy is formulated based on the executed access command, corresponding to the hit situation of the executed access command, the second page policy may include an open page policy and a close page policy.
[0144] When comparing the first and second values to determine the second page strategy, as an optional implementation, a forward calculation of page hits can be performed, where the forward calculation of page hits refers to a weighted sum of the corresponding first values, with the weight of the page history hit information being greater than the page history conflict information and the page history miss information. If the calculated first value is greater than or equal to the second value, then the on-page strategy can be determined, indicating that the probability of a hit occurring on the memory page is high; if the first value is less than the second value, then the off-page strategy is determined, indicating that the probability of a miss or conflict occurring on the memory page is high.
[0145] As another optional implementation, it can be based on the reverse calculation of page hits, and the reverse calculation of page hits refers to the weighted sum of the corresponding first value, and the weight of the page history hit information is less than the page history conflict information and the page history miss information. Among them, if the first value is less than the second value, the page strategy is determined to be on, indicating that the probability of a hit on the memory page is relatively high; if the first value is greater than or equal to the second value, the page strategy is determined to be off, indicating that the probability of a miss or conflict on the memory page is relatively high. For example: the weight of the page history hit information is 0; the weight of the page history conflict information is 1; the weight of the page history miss information is 0.25 or 0.75; at this time, if the first value obtained by weighted summation is smaller, it can be determined that the command history information is biased towards page hits.
[0146] It should be noted that the second page strategy is determined by comparing the first value and the second value. If an accidental disturbance occurs in a single value of the weighted value corresponding to the first value and the threshold value corresponding to the second value, the determined second page strategy can be maintained with a certain historical inertia, so that it will not switch quickly between different page strategies, thereby complying with the characteristics of memory address access time and spatial locality.
[0147] In some embodiments, to ensure the accuracy of the page history information recorded in the page table, FIG4 exemplarily shows another optional flow chart of the memory page access method according to an embodiment of the present disclosure. As shown in FIG4 , while executing step S100, the target access command can also be sent to the page table. Based on the page table's record of page history information, by sending the target access command to the page table, the page table can record the access information corresponding to the target physical address.
[0148] It should be noted that, in addition to recording the information of page hits, the page table can also record the access command category, such as whether the access command is a read command or a write command. Therefore, after sending the target access command to the page table, the page table can also compare the command type of the target access command with the command type of the recorded historical access command, so as to clear the recorded access information corresponding to the historical access command when the command type of the target access command is different from the command type of the recorded historical access command. For example: the target access command currently obtained is a read command, and the access command previously recorded in the page table is a write command. Through comparison, it is found that the command type has switched from a write command to a read command. In this case, the page table will clear all the historical page information in the current entry, and start recording again from the target access command that is a read command.
[0149] In some embodiments, in order to smoothly read and write data in a memory page, referring to FIG4 , after executing step S100 and before executing step S300 , step S110 may also be executed to determine whether the target memory page corresponding to the target access command is in an open state.
[0150] By determining the open state of the target memory page corresponding to the target access command, it is possible to ensure that the required data or instructions are available in the memory.
[0151] If the target memory page corresponding to the target access command is in a closed state, that is, the judgment result is "no", step S120 can be further executed to insert an activation command.
[0152] By inserting an activation command, the corresponding target memory page can be opened, making the required data or instructions available in the memory and the corresponding data can be read or written smoothly.
[0153] It should be noted that the target page policy determination described above can only be performed based on the target access command if the target memory page corresponding to the target access command is determined to be a page hit. If the target memory page corresponding to the target access command is a page conflict or a page miss, the target page policy determination process described above will not be performed for the target access command, and the next target access command will need to be reselected from the command queue.
[0154] In some embodiments, the target access command may be obtained from the command queue based on an arbitration policy. As an optional implementation, the arbitration policy may include: the priority of the target memory access command is screened as the pending access command, and the priority and / or address access efficiency of the pending access command is positively correlated. Thus, a target access command can be obtained from the pending access commands stored in the command queue based on the priority and / or address access efficiency of the pending access command.
[0155] It should be noted that the above example of obtaining the target access command is only an optional implementation. The embodiment of the present disclosure can also obtain the target access command in the command queue according to other rules. The specific settings can be made according to actual conditions, and the present disclosure does not limit this.
[0156] It can be seen that in the embodiment of the present disclosure, when determining the target page strategy based on the obtained target access command, the access commands stored in the command queue and the page history information of the target physical address are comprehensively considered, so that the determination of the target page strategy is more flexible, thereby being able to dynamically adjust the memory page configuration; furthermore, when generating the corresponding memory access command based on the target page strategy, the delay of memory access can be reduced, thereby improving the memory access efficiency.
[0157] Based on the principle of the method flow shown in Figure 2, as an optional architecture implementation of the memory controller to implement the memory page access method, Figure 5 exemplarily shows an optional structural diagram of the memory controller provided by the embodiment of the present disclosure. The device content described below can be considered as the functional modules required to implement the memory page access method provided by the embodiment of the present disclosure. The content described below can be referenced in conjunction with the content described above.
[0158] As shown in FIG. 5 , the memory controller may include a command queue 61 , an arbitration module 62 , and a page table 63 .
[0159] The command queue 61 is used to store access commands to be executed sent to the memory controller by an upstream device of the memory controller, such as a CPU. The access commands to be executed may include physical addresses of corresponding memory pages to be accessed.
[0160] The arbitration module 62 can use an arbitration strategy to retrieve a target access command that needs to be sent to the memory from the pending access commands stored in the command queue. In some embodiments, the arbitration strategy can include: the priority of the access command being screened as the target access command is positively correlated with the access priority and / or address access efficiency of the access command. For example, the arbitration module 62 can retrieve the access command with the highest access priority and / or address access efficiency from the stored pending access commands as the target access command.
[0161] The page table 63 records page history information, which includes information about access commands executed to access memory and the memory pages accessed by the access commands. In one optional implementation, the arbitration module may send the obtained target access command to the page table so that the page table records the access information corresponding to the target access command. In another optional implementation, the arbitration module may also obtain the page history information corresponding to the target access command from the page table.
[0162] It should be noted that, based on the information transmission between the arbitration module and the command queue and page table, the memory page access method executed by the memory controller in the embodiment of the present disclosure can be specifically implemented by the arbitration module. Referring to Figure 5, the arbitration module 62 may include a command acquisition unit (not shown in the figure), an information acquisition unit (not shown in the figure), a first determination unit 621, a second determination unit group 622, and a policy determination unit 623.
[0163] The command acquisition unit is used to acquire a target access command in a command queue, wherein the target access command includes at least a target physical address corresponding to a target memory page. The command queue stores access commands to be executed, wherein the access commands to be executed include a physical address to be accessed corresponding to a memory page to be accessed.
[0164] The information acquisition unit is used to acquire page history information corresponding to the target physical address in a page table.
[0165] The first determining unit 621 is configured to determine a first page strategy according to the physical address to be accessed and the target physical address, where the first page strategy indicates a hit decision of the memory page to be accessed corresponding to the target physical address.
[0166] The second determination unit group 622 is configured to determine a second page strategy according to the page history information, where the second page strategy indicates a hit decision corresponding to the target memory page estimated based on the page history information.
[0167] The policy determination unit 623 is configured to determine a page policy from the first page policy and the second page policy to send as a target page policy, so as to generate a corresponding memory access command based on the target page policy.
[0168] It should be noted that the command acquisition unit, the information acquisition unit, the first determination unit 621, the second determination unit group 622, and the policy determination unit 623 are all arranged inside the arbitration module. In order to facilitate understanding of the process of each component in the arbitration module executing the above-mentioned memory page access method, the first determination unit 621, the second determination unit group 622, and the policy determination unit 623 are placed outside the arbitration module in Figure 5. This does not limit the arbitration module in the embodiment of the present disclosure to including the first determination unit, the second determination unit group, and the policy selection module. In addition, in order to reflect the acquisition of the target access command and page history information by the arbitration module, the command acquisition unit and the information acquisition unit are not shown in the arbitration module. This does not limit the arbitration module in the embodiment of the present disclosure to including the command acquisition unit and the information acquisition unit.
[0169] In some embodiments, the first determining unit 621 determines the first page strategy according to the to-be-accessed physical address and the target physical address, specifically:
[0170] Comparing the physical address to be accessed with the target physical address to obtain an address comparison result;
[0171] A first page strategy is determined according to the address comparison result.
[0172] It should be noted that the first determination unit 621 is included in the arbitration module 62. In Figure 5, in order to show that the first determination unit 621 compares the physical address to be accessed contained in the access command to be executed stored in the command queue 61 with the target physical address contained in the target access command obtained by the arbitration module 62, a dotted arrow is used to indicate that the physical address to be accessed is transmitted to the first determination unit 621.
[0173] In some embodiments, the physical address includes a chip select address, a bank address, and a page address;
[0174] The step of comparing the physical address to be accessed with the target physical address by the first determining unit 621 is specifically as follows:
[0175] Compare respectively the chip select address in the physical address to be accessed and the chip select address in the target physical address, the bank address in the physical address to be accessed and the bank address in the target physical address, and the page address in the physical address to be accessed and the page address in the target physical address.
[0176] In some embodiments, the first page policy determined by the first determining unit 621 includes an open page policy, a close page policy, and an irrelevant policy;
[0177] If the physical address to be accessed is the same as the chip select address in the target physical address, the bank address is the same, and the page address is the same, determining the page opening strategy;
[0178] If the physical address to be accessed is the same as the chip select address in the target physical address, the bank address is the same, and the page address is different, determining a closed page strategy;
[0179] If the chip select address in the to-be-accessed physical address is the same as the target physical address but the bank address is different, or if the chip select address in the to-be-accessed physical address is different from the target physical address but the bank address is the same, an irrelevant strategy is determined.
[0180] In some embodiments, the policy determination unit 623 determines a page policy among the first page policy and the second page policy to be sent as the target page policy, including: the priority of the first page policy is higher than the second page policy, and among the first page policy and the second page policy, determines that the first page policy is sent as the target page policy.
[0181] In some embodiments, the policy determination unit 623 determines a page policy among the first page policy and the second page policy to be sent as the target page policy, and also includes: if the first page policy is an unrelated policy, determining the second page policy among the first page policy and the second page policy to be sent as the target page policy.
[0182] In some embodiments, the second determination unit group 622 includes: a page history information calculation unit 6221 and a page hit prediction unit 6222;
[0183] The page history information calculation unit 6221 is configured to determine a first value and a second value based on the page history information, wherein the first value is obtained by weighted summing the page history information using the information type corresponding to the page history information as a weight; and the second value is obtained by adjusting an initial value based on the information type corresponding to the page history information.
[0184] The page hit prediction unit 6222 is configured to compare the first value and the second value to determine a second page strategy.
[0185] In some embodiments, the page history information acquired by the information acquisition unit includes: page history hit information, page history conflict information, and page history miss information.
[0186] As an optional implementation, when the page history information calculation unit 6221 performs weighted summation on the page history information using the information type corresponding to the page history information as a weight to obtain the first value,
[0187] If the page address of the previous access command of the target access command recorded in the page history information is the same as the page address of the target access command, then the weight of the page history hit information is used as the weight of the page history miss information, and the page history information is weighted and summed up using the information type corresponding to the page history information as the weight to obtain the first value; or
[0188] If the page address of the previous access command of the target access command recorded in the page history information is different from the page address of the target access command, the weight of the page history conflict information is used as the weight of the page history miss information, and the page history information is weighted and summed up with the information type corresponding to the page history information as the weight to obtain the first value.
[0189] In some embodiments, the page history information calculation unit 6221 adjusts the initial value according to the information type corresponding to the page history information, including:
[0190] If page history hit information is added to the page history information, the initial value is correspondingly reduced by a preset ratio; wherein the number of times the initial value is reduced by the preset ratio corresponds to the number of times the page history hit information is added;
[0191] If page history conflict information and / or page history miss information are added to the page history information, the initial value is increased by a preset ratio; wherein the number of times the initial value is increased by the preset ratio corresponds to the number of times the page history conflict information and / or the page history miss information are added.
[0192] In some embodiments, the second page strategy determined by the page hit prediction unit 6222 includes an open page strategy and a close page strategy;
[0193] The page hit prediction unit 6222 compares the first value and the second value to determine the second page strategy, including:
[0194] Based on the forward calculation of page hits, if the first value is greater than or equal to the second value, an open page strategy is determined; if the first value is less than the second value, a close page strategy is determined; or,
[0195] Based on the reverse calculation of the page hit, if the first value is less than the second value, the page opening strategy is determined; if the first value is greater than or equal to the second value, the page closing strategy is determined.
[0196] In some embodiments, the command acquisition unit is further configured to:
[0197] The target access command is sent to the page table so that the page table records the access information corresponding to the target physical address, and compares whether the command type of the target access command is the same as the command type of the recorded historical access command. If different, clear the recorded access information corresponding to the historical access command.
[0198] In some embodiments, the command acquisition unit acquires the target access command in the command queue by acquiring a target access command from the access commands to be executed stored in the command queue according to the access priority and / or address access efficiency of the access command to be executed.
[0199] In some embodiments, the arbitration module 62 further includes: a judgment unit (not shown);
[0200] The judging unit is configured to judge whether the target memory page corresponding to the target access command is in an open state; if not, insert an activation command before the target access command to open the corresponding target memory page.
[0201] It can be seen that when the arbitration module provided in the embodiment of the present disclosure determines the target page strategy based on the obtained target access command, it comprehensively considers the access commands stored in the command queue and the page history information of the target physical address included in the target access command, so that the determination of the target page strategy is more flexible, thereby being able to dynamically adjust the memory page configuration; furthermore, when generating the corresponding memory access command based on the target page strategy, it is possible to reduce the delay of memory access and improve the memory access efficiency.
[0202] Furthermore, the embodiment of the present disclosure determines the target page policy through the arbitration module of the memory controller, so that the determination of the target page policy for memory access is based on hardware implementation and does not require software intervention, which makes maintenance of the memory system more convenient.
[0203] Continuing with FIG5 , the memory controller of the embodiment of the present disclosure further includes a command generation module 64. The command generation module 64 can be configured to generate corresponding memory access commands, which can be read and write command sequences corresponding to DDR (Double Data Rate) memory. The arbitration module 62 can send the determined target page policy to the command generation module 64, so that the command generation module 64 can obtain the target page policy and, based on the target page policy, generate corresponding memory access commands.
[0204] It should be noted that the command generation module 64 can also be used to generate an activation command and a pre-charge command. For example, when it is detected that the target memory page corresponding to the target access command is in a closed state, the command generation module can send an activation command to the memory to open the target memory page corresponding to the target access command in advance. Moreover, only when it is determined that the target memory page corresponding to the target access command is a page hit, can the arbitration module 62 determine the target page policy based on the target access command through the first determination unit, the second determination unit group, and the page policy determination unit. If the target memory page corresponding to the target access command is judged to be a page conflict in the command generation module, the arbitration module 62 will notify the command generation module 64 to generate a pre-charge command and an activation command sequence, and then send the corresponding command to the outside at the appropriate time according to the DDR protocol.
[0205] As an optional implementation, FIG6 shows another optional flow diagram of the memory page access method provided by an embodiment of the present disclosure. This method flow can be executed by a memory controller, for example, specifically by the command generation module 64 in the memory controller. Referring to FIG6 , this method flow may include the following steps.
[0206] Step S71: Obtain target page strategy.
[0207] The target page policy may be a page policy determined by the arbitration module 62 from a first page policy and a second page policy, wherein the first page policy is determined based on the physical address to be accessed and the target physical address, and the second page policy is determined based on page history information.
[0208] Among them, the target physical address is based on the target access command obtained in the command queue 61, and the target access command at least includes the target physical address corresponding to the target memory page. The command queue stores the access command to be executed, and the access command to be executed includes the physical address to be accessed corresponding to the memory page to be accessed.
[0209] The page history information is obtained from the page table 63 based on the corresponding target physical address.
[0210] Step S72: Generate a corresponding memory access command based on the target page policy.
[0211] After obtaining the target page policy sent by the arbitration module 62 , the command generation module 64 may generate a corresponding memory access command based on the target page policy, and then send the memory access command to the memory to perform the access.
[0212] It should be noted that the command generation module 64 can also be used to generate activation commands and pre-charge commands. For example: when it is detected that the target memory page corresponding to the target access command is in a closed state, the command generation module 64 can send an activation command to the memory to open the target memory page corresponding to the target access command in advance. Moreover, only when it is determined that the target memory page corresponding to the target access command is a page hit, can the arbitration module 62 determine the target page policy based on the target access command through the first determination unit, the second determination unit group, and the policy determination unit. If the target memory page corresponding to the target access command is judged to be a page conflict or a page miss by the command generation module, the arbitration module 62 does not execute the target page policy determination process for the target access command, and the arbitration module 62 needs to reselect the next target access command in the command queue.
[0213] It can be seen that in the memory page access method of the embodiment of the present disclosure, a memory access command of the corresponding memory is generated based on the acquired target page strategy. When determining the target page strategy, the access commands stored in the command queue and the page history information of the target physical address included in the target access command are comprehensively considered, so that the execution of the generated memory access command can meet the current memory page configuration, thereby reducing the memory access delay when executing memory access according to the memory access command, and improving the memory access efficiency.
[0214] Based on the above ideas, FIG7 exemplarily shows an optional structural diagram of a command generation module provided by an embodiment of the present disclosure. As shown in FIG7 , the command generation module may include: a target policy acquisition unit 81 and a memory access command generation unit 82 .
[0215] The target policy acquisition unit 81 is configured to acquire a target page policy, wherein the target page policy is a page policy determined from a first page policy and a second page policy, wherein the first page policy is determined based on a physical address to be accessed and a target physical address, and the second page policy is determined based on page history information, wherein the target physical address is obtained based on a target access command obtained from a command queue, wherein the target access command includes at least the target physical address corresponding to a target memory page, wherein the command queue stores access commands to be executed, wherein the access commands to be executed include the physical address to be accessed corresponding to the memory page to be accessed; and wherein the page history information is obtained from a page table based on the target physical address.
[0216] The memory access command generating unit 82 is configured to generate a corresponding memory access command based on the target page policy.
[0217] It should be noted that, in order to implement the execution of the target access command, the memory access command generation unit 82 may also be used to generate an active command and a pre-charge command to open the corresponding target memory page in advance.
[0218] It can be seen that the command generation module of the embodiment of the present disclosure generates a memory access command for the corresponding memory based on obtaining the target page strategy. When determining the target page strategy, the access commands stored in the command queue and the page history information of the target physical address included in the target access command are comprehensively considered, so that the execution of the generated memory access command can meet the current memory page configuration, thereby reducing the memory access delay when executing memory access according to the memory access command, and improving the memory access efficiency.
[0219] The memory controller provided by the embodiment of the present disclosure may correspond to that shown in FIG. 5 , and include an arbitration module and a command generation module.
[0220] The arbitration module is used to obtain a target access command in a command queue, wherein the target access command includes at least a target physical address corresponding to a target memory page, and the command queue stores access commands to be executed, wherein the access commands to be executed include a physical address to be accessed corresponding to a memory page to be accessed; and obtain page history information corresponding to the target physical address in a page table; and send a target page policy based on the target physical address and the page history information.
[0221] The command generation module is used to obtain the target page policy and generate a corresponding memory access command based on the target page policy.
[0222] In some embodiments, the arbitration module may include a command acquisition unit, an information acquisition unit, a first determination unit, a second determination unit group, and a policy determination unit.
[0223] Among them, the command acquisition unit is used to obtain the target access command in the command queue, and the target access command at least includes the target physical address corresponding to the target memory page. The command queue stores the access command to be executed, and the access command to be executed includes the physical address to be accessed corresponding to the memory page to be accessed.
[0224] The information acquisition unit is used to acquire page history information corresponding to the target physical address in the page table.
[0225] The first determining unit is configured to determine a first page strategy according to the physical address to be accessed and the target physical address, where the first page strategy indicates a hit decision of the memory page to be accessed corresponding to the target physical address.
[0226] The second determination unit group is used to determine a second page strategy according to the page history information, where the second page strategy indicates a hit decision corresponding to the target memory page estimated based on the page history information.
[0227] The policy determination unit is configured to determine a page policy from the first page policy and the second page policy to send as a target page policy, so as to generate a corresponding memory access command based on the target page policy.
[0228] It should be noted that the arbitration module, based on the target physical address and page history information, determines and sends the target page policy, which can be implemented by the first determination unit, the second determination unit group, and the policy determination module. The specific functions and extended functions of each logical component in the arbitration module (e.g., the command acquisition unit, the information acquisition unit, the first determination unit, the second determination unit group, and the policy determination unit, etc.) can be found in the description of the corresponding sections above and will not be repeated here.
[0229] In some embodiments, the command generation module may include a target policy acquisition unit and a memory access command generation unit.
[0230] Wherein, the target policy acquisition unit is used to acquire the target page policy, and the target page policy is a page policy determined in the first page policy and the second page policy, the first page policy is determined based on the physical address to be accessed and the target physical address, and the second page policy is determined based on the page history information, wherein the target physical address is based on obtaining the target access command in the command queue, the target access command at least includes the target physical address corresponding to the target memory page, the command queue stores the access command to be executed, and the access command to be executed includes the physical address to be accessed corresponding to the memory page to be accessed; the page history information is obtained in the page table based on the corresponding target physical address.
[0231] A memory access command generating unit is used to generate a corresponding memory access command based on the target page policy.
[0232] It should be noted that the specific functions and extended functions of each logical component in the command generation module (such as the target policy acquisition unit, the memory access command generation unit, etc.) can be referred to the description of the corresponding part above and will not be repeated here.
[0233] The present disclosure also provides a memory system, as shown in Figure 8. The memory system may include the memory controller described above, which may be configured to execute the memory page access method provided in the present disclosure.
[0234] Referring to Figure 8, the memory system also includes a memory, which can be implemented by DDR (Double Data Rate, DDR) memory particles and can include one or more groups of DDR Rank (memory units). In DDR memory, each group of DDR Rank can be composed of multiple DRAM chips (DRAM Device), and the multiple DRAM Devices can share the same address and data bus. Each group of DDR Rank can be regarded as an independent memory module with an independent address space and control logic, and can perform read and write operations independently. In the memory controller, different memory modules can be accessed by selecting different DDR Ranks, thereby achieving parallel access to multiple DDR Ranks and improving memory bandwidth and performance. Among them, Figure 8 only takes a group of DDR Rank 90 as an example. DDR Rank 90 is composed of n DRAM Devices, namely DRAM Device 901, DRAM Device 902,..., DRAM Device 90n.
[0235] In the memory system shown in Figure 8, information is transmitted between the memory controller and the memory via a memory bus. The memory bus is an electronic circuit in a computer system used to transmit data and commands. It connects the memory controller and memory modules and includes a data bus and a command bus. The data bus is used to transmit data to be read from or written to memory, providing a data channel between the memory controller and the memory modules. The command bus is used to transmit memory access commands related to memory operations, providing a command channel between the memory controller and the memory modules. The memory controller transmits memory access commands to the memory via the command channel to access the memory.
[0236] An embodiment of the present disclosure also provides an electronic device, which may include at least one memory and at least one processor, wherein the memory stores one or more computer-executable instructions, and the processor calls the one or more computer-executable instructions to execute the memory page access method provided by the embodiment of the present disclosure.
[0237] As an optional implementation, referring to FIG. 9 , the electronic device may include: at least one processor 1 , at least one communication interface 2 , at least one memory 3 and at least one communication bus 4 .
[0238] In the embodiment of the present disclosure, the number of the processor 1 , the communication interface 2 , the memory 3 and the communication bus 4 is at least one, and the processor 1 , the communication interface 2 and the memory 3 communicate with each other through the communication bus 4 .
[0239] Optionally, the processor 1 can constitute a computer device together with the memory controller of the embodiment of the present disclosure. The processor 1 may be a CPU (central processing unit), a GPU (Graphics Processing Unit), an NPU (embedded neural network processor), an FPGA (Field Programmable Gate Array), a TPU (tensor processing unit), an AI chip, an application-specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiment of the present disclosure.
[0240] Optionally, the communication interface 2 may be an interface of a communication module for performing network communication.
[0241] The memory 3 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 3 stores one or more computer-executable instructions, and the processor 1 calls the one or more computer-executable instructions to execute the memory page access method of the embodiment of the present disclosure.
[0242] An embodiment of the present disclosure further provides a storage medium, wherein the storage medium stores one or more computer-executable instructions, and when the one or more computer-executable instructions are executed, the memory page access method described above is implemented.
[0243] An embodiment of the present disclosure further provides a computer program product, comprising one or more computer-executable instructions, which, when executed, implement the memory page access method described above.
[0244] The above describes multiple embodiment schemes provided by the embodiments of the present disclosure. The various optional methods introduced in each embodiment scheme can be combined and cross-referenced with each other without conflict, thereby extending a variety of possible embodiment schemes, which can all be considered as embodiment schemes disclosed and disclosed by the embodiments of the present disclosure.
[0245] Although the embodiments of the present disclosure are disclosed above, the present disclosure is not limited thereto. Any person skilled in the art may make various changes and modifications without departing from the spirit and scope of the present disclosure. Therefore, the scope of protection of the present disclosure shall be based on the scope defined by the claims.
Claims
1. A memory page access method, comprising: Obtaining a target access command from a command queue, wherein the target access command includes at least a target physical address corresponding to a target memory page, the command queue storing a to-be-executed access command, and the to-be-executed access command including a to-be-accessed physical address corresponding to a to-be-accessed memory page; Obtaining page history information corresponding to the target physical address in the page table; Determining a first page strategy according to the physical address to be accessed and the target physical address, wherein the first page strategy indicates a hit decision of the memory page to be accessed corresponding to the target physical address; Determining a second page strategy based on the page history information, wherein the second page strategy indicates a hit decision corresponding to the target memory page estimated based on the page history information; Among the first page policy and the second page policy, a page policy is determined to be sent as a target page policy, so as to generate a corresponding memory access command based on the target page policy.
2. The memory page access method according to claim 1, wherein: The determining of a first page strategy according to the to-be-accessed physical address and the target physical address includes: Comparing the physical address to be accessed with the target physical address to obtain an address comparison result; The first page strategy is determined according to the address comparison result.
3. The memory page access method according to claim 2, wherein: The physical address includes a chip select address, a bank address and a page address; The comparing of the physical address to be accessed and the target physical address includes: respectively comparing the chip select address in the physical address to be accessed and the chip select address in the target physical address, the library address in the physical address to be accessed and the library address in the target physical address, and the page address in the physical address to be accessed and the page address in the target physical address.
4. The memory page access method according to claim 3, wherein: The first page strategy includes an open page strategy, a close page strategy and an irrelevant strategy; If the physical address to be accessed is the same as the chip select address in the target physical address, the bank address is the same, and the page address is the same, determining the page opening strategy; If the physical address to be accessed is the same as the chip select address in the target physical address, the bank address is the same, and the page address is different, determining the closed page strategy; If the chip select address in the to-be-accessed physical address is the same as the target physical address but the bank address is different, or if the chip select address in the to-be-accessed physical address is different from the target physical address but the bank address is the same, the irrelevant strategy is determined.
5. The memory page access method according to claim 4, wherein: The step of determining a page strategy among the first page strategy and the second page strategy as a target page strategy to be sent includes: The priority of the first page policy is higher than that of the second page policy. Between the first page policy and the second page policy, the first page policy is determined to be sent as the target page policy.
6. The memory page access method according to claim 5, wherein: The step of determining a page strategy among the first page strategy and the second page strategy as a target page strategy to be sent further comprises: If the first page policy is the irrelevant policy, the second page policy is determined to be sent as the target page policy among the first page policy and the second page policy.
7. The memory page access method according to claim 1, wherein: The determining of the second page strategy according to the page history information includes: Determining a first value and a second value based on the page history information, wherein the first value is obtained by weighted summing the page history information using the information type corresponding to the page history information as a weight, and the second value is obtained by adjusting an initial value based on the information type corresponding to the page history information; The first value and the second value are compared to determine the second page policy.
8. The memory page access method according to claim 7, wherein: The page history information includes: page history hit information, page history conflict information and page history miss information.
9. The memory page access method according to claim 8, wherein: When the first value is obtained by weighted summing the page history information using the information type corresponding to the page history information as the weight, If the page address of the access command preceding the target access command recorded in the page history information is the same as the page address of the target access command, then using the weight of the page history hit information as the weight of the page history miss information, performing a weighted summation of the page history information using the information type corresponding to the page history information as the weight to obtain the first value; or, If the page address of the previous access command of the target access command recorded in the page history information is different from the page address of the target access command, the weight of the page history conflict information is used as the weight of the page history miss information, and the information type corresponding to the page history information is used as the weight to perform weighted summation on the page history information to obtain the first value.
10. The memory page access method according to claim 7, wherein: The adjusting the initial value according to the information type corresponding to the page history information includes: If page history hit information is added to the page history information, the initial value is correspondingly reduced by a preset ratio; wherein the number of times the initial value is reduced by the preset ratio corresponds to the number of times the page history hit information is added; If page history conflict information and / or page history miss information are added to the page history information, the initial value is correspondingly increased by the preset ratio; wherein, the number of times the initial value is increased by the preset ratio corresponds to the number of times the page history conflict information and / or the page history miss information are added.
11. The memory page access method according to claim 10, wherein: The second page strategy includes an opening page strategy and a closing page strategy; The comparing the first value and the second value to determine the second page policy includes: Based on the forward calculation of page hits, if the first value is greater than or equal to the second value, the page opening strategy is determined; if the first value is less than the second value, the page closing strategy is determined; or, Based on the reverse calculation of the page hit, if the first value is less than the second value, the page opening strategy is determined; if the first value is greater than or equal to the second value, the page closing strategy is determined.
12. The memory page access method according to any one of claims 1 to 11, wherein: While executing the step of obtaining the target access command from the command queue, the method further includes: The target access command is sent to the page table so that the page table records the access information corresponding to the target physical address, and compares whether the command type of the target access command is the same as the command type of the recorded historical access command. If different, clear the recorded access information corresponding to the historical access command.
13. The memory page access method according to any one of claims 1 to 12, wherein: The step of obtaining the target access command from the command queue includes: A target access command is obtained from the access commands to be executed stored in the command queue according to the access priority and / or address access efficiency of the access command to be executed.
14. An arbitration module, comprising: a command acquisition unit configured to acquire a target access command from a command queue, wherein the target access command includes at least a target physical address corresponding to a target memory page, the command queue stores a to-be-executed access command, and the to-be-executed access command includes a to-be-accessed physical address corresponding to a to-be-accessed memory page; an information acquisition unit configured to acquire page history information corresponding to the target physical address in a page table; a first determining unit configured to determine a first page strategy according to the to-be-accessed physical address and the target physical address, wherein the first page strategy indicates a hit decision of the to-be-accessed memory page corresponding to the target physical address; a second determination unit group configured to determine a second page strategy based on the page history information, wherein the second page strategy indicates a hit decision corresponding to the target memory page estimated based on the page history information; The policy determination unit is configured to determine a page policy from the first page policy and the second page policy to send as a target page policy, so as to generate a corresponding memory access command based on the target page policy.
15. The arbitration module according to claim 14, wherein: The first determining unit determines a first page strategy according to the to-be-accessed physical address and the target physical address, specifically: Comparing the physical address to be accessed with the target physical address to obtain an address comparison result; The first page strategy is determined according to the address comparison result.
16. The arbitration module according to claim 15, wherein: The second determination unit group includes: a page history information calculation unit and a page hit prediction unit; The page history information calculation unit is configured to determine a first value and a second value based on the page history information, wherein the first value is obtained by weighted summing the page history information using the information type corresponding to the page history information as a weight, and the second value is obtained by adjusting an initial value based on the information type corresponding to the page history information; The page hit prediction unit is configured to compare the first value and the second value to determine Define the second page strategy.
17. The arbitration module according to claim 14, wherein: The command acquisition unit is further configured to: The target access command is sent to the page table so that the page table records the access information corresponding to the target access command, and compares whether the command type of the target access command is the same as the command type of the recorded historical access command. If different, clear the recorded access information corresponding to the historical access command.
18. A memory page access method, comprising: Obtaining a target page policy, wherein the target page policy is a page policy determined in a first page policy and a second page policy, the first page policy being determined based on a physical address to be accessed and a target physical address, and the second page policy being determined based on page history information, wherein the target physical address is obtained based on a target access command obtained in a command queue, the target access command including at least the target physical address corresponding to a target memory page, the command queue storing access commands to be executed, the access commands to be executed including the physical address to be accessed corresponding to a memory page to be accessed, and the page history information being obtained in a page table based on the target physical address; and Based on the target page policy, a corresponding memory access command is generated.
19. A command generation module, wherein: include: a target policy acquisition unit configured to acquire a target page policy, wherein the target page policy is a page policy determined between a first page policy and a second page policy, the first page policy being determined based on a physical address to be accessed and a target physical address, and the second page policy being determined based on page history information, wherein the target physical address is obtained based on a target access command obtained in a command queue, the target access command at least including the target physical address corresponding to a target memory page, the command queue storing access commands to be executed, the access commands to be executed including the physical address to be accessed corresponding to a memory page to be accessed, and the page history information being obtained from a page table based on the target physical address; and The memory access command generating unit is configured to generate a corresponding memory access command based on the target page policy.
20. A memory controller comprising: Arbitration module and command generation module; The arbitration module is configured to obtain a target access command in a command queue, wherein the target access command includes at least a target physical address corresponding to a target memory page, and the command queue stores commands to be executed. A row access command, wherein the access command to be executed includes a physical address to be accessed corresponding to a memory page to be accessed; and obtaining page history information corresponding to the target physical address in a page table; and sending a target page policy based on the target physical address and the page history information; as well as The command generation module is configured to obtain the target page policy and generate a corresponding memory access command based on the target page policy.
21. A memory system, wherein: Comprising the memory controller as claimed in claim 20.
22. An electronic device comprising: At least one memory and at least one processor, the at least one memory storing one or more computer-executable instructions, the at least one processor calling the one or more computer-executable instructions to execute the memory page access method according to any one of claims 1 to 13, or, to execute the memory page access method according to claim 18.
23. A storage medium, wherein: The storage medium stores one or more computer-executable instructions, and when the one or more computer-executable instructions are executed, the memory page access method according to any one of claims 1 to 13 is implemented, or the memory page access method according to claim 18 is implemented.
24. A computer program product, wherein The method comprises one or more computer executable instructions, which, when executed, implement the memory page access method according to any one of claims 1 to 13, or the memory page access method according to claim 18.
Citation Information
Patent Citations
Memory page access method and related equipment
CN118245397A
Detection of speculative precharge
CN102084345A
Hot page prediction method and page scheduling method for storage medium
CN110795363A
Method and apparatus for memory access scheduling to reduce memory access latency
CN1735869A
Predictor-based management of dram row-buffers
US20120059983A1