A method, device, electronic device and storage medium for processing memory access request

By using the data ready bit in the cache system for address tag matching, the problem of time overhead and cache hit rate contradiction caused by the small number of MSHR items is solved, and the cache performance and the ability to accommodate unfinished memory access requests are improved.

CN118568012BActive Publication Date: 2024-10-15BEIJING INSTITUTE OF OPEN SOURCE CHIP
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411025857.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-10-15
Estimated Expiration
2044-07-29

AI Technical Summary

Technical Problem

In the cache system, the small number of MSHR items leads to a large search time overhead when the cache misses, affecting the cache hit rate, and the small number of MSHR items has a greater impact on the cache hit rate, resulting in time overhead and cache hit rate. contradiction.

Method used

By setting the data ready bit in the address tag of the target cache line, the address tag is matched only through the data ready bit, and the first memory access request is determined to be an unfinished memory access request at the same address of the second memory access request, thus avoiding a fully associative search. , reduce the number of MSHR searches.

Benefits of technology

It reduces the time overhead of MSHR searching for unfinished memory access requests for the same address, eliminates the contradiction between time overhead and cache hit rate, supports MSHR with a larger number of items, and improves cache performance and the ability to accommodate unfinished memory access requests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118568012B_ABST
    Figure CN118568012B_ABST
Patent Text Reader

Abstract

The embodiments of the present invention provide a method, device, electronic device and storage medium for processing memory access requests, and relate to the field of memory access technology. The method includes: receiving a first memory access request; in the case of a cache miss in the first memory access request, allocating a target cache line for target data; setting a data ready bit in a target address tag corresponding to the target cache line according to whether the target data is stored in the target cache line; receiving a second memory access request; in the process of matching the address tag of the target memory access address of the second memory access request, obtaining the data ready bit from the target address tag; in the case of an invalid data ready bit, determining the first memory access request as an uncompleted memory access request with the same address as the second memory access request. The present application reduces or even eliminates the contradiction between the time overhead introduced by the search of uncompleted memory access requests with the same address by MSHR and the cache hit rate, and supports the expansion of MSHR to a larger number of items.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of memory access technology, and in particular to a method for processing a memory access request, a device for processing a memory access request, an electronic device and a storage medium. Background Art

[0002] If the accessed data does not exist in the cache, a cache miss occurs. In this case, it is necessary to obtain data from a slower memory level (such as main memory or auxiliary cache). Since it takes a long time to obtain data from the memory, the cache can continue to respond to other memory access requests during this period to improve data transmission efficiency. In order to effectively manage these cache miss memory access requests, MSHR (Miss Status Holding Registers) is used to store the status information of these cache miss memory access requests. The main functions of MSHR include tracking cache miss memory access requests, resolving conflicts of cache miss memory access requests, forwarding temporarily stored data, etc. For multi-level caches, each level of cache has a corresponding MSHR.

[0003] Currently, in the cache system, after a cache miss triggers a missed memory access request to enter the MSHR, it is necessary to use a fully associative search to find out whether there is an unfinished memory access request with the same address in the MSHR in order to merge the memory access requests.

[0004] However, the search for the unfinished memory access request with the same address will check all the items in the MSHR. When the number of items in the MSHR is large, the time overhead is large. Therefore, the number of items in the MSHR is currently small, and the time overhead of the search is reduced as much as possible. However, the small number of items in the MSHR will affect the cache hit rate, especially when the amount of data is increasing. The smaller number of MSHR items has a greater impact on the cache hit rate. In other words, the search for the unfinished memory access request with the same address by the MSHR will introduce a contradiction between time overhead and cache hit rate. Summary of the invention

[0005] In view of the above problems, an embodiment of the present invention is proposed to provide a method for processing memory access requests that overcomes the above problems or at least partially solves the above problems, so as to reduce or even completely eliminate the contradiction between time overhead and cache hit rate.

[0006] In a first aspect, the present invention provides a method for processing a memory access request, the method comprising:

[0007] Receive a first memory access request; the first memory access request includes: a target memory access address;

[0008] In the case where the first memory access request cache misses, requesting target data corresponding to the first memory access request from the memory, and allocating a target cache line for the target data;

[0009] According to whether the target data is stored in the target cache line, setting a data ready bit in the target address tag corresponding to the target cache line;

[0010] receiving a second memory access request; the second memory access request comprising: the target memory access address;

[0011] In a process of performing address tag matching on the target memory access address of the second memory access request, acquiring the data ready bit from the target address tag;

[0012] When the data ready bit is invalid, the first memory access request is determined as an incomplete memory access request with the same address as the second memory access request.

[0013] In a second aspect, the present invention provides a device for processing a memory access request, the device comprising:

[0014] A first receiving module is configured to receive a first memory access request; the first memory access request includes: a target memory access address;

[0015] an allocation module, configured to request target data corresponding to the first memory access request from a memory and allocate a target cache line for the target data if the first memory access request does not hit the cache;

[0016] A setting module, configured to set a data ready bit in a target address tag corresponding to the target cache line according to whether the target data is stored in the target cache line;

[0017] A second receiving module is used to receive a second memory access request; the second memory access request includes: the target memory access address;

