Memory access method, memory controller, chip and electronic equipment
By designing a page open queue module and a non-page open queue module in the memory controller, the instruction sending sequence of memory access requests is dynamically planned, which solves the problems of memory access performance fluctuation and insufficient optimization in the existing technology, and achieves more efficient access. storage performance.
Patent Information
- Application Number
- CN202410835064.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-09-10
AI Technical Summary
When existing memory controllers process memory access requests, there are problems with performance fluctuations and insufficient optimization of the order of instruction issuance, resulting in poor memory access performance. It is especially difficult to adapt in time when facing dynamically changing memory access requests.
Design the page open queue module and the non-page open queue module to dynamically plan the instruction sending order according to the page status change of the memory access request, ensure that the instruction sending order meets the preset timing interval requirements, and prioritize accesses in the page open state in the instruction arbitration. Save request.
By dynamically planning the instruction sending sequence of memory access requests, the memory controller's processing efficiency of memory access requests is improved, and the memory access performance is improved. Especially in the face of dynamically changing access conditions, it can manage page status more flexibly and reduce performance. fluctuation.
Smart Images

Figure CN118626019A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and specifically to a memory access method, a memory controller, a chip, and an electronic device. Background Art
[0002] The memory controller is a key component in a computer system, responsible for managing data exchange between the processor and the memory. In other words, the memory controller is responsible for processing memory access requests sent by the processor to the memory and transmitting corresponding memory operation instructions to the memory. It can be seen that the memory controller's processing performance of memory access requests directly affects the computer system's memory access performance (such as memory access efficiency). Therefore, how to provide a technical solution to optimize the memory controller's processing of memory access requests, thereby improving the computer system's memory access performance, has become a technical problem that those skilled in the art urgently need to solve. Summary of the Invention
[0003] In view of this, embodiments of the present application provide a memory access method, a memory controller, a chip, and an electronic device to optimize the memory controller's processing of memory access requests, thereby improving the memory access performance of a computer system.
[0004] To achieve the above objectives, the embodiments of the present application provide the following technical solutions.
[0005] In a first aspect, an embodiment of the present application provides a memory access method, applied to a memory controller, the method comprising:
[0006] Get memory access request;
[0007] Determine the page status that matches the memory access request;
[0008] Distributing memory access requests matching the page open state to the page open queue module, and distributing memory access requests matching the non-page open state to the non-page open queue module;
[0009] and, flowing the memory access request between the page open queue module and the non-page open queue module according to the page state change of the memory access request;
[0010] Planning an instruction sending sequence of corresponding memory access operation instructions for the memory access requests stored in the page opening queue module, wherein a total timing interval of the instruction sending sequence meets a preset timing interval requirement;
[0011] At least based on the instruction sending sequence, the memory access operation instructions are made to participate in instruction arbitration, so that the memory access operation instructions are sent to the memory in the instruction sending sequence.
[0012] In a second aspect, an embodiment of the present application provides a memory controller, comprising:
[0013] A page state manager is configured to obtain a memory access request; determine a page state that matches the memory access request based on the recorded page state; and distribute memory access requests that match a page open state to a page open queue module, and distribute memory access requests that match a non-page open state to a non-page open queue module.
[0014] The non-page open queue module is used to save the memory access requests in the non-page open state;
[0015] A page open queue module is configured to store memory access requests in a page open state; plan an instruction sending order for corresponding memory access operation instructions for the stored memory access requests, wherein a total timing interval of the instruction sending order meets a preset timing interval requirement; and send the memory access operation instructions to an instruction arbiter for instruction arbitration based at least on the instruction sending order, so that the memory access operation instructions are sent to the memory in the instruction sending order;
[0016] The memory access requests stored in the page open queue module and the non-page open queue module flow between the page open queue module and the non-page open queue module based on page state changes;
[0017] An instruction arbitrator is used to perform instruction arbitration on memory operation instructions participating in instruction arbitration and determine the memory operation instruction sent to the memory; wherein the memory operation instructions participating in instruction arbitration include: the memory access operation instruction and other memory operation instructions; in the memory access mode of the memory controller, the arbitration priority of the memory access operation instruction is higher than that of other memory operation instructions.
[0018] In a third aspect, an embodiment of the present application provides a chip comprising a memory controller; the memory controller is the memory controller as described in the second aspect above, or the memory controller is configured to execute the memory access method as described in the first aspect above.
[0019] In a fourth aspect, an embodiment of the present application provides an electronic device comprising the chip as described in the third aspect above.
[0020] The memory access method provided by the embodiment of the present application can distribute memory access requests that match the page open state to the page open queue module, and distribute memory access requests that match the non-page open state to the non-page open queue module; and the memory access request can flow between the page open queue module and the non-page open queue module based on the change of the page state; thus, the embodiment of the present application allows the memory access request saved by the page open queue module to participate in instruction arbitration. Furthermore, the embodiment of the present application can plan the instruction sending order of the corresponding memory access operation instructions for the memory access request saved by the page open queue module, and the total timing interval of the instruction sending order meets the preset timing interval requirement; and, at least based on the instruction sending order, the memory access operation instruction is allowed to participate in instruction arbitration, so that the memory access operation instructions are sent to the memory according to the instruction sending order. It can be seen that the solution provided by the embodiment of the present application introduces the dynamic planning of the instruction sending order of memory access requests in the page-open state into the instruction arbitration of the memory controller through the page-open queue module, that is, the memory access requests in the page-open state can participate in the instruction arbitration according to the planned instruction sending order, and then the instruction sending order after the memory access request planning optimization is introduced into the instruction arbitration process, thereby optimizing the memory controller's processing mechanism for memory access requests, and improving the probability that the memory access requests in the page-open state can send memory access operation instructions to the memory according to the planned instruction sending order, thereby improving the memory access performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without any creative work.
[0022] Figure 1 A diagram showing an example of memory organization in a computer system.
[0023] Figure 2 An example diagram of a computer system.
[0024] Figure 3 This diagram shows an example of a memory controller's processing mechanism for memory access requests.
[0025] Figure 4 This is a flowchart of a memory access method according to an embodiment of the present application.
[0026] Figure 5 This is an example diagram of a memory controller provided in an embodiment of the present application.
[0027] Figure 6 This is an example diagram of the page opening queue module provided in an embodiment of the present application.
[0028] Figure 7 A flowchart of the order in which planning instructions are sent provided in an embodiment of the present application.
[0029] Figure 8 This is an example diagram of matrix operations.
[0030] Figure 9 The following diagram shows an example of the loop-shaped instruction sending sequence. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0032] Memory is a key component in computer systems, used to store and provide high-speed access to data and programs required by the computer system (primarily the processor). Main types of memory include, but are not limited to, DRAM (Dynamic Random Access Memory), SRAM (Static Random Access Memory), ROM (Read Only Memory), and Flash Memory.
[0033] Memory can be installed in a memory package assembly, which then connects to a computer motherboard through the memory package assembly to communicate with components such as a memory controller in the computer system. For example, a memory package assembly such as a DIMM (Dual Inline Memory Module) can connect to a computer motherboard through a memory slot.
[0034] In terms of memory organization, multiple memories (e.g., multiple DRAMs) can be grouped into a RANK. For example, multiple DRAMs working in parallel can be grouped into a RANK, so that the memory of a RANK can be accessed simultaneously by the memory controller to improve the bandwidth of memory access. It should be noted that a memory package component (e.g., a DIMM) can contain one or more RANKs. The number of RANKs contained in a memory package component depends on the design of the memory package component (e.g., DIMM) and the required memory capacity and configuration. Accordingly, the number of RANKs supported by a computer system can be determined by the number of memory package components supported by the computer system and the number of RANKs allowed to be contained in each memory package component.
[0035] Furthermore, the memory in RANK can be organized in a hierarchical structure. For ease of understanding, Figure 1 The following diagram shows an example of memory organization in a computer system. Figure 1 As shown, the memory in a RANK can be stacked in layers. For example, multiple memory layers are stacked to form a RANK, and a memory layer can be considered a stacked layer in the RANK. The stacking of multiple memory layers can include, but is not limited to, 3D stacking. For example, in 3D stacked memory technology, multiple memory layers are physically stacked in 3D space to form a RANK, and each memory layer can implement data storage functions.
[0036] Hierarchical stacking is the physical organization of memory in RANK (for example, memory technology suitable for 3D stacking), while in terms of logical organization, the banks in each stack layer can be organized and managed through bank groups. In other words, a stack layer (memory layer) can have multiple banks, and the multiple banks within a stack layer can be logically divided into multiple stack groups. A stack group includes one or more banks, so that the banks in a stack layer can be organized in stack groups to optimize memory management.
[0037] A heap is a data storage matrix consisting of multiple rows and columns. In other words, the row and column structure is the basic structure of memory data storage. Each row can contain multiple data bits, and the columns are the vertical counterparts of the individual data bits in the row; that is, for a given row, a column in the row represents a data bit in the row.
[0038] Based on the hierarchical organization of the memory, when the memory controller processes the memory access request sent by the processor, it needs to convert the physical address carried in the memory access request into a hierarchical address format that the memory can recognize. Figure 2 An exemplary diagram of an optional example of a computer system is shown, such as Figure 2As shown, the computer system may include a processor 210 , a memory controller 220 , and a memory 230 .
[0039] The processor 210 is the core execution unit in a computer system, responsible for interpreting and executing instructions in a program. Processor types may include, but are not limited to, a CPU (Central Processing Unit) and a GPU (Graphics Processing Unit). When the processor 210 needs to access memory (for example, to read or write data from or to memory), it may issue a memory access request and transmit it to the memory controller 220.
[0040] A memory access request may carry a physical address pointing to memory. This physical address primarily indicates a location in the system's memory address space and is a system-wide address. Therefore, upon receiving a memory access request, the memory controller 220 must, based on the memory's hierarchical organization, convert the physical address carried in the request into a memory address corresponding to the memory's hierarchical organization structure. This allows the memory controller 220 to locate the target row and column (i.e., the row and column targeted by the read or write operation) using the memory address.
[0041] For example, based on the hierarchical organization structure of memory RANK, stack layer, stack group, stack, row and column, the memory controller can convert the physical address carried by the memory access request into a memory address that conforms to the format of CS (Chip Select), CID (Chip ID), BG, BA (Bank Address), Row, and COL (column).
[0042] Among them, CS in the above memory address represents the selected target RANK; when performing a memory access operation, a memory access operation (such as a read operation, a write operation, etc.) is for a RANK. The CID in the above memory address is the next-level index variable of CS, indicating the target stacking layer selected in the target RANK; optionally, the presence of CID in the memory address can be applicable to a memory with a 3D stacking structure (such as a 3D stacked DRAM). The BG in the above memory address is the next-level index variable of CID, indicating the target stacking group selected in the target stacking layer. The BA in the above memory address is the next-level index variable of BG, indicating the target heap selected in the target stacking group. The Row in the above memory address is the next-level index variable of BA, indicating the target row selected in the target heap, that is, the row pointed to by the memory access operation. The COL in the above memory address represents the target column selected in the target row, that is, the column that the memory access operation needs to access in the target row.
[0043] After converting the physical address carried in the memory access request into a memory address corresponding to the hierarchical organization structure of the memory, the memory controller can issue different memory operation instructions to the memory based on the different page states of the target row.
[0044] It should be noted that multiple rows in a heap can be managed using pages as logical units. A page can be regarded as a block of a set size in the heap, and a page has at least one row (or one or more rows); that is, a page can be regarded as a logical unit of memory management, and a row can be regarded as a physical storage unit of memory.
[0045] Therefore, the state of the page where the row is located can be called the page state of the row. For the target row of the memory access request, the page state of the target row can be mainly divided into page open (Page Open), page close (Page Close) and page conflict (Page Conflict);
[0046] The target behavior page open state indicates that the target row pointed to by the memory access operation has been activated and the target row remains in an active state; that is, the state of the page where the target row is located is open, allowing memory access operations such as reading and writing to the rows in the open page; accordingly, when the target behavior page is in the open state, the memory controller can directly initiate a memory access operation instruction to the memory, thereby performing a memory access operation on the target column; based on different types of memory access operations, memory access operation instructions can be divided into RD (Read) instructions and WR (Write) instructions, where the RD instruction is used to read data in the target column and the WR instruction is used to write data in the target column; the target behavior page closed state indicates that the target row pointed to by the memory access operation is not activated, that is, the state of the page where the target row is located is closed; accordingly, the memory controller needs to activate the target row first and then initiate a memory access operation instruction; thus, when the target behavior page is in the closed state, the memory controller can first initiate an ACT (Activate) instruction to the memory to activate the target row; further, after the target row is activated, the memory controller can initiate a memory access operation instruction (RD instruction or WR instruction);
[0047] The target behavior page conflict state indicates that there are other activated rows in the target stack to which the target row pointed to by the memory access operation belongs, and the pages where the other activated rows are located are not the page where the target row is located; at this time, the memory controller needs to precharge the pages of the other activated rows first, and then activate the target row, and then initiate the memory access operation instruction; accordingly, in the target behavior page conflict state, the memory controller can first initiate a PCHG (Precharge, page precharge) instruction to the memory to precharge the pages of other activated rows in the target stack, thereby closing the other activated rows in the target stack; then, the memory controller can initiate an ACT instruction to the memory to activate the target row; after the target row is activated, the memory controller can initiate a memory access operation instruction.
[0048] It can be seen that before performing memory access operations such as read and write operations on the target column, the target row needs to be activated (i.e., the target row is in the page-open state); if the target row is in the page-closed state, the memory controller needs to activate the target row first, and then perform memory access operations such as data read and write on the target column; and if the target row is in the page conflict state, the memory controller needs to precharge the pages of other activated rows (not located on the page where the target row is located), and then activate the target row, and then perform memory access operations such as data read and write on the target column. Therefore, if the target row targeted by the processor's memory access request is in the page-open state, the memory controller can save the time of issuing an ACT instruction after obtaining the memory access request. However, if the target row targeted by the memory access request is in the page conflict state, the memory controller needs to additionally issue a PCHG instruction and an ACT instruction after obtaining the memory access request.
[0049] Based on this, one aspect of optimizing the processing mechanism of the memory controller is to flexibly manage the page status so that the target row is in the page open state as much as possible and the target row is avoided from being in the page conflict state as much as possible (that is, the probability of the target row being in the page open state is increased and the probability of the target row being in the page conflict state is reduced), thereby improving the memory access performance of the computer system by omitting the initiation of PCHG instructions and ACT instructions.
[0050] However, the memory access requests issued by the processor may be relatively concentrated or relatively dispersed in terms of addresses. For example, the memory access requests issued by the processor may be sometimes concentrated or sometimes dispersed in terms of addresses. Specifically, when the memory access requests issued by the processor are relatively concentrated in terms of addresses, different rows in the same area (such as the same stack) may be frequently accessed, which may lead to multiple consecutive page conflicts, and thus page pre-charging and row activation are required each time the row to be accessed is switched. When the memory access requests issued by the processor are relatively dispersed in terms of addresses, frequent page closing may occur, that is, a new row needs to be activated for each access.
[0051] It can be seen that the memory access requests issued by the processor exhibit address uncertainty at different times (addresses are sometimes concentrated or sometimes dispersed). If the memory controller adopts a fixed page strategy to deal with this uncertainty, memory access performance will fluctuate. For example, if the memory controller uses a fixed page strategy that expresses that it keeps the pages of previously accessed rows in the open state for as long as possible, then when the addresses of memory access requests are relatively concentrated, this page strategy can achieve better memory access performance (reducing the frequent activation and deactivation of rows). However, when the addresses of memory access requests are relatively dispersed, because the addresses of memory access requests are widely distributed and not concentrated in memory, the previously accessed rows may no longer be frequently accessed (i.e., the rows are no longer active). At this time, if the rows are still kept in the open state, system resources will be occupied by the inactive rows, resulting in a high probability of page precharge and row activation operations required each time a new row is accessed, resulting in reduced memory access performance.
[0052] In order to process the memory access requests issued by the processor as quickly as possible, another aspect of optimizing the processing mechanism of the memory controller is to plan the instruction sending order of the memory access requests so that the total time consumed by the memory controller to complete the memory access requests is the shortest (for example, the overall time required for the memory controller to complete all memory access requests is the shortest); wherein, planning the instruction sending order of the memory access requests can be for memory access requests in the page-on state, that is, for all memory access requests in the target behavior page-on state, planning the instruction sending order with the shortest total consumption time (for memory access requests in the target behavior page-on state, the memory operation instructions sent by the memory controller to the memory can be read instructions, write instructions and other memory access operation instructions); of course, some memory access requests in the target behavior page conflict state or page closed state can also be taken into consideration in the planning of the instruction sending order, such as combining all memory access requests in the target behavior page-on state and some memory access requests in the target behavior page conflict state or page closed state to plan the instruction sending order with the shortest total consumption time.
[0053] From the above description, it can be seen that optimizing the processing mechanism of the memory controller to flexibly manage page status and optimize the instruction sending order is of great significance for improving the memory access performance of the computer system.
[0054] An example of a memory controller's processing mechanism for memory access requests can be combined with Figure 3 As shown, refer to Figure 3 As shown, a request queue 310 , a page management record module 320 , a primary arbitration module 330 and a secondary arbitration module 340 may be provided in the memory controller.
[0055] The request queue 310 is used to temporarily store memory access requests that have not yet been processed by the memory controller.
[0056] Specifically, because the processor's processing speed is higher than that of the memory controller, for example, the memory controller's throughput (the amount of data processed per unit time) is lower than the processor's throughput, and the processor may send a large number of memory access requests to the memory controller, the memory controller can buffer the memory access requests that it cannot process in time in the request queue. Consequently, the memory controller can send the memory operation instructions corresponding to the memory access requests to the memory as quickly as possible and in compliance with the timing requirements of the memory protocol, without disrupting the interdependencies between the memory access requests.
[0057] The page management recording module 320 can be used to track and record the page status of a row. For example, a historical record can be set in the page management recording module 320 to track and record the page status of a row. When the memory controller issues an ACT instruction or a PCHG instruction, the page management recording module can update the recorded page status accordingly. Furthermore, the page management recording module 320 can determine the row for page precharge based on conditions such as the row's activation time, whether there are memory access requests directed to the row in the request queue, and the historical usage of the heap to which the row belongs, and send the corresponding PCHG instruction to the secondary arbitration module 340 for arbitration. Optionally, the longer the row's activation time (for example, the row's activation time exceeds a preset activation time), the absence of memory access requests directed to the row in the request queue (i.e., no subsequent memory access requests for the row), and the lower the historical access frequency of the heap to which the row belongs, the higher the probability that the row will undergo page precharge.
[0058] The first-level arbitration module 330 can arbitrate and filter out memory access requests that can issue ACT instructions or memory access operation instructions (RD instructions, WR instructions) from the request queue based on factors such as the page status of the target row corresponding to the memory access request, the cache length of the memory access request in the request queue, the priority of the memory access request, and the timing check result; the ACT instructions or memory access operation instructions (RD instructions, WR instructions) of the memory access requests filtered out by arbitration are sent to the second-level arbitration module 340 for arbitration.
[0059] The secondary arbitration module 340 can further arbitrate input memory operation instructions (ACT instructions, memory access operation instructions, PCHG instructions) and send the memory operation instructions that pass the arbitration to the memory. Furthermore, the instructions involved in the arbitration of the secondary arbitration module 340 can also include memory maintenance instructions such as REF (Refresh) instructions for memory maintenance. Memory maintenance instructions such as REF instructions can be provided by the memory maintenance module in the memory controller; among them, REF instructions are used to periodically refresh the memory to ensure that memory data is not lost due to charge leakage, thereby maintaining memory data integrity.
[0060] based on Figure 3As shown in the processing mechanism, for a memory access request that requires activating a row first, the memory controller can consider factors such as the time priority of the memory access request entering the request queue (i.e., the cache length of the memory access request in the request queue), the priority of the memory access request, and whether the timing conditions are met, and output an ACT instruction for the memory access request; then, when the timing requirements for sending the memory access operation instruction are met, the memory access operation instruction is output for the memory access request (whether the RD instruction or the WR instruction is output depends on the memory access operation type); after outputting the memory access operation instruction of the memory access request, the page management record module can be combined to decide whether to precharge the page, and a PCHG instruction to close the row can be output.
[0061] Figure 3 The memory controller shown uses a two-level arbitration mechanism for processing memory access requests. Although this mechanism can manage and update the page status of memory rows and arbitrate the order in which memory operation instructions are sent, its memory access performance still needs to be improved. Specifically, the following aspects are reflected:
[0062] Two-level arbitration suffers from redundancy and efficiency issues. Specifically, a memory access request that wins the first-level arbitration may not necessarily win the second-level arbitration. This can render the first-level arbitration process ineffective, wasting memory controller processing resources and time.
[0063] The optimal timing for sending memory operation instructions may be missed. Specifically, after a memory access request wins the first-level arbitration, it will go through other subsequent logic and the second-level arbitration process, which takes multiple clocks. To prevent the same memory access request from being repeatedly arbitrated, once a memory access request wins the first-level arbitration, it will be temporarily masked for a period of time (for example, several clocks). If the memory access request does not win the second-level arbitration, it may miss the optimal instruction sending time, resulting in reduced memory access performance. Especially when there are many and complex memory access requests, the response time of the memory access request will be longer.
[0064] This may cause the planning of instruction sending sequence to fall into the local timing optimum rather than the global optimum; specifically, Figure 3 The two-level arbitration processing mechanism shown is mainly based on a greedy algorithm to arbitrate the instructions output to the memory, which may find the local optimal instruction sending order rather than the global optimal instruction sending order;
[0065] For example, suppose there are two WR instructions (WR1 and WR2), where WR1 meets the timing requirement in the current clock cycle, while WR2 needs to wait for one clock cycle to meet the timing requirement. From the perspective of the local optimality of the greedy algorithm, the greedy algorithm will arbitrate and choose to output the WR1 instruction to the memory in the current clock cycle, and then arbitrate and choose to output the WR2 instruction to the memory. From the perspective of the global optimality, if the instruction sending timing interval of outputting the WR2 instruction first and then the WR1 instruction is smaller than the instruction sending timing interval of outputting the WR1 instruction first and then the WR2 instruction, then when the WR1 instruction meets the timing requirement, the WR1 instruction can be chosen not to be output. Thus, after waiting for one clock cycle, the WR2 instruction can be chosen to be output to the memory first, and then the WR1 instruction can be chosen to be output to the memory by arbitration, thereby shortening the timing interval between the two WR instructions. It can be seen that the arbitration mechanism based on the greedy algorithm has the disadvantage of falling into the local optimality of the instruction sending order. This disadvantage will become more obvious as the number and complexity of memory access requests increase.
[0066] The optimization options and methods for the processing mechanism are relatively limited. For example, optimization primarily relies on adjusting timing parameters (not all timing parameters are optimal using the minimum values specified by the memory protocol), built-in counter thresholds (such as the conversion thresholds for read and write memory access operations), and address resolution conversion algorithms (the algorithms depend on the memory access request pattern issued by the upstream processor and cannot be adjusted after normal read and write memory access operations begin). These optimization options and methods may not be flexible enough to handle dynamically changing memory access requests, resulting in limited improvements in memory access performance.
[0067] The page strategy has limitations. Specifically, page precharge management mainly relies on the historical usage of the heap, the activation time of the row, and the page status information when the memory access request reaches the memory controller. This page strategy may not be able to adapt in time when the access situation of the memory access request changes, resulting in the need for frequent page status updates. For example, during a certain period of time, there are intensive memory accesses from BANK0 to BANK9, and the memory controller will keep the page open for the rows in BANK0 to BANK9 for a long time. Later, during another period of time, there are intensive memory accesses from BANK10 to BANK19. Due to the limited recording capacity of the page management recording module, large-scale page status updates are required based on changes in the BANK area with intensive memory access. Such large-scale page status updates may be beyond the page strategy's ability to adapt in time, resulting in limitations of the page strategy. In other words, the page strategy is not efficient enough for page status management, especially when multiple BANKs are intensively accessed and change.
[0068] The memory access performance of the processing mechanism based on the memory controller needs to be improved. The embodiment of the present application considers further optimizing the processing mechanism of the memory controller for memory access requests.
[0069] The embodiment of the present application can design a page-open queue module (storing memory access requests with the target behavior in the page-open state) and a non-page-open queue module (storing memory access requests with the target behavior in the non-page-open state), as well as a flow mechanism for memory access requests between the page-open queue module and the non-page-open queue module; by making the memory access requests of the page-open queue module participate in instruction arbitration, while the memory access requests of the non-page-open queue module do not participate in instruction arbitration, thereby planning the instruction sending order for the memory access requests of the page-open queue module based on the timing interval of the memory access requests of the page-open queue module, and the total timing interval of the instruction sending order meets the preset timing interval requirement (for example, the total timing interval of the instruction sending order is the minimum) to optimize the planning effect of the instruction sending order. In other words, the embodiment of the present application can introduce the dynamic planning strategy of the instruction sending order into instruction arbitration through the design of the page-open queue module and the non-page-open queue module and the flow mechanism, thereby improving the memory access performance.
[0070] As an optional implementation, Figure 4 The following is an exemplary flowchart of an optional memory access method according to an embodiment of the present application, wherein Figure 4 The method flow shown can be implemented by a memory controller. Figure 5 The following is an example diagram of a memory controller provided by an embodiment of the present application. Figure 5 As shown, the memory controller may include: a page status manager 510, a page open queue module 520, a non-page open queue module 530, and an instruction arbiter 540. It should be noted that the above-mentioned components included in the memory controller may be hardware components. Of course, in addition to implementing corresponding functions through hardware logic, the above-mentioned hardware components may also be combined with the memory controller firmware to implement functional configuration to support each hardware component to implement corresponding functions.
[0071] The following combination Figure 4 and Figure 5 The memory access solution provided in the embodiment of the present application is introduced. The process content of the memory access method provided in the embodiment of the present application and the structure and functional content of the memory controller can refer to and reference each other.
[0072] Combine Figure 4 and Figure 5 As shown, the process of the memory access method provided in the embodiment of the present application may include the following steps.
[0073] In step S410, a memory access request is obtained.
[0074] The memory access request may be issued by the processor, so that the memory controller may obtain the memory access request issued by the processor.
[0075] In step S411 , the page status that matches the memory access request is determined.
[0076] In an optional implementation, the memory controller may record page states, and thereby determine the page states that match the memory access request based on the recorded page states. The page states that match the memory access request include a page open state and a non-page open state (a page closed state or a page conflict state).
[0077] In an optional implementation, the page status manager 510 may be a device in the memory controller that records the page status; for example, in combination with Figure 5 As shown, a recording unit 511 may be provided in the page state manager 510 , and the recording unit 511 may be used to record the page state.
[0078] Optionally, in the initial state, the page state recorded by the page state manager 510 is empty, for example, the record in the recording unit 511 is empty. As the memory controller processes the memory access request issued by the processor and updates the page state during the processing of the memory access request, the page state recorded by the page state manager 510 (for example, the recording unit 511 in the page state manager 510) will be updated accordingly. In other words, the page state manager 510 can record the page state of the row pointed to by the memory access request processed by the memory controller, and update the recorded page state accordingly as the memory controller updates the page state.
[0079] In step S412 , memory access requests matching the page open state are distributed to the page open queue module, and memory access requests matching the non-page open state are distributed to the non-page open queue module.
[0080] In an optional implementation, based on the page open queue module 520 and the non-page open queue module 530 set in the embodiment of the present application, the page state manager can distribute the memory access request of the page open state (that is, the target behavior page open state pointed to by the memory access request) to the page open queue module, and distribute the memory access request of the non-page open state (that is, the target behavior non-page open state pointed to by the memory access request) to the non-page open queue module according to the recorded page state. It should be noted that the non-page open state can include any of the following: page closed state and page conflict state; that is, the memory access request of the page closed state (the target behavior page closed state pointed to by the memory access request) and the memory access request of the page conflict state (the target behavior page conflict state pointed to by the memory access request) are distributed to the non-page open queue module.
[0081] Furthermore, in the initial situation, based on the fact that the page status recorded by the page status manager is empty, the memory access requests issued by the processor can be uniformly distributed to the non-page open queue module; and as the page status recorded by the page status manager is updated, if the memory access requests subsequently issued by the processor match the page open status in the page status recorded by the page status manager, then the memory access requests matching the page open status are distributed to the page open queue module; if the memory access request issued by the processor matches the non-page open status (page closed status or page conflict status) in the page status recorded by the page status manager, or does not match the page status (that is, the page status manager has not yet recorded the page status of the target row pointed to by the memory access request), then the memory access request is distributed to the non-page open queue module.
[0082] Optionally, the process of adaptively distributing memory access requests to the page open queue module and the non-page open queue module can be performed by the recording unit 511. In other words, in addition to recording the page status, the recording unit 511 can also adaptively distribute memory access requests issued by the processor to the page open queue module and the non-page open queue module based on the recorded page status.
[0083] In a further optional implementation, the page state manager can generate a corresponding page state adjustment instruction for a memory access request in a non-page open state, and send it to the instruction arbiter 540 for instruction arbitration. Figure 5 As shown, the page state manager 510 may be provided with a page state adjustment unit 512 , which may generate corresponding page state adjustment instructions for memory access requests in a non-page-open state and send the instructions to the instruction arbiter 540 for instruction arbitration.
[0084] Optionally, the page state manager (such as the page state adjustment unit in the page state manager) can continuously query the recorded page state. If a memory access request that matches a non-page open state is detected, a corresponding page state adjustment instruction can be generated for the memory access request, and sent to the instruction arbitrator to participate in instruction arbitration. For example, if the page state manager detects a memory access request that matches a page closed state, an ACT instruction can be generated for the memory access request, and sent to the instruction arbitrator to participate in instruction arbitration. For another example, if the page state manager detects a memory access request that matches a page conflict state, a PCHG instruction can be generated for the memory access request, and sent to the instruction arbitrator to participate in instruction arbitration. It should be noted that page state adjustment instructions (such as ACT instructions, PCHG instructions, etc.) can be regarded as a form of memory operation instructions, which are used to adjust the page state of a row in the memory.
[0085] In an optional implementation, the page state manager can generate a corresponding page state adjustment instruction when the memory access request issued by the processor matches a non-page open state. For example, in the initial case, since the page state recorded by the page state manager is empty, the page state of the memory access request issued by the processor matches a non-page open state, and the page state manager can generate a corresponding page state adjustment instruction for the memory access request issued by the processor (the page state adjustment instruction generated at this time can be a PCHG instruction, etc.). As the page state recorded by the page state manager is updated, the page state manager can generate an ACT instruction when the memory access request issued by the processor matches a page closed state, and generate a PCHG instruction when it matches a page conflict state; if the memory access request issued by the processor still matches an empty state, a PCHG instruction is generated.
[0086] It can be seen that the page status manager mainly implements two functions: on the one hand, it records and updates the page status of the target row pointed to by the memory access request processed by the memory controller, and distributes the memory access request to the page open queue module or the non-page open queue module based on the recorded page status (optionally, this function can be implemented by the recording unit); on the other hand, it generates corresponding page status adjustment instructions for memory access requests in the non-page open state (optionally, this function can be implemented by the page status adjustment unit).
[0087] In an optional implementation, the page status manager may be a hardware device in the memory controller; further, the page status manager in the form of a hardware device may be functionally configured through the firmware of the memory controller to support the page status manager in implementing the above functions.
[0088] It should be further explained that the page state manager or the front-end device of the memory controller can first convert the physical address carried in the memory access request issued by the processor into a memory address corresponding to the hierarchical organization structure of the memory (for example, a memory address in the CS, CID, BG, BA, ROW, and COL formats); on this basis, the page state manager implements the above-mentioned functions of distributing memory access requests to different queue modules and generating page state adjustment instructions. The relevant content of converting the physical address carried in the memory access request into a memory address corresponding to the hierarchical organization structure of the memory can be referred to the description of the corresponding section above and will not be elaborated here.
[0089] In step S413 , the memory access request is flowed between the page open queue module and the non-page open queue module according to the page status change of the memory access request.
[0090] Different from the method in which all memory access requests are uniformly placed in a request queue, when a memory access request is selected by the first-level arbitration, it needs to be masked for a period of time to prevent it from being selected repeatedly in the future. In the embodiment of the present application, a page open queue module 520 is provided for saving memory access requests in the page open state, and a non-page open queue module 530 is provided for saving memory access requests in the non-page open state, and based on the change of the page state of the memory access request, a flow mechanism of the memory access request between the page open queue module and the non-page open queue module is provided.
[0091] It should be noted that a memory access request entering the page open queue module means that the row pointed to by the memory access request has been activated, that is, the memory access request pointing to an activated row has a dedicated storage queue (i.e., the page open queue module); and a memory access request entering the non-page open queue module means that the row pointed to by the memory access request is in a page closed or page conflict state, that is, the memory access request in the page closed state and the memory access request in the page conflict state share a storage queue (i.e., the non-page open queue module). Furthermore, in order to identify the memory access requests in the page closed state and the memory access requests in the page conflict state stored in the non-page open queue module, the non-page open queue module can set a flag bit for the memory access request, and different values of the flag bit represent different non-page open states of the memory access request, that is, in the non-page open queue module, the memory access request in the page closed state and the memory access request in the page conflict state have flag bits with different values.
[0092] In an embodiment of the present application, a memory access request can flow between a page-open queue module and a non-page-open queue module based on a change in page status. For example, if the page status of a memory access request stored in a page-open queue module changes to a non-page-open state (page-closed state or page-conflict state), the memory access request can flow from the page-open queue module to the non-page-open queue module. For another example, if the page status of a memory access request stored in a non-page-open queue module changes to a page-open state, the memory access request can flow from the non-page-open queue module to the page-open queue module.
[0093] It should be noted that the page status of memory access requests issued by the processor is not fixed. For example, when the memory controller sends an ACT instruction, PCHG instruction, or memory operation instruction (WR instruction, RD instruction) to the memory for a memory access request, this may cause the page status of other unprocessed memory access requests to change. For example, the memory controller may process multiple memory access requests. When a page within a stack is activated, other pages in the same stack cannot be activated until the activated page is closed through page precharge. Therefore, when an ACT instruction in a memory access request activates the page containing the target row, it may cause the status of other pages in the same stack to change to the page closed state, thereby changing the page status of other memory access requests not processed by the memory controller. Of course, there are other situations in which the ACT instruction, PCHG instruction, or memory operation instruction (WR instruction, RD instruction) of a memory access request may cause the page status of other memory access requests to change. This will not be elaborated here, as it depends on the specific situation.
[0094] It can be seen that there are changes in the page status of the memory access requests saved by the page opening queue module and the non-page opening queue module. The embodiment of the present application can flow the memory access requests between the page opening queue module and the non-page opening queue module based on the changes in the page status of the memory access requests.
[0095] Based on the fact that memory access requests flow between the page-open queue module and the non-page-open queue module, the embodiment of the present application can allow memory access requests in the page-open queue module to participate in instruction arbitration, while not allowing memory access requests in the non-page-open queue module to participate in instruction arbitration. For example, the memory access request issued by the processor will first query the page status through the page status manager. If the page status manager queries that the memory access request matches the non-page-open state (page-closed state or page conflict state), then the page status manager will generate a corresponding page status adjustment instruction and send it to the instruction arbitrator for arbitration; and the memory access request in the non-page-open state is distributed to the non-page-open queue module for storage. At the same time, the memory access request in the queue of the non-page-open queue module does not participate in instruction arbitration, but waits until the memory access request of the non-page-open queue module flows to the page-open queue module, and then participates in instruction arbitration through the memory access request saved by the page-open queue module.
[0096] The mechanisms of the page opening queue module and the non-page opening queue module provided in the embodiments of the present application are introduced below.
[0097] In an optional implementation, both the page opening queue module and the non-page opening queue module can set an upper limit on the number of requests, and the upper limit on the number of requests of the page opening queue module and the non-page opening queue module can be the same or different. The upper limit on the number of requests of the page opening queue module and the non-page opening queue module can be defined according to actual conditions.
[0098] Optionally, when the memory access requests stored in any queue of the page open queue module and the non-page open queue module reach the upper limit of the number of requests (that is, the memory access requests stored in any queue of the page open queue module and the non-page open queue module are full), in order to prevent the memory access requests issued by the processor from being lost or delayed due to overload, the embodiment of the present application can block the processor from continuing to send memory access requests through a back pressure mechanism until there is enough free space (for example, a preset number of free spaces) in the page open queue module and the non-page open queue module to save new memory access requests. For example, when the memory access requests stored in any queue of the page open queue module and the non-page open queue module reach the upper limit of the number of requests, the memory controller can send a memory access request stop receiving message to the processor to achieve the purpose of blocking the processor from continuing to send memory access requests through the back pressure mechanism; when the number of memory access requests stored in the page open queue module and the non-page open queue module is lower than the upper limit of the number of requests, and the difference with the upper limit of the number of requests corresponds to a preset number of free spaces, the memory controller can send a memory access request continue receiving message to the processor to enable the processor to continue to send memory access requests.
[0099] In an optional implementation, when the memory controller sends an ACT instruction, PCHG instruction, WR instruction, or RD instruction for a memory access request to the memory, the page status of other memory access requests not processed by the memory controller may change, thereby causing the memory access requests to flow between the page open queue module and the non-page open queue module. When the number of memory access requests issued by the processor is large (i.e., the memory controller faces a high memory access request load), the memory access requests may frequently flow between the page open queue module and the non-page open queue module, and the number of flows may be large. In this case, the page open queue module or the non-page open queue module may overflow. That is, due to the flow of memory access requests, the number of memory access requests that need to be stored in either the page open queue module or the non-page open queue module exceeds the upper limit of the request number. For example, taking the page open queue module as an example, the number of memory access requests originally stored in the page open queue module does not exceed the upper limit of the request number, but due to the high memory access request load and frequent changes in the page status of the memory access requests, a large number of memory access requests may frequently flow to the page open queue module, resulting in insufficient space in the page open queue module to store the incoming memory access requests, causing the page open queue module to overflow.
[0100] In order to manage the above-mentioned overflow situation of the queue module, in an optional implementation, the embodiment of the present application can retain the memory access request that needs to flow to the overflow queue module in the currently saved queue module when any queue in the page-open queue module or the non-page-open queue module overflows due to the flow of memory access requests, and set a flow tag for the memory access request, so that the overflow queue no longer flows into the memory access request. Optionally, the flow tag can indicate that the memory access request needs to flow out of the currently saved queue module but has not flowed out. Furthermore, when the overflow queue module has free space to receive the memory access request, the memory access request with the flow tag set can flow into the queue module to which it needs to flow. Of course, the memory access request with the flow tag set may not need to flow out of the currently saved queue module due to changes in the page status. At this time, the flow tag set for the memory access request can be canceled to keep the memory access request in the currently saved queue module. It should be noted that the overflow queue can be regarded as a queue module in the page-open queue module and the non-page-open queue module that has no free space to store the memory access request that needs to flow in.
[0101] Because the memory access requests in the page open queue module participate in instruction arbitration, the dequeue speed of the memory access requests in the page open queue module has an important impact on the throughput of the memory controller. For the situation where the memory access request has not been arbitrated for a long time, different from the method of setting a time count for the memory access request, thereby increasing the arbitration priority of the memory access request whose time count reaches the threshold (this method will cause a certain memory access request to be suddenly jammed in arbitration due to the increase in priority, destroying the arbitration plan), the situation in which a certain memory access request has not been arbitrated for a long time in the embodiment of the present application is mainly because: the memory access request frequently flows between the page open queue module and the non-page open queue module for a long time, so that the memory access request does not participate in instruction arbitration when it flows into the page open queue module, that is, the memory access request falls into a cycle of frequent flow between the page open queue module and the non-page open queue module, and does not participate in instruction arbitration.
[0102] Based on this, the embodiment of the present application can set a flow count value for the memory access request, and the flow count value of the memory access request is based on the flow count of the memory access request between the page open queue module and the non-page open queue module, and increases by times; for example, each time the memory access request flows between the page open queue module and the non-page open queue module, the flow count value of the memory access request increases by 1. Thus, when the flow count value of the memory access request reaches the flow count threshold, the memory access request will no longer flow out of the page open queue module after flowing into the page open queue module; that is, when the flow count value of the memory access request entering the page open queue module reaches the flow count threshold, the memory access request will remain in the page open queue module and will no longer flow out of the page open queue module. Through the above setting, the situation where the memory access request does not participate in instruction arbitration for a long time can be reduced, and at the same time, the situation where the arbitration plan is destroyed due to the sudden increase in the priority of the memory access request will not occur (suddenly increasing the priority of a memory access request may lead to an increase in the interval between subsequent instruction transmissions, destroying the arbitration plan). That is to say, in the embodiment of the present application, the memory access request whose flow count value reaches the flow count threshold will be forced to be retained in the page open queue module and participate in instruction arbitration, so as to be sent to the memory at the appropriate sending time.
[0103] Continue to refer to Figure 4 In step S414, for the memory access request saved by the page open queue module, an instruction sending sequence of the corresponding memory access operation instruction is planned, and the total timing interval of the instruction sending sequence meets the preset timing interval requirement.
[0104] In a further optional implementation, the embodiment of the present application can further set different sub-queues in the page open queue module, such as a first sub-queue and a second sub-queue, and for memory access requests entering the page open queue module (including memory access requests distributed by the page state manager to enter the page open queue module, and memory access requests flowing into the page open queue module from non-open queues), the embodiment of the present application can group them according to the grouping strategy, thereby determining whether the memory access requests entering the page open queue module are grouped into the first sub-queue or the second sub-queue. Furthermore, the embodiment of the present application can plan the instruction sending order for the memory access requests stored in the page open queue module based on the memory access requests stored in the first sub-queue and the memory access requests stored in the second sub-queue.
[0105] In an optional implementation, the policy goal of the grouping strategy is to increase the timing interval between the memory access requests in the first sub-queue and the memory access requests in the second sub-queue; that is, the timing interval from any memory access request in the first sub-queue to all memory access requests in the second sub-queue is relatively large, and the timing interval from any memory access request in the second sub-queue to all memory access requests in the first sub-queue is also relatively large.
[0106] The strategic goal of the above-mentioned grouping strategy can optimize the processing of memory access requests in the time dimension. For example, by expanding the timing interval of memory access requests in the two sub-queues, the used memory bandwidth can be evenly distributed; if the memory accesses from different sub-queues are isolated from each other in time, the conflicts caused by resource competition (such as multiple activation or deactivation of different pages in the same stack) can be reduced; by controlling the timing interval of memory access requests between the two sub-queues, memory operations can be flexibly adjusted and planned. For example, the timing interval between memory access requests can be used to predict the optimal instruction sending order.
[0107] As an optional implementation, Figure 6 An example diagram of a page opening queue module provided in an embodiment of the present application is shown as follows: Figure 6 As shown, the page open queue module may include: a grouping unit 610 , a first sub-queue 620 , a second sub-queue 630 , and an instruction decision unit 640 .
[0108] The grouping unit 610 is used to group the memory access requests entering the page open queue module into the first sub-queue 620 and the second sub-queue 630 according to the grouping strategy.
[0109] In an optional implementation, the grouping unit 610 can be used to group the memory access requests distributed into the page open queue module and the memory access requests flowing from the non-open queue module into the page open queue module according to the grouping strategy, thereby grouping the memory access requests into the first sub-queue and the second sub-queue.
[0110] In an optional implementation, for the memory access requests of the distribution entry page open queue module and the memory access requests of the inflow page open queue module at the same time, the grouping priority of the memory access requests of the distribution entry page open queue module is higher than the grouping priority of the memory access requests of the inflow page open queue module. In other words, if the memory access requests of the distribution entry page open queue module and the memory access requests of the inflow page open queue module exist at the same time, the embodiment of the present application can give priority to grouping the memory access requests of the distribution entry page open queue module to ensure that the memory access requests of the two sub-queues can be saturated as much as possible.
[0111] As an optional implementation, the grouping unit can group memory access requests entering the page open queue module in the memory access mode of the memory controller. Optionally, the grouping strategy can at least consider the memory access operation type (e.g., read or write memory access operation type) of the memory access request; further, in order to balance the number of memory access requests in the two sub-queues, the grouping strategy can also consider the memory access location of the memory access request in the memory.
[0112] As an optional implementation, in the initial state of the page opening queue module, the first sub-queue and the second sub-queue are both empty. In this case, the memory access requests entering the page opening queue module may not be grouped according to the grouping strategy, but the memory access requests entering the page opening queue module may be uniformly allocated to the first sub-queue for storage. In this case, the instruction decision unit 640 for planning the instruction sending order in the page opening queue module may be based on a greedy algorithm (such as Figure 3 The example of the scheme is shown), as well as the timing of the memory (such as the timing of DRAM), to decide the order in which the memory access requests of the first sub-queue participate in instruction arbitration and send them to the instruction arbitrator to participate in instruction arbitration until the operating conditions of the grouping strategy are met.
[0113] In a further optional implementation, the embodiment of the present application may group the memory access requests entering the page open queue module according to the grouping strategy when the operating conditions of the grouping strategy are met. In an optional implementation, the embodiment of the present application may regard the operating conditions of the grouping strategy as being met when the backlog of memory access requests stored in the first sub-queue reaches a set level. For example, if the time it takes for all memory access requests stored in the first sub-queue to be sent to participate in instruction arbitration is greater than the duration of a planned instruction sending sequence, then it is deemed that the backlog of memory access requests stored in the first sub-queue has reached a set level and the operating conditions of the grouping strategy have been met.
[0114] Optionally, when the operating conditions of the grouping strategy are met, embodiments of the present application can group memory access requests entering the page open queue module into the first sub-queue and the second sub-queue based on the grouping strategy's policy objectives and the grouping dimension of the grouping strategy. Optionally, the policy objectives of the grouping strategy can be as described above and will not be expanded upon here.
[0115] In an optional implementation, the grouping dimension of the grouping strategy may include memory access operation types (e.g., read and write memory access operation types). For example, the embodiment of the present application can initially group memory access requests of different memory access operation types into different sub-queues based on the memory access operation type of the memory access instruction; for example, if the memory access operation type of the memory access request entering the page open queue module is a read operation, the memory access request can be grouped into the first sub-queue, and if the memory access operation type of the memory access request entering the page open queue module is a write operation, the memory access request can be grouped into the second sub-queue; of course, the embodiment of the present application can also support memory access requests for read operations, grouped into the second sub-queue, and memory access requests for write operations grouped into the first sub-queue. The memory access operation type of the memory access request and the grouping relationship of the sub-queue can be set according to actual conditions, and the embodiment of the present application is not limited thereto.
[0116] Since the number of memory access requests for read and write operations issued by the processor in each period of time is uncertain, if the memory access requests are grouped into different sub-queues according to a single grouping dimension of the memory access operation type (read and write memory access operations), it may cause the number of memory access requests stored in the first sub-queue and the second sub-queue to be unbalanced. For example, one sub-queue may store a larger number of memory access requests, while the other sub-queue may store a smaller number of memory access requests.
[0117] Based on this, embodiments of the present application can also introduce the memory access location of the memory access request in the memory into the grouping dimension of the grouping strategy, thereby grouping different memory access requests with the same access location at the same memory structure level into different sub-queues to balance the number of memory access requests stored in different sub-queues; wherein the memory structure level is, for example, at least one of a stack group, a stack layer, and a RANK. In other words, if multiple memory access requests entering the page open queue module have the same access location at the same memory structure level, these multiple memory requests should not be grouped into the same sub-queue, but should be grouped into different sub-queues.
[0118] For example, after grouping memory access requests based on memory access operation type, if the difference in the number of memory access requests stored in the first sub-queue and the second sub-queue reaches a preset difference, the number of memory access requests stored in the two sub-queues is considered to be unbalanced, thereby introducing the memory access location grouping dimension. Consequently, for subsequent memory access requests entering the page open queue module, different memory access requests with the same access location at the same memory structure level can be grouped into different sub-queues based on their memory location.
[0119] In an optional implementation, an embodiment of the present application may introduce a memory structure hierarchy based on grouping in the grouping dimension in the order of the memory structure hierarchy from low to high, until the number of memory access requests stored in the first subqueue and the second subqueue is balanced. For example, the stacking group, stacking layer and RANK may be introduced as a grouping dimension in the order of the memory structure hierarchy from low to high, until the number of memory access requests stored in the first subqueue and the second subqueue is balanced. For example, an embodiment of the present application may first introduce the memory structure hierarchy of the stacking group (BG) in the grouping dimension, so that if different memory access requests have the same access position in the memory structure hierarchy of the stacking group, they should be grouped into different subqueues; that is, multiple different memory access requests accessing the same stacking group should be grouped into different subqueues.
[0120] If the number of memory access requests stored in the two subqueues still tends to be unbalanced after the memory structure hierarchy of the stacking group is introduced in the grouping dimension, a higher-level memory structure hierarchy can be introduced. For example, a memory structure hierarchy of the stacking layer and / or RANK is introduced in the grouping dimension, so that if different memory access requests have the same access location in the memory structure hierarchy of the stacking layer and / or RANK, they should be grouped into different subqueues. This method of introducing the memory access location of the memory access request into the grouping dimension in order of the memory structure hierarchy from low to high can dynamically adjust the distribution of the memory access requests in the first subqueue and the second subqueue, so that the number of memory access requests stored in the two subqueues tends to be balanced, thereby balancing the memory access request load in different subqueues.
[0121] In other possible implementations, the embodiments of the present application may also consider the memory access operation type (read and write memory access operations) and multiple memory structure levels of the memory access location in the grouping dimension. For example, the grouping dimension of the grouping strategy may include multiple dimensions, and the multiple dimensions may include the memory access operation type and multiple memory structure levels of the memory access location; thus, the embodiments of the present application may set weights for each dimension separately; further, for any memory access request entering the page open queue module, the embodiments of the present application may determine the weighted results of the memory access request in multiple dimensions based on the matching conditions of the memory access request in each dimension and the weights of each dimension (for example, multiplying the matching conditions of each dimension by the weights of the corresponding dimensions, and accumulating the multiplication results to obtain weighted results of multiple dimensions); further, based on the weighted results of the memory access request in multiple dimensions, determine the subqueues into which the memory access request is grouped. For example, the embodiments of the present application may set different weighted result ranges for the first subqueue and the second subqueue, and based on the weighted result ranges matched by the weighted results of the memory access request in multiple dimensions, the memory access request may be grouped into the subqueue corresponding to the matched weighted result range.
[0122] For example, taking the multiple dimensions of the grouping dimension including CS (indicating the RANK of the access), CID (indicating the stacking layer of the access), BG (indicating the stacking group of the access), BA (indicating the heap of the access), and TYPE (indicating the type of memory access operation, divided into read operation and write operation) as an example, the embodiment of the present application can set weights for CS, CID, BG, BA, and TYPE respectively, so that the matching situation of the access request in CS, CID, BG, BA, and TYPE (such as the RANK identifier, stacking layer identifier, stacking group identifier, heap address, and memory access operation type of the access request) is multiplied with the weights corresponding to CS, CID, BG, BA, and TYPE, and the multiplication results are accumulated to obtain the weighted result of the memory access request; then, the memory access request is grouped based on the weighted result. This method of setting weights for multiple dimensions of the grouping dimension provides the possibility of software tuning. For example, by adjusting the weight of each dimension, the grouping effect of the memory access request can be adjusted; thus, the weight of each dimension can be adjusted according to the actual grouping requirements.
[0123] It should be noted that the number of dimensions of the multiple dimensions of the grouping dimension can be set according to actual conditions, and is not necessarily 5 dimensions as in the above example. It is understandable that if the grouping dimension is 5 dimensions, the memory access request can be represented in the form of a 5-dimensional coordinate. For example, the matching of the memory access request in 5 dimensions can be regarded as a 5-dimensional coordinate, thereby representing the memory access request. If the grouping dimension is 3 dimensions, correspondingly, the memory access request can be represented in the form of a 3-dimensional coordinate (i.e., the matching of the memory access request in 3 dimensions); at this time, the policy goal of the grouping strategy can be approximated by using a 2-dimensional plane (corresponding to two sub-queues) to divide the 3-dimensional space (corresponding to the 3 dimensions of the grouping), and the number of memory access requests on both sides of the 2-dimensional plane is balanced, and the relative distance between the memory access requests on both sides is as far as possible.
[0124] For ease of understanding, taking the grouping dimension as 3 dimensions as an example, each memory access request can be represented by the matching situation of 3 dimensions, so that the matching situation of the memory access request in 3 dimensions can locate a point in the 3-dimensional space, that is, the memory access request can be represented in the 3-dimensional space; therefore, grouping the memory access requests represented in the 3-dimensional space into two sub-queues (the first sub-queue and the second sub-queue) can be regarded as introducing a 2-dimensional partitioning plane in the 3-dimensional space; and, the 2-dimensional partitioning plane is to group the points in the 3-dimensional space (that is, the memory access requests) to both sides of the 2-dimensional partitioning plane as evenly as possible, and at the same time, the relative distance between the memory access requests on both sides of the 2-dimensional partitioning plane is as large as possible.
[0125] In an optional implementation, combined with Figure 6As shown, the first subqueue 620 and the second subqueue 630 can share the same storage queue to maximize the utilization of the storage queue. In an optional implementation, the first subqueue can be stacked downward from the top of a storage queue, and the second subqueue can be stacked upward from the bottom of the storage queue to achieve the first subqueue and the second subqueue sharing the same storage queue. That is, the first subqueue and the second subqueue can be designed to be physically located in the same storage queue, and the first subqueue and the second subqueue store memory access requests from different directions of the storage queue; for example, for the first subqueue, memory access requests are added to the top of the storage queue, and as the number of memory access requests stored in the first subqueue increases, the old memory access requests stored in the first subqueue move toward the bottom of the storage queue; for the second subqueue, memory access requests are added to the bottom of the storage queue, and as the number of memory access requests stored in the second subqueue increases, the old memory access requests stored in the second subqueue move toward the top of the storage queue.
[0126] In an optional implementation, the present invention provides a subqueue locking mechanism, so that the memory access requests in the locked subqueue can be used as memory access requests to be planned for instruction sending order planning. That is, the memory access requests stored in the locked subqueue can be the memory access requests for which the page open queue module plans the instruction sending order in step S414.
[0127] Optionally, when the number of memory access requests saved in any subqueue of the first subqueue and the second subqueue reaches the upper limit of the matrix operation capability (matrix operation is used to plan the instruction sending order), or when the timing of the memory access requests saved in any subqueue reaches a preset timing upper limit, the embodiment of the present application can lock the subqueue (that is, lock the memory access requests saved in the subqueue), so that the memory access requests saved in the locked subqueue are used as memory access requests to be planned, and the instruction sending order is planned.
[0128] In an optional implementation, locking a subqueue does not mean that memory access requests are no longer allocated to the subqueue, but rather that the memory access requests allocated to the subqueue are cached in the subqueue's cache interval. Figure 6 As shown, a cache interval 650 can be set between the first subqueue 620 and the second subqueue 630 to cache memory access requests grouped into the locked subqueue when any subqueue in the first subqueue and the second subqueue is locked; and after the locked subqueue is unlocked, the memory access requests of the subqueue cached in the cache interval can be migrated into the subqueue.
[0129] For example, further combining Figure 6As shown, the cache interval 650 may include a first cache interval 651 corresponding to the first sub-queue, and a second cache interval 652 corresponding to the second sub-queue. The first cache interval 651 is used to cache memory access requests grouped into the first sub-queue when the first sub-queue is locked, and to migrate the cached memory access requests into the first sub-queue when the first sub-queue is unlocked. Similarly, the second cache interval 652 is used to cache memory access requests grouped into the second sub-queue when the second sub-queue is locked, and to migrate the cached memory access requests into the second sub-queue when the second sub-queue is unlocked.
[0130] Optionally, after the memory access operation instructions corresponding to the memory access requests stored in the subqueue are sent to the instruction arbitration (for example, after being sent to the instruction arbitrator to participate in the instruction arbitration) in accordance with the planned instruction sending order, the subqueue is unlocked. Furthermore, the memory access requests cached in the cache interval of the subqueue can be migrated into the subqueue. For example, if the subqueue is locked based on the timing of the subqueue storing the memory access request reaching the preset timing upper limit, then after the subqueue is unlocked, the timing of the subqueue storing the memory access request can be reset (that is, the timing of the subqueue storing the memory access request is restarted).
[0131] In an optional implementation, an embodiment of the present application determines the memory access requests to be planned in the page open queue module (for example, the memory access requests saved by any locked sub-queue); thereby, based on the timing intervals between the memory access requests to be planned, the instruction path with the smallest total timing interval is optimized as the instruction sending order; wherein, if the total timing interval of the instruction sending order is the smallest, it meets the preset timing interval requirements.
[0132] In an optional implementation, the instruction decision unit 640 in the page open queue module can plan the instruction sending order for the memory access requests stored in the page open queue module. For example, when any sub-queue of the first sub-queue and the second sub-queue is locked, the instruction decision unit 640 can plan the instruction sending order for the memory access requests stored in the locked sub-queue. Furthermore, the instruction decision unit 640 can, based on the planned instruction sending order, allow the memory access operation instructions corresponding to the memory access request to be planned to participate in instruction arbitration; for example, based on the planned instruction sending order, send the memory access operation instructions corresponding to the memory access request to be planned to the instruction arbitrator to participate in instruction arbitration.
[0133] The following describes an optional implementation method for planning the order in which instructions are sent. In the optional implementation, the embodiment of the present application can use matrix operations to plan the order in which instructions are sent. Figure 7 The optional flow chart of planning the instruction sending sequence provided by the embodiment of the present application is exemplarily shown. The method flow can be implemented by the memory controller, for example, by the instruction decision unit in the page open queue module of the memory controller. Figure 7 , the process may include the following steps.
[0134] In step S710 , an initial two-dimensional matrix is constructed according to the number of memory access requests to be planned; different elements in the initial two-dimensional matrix represent timing intervals between different memory access requests to be planned.
[0135] In an optional implementation, the memory access requests to be planned can be considered as memory access requests for the instruction sending order to be planned, such as memory access requests stored in a locked subqueue. Optionally, when the instruction sending order is planned using a matrix operation method, the number of memory access requests to be planned can correspond to the upper limit of the matrix operation capability.
[0136] In an embodiment of the present application, an initial two-dimensional matrix can be constructed based on the number of memory access requests to be planned; for example, an initial two-dimensional matrix with the same two dimensions is constructed with the number of memory access requests to be planned as the dimension. For example, assuming that the number of memory access requests to be planned is N, an N×N two-dimensional matrix can be constructed as the initial two-dimensional matrix. Among them, any element in the initial two-dimensional matrix represents the timing interval between any memory access request to be planned, that is, different elements represent the timing interval between different memory access requests to be planned. For example, the row number and column number in the initial two-dimensional matrix can identify the sequence number of the memory access request to be planned, that is, the row number and column number in the initial two-dimensional matrix can be maintained as the sequence number of the memory access request to be planned, so that the elements corresponding to different row numbers and different column numbers can be regarded as the timing interval between memory access requests to be planned with different sequence numbers, and since the elements corresponding to the same row number and column number represent the same memory access request, the values of the elements corresponding to the same row number and column number can be expressed as meaningless values (such as infinity).
[0137] In an optional implementation, the upper limit of the computing power of the matrix operation can be determined based on at least the average timing interval between memory access requests. For example, the larger the average timing interval between memory access requests, the higher the upper limit of the computing power of the matrix operation, and the greater the number of corresponding memory access requests to be planned (i.e., it is considered to be a positive correlation). Optionally, the average timing interval between memory access requests can be related to the memory specification of the memory; for example, under a certain memory specification, the average value of the timing intervals of all memory access requests; wherein the memory specification represents the number of data transfers per second that the memory can theoretically perform. For ease of understanding, assume that under medium to high loads of memory access requests, the locked subqueue stores memory access requests of a single memory access operation type, such as all read (RD) type memory access requests or all write (WR) type memory access requests. Taking the DDR-4800 memory specification as an example (the DDR-4800 memory specification indicates that the memory theoretically performs 48 million data transfers per second), the average timing interval between memory access requests is approximately 10 memory clock cycles, which translates to approximately 5 internal clock cycles of the memory controller. This can cover path optimization for a matrix of approximately 10×10, and the number of memory access requests to be planned can be 10. Taking the DDR-5400 memory specification as an example (the DDR-5400 memory specification indicates that the memory theoretically performs 54 million data transfers per second), the average timing interval between memory access requests is approximately 12 memory clock cycles, which translates to approximately 6 internal clock cycles of the memory controller. This can cover path optimization for a matrix of approximately 12×12, and the number of memory access requests to be planned can be 12.
[0138] In an optional implementation, the embodiment of the present application can set an upper limit on the number of memory access requests stored by the subqueue based on the storage space of the page open queue module and the average timing interval between memory access requests, so that the upper limit on the number of memory access requests stored by the subqueue can correspond to the upper limit of the computing power of the matrix operation. In one example, the page open queue module can be set to cache a maximum of 48 memory access requests, and the first subqueue and the second subqueue can lock a maximum of 16 memory access requests. Accordingly, the computing power of the matrix operation is upper bounded by a 16×16 two-dimensional matrix.
[0139] In step S711, the initial two-dimensional matrix is reduced using the current minimum element value of each row and column in the initial two-dimensional matrix so that each row and column has at least one element with a value of 0, thereby obtaining a reduced matrix.
[0140] Reducing the initial two-dimensional matrix can be considered as subtracting the values of the rows and columns in the initial two-dimensional matrix, so that each row and column contains at least one element with a value of 0. When subtracting the values of the rows and columns in the initial two-dimensional matrix, the values of the elements subtracted from each row and column can be determined based on the current minimum value of the elements in each row and column.
[0141] In an optional implementation, an embodiment of the present application can determine the subtraction element values of each row and each column in the initial two-dimensional matrix based on the current minimum element value of each row and each column, so that after all elements in each row are subtracted from the subtraction element value of the corresponding row, and all elements in each column are subtracted from the subtraction element value of the corresponding column, there is at least one element with a value of 0 in each row and each column in the initial two-dimensional matrix, thereby reducing the initial two-dimensional matrix to obtain a reduced matrix. In other words, the matrix reduction process is to reduce the element values in the matrix to ensure that at least one element with a value of 0 is present in each row and column.
[0142] Optionally, the embodiment of the present application can start the subtraction of element values from the rows first, and then start the subtraction of element values from the columns. For example, the current minimum element value of each row in the initial two-dimensional matrix is determined as the subtraction element value of each row; thus, all elements of each row are subtracted from the current minimum element value of the corresponding row, so that each row has at least one element with a value of 0. Then, for each column in the initial two-dimensional matrix, it is determined whether the column has at least one element with a value of 0; if so, the column does not perform element value subtraction, that is, there is no subtraction element value in the column at this time; if not, all elements of the column can subtract the current minimum element value of the column, and accordingly, the current minimum element value of the column is the subtraction element value of the column.
[0143] For ease of understanding, Figure 8 An example diagram of matrix operations is shown as follows: Figure 8 As shown, taking the initial 5×5 two-dimensional matrix as an example, the minimum element value 7 in the first row can be subtracted from all elements in the first row, making the second column of the first row equal to 0; the minimum element value 5 in the second row can be subtracted from all elements in the second row, making the third column of the second row equal to 0; the minimum element value 12 in the third row can be subtracted from all elements in the third row, making the fifth column of the third row equal to 0; the minimum element value 21 in the fourth row can be subtracted from all elements in the fourth row, making the second column of the fourth row equal to 0; and the minimum element value 15 in the fifth row can be subtracted from all elements in the fifth row, making the first column of the fifth row equal to 0. After completing the subtraction of the element values of each row, except for the fourth column, all other columns have at least one element with a value of 0. Therefore, all elements in the fourth column need to subtract the current minimum element value 3 in the fourth column, making the fifth row of the fourth column equal to 0, thus completing the reduction processing of the initial two-dimensional matrix and obtaining the reduced matrix.
[0144] Of course, the embodiment of the present application can also support the subtraction processing of element values starting from the column first, and then starting the subtraction processing of element values from the row; the implementation method can be referred to in the same way and will not be expanded here.
[0145] In step S712 , starting from the reduced matrix, the matrix is iteratively pruned based on the reduced cost until an instruction path with the smallest total timing interval is determined as the instruction sending sequence.
[0146] Optionally, the embodiment of the present application may define a reduction cost. For example, the reduction cost may be a reduction number; the reduction number for one reduction process is: the cumulative result of the subtraction element values of each row of the matrix and the subtraction element values of each column of the matrix in one reduction process; the subtraction element values of each row of the matrix are selected from the current minimum element values of each row of the matrix, and the subtraction element values of each column of the matrix are selected from the current minimum element values of each column of the matrix. For example, in Figure 8 In an exemplary embodiment, the subtraction element values of each row and the subtraction element values of each column used in the reduction processing of the initial two-dimensional matrix can be accumulated, so that the reduction number is 63, which can be represented by h.
[0147] In an optional implementation, an embodiment of the present application can start from a reduced matrix, and use the branch and bound method based on the reduced cost to iteratively prune the matrix, thereby continuously shrinking the matrix until an instruction sending path that meets the preset timing interval requirements is obtained, for example, the instruction path with the smallest total timing interval is used as the instruction sending order.
[0148] It should be noted that the branch-and-bound method is a search algorithm for solving optimization problems. It searches for the optimal path by continuously decomposing the problem into smaller subproblems. In the embodiment of the present application, it can be regarded as searching for an instruction sending sequence whose total timing interval meets the preset timing interval requirements (for example, searching for the instruction sending sequence with the smallest total timing interval). In other words, the search for the instruction sending sequence can be regarded as the branch-and-bound method for searching for the optimal path in the matrix.
[0149] In an embodiment of the present application, the branch and bound method is used to search for the instruction sending order, and a heuristic search strategy can be used to guide the search direction, such as selecting the search direction with the smallest reduction cost; and the bounding function of the branch and bound method can prune the areas (rows and columns) in the matrix that cannot contain the optimal solution. For example, the bounding function of the branch and bound method can prune the areas in the matrix with the largest reduction cost, thereby improving the search efficiency.
[0150] In an implementation example, starting from the reduced matrix, each time the matrix is pruned using the branch and bound method, the embodiment of the present application can determine the region formed by the rows and columns where each element with a value of 0 is located, thereby obtaining multiple regions (a region can be a row and a column in the matrix); then, the reduction cost of each region is determined (for example, the reduction number of the region, formed by the minimum element value other than 0 in the rows and columns of the region); if the region with the largest pruning reduction cost (for example, the largest reduction number) is smaller than the total matrix reduction cost of the region with the largest unpruned reduction cost, then the region with the largest reduction cost is pruned to prune the region in the matrix that is unlikely to contain the optimal solution; if the region with the largest pruning reduction cost is larger than the total matrix reduction cost of the region with the largest unpruned reduction cost, then the region with the largest reduction cost is retained. Wherein, the total matrix reduction cost can be the reduction cost of the entire matrix accumulated starting from the initial two-dimensional matrix, such as the total matrix reduction number.
[0151] Example, combined Figure 8 As shown in the figure, taking the reduced matrix after the initial matrix is reduced as an example, the region formed by the rows and columns where each element with a value of 0 is located can be determined, and the minimum element value other than 0 in each region can be determined to obtain the reduction number of each region; among them, the reduction number of the region where the 3rd row and the 5th column are located is the largest, and the total reduction number of the matrix after pruning the region where the 3rd row and the 5th column are located is less than the total reduction number of the matrix where the 3rd row and the 5th column are located without pruning, then the region where the 3rd row and the 5th column are located is regarded as the region that cannot contain the optimal solution in the search process of the branch and bound method and can be pruned; thus, the region where the 3rd row and the 5th column are located is selected for pruning (that is, subtracting the region where the 3rd row and the 5th column are located in the matrix). Figure 8 The total matrix reduction of each stage is shown as an example. If the region with the largest reduction number is selected for pruning, the total matrix reduction is smaller than that of the region without the largest reduction number, then the region with the largest reduction number can be pruned. If the region with the largest reduction number is selected for pruning, the total matrix reduction is larger than that of the region without the largest reduction number, then the region with the largest reduction number is not pruned, that is, the region with the largest reduction number is retained. The same logic can be used to refer to Figure 8 The processing of each stage of the example will not be expanded here.
[0152] The embodiments of the present application can continuously prune the matrix based on the reduction cost, subtracting the areas in the matrix that are unlikely to contain the optimal solution, thereby continuously reducing the matrix, and then determining the instruction sending order whose total timing interval meets the preset timing interval requirement (for example, the total timing interval is minimized). Optionally, the order of the row and column numbers corresponding to the instruction path searched by the branch and bound method can represent the determined instruction sending order.
[0153] It should be noted that in the process of iterative pruning of the matrix in the embodiment of the present application, the branch and bound method adopts a heuristic search strategy with the reduction cost as the search direction. Therefore, under this strategic search method, the efficiency of searching for the optimal path can be improved. For example, the fastest number of operations is n to obtain the optimal result (i.e., the optimal instruction sending order); compared with the brute force path search method, which requires n 2 times of operations, the embodiment of the present application can improve search efficiency.
[0154] It should be further explained that in the scheme for planning the instruction sending order provided in the embodiment of the present application, different elements in the matrix represent the timing intervals between different memory access requests, which takes into account the timing differences and directionality between different memory access requests. This is because if a unified timing value is used, it may lead to a decrease in memory access performance. Therefore, it is necessary to consider fine-grained management of the timing intervals of different memory access requests.
[0155] Specifically, taking the memory specifications of DDR-4800 and DDR-5400 as an example, in DDR-4800 and DDR-5400, the timing interval between WR (write) and RD (read) is different from the timing interval between RD and WR; and, for the same pair of WR and RD, the timing interval between WR and RD is greater than the timing interval between RD and WR, and the difference is relatively large. For example, for DDR-4800 memory specifications, the timing interval between a WR and a RD is 80 memory clock cycles for both the same BA (stack address) and different BAs, 62 memory clock cycles for different BGs (stack groups), 13 memory clock cycles for different CSs (CS indicates RANK), and 15 memory clock cycles for different DIMMs. However, for DDR-4800 memory specifications, the timing interval between a RD and a WR is 15 memory clock cycles for the same BA, different BAs, different BGs, and different DIMMs, and 13 memory clock cycles for different CSs. Clearly, for DDR-4800, the timing interval between a WR and a RD is different from the timing interval between a RD and a WR, and there is a significant difference. Furthermore, for the BA access hierarchy, the timing interval between a WR and a WR is the same when accessing the same BA and different BAs, while the timing interval between a RD and a RD is the same when accessing the same BA and different BAs. In other words, the timing intervals between WRs and RDs form an omnidirectional pattern (regardless of direction, the timing intervals are the same).
[0156] However, the inventors of the present application discovered that for the access level of RANK, the timing intervals of WR after WR when accessing different RANKs are different, and the timing intervals of RD after RD when accessing different RANKs are different. That is to say, WR and WR between different RANKs are directional, and RD and RD are directional. For this situation, one way to deal with it is to use a unified timing value to process memory access operations between RANKs; for example, for different RANKs, all WR to WR or all RD to RD use a unified timing value, that is, the timing intervals of memory access operations (such as write operations or read operations) between different RANKs are all set to a unified timing value, and the unified timing value can be the maximum timing interval between WR and WR, and RD and RD between different RANKs.
[0157] Since the performance differences between different RANKs may be large, using a unified timing value may lead to reduced memory access performance. Therefore, it is necessary to consider fine-grained management of the timing intervals of memory access operations between different RANKs, use different timing intervals to handle WR and WR, RD and RD between different RANKs, and take into account the hardware overhead of the memory controller.
[0158] Based on this, the embodiments of the present application take into account the timing differences caused by the above-mentioned directionality (i.e., the timing interval differences caused by the directionality of WR and WR, and the directionality of RD and RD between different RANKs) when planning the instruction sending order. On this basis, the embodiments of the present application can consider the initial type of memory access operation when grouping memory access requests entering the page open queue module, and group the memory access requests into different sub-queues; the relevant content can be referred to the description of the corresponding part above, and will not be expanded here.
[0159] Continue to refer to Figure 4 As shown, after planning the instruction sending sequence for the memory access request to be planned, the memory access operation instruction corresponding to the memory access request can be sent to the instruction arbitration according to the instruction sending sequence.
[0160] That is, the embodiment of the present application may proceed to step S415:
[0161] At least based on the instruction sending sequence, the memory access operation instructions are made to participate in instruction arbitration, so that the memory access operation instructions are sent to the memory in the instruction sending sequence.
[0162] Optionally, the instruction decision unit can send the memory access operation instructions corresponding to the memory access request to the instruction arbiter one by one according to the instruction sending order. In other words, based on the sequential sending of the memory access operation instructions corresponding to the memory access request to the instruction arbiter, the embodiment of the present application is equivalent to reserving multiple subsequent memory operations of the memory.
[0163] For example, the instruction decision unit can send the memory access operation instructions of N memory access requests to the instruction arbiter in sequence according to the instruction sending order, so that the instruction arbiter can arbitrate the memory access operation instructions of the N memory access requests in sequence and send them to the memory, which is equivalent to reserving the memory for the subsequent N memory access operations. Furthermore, while the instruction arbiter is arbitrating the memory access operation instructions of the N memory access requests, the instruction decision unit can continue to plan the instruction sending order for the memory access requests stored in the next locked sub-queue; after the instruction decision unit completes the planning of the instruction sending order again, it can again send the memory access operation instructions of the N memory access requests to the instruction arbiter in sequence, which is equivalent to reserving the memory for the subsequent N memory access operations, and this cycle repeats.
[0164] In an optional implementation, the instruction sending sequence to be planned by the branch and bound method can be a loop-shaped instruction sending sequence, that is, the instruction sending sequence starts from the memory access request of the first sent instruction, sorts to the memory access request of the last sent instruction, and then returns to the memory access request of the first sent instruction, forming a loop, and the total timing interval of the loop is the shortest. For example, Figure 9 An exemplary loop-shaped instruction sending sequence is shown, referring to Figure 9 As shown in the figure, when 5 memory access requests participate in the planning of the instruction sending order, based on the shortest total timing interval, the looped instruction sending order is: 2-1-3-5-4-2; that is, the instruction sending order is the second memory access request, the first memory access request, and so on, and finally returns to the second memory access request.
[0165] In an optional implementation, the embodiment of the present application may not follow the instruction sending order in a loop form when sending the memory access operation instructions of the memory access request to the instruction arbitrator for instruction arbitration according to the instruction sending order; for example, according to the number of memory access requests to be planned, the memory access operation instructions of the memory access request are sent to the instruction arbitrator for instruction arbitration in the corresponding order of instruction sending. That is to say, according to the instruction sending order, starting from the first memory access request that sends an instruction, the corresponding memory access operation instruction is sent to the instruction arbitrator for instruction arbitration, until the end of the last memory access request that sends an instruction, the corresponding memory access operation instruction is sent to the instruction arbitrator for instruction arbitration, without returning to the first memory access request that sends an instruction (that is, without forming a loop). For example, according to Figure 9 In the example of the loop-back instruction sending sequence, when the memory access operation instructions of the memory access request are actually sent, the sending order of the memory access operation instructions of the memory access request is 2-1-3-5-4.
[0166] Continue to refer to Figure 4 In step S416, instruction arbitration is performed on the memory operation instructions participating in instruction arbitration to determine the memory operation instruction sent to the memory.
[0167] Optionally, step S416 may be implemented by the instruction arbiter 540. In an optional implementation, the memory operation instructions participating in the instruction arbitration may include: memory access operation instructions and other memory operation instructions.
[0168] It should be noted that the memory operation instruction corresponding to the memory access request depends on the page status of the target row pointed to by the memory access request. If the page status of the target row is the page open state, the memory operation instruction corresponding to the memory access request is a memory access operation instruction (read instruction, write instruction, etc.). If the page status of the target row is not the page open state, the memory operation instruction corresponding to the memory access request can be a page state adjustment instruction for adjusting the page state. For example, if the page status of the target row is the page closed state, the memory operation instruction corresponding to the memory access request is an ACT instruction. For another example, if the page status of the target row is the page conflict state, the memory operation instruction corresponding to the memory access request is a PCHG instruction. Therefore, other memory operation instructions participating in instruction arbitration may include page state adjustment instructions, such as ACT instructions and PCHG instructions. It can be understood that in an optional implementation, the memory access operation instructions participating in instruction arbitration are provided by the page start queue module (such as the instruction decision unit therein), and the page state adjustment instructions participating in instruction arbitration can be provided by the page state manager (such as the page state adjustment unit therein).
[0169] In a further optional implementation, other memory operation instructions participating in instruction arbitration may also include: memory maintenance instructions, such as REF (refresh) instructions, etc.
[0170] In an optional implementation, the memory controller may have different memory operation modes, mainly divided into a memory access mode and a memory maintenance mode.
[0171] The memory access mode can be considered the mode in which the memory controller accesses memory (hence, the memory access mode is also called the read-write mode). In the memory access mode, the memory controller can adjust the page state of the target row of the memory access operation through page state adjustment instructions (such as the PCHG instruction and the ACT instruction), and output memory access operation instructions (such as read instructions and write instructions) when the target row is activated. In the memory access mode of the memory controller, for memory operation instructions participating in instruction arbitration, the arbitration priority of memory access operation instructions (such as read and write instructions) is higher than that of other memory operation instructions.
[0172] Memory maintenance mode can be considered a mode set by the memory controller to handle memory maintenance tasks (such as REF). It is mainly used to maintain the data integrity of the memory and prevent memory data loss. When the number of REF instructions accumulated by the memory controller is large (for example, the number of accumulated REF instructions reaches the backlog threshold), it can enter memory maintenance mode to prioritize the processing of REF instructions. At this time, the priority of the memory operation instructions corresponding to the memory access request will be lowered to ensure that the backlog of REF instructions can be processed in a timely manner. In other words, in memory maintenance mode, memory maintenance instructions such as REF instructions have a higher arbitration priority than other instructions participating in arbitration.
[0173] Alternatively, the memory controller may be unable to perform REF operations in a timely manner due to prioritizing memory operation instructions corresponding to memory access requests, resulting in a backlog of REF instructions. Furthermore, once the backlog of REF instructions is processed and the memory's REF compensation is complete (for example, by executing REF instructions to perform a memory refresh, restoring the memory state to normal operating levels), the memory controller can switch back to memory access mode.
[0174] In a further optional implementation, based on the looped instruction sending order, the embodiment of the present application can determine the maximum timing interval in the looped instruction sending order, and determine the starting memory access request of the maximum timing interval (that is, the starting memory access request of the two memory access requests targeted by the maximum timing interval) as the query target; thereby, in another subqueue (another subqueue outside the subqueue where the starting memory access request is located, that is, another subqueue where the starting memory access request is not located) and a non-page open queue, query whether there is a memory access request that accesses a different BG (stack group) from the query target (that is, search in another subqueue or non-page open queue for a memory access request that accesses a different BG from the query target); if a memory access request that accesses a different BG from the query target is found in the other subqueue, then based on the shortest timing interval between memory access requests of different BGs, the embodiment of the present application can switch the planning of the instruction sending order to the other subqueue based on the memory access request found in the other subqueue;
[0175] If a memory access request different from the BG accessed by the query target is queried in the non-page open queue, an activation requirement for the memory access request can be proposed to the page state manager (specifically, the page state adjustment unit in the page state manager), so that the page state manager can generate an ACT instruction for the memory access request and participate in instruction arbitration; at this time, the ACT instruction of the memory access request is higher than the read instruction, write instruction and other memory access operation instructions participating in instruction arbitration, so as to ensure that the timing interval between memory access requests of different BGs is shortened, thereby further shortening the timing interval of sending memory access requests;
[0176] If no memory access request different from the BG accessed by the query target is found in another sub-queue and the non-page open queue, then a memory access request whose timing interval with the query target meets the conditions (for example, the shortest timing interval) is determined from another sub-queue to transition the planning of the instruction sending order to another sub-queue.
[0177] In an optional implementation, the above-mentioned content related to the query target can be executed by the page open queue module, for example, by the instruction decision unit in the page open queue module.
[0178] It should be further explained that, in order to maintain normal storage of data in memory, the memory controller needs to periodically send REF instructions to refresh the memory data, and needs to periodically send PowerDown instructions, as well as set the idle RANKs in the memory to enter PowerDown mode. The REF and PowerDown instructions are sent before the RANKs are in the IDLE state. Based on this, when grouping memory access requests entering the page open queue module, memory access requests that access the same RANK can be specifically grouped into the same sub-queue. Furthermore, the page open queue module (specifically, the grouping unit within the page open queue module) can query the non-page open queue module to determine whether there are memory access requests that access the same RANK as the memory access requests stored in the page open queue module. If so, the page open queue module (specifically, the instruction decision unit within the page open queue module) can send the page state adjustment request for the memory access request found in the non-page open queue module to the page state manager (specifically, the page state adjustment unit within the page state manager). Therefore, the page state manager can generate the corresponding page state adjustment instruction (determine whether it is an ACT instruction or a PCHG instruction based on the specific non-page open state of the memory access request) and participate in instruction arbitration. Afterwards, based on the page state of the memory access request queried in the non-page open queue module, the memory access request can flow from the non-page open queue module to the page open queue module, thereby optimizing the processing order of the memory access request and providing a basis for faster REF or low power consumption of the entire RANK.
[0179] It can be seen that the page open queue module (specifically, the instruction decision unit in the page open queue module) sends the page status adjustment request to the page status manager mainly in the following situations:
[0180] 1. When a memory access request is found in a non-page open queue that is different from the BG accessed by the query target, the page state manager needs to generate an ACT instruction for the memory access request and participate in instruction arbitration to improve memory access efficiency while minimizing the timing interval between memory access requests from different BGs.
[0181] 2. If there is a memory access request in the non-page open queue module that accesses the same RANK as the page open queue module, the page state manager needs to generate a page state adjustment instruction for the memory access request and participate in instruction arbitration to speed up the REF of the RANK or reduce power consumption.
[0182] In a further optional implementation, if any subqueue is locked and the instruction sending order of the memory access requests in the subqueue is dynamically scheduled, the page state manager should cancel the PCHG instruction corresponding to the memory access request in the subqueue from being sent to the instruction arbiter to prevent the memory access request in the subqueue from being discharged and causing subsequent instruction arbitration to fail. In other words, for memory access requests that are undergoing instruction sending order scheduling in page-open queue mode (i.e., memory access requests to be scheduled), the page containing the target row of the memory access request should not be closed, and the PCHG instruction associated with the memory access request should not be involved in arbitration.
[0183] In a further optional implementation, when planning the instruction sending order for the planned memory access request, if the total matrix reduction cost (for example, the total matrix reduction number) exceeds the preset reduction cost (for example, the preset reduction number), it is regarded as a situation in which the reduction number increases significantly during the matrix reduction operation; at this time, it is possible to consider replacing the memory access request that causes the total matrix reduction cost to exceed the preset reduction cost (that is, consider replacing the memory access request that causes the reduction number to increase significantly). For example, in another sub-queue and non-page open queue module, a memory access request whose timing interval after replacement meets the conditions (for example, the timing interval is the smallest) is searched as a replacement memory access request; thereby, the page state jump requirement of the replacement memory access request is sent to the page state manager. For the relevant content of sending the page state jump requirement of the memory access request to the page state manager, please refer to the corresponding part of the previous description and will not be expanded here. It should be noted that the process of determining whether the total matrix reduction cost exceeds the preset reduction cost can be executed by the page opening queue module, such as by the instruction decision unit; the process of sending the page status jump request to the page status manager can be executed by the page opening queue module, such as by the instruction decision unit.
[0184] The solution provided by the embodiment of the present application introduces the dynamic planning of the instruction sending order of memory access requests in the page-open state into the instruction decision of the memory controller through the page-open queue module; thereby, the memory access requests in the page-open state can participate in instruction arbitration according to the planned instruction sending order, and then the instruction sending order after the memory access request planning optimization is introduced into the instruction arbitration process (for example, the instructions corresponding to the memory access request can be arbitrated and sent to the memory with the shortest timing interval), thereby improving the memory access efficiency.
[0185] Since the dynamic planning of the instruction sending order is a procedural operation, if the instruction sending order sorting of multiple memory access requests is to be completed within one clock, a large amount of hardware logic may be required, which is unacceptable for chip design; therefore, the embodiment of the present application considers arranging the dynamic planning of the instruction sending order to be completed in a continuous period of time, for example, within a continuous clock cycle of the memory controller (for example, within 150 to 200 clock cycles), to complete the dynamic planning of the instruction sending order, thereby reducing the hardware overhead for the dynamic planning of the instruction sending order, and also obtaining the memory access performance benefits after the instruction sending order planning.
[0186] Furthermore, for different initial two-dimensional matrix sizes and different instruction timing conditions in the matrix, the time required to complete the sorting of the instruction sending order is not fixed. Therefore, each time the sub-queue is locked, the memory controller needs to retain sufficient time (such as the continuous time required to complete the dynamic planning of the instruction sending order) to plan the instruction sending order; further, if the planning of the instruction sending order is completed in advance within the retained time, a page state adjustment request can be generated to the page state manager to add some new memory access requests when sorting the instruction sending order to improve the sorting effect of the instruction sending order.
[0187] Furthermore, the structure of the memory controller provided in the embodiment of the present application is conducive to performance debugging. Different from methods such as adjusting the timing interval between instructions and adjusting the counter threshold of memory access requests, the embodiment of the present application can set the timing interval between all memory access requests to the minimum value when the total timing interval is the smallest instruction sending order; in addition, further consideration can be given to the grouping performance tuning of memory access requests in the page opening queue module and the algorithm optimization of the dynamic programming of the instruction sending order (such as improving the rate and effect of heuristic search), and through the software configuration update of the memory controller firmware, the functional configuration and performance improvement of the memory access processing of the hardware device logic of the memory controller can be supported, thereby improving the memory access performance.
[0188] Furthermore, the solution provided by this embodiment optimizes the sequencing of read and write memory access requests by grouping memory access requests within the page-opening queue module and dynamically planning the instruction transmission sequence through time-sharing multiplexing, thereby improving the read and write access performance of the memory. Furthermore, in digital simulation and post-silicon testing, the embodiment of the present application can use software to classify the executed read and write modes, forming corresponding dynamic grouping and dynamic planning strategies, thereby achieving better performance.
[0189] Furthermore, the memory controller may also include a timing check module for determining the current timing of the memory. Furthermore, the memory controller may also include a memory maintenance module for generating memory maintenance instructions, etc. The further structural design of the memory controller may be determined based on actual circumstances and is not limited by the embodiments of the present application.
[0190] Furthermore, an embodiment of the present application also provides a chip, including the memory controller provided in an embodiment of the present application.
[0191] Furthermore, an embodiment of the present application also provides an electronic device (such as a terminal device or a server device), including the memory controller provided by an embodiment of the present application, or the chip provided by an embodiment of the present application.
[0192] The above describes multiple embodiment schemes provided by the embodiments of the present application. 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 open in the embodiments of the present application.
[0193] Although the embodiments of the present application are disclosed above, the present application 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 application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims.
Claims
1. A memory access method, characterized in that: Applied to a memory controller, the method comprises: Get memory access request; Determine the page status that matches the memory access request; Distribute memory access requests matching the page open state to the page open queue module, and distribute memory access requests matching the non-page open state to the non-page open queue module; and, flowing the memory access request between the page opening queue module and the non-page opening queue module according to the page state change of the memory access request; For the memory access requests saved by the page opening queue module, planning the instruction sending sequence of the corresponding memory access operation instructions, wherein the total timing interval of the instruction sending sequence meets the preset timing interval requirement; At least based on the instruction sending sequence, the memory access operation instructions are made to participate in instruction arbitration, so that the memory access operation instructions are sent to the memory according to the instruction sending sequence.
2. The memory access method according to claim 1, characterized in that: The memory access request saved by the page opening queue module and the instruction sending sequence of the corresponding memory access operation instruction are planned to include: Determining the memory access requests to be planned in the page opening queue module; Based on the timing intervals between the memory access requests to be planned, an instruction path with the smallest total timing interval is optimized as the instruction sending sequence; wherein, the instruction sending sequence with the smallest total timing interval meets the preset timing interval requirement.
3. The memory access method according to claim 2, characterized in that: The optimizing the instruction path with the smallest total timing interval based on the timing interval between the memory access requests to be planned as the instruction sending sequence includes: According to the number of memory access requests to be planned, an initial two-dimensional matrix is constructed; different elements in the initial two-dimensional matrix represent timing intervals between different memory access requests to be planned; The initial two-dimensional matrix is reduced by using the current minimum element value of each row and column in the initial two-dimensional matrix so that each row and column has at least one element with a value of 0, thereby obtaining a reduced matrix; Starting from the reduction matrix, the matrix is pruned iteratively based on the reduction cost until an instruction path with the smallest total timing interval is determined as the instruction sending order.
4. The memory access method according to claim 3, characterized in that: Starting from the reduction matrix, the matrix is pruned iteratively based on the reduction cost until an instruction path with the smallest total timing interval is determined as the instruction sending sequence, which includes: Starting from the reduction matrix, the matrix is iteratively pruned using the branch and bound method until an instruction path with the smallest total timing interval is searched out as the instruction sending order; wherein the branch and bound method uses the minimum reduction cost as the search direction, and the bounding function of the branch and bound method prunes the area with the largest reduction cost in the matrix.
5. The memory access method according to claim 4, characterized in that: The method of iteratively pruning the matrix using the branch and bound method starting from the reduced matrix includes: Starting from the reduced matrix, each time the matrix is pruned using the branch and bound method, the region formed by the rows and columns where each element with a value of 0 is located is determined to obtain multiple regions; and the reduced cost of each region is determined; If the total matrix reduction cost of the region with the largest pruning cost is smaller than that of the region with the largest unpruned cost, the region with the largest pruning cost is pruned; if the total matrix reduction cost of the region with the largest pruning cost is larger than that of the region with the largest unpruned cost, the region with the largest reduction cost is retained.
6. The memory access method according to claim 1, characterized in that: The page opening queue module includes at least a first sub-queue and a second sub-queue; the method further includes: For memory access requests entering the page open queue module, the memory access requests are grouped into a first sub-queue and a second sub-queue according to a grouping strategy, and the policy objectives of the grouping strategy are met; wherein the policy objectives at least include: increasing the timing interval between the memory access requests in the first sub-queue and the memory access requests in the second sub-queue.
7. The memory access method according to claim 6, characterized in that: Also includes: In the initial situation where both the first subqueue and the second subqueue are empty, the memory access requests entering the page opening queue module are uniformly allocated to the first subqueue; Based on the greedy algorithm and the current memory timing requirements, the order in which the memory access requests of the first sub-queue participate in instruction arbitration is determined until the operating conditions of the grouping strategy are met; The grouping of the memory access requests into the first sub-queue and the second sub-queue according to the grouping strategy comprises: When the operating condition of the grouping strategy is met, the memory access requests are grouped into a first sub-queue and a second sub-queue according to the grouping dimension of the grouping strategy; The operating condition for achieving the grouping strategy includes: the time taken for all memory access requests stored in the first sub-queue to be sent to participate in instruction arbitration is greater than the time taken for planning the instruction sending sequence once.
8. The memory access method according to claim 7, characterized in that: The grouping of the memory access requests into the first sub-queue and the second sub-queue according to the grouping dimension of the grouping strategy includes: According to the memory access operation types of the memory access requests, memory access requests of different memory access operation types are grouped into different sub-queues; If the number of memory access requests stored in the first subqueue and the second subqueue is unbalanced, different memory access requests with the same access location at the same memory structure level are grouped into different subqueues; Among them, the memory structure hierarchy includes at least one item of a stacking group, a stacking layer and a RANK; and the stacking group, the stacking layer and the RANK introduce the grouping dimension in the order from low to high of the memory structure hierarchy until the number of memory access requests stored in the first sub-queue and the second sub-queue is balanced.
9. The memory access method according to claim 7, characterized in that: The grouping dimension includes multiple dimensions, and the multiple dimensions include multiple memory structure levels and memory access operation types; wherein each dimension is respectively provided with a weight; The grouping of the memory access requests into the first sub-queue and the second sub-queue according to the grouping dimension of the grouping strategy includes: For any memory access request entering the page open queue module, the weighted results of the memory access request in multiple dimensions are determined according to the matching status of the memory access request in each dimension and the weight of each dimension; based on the weighted results of the memory access request in multiple dimensions, the sub-queue into which the memory access request is grouped is determined.
10. The memory access method according to claim 6, characterized in that: Also includes: The subqueues satisfying the locking condition in the first subqueue and the second subqueue are locked, and the memory access requests saved in the locked subqueues are used as the memory access requests to be planned, so as to plan the instruction sending order; Among them, the subqueue meets the locking conditions including: The number of memory access requests saved by the subqueue reaches the upper limit of the matrix operation capability. The matrix operation is used to plan the order in which instructions are sent. Alternatively, the timing of the memory access request saved by the subqueue reaches a preset timing upper limit; wherein, after the memory access operation instruction corresponding to the memory access request saved by the subqueue is sent to the participating instruction arbitration according to the planned instruction sending order, the subqueue is unlocked, and the timing of the memory access request saved by the subqueue restarts when the subqueue is unlocked; The method further comprises: When the subqueue is locked, the memory access requests allocated to the subqueue are cached in the cache interval of the subqueue, until the subqueue is unlocked, and the memory access requests cached in the cache interval of the subqueue are migrated into the subqueue.
11. The memory access method according to claim 6, characterized in that: The planned instruction sending sequence is an instruction sending sequence in a loop form; the instruction sending sequence in the loop form starts from the memory access request of the first instruction to be sent, and after the memory access request of the last instruction to be sent is sorted, it returns to the memory access request of the first instruction to be sent; The step of causing the memory access operation instruction to participate in instruction arbitration at least based on the instruction sending order includes: According to the number of memory access requests to be planned, the memory access operation instructions corresponding to the memory access requests to be planned are made to participate in instruction arbitration in a corresponding order of instruction sending.
12. The memory access method according to claim 11, characterized in that: Also includes: Determine a maximum timing interval in a loop-shaped instruction sending sequence, and determine a starting point memory access request of the maximum timing interval as a query target; In another sub-queue and non-page-opened queue module where the query target is not located, query whether there is a memory access request different from the stack group accessed by the query target; If the instruction is found in the other sub-queue, then based on the memory access request found in the other sub-queue, the planning of the instruction sending order is switched to the other sub-queue; If it is found in the non-page opening queue module, an activation instruction corresponding to the memory access request found in the non-page opening queue module is generated and participates in instruction arbitration, and the arbitration priority of the activation instruction is set higher than the memory access operation instruction; If the query is not found in the other sub-queue and the non-page open queue, a memory access request that meets the timing interval conditions with the query target is determined from the other sub-queue, and based on the memory access request determined from the other sub-queue, the planning of the instruction sending order is transitioned to the other sub-queue.
13. The memory access method according to any one of claims 1 to 12, characterized in that: Also includes: Performing instruction arbitration on the memory operation instructions participating in instruction arbitration, and determining the memory operation instructions sent to the memory; The memory operation instructions participating in instruction arbitration include: the memory access operation instructions and other memory operation instructions; in the memory access mode of the memory controller, the arbitration priority of the memory access operation instructions is higher than that of other memory operation instructions.
14. The memory access method according to claim 13, characterized in that: The other memory operation instructions include: page status adjustment instructions; the method also includes: When the page state matched by the memory access request is a non-page open state, a corresponding page state adjustment instruction is generated for the memory access request and participates in instruction arbitration; The page state matched by the memory access request is a non-page open state and includes any of the following: When the record of the page status is empty, the page status matched by the memory access request is not the page open status; When the record of the page status is not empty, the memory access request matches the page closed status, page conflict status, or unmatched page status.
15. The memory access method according to claim 14, characterized in that: Also includes: In the non-page opening queue module, query whether there is a memory access request that accesses the same RANK as the memory access request saved by the page opening queue module; If it exists, a corresponding page status adjustment instruction is generated for the memory access request queried in the non-page open queue module and participates in instruction arbitration.
16. The memory access method according to claim 13, characterized in that: The other memory operation instructions include: memory maintenance instructions; in the memory maintenance mode of the memory controller, the memory maintenance instructions have an arbitration priority higher than other instructions participating in arbitration.
17. The memory access method according to claim 1, characterized in that: Determining the page status matching the memory access request includes: Based on the recorded page status, determine the page status that matches the memory access request; The method further comprises: If a memory operation instruction of a memory access request sent to the memory causes a change in the page status of other unprocessed memory access requests, the recorded page status is updated based on the change in the page status; The step of flowing the memory access request between the page opening queue module and the non-page opening queue module according to the page state change of the memory access request comprises: If the page state of the memory access request saved by the page open queue module changes to a non-page open state, it flows to the non-page open queue module; If the page state of the memory access request saved by the non-page open queue module changes to the page open state, it flows to the page open queue module; The method further comprises: For a memory access request for which instruction sending sequence planning is performed, the page precharge instruction corresponding to the memory access request is cancelled from participating in arbitration.
18. The memory access method according to claim 1, further comprising: When the memory access requests stored in any queue of the page open queue module and the non-page open queue module reach the upper limit of the request quantity, the processor is blocked from continuing to send memory access requests through the back pressure mechanism until there is a preset amount of free space in the page open queue module and the non-page open queue module; and / or, when any queue in the page-open queue module or the non-page-open queue module overflows due to the flow of memory access requests, the memory access requests that need to flow to the overflow queue module are retained in the currently saved queue module, and a flow tag is set for the memory access requests; And / or, a flow count value is set for the memory access request, and the flow count value of the memory access request is based on the flow count of the memory access request between the page open queue module and the non-page open queue module, and increases by times; when the flow count value of the memory access request reaches the flow count threshold, if the memory access request flows into the page open queue module, the memory access request is set to no longer flow out of the page open queue module.
19. A memory controller, characterized in that: include: Page state manager, used to obtain memory access requests; Based on the recorded page status, determine the page status that matches the memory access request; Distribute memory access requests matching the page open state to the page open queue module, and distribute memory access requests matching the non-page open state to the non-page open queue module; The non-page open queue module is used to save the memory access requests in the non-page open state; A page open queue module is used to save memory access requests in the page open state; for the saved memory access requests, a command sending sequence of corresponding memory access operation instructions is planned, and the total timing interval of the command sending sequence meets the preset timing interval requirement; And, at least based on the instruction sending order, the memory access operation instruction is sent to the instruction arbitrator to participate in instruction arbitration, so that the memory access operation instruction is sent to the memory according to the instruction sending order; Wherein, the memory access requests stored in the page opening queue module and the non-page opening queue module flow between the page opening queue module and the non-page opening queue module based on the page state change; An instruction arbitrator is used to perform instruction arbitration on memory operation instructions participating in instruction arbitration and determine the memory operation instructions sent to the memory; wherein the memory operation instructions participating in instruction arbitration include: the memory access operation instructions and other memory operation instructions; in the memory access mode of the memory controller, the arbitration priority of the memory access operation instructions is higher than that of other memory operation instructions.
20. The memory controller according to claim 19, wherein: The page open queue module includes: a grouping unit, a first sub-queue, a second sub-queue, and an instruction decision unit; The grouping unit is used to group the memory access requests entering the page opening queue module into a first sub-queue and a second sub-queue according to the grouping strategy, and meet the policy objectives of the grouping strategy; wherein the policy objectives at least include: increasing the timing interval between the memory access requests in the first sub-queue and the memory access requests in the second sub-queue; The first sub-queue is used to store the memory access request of the grouping unit grouped into the first sub-queue; The second sub-queue is used to store the memory access request of the grouping unit grouped into the second sub-queue; The instruction decision unit is used to, when any subqueue of the first subqueue and the second subqueue is locked, use the memory access request saved in the locked subqueue as the memory access request to be planned; based on the timing intervals between the memory access requests to be planned, optimize the instruction path with the smallest total timing interval as the instruction sending order; wherein, the total timing interval of the instruction sending order is the smallest, which meets the preset timing interval requirements; and, at least based on the instruction sending order, send the memory access operation instructions corresponding to the memory access request to be planned to the instruction arbitrator to participate in instruction arbitration.
21. The memory controller according to claim 20, characterized in that: The instruction decision unit is used to optimize the instruction path with the smallest total timing interval based on the timing interval between the memory access requests to be planned, as the instruction sending sequence includes: According to the number of memory access requests to be planned, an initial two-dimensional matrix is constructed; different elements in the initial two-dimensional matrix represent timing intervals between different memory access requests to be planned; The initial two-dimensional matrix is reduced by using the current minimum element value of each row and column in the initial two-dimensional matrix so that each row and column has at least one element with a value of 0, thereby obtaining a reduced matrix; Starting from the reduction matrix, the matrix is pruned iteratively based on the reduction cost until an instruction path with the smallest total timing interval is determined as the instruction sending order.
22. The memory controller according to claim 20, characterized in that: The grouping unit is further used to uniformly allocate the memory access requests entering the page opening queue module to the first subqueue in an initial situation where both the first subqueue and the second subqueue are empty; The instruction decision unit is further used to decide the order in which the memory access requests of the first sub-queue participate in instruction arbitration based on the greedy algorithm and the current memory timing requirements until the operating conditions of the grouping strategy are met; When the operating condition of the grouping strategy is met, the grouping unit starts to execute the step of grouping the memory access requests into the first sub-queue and the second sub-queue according to the grouping strategy.
23. The memory controller according to claim 20, characterized in that: The page opening queue module further includes: a cache interval; the cache interval includes a cache interval of the first sub-queue and a cache interval of the second sub-queue; The cache interval of the first subqueue is used to cache the memory access requests assigned to the first subqueue by the grouping unit when the first subqueue is locked, and to migrate the cached memory access requests into the first subqueue when the first subqueue is unlocked; The cache interval of the second subqueue is used to cache the memory access requests assigned to the second subqueue by the grouping unit when the second subqueue is locked, and to migrate the cached memory access requests into the second subqueue when the second subqueue is unlocked; The locking condition satisfied by any one of the first sub-queue and the second sub-queue includes: The number of memory access requests saved by the subqueue reaches the upper limit of the matrix operation capability. The matrix operation is used to plan the order in which instructions are sent. Alternatively, the timing of the memory access request saved by the sub-queue reaches a preset timing upper limit; wherein, after the memory access operation instruction corresponding to the memory access request saved by the sub-queue is sent to the instruction arbitrator to participate in instruction arbitration in accordance with the planned instruction sending order, the sub-queue is unlocked, and the timing of the memory access request saved by the sub-queue restarts when the sub-queue is unlocked.
24. The memory controller according to claim 20, characterized in that: The page status manager includes: a recording unit and a page status adjustment unit; The recording unit is used to record the page status; and based on the recorded page status, determine the page status that the memory access request matches; distribute the memory access request that matches the page open status to the page open queue module, and distribute the memory access request that matches the non-page open status to the non-page open queue module; The page state adjustment unit is used to generate a corresponding page state adjustment instruction for the memory access request when the page state matched by the memory access request is a non-page open state, and send it to the instruction arbitrator to participate in instruction arbitration; and when the page state adjustment requirement of the memory access request from the instruction decision unit is obtained, the corresponding page state adjustment instruction is generated for the memory access request, and sent to the instruction arbitrator to participate in instruction arbitration.
25. A chip, characterized in that: Including a memory controller; the memory controller is a memory controller as described in any one of claims 19-24, or the memory controller is configured to execute the memory access method as described in any one of claims 1-18.
26. An electronic device, characterized in that: Comprising the chip as claimed in claim 25.
Citation Information
Cited By
GPGPU (General Purpose Graphics Processing Unit)-based instruction execution acceleration method and GPGPU architecture
CN119537041A
Artificial intelligence chip and operation method thereof
CN121051065A