[0018] an acquisition module, configured to acquire the data ready bit from the target address tag during the process of performing address tag matching on the target memory access address of the second memory access request;

[0019] A determination module is used to determine the first memory access request as an uncompleted memory access request with the same address as the second memory access request when the data ready bit is invalid.

[0020] In a third aspect, the present invention provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method for processing memory access requests when executing the program.

[0021] In a fourth aspect, the present invention provides a readable storage medium, which enables the electronic device to execute the above-mentioned method for processing memory access requests when instructions or transactions in the storage medium are executed by a processor of the electronic device.

[0022] In a fifth aspect, the present invention provides a computer program product, including instructions or transactions, which, when executed by a processor in an electronic device, enable the electronic device to execute the above-mentioned method for processing memory access requests.

[0023] The present invention includes the following advantages:

[0024] According to whether the target data is stored in the target cache line, the data ready bit is set in the target address tag corresponding to the target cache line. If the data ready bit is invalid, it means that the target data corresponding to the first memory access request and the second memory access request have not been stored in the target cache line. In the process of address tag matching of the target memory access address of the second memory access request, it is necessary to obtain the target address tag corresponding to the target cache line, and obtain the data ready bit from the aforementioned target address tag. There is no additional step for obtaining the data ready bit. Since the target data corresponding to the first memory access request and the second memory access request have not been stored in the target cache line, the first memory access request has not been completed. Therefore, the second memory access request is also a cache miss memory access request, and the first memory access request is an incomplete memory access request with the same address as the second memory access request. Therefore, the first memory access request is determined as an incomplete memory access request with the same address as the second memory access request. That is to say, the search and confirmation of the incomplete memory access request with the same address can be completed only by setting the aforementioned data ready bit, and there is no need for MSHR to search for the incomplete memory access request with the same address. Therefore, the contradiction between the time overhead introduced by the search of the incomplete memory access request with the same address performed by MSHR and the cache hit rate is reduced or even eliminated. The search for whether there are outstanding memory access requests with the same address can be completed only through the aforementioned data ready bit, without searching all the items in the MSHR. This can reduce or even eliminate the time overhead of searching for outstanding memory access requests with the same address in the MSHR. Therefore, even if the number of items in the MSHR is set to be larger, it has basically no effect on the time overhead here, so that the expansion of the MSHR to a larger number of items can be supported. In addition, the more items in the MSHR, the more outstanding memory access requests that can be supported, so that the cache can accommodate more outstanding memory access requests when working, further improving the cache performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0026] Figure 1 A flowchart showing a method for processing a memory access request according to an embodiment of the present invention is provided;

[0027] Figure 2 A flowchart showing another embodiment of a method for processing a memory access request of the present invention;

[0028] Figure 3 A schematic structural diagram of a cache system of the present invention is shown;

[0029] Figure 4 A flowchart showing another embodiment of a method for processing a memory access request of the present invention;

[0030] Figure 5 A structural block diagram showing an embodiment of a device for processing memory access requests of the present invention;

[0031] Figure 6 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0033] One of the core concepts of the embodiment of the present invention is that the search for the unfinished memory access request with the same address by the MSHR is adjusted to be completed only through the aforementioned data ready bit, without searching all the items in the MSHR, which can reduce or even eliminate the time overhead of searching the unfinished memory access request with the same address in the MSHR. Therefore, even if the number of items in the MSHR is set to be larger, it has basically no effect on the time overhead here, so that the expansion of the MSHR to a larger number of items can be supported. In addition, the more items in the MSHR, the more unfinished memory access requests that can be supported, so that the cache can accommodate more unfinished memory access requests when working, further improving the cache performance.

[0034] The present application provides a method for processing memory access requests, which can be applied to a direct-mapped cache system, a fully associative mapping cache system, or a set-associative mapping cache system. Caches can usually use faster SRAM (Static Random-Access Memory) to store frequently accessed data. When a cache superstructure such as a processor needs data, it is preferred to obtain data from the cache. If the cache hits, there is no need to go to the memory to obtain the data, thereby improving the performance of the processor. Direct mapping, fully associative mapping, and set-associative mapping are three important methods for address mapping between main memory and cache in computer systems. In fully associative mapping, each page of the main memory or memory can be mapped to any page of the cache, and there is no fixed corresponding relationship, so it has high flexibility. Set-associative mapping uses a direct mapping method between groups, but uses a fully associative mapping between pages within a group, that is, each page within a group can be mapped to any page within the corresponding cache group, which also shows high flexibility.

[0035] Reference Figure 1 The method for processing the memory access request provided in this application may specifically include the following steps.

[0036] Step 101: Receive a first memory access request; the first memory access request includes: a target memory access address.

[0037] The first memory access request may be issued by the processor for accessing memory data. The target memory access address is the memory address that the first memory access request needs to access.

[0038] Step 102: When the first memory access request does not hit the cache, request target data corresponding to the first memory access request from the memory, and allocate a target cache line for the target data.

[0039] The data accessed by the first memory access request does not exist in the cache, which is a cache miss for the first memory access request. Since the data accessed by the first memory access request does not exist in the cache, it is necessary to obtain the target data corresponding to the first memory access request from the memory. The target data here can be understood as the data stored in the target memory access address of the memory. After obtaining the target data from the memory, the target data is usually returned to the processor, and in order to avoid subsequent memory access to the target data, the target data is usually stored in the cache. Therefore, a target cache line is allocated in the cache for the target data. After the target data corresponding to the first memory access request is obtained from the memory, it will be stored in the target cache line.

[0040] Step 103 : according to whether the target data is stored in the target cache line, set a data ready bit in the target address tag corresponding to the target cache line.

[0041] The target address tag corresponding to the target cache line refers to the address tag of the cache structure associated with the target cache line. The target cache line can be uniquely determined by the target address tag, or the target cache line can be roughly determined by the target address tag. If the target data is stored in the target cache line, setting the data ready bit in the target address tag corresponding to the target cache line is effective, and if the target data is not stored in the target cache line, setting the data ready bit in the target address tag corresponding to the target cache line is invalid.

[0042] It should be noted that the number of data ready bits is not specifically limited here, for example, it can be 1 bit or more bits.

[0043] Optionally, the number of bits of the data-ready bit here can be 1 bit, because there are two states of the target data being stored in the target cache line or the target data being not stored in the target cache line, and 1 bit of 0 and 1 can record these two states, and the number of bits of the data-ready bit is only 1 bit, which has a smaller storage overhead or area overhead than the number of bits of the data-ready bit being multiple bits.

[0044] Step 104: Receive a second memory access request; the second memory access request includes: the target memory access address.

[0045] The second memory access request here can also be issued by the processor for accessing memory data. The second memory access request also includes the target memory access address, that is, the first memory access request and the second memory access request are both memory access requests for the same address.

[0046] Step 105: In the process of performing address tag matching on the target memory access address of the second memory access request, obtain the data ready bit from the target address tag.

[0047] Address addressing is generally used to find data in a cache system. A memory address is usually broken down into three main parts: tag, index, and offset. These three parts work together to determine the location of data in the cache. During cache lookup, the index is first used to determine the cache line or group to be accessed. The tag is then used to compare each cache block in the cache line or group to determine whether the required data is stored. If the tags match, there is a high probability that a cache hit has occurred, and the offset is used to extract the correct data. This address decomposition method in cache design allows efficient data retrieval and can reduce cache misses, thereby improving system performance.

[0048] After receiving the second memory access request, the address tag matching will be performed for the target memory access address of the second memory access request to determine whether a cache hit occurs. In the process of address tag matching, it is necessary to read the target address tag corresponding to the target cache line, and obtain the data ready bit from the target address tag, that is, obtaining the data ready bit reuses the existing address tag matching steps, and no additional steps are added to achieve high efficiency.

[0049] Step 106: When the data ready bit is invalid, determine the first memory access request as an uncompleted memory access request with the same address as the second memory access request.

[0050] The invalidity of the data ready bit means that the target data corresponding to the aforementioned first memory access request has not yet been stored in the target cache line. The second memory access request and the first memory access request are memory access requests for the same address, therefore, the target data corresponding to the second memory access request has not yet been stored in the target cache line, that is, the target data corresponding to the second memory access request does not exist in the cache, and the second memory access request is also a cache miss. Since the target data corresponding to the first memory access request has not yet been stored in the target cache line, that is, no data has been returned for the first memory access request, the first memory access request is an incomplete memory access request, and since the second memory access request and the first memory access request are memory access requests for the same address, the first memory access request is determined as an incomplete memory access request for the same address as the second memory access request. The confirmation of the incomplete memory access request with the same address of the second memory access request is not implemented by the MSHR searching in all the items in the MSHR, which can reduce or even eliminate the time overhead of searching the incomplete memory access request with the same address in the MSHR. Therefore, even if the number of items in the MSHR is set to be larger, it has basically no effect on the time overhead here, so that the expansion of the MSHR to a larger number of items can be supported. In addition, the more items in the MSHR, the more incomplete memory access requests that can be supported, so that the cache can accommodate more incomplete memory access requests when working, further improving the cache performance.

[0051] In the related art, the original full-association search method is replaced with a hash search process based on a hash algorithm to expand the number of missed requests that the MSHR can store. Since the hash algorithm is introduced in the related art, the hardware design is more complicated and the delay of calculating the additional hash value is increased. Compared with the related art, the present application will not have a negative impact on the hardware design and has a smaller delay.

[0052] In the related art, a hierarchical MSHR structure is used to implement cache miss management, etc. Specifically, each memory bank of the cache has its own independent small group of MSHRs and a counter based Bloom filter. All memory banks share a relatively large set of MSHRs. If the private MSHR of the memory bank does not have enough items, or the Bloom filter indicates that the shared MSHR may have the same items, it will be allocated from the shared MSHR. This related art adds the hardware overhead of the additional filter and increases the time overhead of searching the Bloom filter. Compared with this related art, the present application will not have an adverse impact on the hardware design and will have less delay.

[0053] Optionally, the number of entries in the miss status holding register in the cache system is greater than 16 entries. Specifically, since the confirmation of the incomplete memory access request with the same address is not implemented by the MSHR searching in all the entries in the MSHR, the time overhead of searching the MSHR for the incomplete memory access request with the same address can be reduced or even eliminated. Therefore, even if the number of MSHR entries is set to be larger, there is basically no effect on the time overhead here, so that the expansion of the MSHR to a larger number of entries can be supported. Moreover, the more items the MSHR has, the more the number of incomplete memory access requests that can be supported will also increase, so that the cache can accommodate more incomplete memory access requests when working, further improving the cache performance. For example, the present application can support the expansion of the MSHR to a larger number of items, such as 64 items, 128 items, etc.

[0054] The present application also provides another method for processing memory access requests, which can be applied to a directly mapped cache system, a fully associative mapped cache system, or a set associative mapped cache system. Here, the directly mapped cache system, the fully associative mapped cache system, or the set associative mapped cache system can refer to the corresponding records mentioned above, which will not be repeated here to avoid repetition.

[0055] Reference Figure 2 The method for processing the memory access request provided in this application may specifically include the following steps.

[0056] Step 201: Receive a first memory access request; the first memory access request includes: a target memory access address.

[0057] Step 202: When the first memory access request does not hit the cache, request target data corresponding to the first memory access request from the memory, and allocate a target cache line for the target data.

[0058] Step 201 and step 202 may refer to the relevant records of the aforementioned step 101 and step 102 respectively, and can achieve the same or similar beneficial effects, which will not be described again here to avoid repetition.

[0059] Step 203: Set a data ready bit in the address tag of the target cache line according to whether the target data is stored in the target cache line.

[0060] In the process of searching for data in the cache system, the address tag of the target cache line is used to determine whether each cache block in the target cache line stores the required data. The data ready bit is directly set in the address tag of the target cache line. In the process of using the address tag of the target cache line to determine whether each cache block in the target cache line stores the required data, the address tag of the target cache line needs to be obtained. In this process, it is obtained from the address tag of the target cache line by the way, which has less time overhead.

[0061] More specifically, Figure 3 The cache array shown mainly includes a tag array and a data array. The address tag here can refer to the tag array here. The tag in the tag array usually has a mapping relationship with the memory address. In addition to the tag, the status bit can also be set in the tag array. For example, Figure 3 The valid in the word refers to whether the cache line is valid. Here, a valid cache line means that the cache line has been allocated, and an invalid cache line means that the cache line has not been allocated. Figure 3 Modified in the cache line refers to whether the data in the cache line has been modified since it was last loaded from memory. Figure 3 The data ready bit (Data Ready) in the tag array is the data ready bit specially set in the present application. For example, if the data ready bit of the target cache line is 1, it can be considered that the data ready bit is valid, and the target data has been stored in the target cache line. If the data ready bit of the target cache line is 0, it can be considered that the data ready bit is invalid, and the target data has not been stored in the target cache line. Figure 3 In , the data array is used to store data in cache lines. Each cache line usually contains multiple bytes of data, which are copied from the main memory to the cache so that the CPU (Central Processing Unit) can access it quickly.

[0062] Step 204: Receive a second memory access request; the second memory access request includes: the target memory access address.

[0063] Step 205: In the process of performing address tag matching on the target memory access address of the second memory access request, obtain the data ready bit from the target address tag.

[0064] Corresponding to the aforementioned step 203, when the cache performs cache address tag matching according to the input target address, the data ready bit is obtained from the target address tag of the target cache line.

[0065] Step 206: When the data ready bit is invalid, determine the first memory access request as an uncompleted memory access request with the same address as the second memory access request.

[0066] Steps 204 to 206 may refer to the relevant records of the aforementioned steps 104 to 106 respectively, and can achieve the same or similar beneficial effects, which will not be described again here to avoid repetition.

[0067] Step 207 : When the data ready bit is invalid, after waiting for the first memory access request to be completed, return data corresponding to the second memory access request based on the target cache line.

[0068] Step 208: When the data ready bit is valid, return data corresponding to the second memory access request based on the target cache line.

[0069] Specifically, the data ready bit in the target address tag of the target cache line is checked. If the target cache line is valid, it means that the target cache line has been allocated, and the data ready bit is 1, indicating that the target data corresponding to the target address has been stored in the target cache line. At this time, the cache data block can be read, written, kicked out, and other operations can be performed normally, that is, the corresponding data can be returned based on the target cache line for both the first memory access request and the second memory access request. If the target cache line is valid, it means that the target cache line has been allocated, but the data ready bit is not 1, indicating that the target data corresponding to the target address is not stored in the target cache line, which indirectly indicates that the previous request with the same address, that is, the first memory access request, has not been completed. At this time, it is necessary to wait for the previous memory access request with the same address to be completed before processing the memory access request of the current address, that is, the second memory access request. That is to say, it is necessary to wait for the aforementioned first memory access request to be completed, the target data has been stored in the target cache, and the corresponding cache tag data ready bit has been set to 1, and then the notification mechanism is started to notify the blocked second request to continue, so that the data corresponding to the second memory access request can be returned based on the target cache line.

[0070] More specifically, in order to improve efficiency, the cache is usually divided into multiple pipelines, and each pipeline performs different operations. For example, the main pipeline of the cache can be divided into: stage 1, sending a signal to read the data and tags of the cache line / cache set (group) corresponding to the memory access request address; stage 2, performing tag matching operations; stage 3, performing different cache operations according to the results of stage 2 (if matched, return data or write data; if not matched, request enter MSHR). The cache detects in stage 2 that the data ready bit in the data ready bit in the target address tag corresponding to the second memory access request is not 1, and blocks stage 2, which will prevent the second memory access request and the subsequent memory access requests that have not entered the pipeline from continuing to be executed. After the target data corresponding to the first memory access request is returned, the cache writes the target data to the corresponding target cache line, sets the data ready bit in the target address tag to 1, and gives a feedback signal to stage 2. After detecting the feedback signal, stage 2 releases the blocking state, so that the second memory access request and the subsequent memory access requests that have not entered the pipeline can continue to be executed.

[0071] Optionally, the present application may also include the following steps. A waiting item is set in the target address tag. A memory access request queue is usually set in the cache. The memory access request queue is used to store the received memory access request. After receiving the second memory access request, the second memory access request will be stored in the memory access request queue, and the target number of the storage position of the second memory access request in the memory access request queue is assigned to the second memory access request. The target number can be used to characterize the storage position of the second memory access request in the memory access request queue, etc. The second memory access request can be uniquely identified in the memory access request queue through the target number. In the case where the data ready bit is invalid and there is a blank waiting item in the aforementioned waiting item, the target number corresponding to the second memory access request is written into the aforementioned blank waiting item. The blank waiting item here refers to a waiting item that is not currently in use. The aforementioned step 203 may include: receiving the target data returned by the memory, storing the target data in the aforementioned target cache line, and setting the data ready bit in the target address tag corresponding to the target cache line to be valid, which is used to characterize that the target data corresponding to the aforementioned first memory access request has been stored in the target cache line. The aforementioned step 208 may include: when the data ready bit in the target address tag is valid, reading the target number from the waiting item of the target address tag, waking up the second memory access request corresponding to the target number in the memory access request queue, re-matching the address tag, and in the process of re-matching the address tag, since the target data has been stored in the aforementioned target cache line, a cache hit will occur, and the data corresponding to the second memory access request will be returned based on the target data in the target cache line. In the present application, by adding the aforementioned waiting item, the corresponding blocked memory access request can be quickly and accurately awakened to continue after the target data has been stored in the aforementioned target cache line, and since the target number of the blocked second memory access request has been stored in the blank waiting item, the cache main pipeline will not be blocked, and other memory access requests after the second memory access request can continue to be processed.

[0072] More specifically, a waiting item is set in the target address tag corresponding to the target cache line, and all memory access requests sent to the cache will first enter a memory access request queue, and a storage location number in the memory access request queue will be assigned to each memory access request as the target number. The cache obtains the memory access request from the memory access request queue for tag matching and subsequent operations. For example, suppose the memory access request queue has 64 items, where the target number of the first memory access request is 30, and the target number of the second memory access request is 42. When the cache obtains the memory access request from the memory access request queue for tag matching, it also obtains the target number corresponding to the memory access request. When the second memory access request is blocked, if there is still a blank waiting item, write the target number 42 into the blank waiting item of the cache tag without blocking the main cache pipeline (if there is no blank waiting item, refer to the above-mentioned supplementary records, and the main cache pipeline needs to be blocked). After the target data of the first memory access request is returned, the data ready bit in the cache tag is updated, the waiting item is read, and a feedback signal is sent to the memory access request queue to wake up the second memory access request with the target number 42 in the memory access request queue. After that, the second memory access request can re-match the tag and perform subsequent operations. The advantage of this method is that after the second memory access request is blocked, other memory access requests in the memory access request queue can still be executed normally.

[0073] For example, a waiting item is set in the target address tag corresponding to the target cache line. There are two memory access requests a1 and a2 that access the same address A, and a1 accesses the cache before a2. a1 accesses the cache normally. After the cache is judged not to hit, a1 needs to be assigned a target cache line, the data ready bit in the corresponding target address tag is cleared, and a1 enters MSHR. When a2 accesses the cache, a2 is stored in the memory access request queue, and a2 is assigned the storage location number of a2 in the memory access request queue as the target number. The target number is used to uniquely identify a2 in the memory access request queue. Then a cache address tag matching is required. At this time, the data ready bit in the corresponding cache address line tag is 0, that is, the data ready bit is invalid. Before the cache judgment, there is a request with the same address that has not been completed, and a2 is blocked. If there is still a blank waiting item in the aforementioned waiting item, the target number corresponding to a2 is stored in the blank waiting item. When the target data corresponding to a1 is returned from the memory, the target data is written to the pre-allocated target cache line, and the data ready bit in the target address tag corresponding to the target cache line is set to 1, that is, the data ready bit is valid, and the notification mechanism is started. Specifically, the target number of a2 is read from the waiting item of the target address tag corresponding to the target cache line, and the second memory access request a2 corresponding to the target number of a2 in the memory access request queue is awakened. Re-address tag matching notification is to continue to execute the a2 request, and a2 will be considered a cache hit. This implementation method will not block the main cache pipeline, and other memory access requests after the second memory access request can continue to be processed.

[0074] It should be noted that, in the case where there is no blank wait item in the aforementioned wait items, as mentioned above, stage 2 will be blocked, which will make the second memory access request, the memory access request in stage 1 and the subsequent memory access request that have not entered the pipeline unable to continue to be executed. After the target data corresponding to the first memory access request is returned, the cache writes the target data to the corresponding target cache line, and sets the data ready bit in the target address tag to 1, and gives a feedback signal to stage 2. After detecting the feedback signal, stage 2 releases the blocking state, so that the second memory access request, the memory access request in stage 1 and the subsequent memory access request that have not entered the pipeline can continue to be executed.

[0075] In the present application, corresponding processing methods for the second memory access request are provided for different states of the data ready bit, and the above corresponding processing methods are more consistent with the actual situation and have less time overhead.

[0076] The present application also provides another method for processing memory access requests, which can be applied to a directly mapped cache system, a fully associative mapped cache system, or a set associative mapped cache system. The directly mapped cache system, the fully associative mapped cache system, or the set associative mapped cache system here can refer to the corresponding records mentioned above, which will not be described again here to avoid repetition.

[0077] Reference Figure 4 The method for processing the memory access request provided in this application may specifically include the following steps.

[0078] Step 301: Receive a first memory access request; the first memory access request includes: a target memory access address.

[0079] Step 302: When the first memory access request does not hit the cache, request target data corresponding to the first memory access request from the memory, and allocate a target cache line for the target data.

[0080] Step 301 and step 302 may refer to the relevant records of the aforementioned step 101 and step 102 respectively, and can achieve the same or similar beneficial effects, which will not be described again here to avoid repetition.

[0081] Step 303: Group the cache lines in the buffer system to obtain at least one cache group.

[0082] For a cache system with full associative mapping or a cache system with set associative mapping, cache lines in the buffer system are usually grouped to obtain at least one cache group, and whether the number of cache lines in each cache group is equal is not specifically limited.

[0083] For example, set-associative mapping is a compromise between direct mapping and fully associative mapping. For set-associative mapping, cache lines in the cache system are divided into multiple sets of the same size. A data item at a memory address is mapped to a fixed set and can be mapped to any cache line within the set. Furthermore, each set can be divided into multiple banks (memory bodies). This design allows multiple data items to be loaded into the cache at the same time, thereby improving the cache bandwidth and reducing access latency.

[0084] Step 304 : according to whether the target data is stored in the target cache line, set a data ready bit in the address tag of the cache group where the target cache line is located.

[0085] The target cache line can be quickly located through the address tag of the cache group where the target cache line is located. Compared with setting the data ready bit in the address tag of the target cache line, setting the data ready bit in the address tag of the cache group where the target cache line is located here can reduce storage overhead or area overhead.

[0086] For example, in order to set the data-ready bit in the address tag of the target cache line, the address tag of each target cache line adds 1 data-ready bit, and the storage overhead of the cache increases significantly. For example, a cache with a data storage array size of 2MB (megabytes) and a cache line size of 64B (bytes), there are a total of 32768 cache lines. If each cache line adds 1 data-ready bit, a total of 4KB (kilobytes) of additional storage overhead is added. Here, by compressing to 1 cache group corresponding to 1 data-ready bit, if the data-ready bit is not 1, it means that the target data corresponding to the memory access request in the current cache group has not been written into the target cache, which can significantly reduce the storage overhead of the cache.

[0087] Step 305: Receive a second memory access request; the second memory access request includes: the target memory access address.

[0088] Step 306: In the process of performing address tag matching on the target memory access address of the second memory access request, obtain the data ready bit from the target address tag.

[0089] Corresponding to the aforementioned step 304, here the data ready bit is obtained from the address tag of the cache group where the target cache line is located.

[0090] Step 307: When the data ready bit is invalid, determine the first memory access request as an uncompleted memory access request with the same address as the second memory access request.

[0091] Steps 305 to 307 may refer to the relevant records of the aforementioned steps 104 to 106 respectively, and can achieve the same or similar beneficial effects, which will not be described again here to avoid repetition.

[0092] Step 308: When the data ready bit is invalid, after waiting for the first memory access request to be completed, return the data corresponding to the second memory access request based on the target cache line.

[0093] Step 309: When the data ready bit is valid, return data corresponding to the second memory access request based on the target cache line.

[0094] Steps 308 to 309 may refer to the relevant records of the aforementioned steps 207 to 208 respectively, and can achieve the same or similar beneficial effects, which will not be described again here to avoid repetition.

[0095] The present application is further explained below in conjunction with specific embodiments.

[0096] Assume that there is a cache with a data storage size of 2MB, a 4-way set associative mapping structure, a cache line size of 64B, and the size of cache read data is the size of a cache line. A data ready bit is added to the address tag corresponding to each cache line.

[0097] When the cache performs address tag matching according to the target address of the second memory access request, such as address A, the data ready bit in the target address tag a of the corresponding target cache line is checked. If the cache valid bit in the target address tag a is 1, it means that the target cache line has been allocated, and the data ready bit is 1, indicating that the target data corresponding to the target address has been stored in the target cache line. At this time, the cache data block can be read, written, kicked out, and other operations can be performed normally. If the cache valid bit in the target address tag a is 1, it means that the target cache line has been allocated, but the data ready bit is not 1, indicating that the target data corresponding to the target address is not stored in the target cache line, indirectly indicating that the previous request with the same address, that is, the first memory access request, has not been completed. At this time, it is necessary to wait for the previous request with the same address, the first memory access request, to complete before processing the current memory access request with the same address, that is, the first memory access request.

[0098] In the present application, the search and confirmation of the unfinished memory access request with the same address can be completed only by setting the aforementioned data ready bit, and there is no need for the MSHR to search for the unfinished memory access request with the same address, thereby reducing or even eliminating the contradiction between the time overhead introduced by the search for the unfinished memory access request with the same address performed by the MSHR and the cache hit rate. That is, the search for whether there is an unfinished memory access request with the same address can be completed only by the aforementioned data ready bit, without searching all the items in the MSHR, which can reduce or even eliminate the time overhead of searching for the unfinished memory access request with the same address in the MSHR. Therefore, even if the number of items in the MSHR is set to be larger, it basically has no effect on the time overhead here, so that the expansion of the MSHR to a larger number of items can be supported. In addition, the more items the MSHR has, the more the number of unfinished memory access requests that can be supported will also increase, so that the cache can accommodate more unfinished memory access requests when working, further improving the cache performance.

[0099] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0100] Reference Figure 5 , Figure 5 The structural block diagram of an embodiment of a memory access request processing device of the present invention is shown, and the memory access request processing device can be applied to the above-mentioned direct-mapped cache system, fully-associatively mapped cache system or set-associatively mapped cache system. Here, the direct-mapped cache system, fully-associatively mapped cache system and set-associatively mapped cache system can refer to the above-mentioned related records, and will not be repeated in order to avoid repetition. The memory access request processing device may include:

[0101] The first receiving module 401 is used to receive a first memory access request; the first memory access request includes: a target memory access address;

[0102] An allocation module 402, configured to request target data corresponding to the first memory access request from a memory and allocate a target cache line for the target data if the first memory access request does not hit the cache;

[0103] A setting module 403, configured to set a data ready bit in a target address tag corresponding to the target cache line according to whether the target data is stored in the target cache line;

[0104] The second receiving module 404 is configured to receive a second memory access request; the second memory access request includes: the target memory access address;

[0105] An acquisition module 405, configured to acquire the data ready bit from the target address tag during address tag matching of the target memory access address of the second memory access request;

[0106] The determination module 406 is configured to determine, when the data ready bit is invalid, the first memory access request as an incomplete memory access request with the same address as the second memory access request.

[0107] Optionally, the setting module 403 includes: a first setting submodule, configured to set a data ready bit in the address tag of the target cache line.

[0108] Optionally, the memory access request processing device further includes: a grouping module, configured to group cache lines in the buffer system to obtain at least one cache group;

[0109] The setting module 403 includes: a second setting submodule, configured to set a data ready bit in the address tag of the cache group where the target cache line is located.

[0110] Optionally, the number of entries of the miss status holding register in the cache system is greater than 16 entries.

[0111] Optionally, the number of bits of the data ready bit is 1.

[0112] Optionally, the memory access request processing device further includes:

[0113] A first returning module, configured to return data corresponding to the second memory access request based on the target cache line after the first memory access request is completed when the data ready bit is invalid;

[0114] The second returning module is configured to return data corresponding to the second memory access request based on the target cache line when the data ready bit is valid.

[0115] Optionally, the memory access request processing device may further include: a waiting item setting module, configured to set a waiting item in the target address tag;

[0116] a target number allocation module, configured to store the second memory access request in a memory access request queue, and allocate a target number of a storage position in the memory access request queue to the second memory access request;

[0117] a target number writing module, used for writing the target number into the blank waiting item when the data ready bit is invalid and there is a blank waiting item in the waiting items;

[0118] The setting module 403 includes: a third setting submodule, configured to receive target data returned by the memory, store the target data into the target cache line, and set a data ready bit in a target address tag corresponding to the target cache line to be valid;

[0119] The second return module comprises:

[0120] A target number reading submodule, used for reading the target number from the waiting item of the target address tag when the data ready bit in the target address tag is valid;

[0121] The wake-up submodule is used to wake up the second memory access request corresponding to the target number in the memory access request queue and re-match the address tag.

[0122] Figure 6 is a structural diagram of an electronic device provided by an embodiment of the present invention. Figure 6 The present invention also provides an electronic device, see Figure 6 , including: a processor 501, a memory 502, and a computer program 5021 stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned data interaction embodiments when executing the program.

[0123] The present invention also provides a readable storage medium, when the instructions or transactions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the steps of each embodiment of the processing method for the above-mentioned memory access request. A transaction mentioned in the present invention performs an operation, which can be reading from the memory or writing to the memory.

[0124] The present invention also provides a computer program product, including instructions or transactions, which, when executed by a processor in an electronic device, enable the electronic device to execute any one of the aforementioned methods for processing memory access requests.

[0125] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0126] It should be noted that, for the method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described order of actions, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.

[0127] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0128] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0129] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a predictable manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0130] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1The steps for the functions specified in one or more boxes.

[0131] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0132] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0133] The above is a detailed introduction to a method and device for processing a memory access request, an electronic device and a storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for a person skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for processing a memory access request, It is characterized in that The method comprises: Receive a first memory access request; the first memory access request includes: a target memory access address; In the case where the first memory access request cache misses, requesting target data corresponding to the first memory access request from the memory, and allocating a target cache line for the target data; According to whether the target data is stored in the target cache line, setting a data ready bit in the target address tag corresponding to the target cache line; receiving a second memory access request; the second memory access request comprising: the target memory access address; In a process of performing address tag matching on the target memory access address of the second memory access request, acquiring the data ready bit from the target address tag; In a case where the data ready bit is invalid, determining the first memory access request as an uncompleted memory access request with the same address as the second memory access request; Setting a waiting item in the target address tag; storing the second memory access request in a memory access request queue, and assigning a target number of a storage position in the memory access request queue to the second memory access request; When the data ready bit is invalid and there is a blank waiting item in the waiting items, writing the target number into the blank waiting item; When the data ready bit in the target address tag is valid, reading the target number from the waiting item of the target address tag; A second memory access request corresponding to the target number in the memory access request queue is awakened, and address tag matching is performed again.

2. The method for processing a memory access request according to claim 1, It is characterized in that The step of setting a data ready bit in a target address tag corresponding to the target cache line includes: A data ready bit is set in the address tag of the target cache line.

3. The method for processing a memory access request according to claim 1, It is characterized in that Before setting the data ready bit in the target address tag corresponding to the target cache line, the method further includes: Grouping cache lines in the buffer system to obtain at least one cache group; The step of setting a data ready bit in a target address tag corresponding to the target cache line includes: A data ready bit is set in the address tag of the cache group where the target cache line is located.

4. The method for processing a memory access request according to claim 1, It is characterized in that The number of entries of the miss status holding register in the cache system is greater than 16 entries.

5. The method for processing a memory access request according to any one of claims 1 to 4, It is characterized in that The number of bits of the data ready bit is 1.

6. The method for processing a memory access request according to any one of claims 1 to 4, It is characterized in that The method further comprises: When the data ready bit is invalid, after waiting for the first memory access request to be completed, data corresponding to the second memory access request is returned based on the target cache line.

7. The method for processing a memory access request according to claim 6, It is characterized in that The step of setting a data ready bit in a target address tag corresponding to the target cache line according to whether the target data is stored in the target cache line comprises: Receive the target data returned by the memory, store the target data into the target cache line, and set the data ready bit in the target address tag corresponding to the target cache line to be valid.

8. A memory access request processing device, It is characterized in that The device comprises: A first receiving module is configured to receive a first memory access request; the first memory access request includes: a target memory access address; an allocation module, configured to request target data corresponding to the first memory access request from a memory and allocate a target cache line for the target data if the first memory access request does not hit the cache; A setting module, configured to set a data ready bit in a target address tag corresponding to the target cache line according to whether the target data is stored in the target cache line; A second receiving module is used to receive a second memory access request; the second memory access request includes: the target memory access address; an acquisition module, configured to acquire the data ready bit from the target address tag during the process of performing address tag matching on the target memory access address of the second memory access request; a determination module, configured to determine, when the data ready bit is invalid, the first memory access request as an uncompleted memory access request with the same address as the second memory access request; A waiting item setting module, used for setting a waiting item in the target address tag; a target number allocation module, configured to store the second memory access request in a memory access request queue, and allocate a target number of a storage position in the memory access request queue to the second memory access request; a target number writing module, used for writing the target number into the blank waiting item when the data ready bit is invalid and there is a blank waiting item in the waiting items; A target number reading submodule, used for reading the target number from the waiting item of the target address tag when the data ready bit in the target address tag is valid; The wake-up submodule is used to wake up the second memory access request corresponding to the target number in the memory access request queue and re-match the address tag.

9. An electronic device, It is characterized in that include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for processing a memory access request as claimed in any one of claims 1 to 7 is implemented.

10. A readable storage medium, It is characterized in that When the instructions or transactions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method for processing a memory access request according to any one of claims 1 to 7.

11. A computer program product, comprising instructions or transactions, which, when executed by a processor in an electronic device, enable the electronic device to execute the method for processing a memory access request according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Methods and apparatus for adjusting resources in cache, and for accessing data.

    CN111602377B

  • Cache processing method and device, electronic equipment and medium

    CN117331853A

  • Caching method, cache, electronic equipment and readable storage medium

    CN117609110A

  • Reducing tag-ram accesses and accelerating cache operation during cache miss

    US20040024967A1

  • Cache supporting SIMT architecture and corresponding processor

    WO2024045586A1