Data reading method, device, processor and electronic device

By receiving and storing data requests that the processor does not need in the cache, the problems of data errors and low time utilization in high-performance computing are solved, and more efficient data reading and cache utilization are achieved.

CN114063923BActive Publication Date: 2024-11-22HYGON INFORMATION TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202111361589.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-17
Publication Date
2024-11-22
Estimated Expiration
2041-11-17

AI Technical Summary

Technical Problem

In high-performance computing, existing technologies cannot effectively avoid data errors while improving time utilization, resulting in wasted time and computational errors for the processor while waiting for data to return.

Method used

By receiving data requests that the processor does not currently need to process, it determines whether the current level cache is a specified level cache, and stops returning data when a hit occurs, storing it in the specified level cache in advance to avoid data errors and improve cache time utilization.

Benefits of technology

It improves data reading efficiency, avoids calculation errors, reduces cache network pressure, makes full use of cache time, and reduces unnecessary data returns and processor resource waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114063923B_ABST
    Figure CN114063923B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a data reading method, device, processor and electronic device, wherein the data reading method comprises: receiving a special request to read first data, wherein the first data requested by the special request is data that the processor does not need to process at present; when it is determined that the current level module receiving the special request is a storage designated level cache, and the first data hits in the current level cache, stopping returning the first data. The embodiment of the present application can improve the reading efficiency on the basis of avoiding calculation errors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computers, and specifically to a data reading method, device, processor, and electronic device. Background Art

[0002] In a typical computer structure, it usually includes a processor and multi-level memory. In the multi-level memory, the internal memory stores instructions and data. The processor obtains instructions and corresponding data from the internal memory, executes the instructions, and writes the result data back to the internal memory. In addition, there is usually one or more levels of cache memory between the processor and the internal memory. The cache memory is used to reduce the time for the processor to read instructions and data. When the memory needs to read data at a certain address in the internal memory, it first checks whether the data exists in the cache. If the cache contains the data, the processor reads the data directly from the cache, and reading data from the cache is much faster than reading data from the internal memory. Otherwise, the cache reads the data from the internal memory, stores it in the cache, and returns it to the internal memory.

[0003] High-performance computing usually has a clear processing order. The first request received is processed first, and after the data is returned, the later request is processed. If the data acquisition time of the first request received is long, it will cause a waste of time and reduce time utilization. If the later received requests are processed at the same time within the time interval, it will cause confusion in the data received by the computing module, resulting in computing errors.

[0004] Therefore, how to improve time utilization while avoiding data errors has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] In view of this, embodiments of the present application provide a data processing method, device, cache, processor, and electronic device to improve time utilization while avoiding data errors.

[0006] To achieve the above objectives, the embodiments of the present application provide the following technical solutions.

[0007] In a first aspect, an embodiment of the present application provides a data reading method, which is applied to a cache, comprising:

[0008] A special request for reading first data is received, where the first data requested by the special request is data that the processor does not need to process currently.

[0009] When it is determined that the current level module receiving the special request is a storage designated level cache and the first data hits in the current level cache, the first data is stopped from being returned.

[0010] In a second aspect, an embodiment of the present application provides a data reading method, applicable to a processor, comprising:

[0011] When it is determined that a predetermined condition for sending a special request is met, a special request for reading first data is sent to the first-level cache, where the first data is data that the processor does not need to process currently.

[0012] Stop receiving the first data.

[0013] In a third aspect, an embodiment of the present application provides a data reading device, applied to a cache, comprising: a data acquisition request receiving module, adapted to receive a special request to read first data, wherein the first data requested by the special request is data that a processor does not currently need to process;

[0014] The data acquisition response module is adapted to stop returning the first data when it is determined that the current level cache receiving the special request is a storage designated level cache and the first data hits in the current level cache.

[0015] In a fourth aspect, an embodiment of the present application provides a data reading device, applicable to a processor, comprising: a data acquisition request sending module, adapted to send a special request to a first-level cache to read first data when determining that a predetermined condition for sending a special request is met, wherein the first data is data that the processor does not currently need to process;

[0016] The data acquisition response receiving module is adapted to stop receiving the first data.

[0017] In a fifth aspect, an embodiment of the present application provides a processor, which executes computer-executable instructions to implement the data reading method as described in any one of the first aspect or the second aspect above.

[0018] In a sixth aspect, an embodiment of the present application provides an electronic device, comprising the processor as described in the fifth aspect above.

[0019] In the data reading method provided by the embodiment of the present application, the request received by the current level cache includes a special request, and the data requested by the special request is the first data that does not need to be processed currently. If the current level cache is a storage-specified level cache, it is further determined whether the requested first data hits in the current level cache. If it hits, the first data is not returned.

[0020] It can be seen that the data reading method provided in the embodiment of the present application can store the first data that does not need to be processed currently in the storage specified level cache in advance. When the first data needs to be processed later, it can be directly obtained from the storage specified level cache, thereby improving the overall reading efficiency; and, since the storage location of the first data is currently determined in advance, it can be executed when the current level cache is idle, thereby making full use of the time of the current level cache and improving the time utilization of the current level cache; further, the first data stored in the storage specified level cache in advance will not be returned to the processor, thereby avoiding the calculation errors caused by the processor receiving the data that does not need to be processed currently and using it as the data that needs to be processed currently; at the same time, since there is no need to return the first data from the storage specified level cache to the processor level by level, it is also possible to avoid the application for cache network authorization, thereby reducing the pressure on the cache network caused by improving the time utilization of the current level cache. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 A schematic diagram of a system structure of a cache technology;

[0022] Figure 2 A schematic diagram of the cache time situation at each level;

[0023] Figure 3 is another schematic diagram of the cache time situation at each level;

[0024] Figure 4 A flowchart of a data reading method provided in an embodiment of the present application;

[0025] Figure 5 A flowchart of reading first data of the data reading method provided in an embodiment of the present application;

[0026] Figure 6 A flowchart of a data reading method provided in an embodiment of the present application;

[0027] Figure 7 A flowchart of a data reading method provided in an embodiment of the present application;

[0028] Figure 8 A structural block diagram of a data reading device provided in an embodiment of the present application;

[0029] Fig. 9 This is a structural block diagram of a data reading device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0031] Figure 1 Figure 2 shows a schematic diagram of the system structure of the cache technology. Figure 1 As shown, the cache technology mainly includes a processor 100 , a multi-level cache and a memory 130 .

[0032] Figure 1 In the embodiment, the processor 100 may be a central processing unit, a graphics processor or a general-purpose graphics processor. All processors described in the embodiments of the present application refer to processors in a functional sense, that is, a computing and control core with logical computing and control functions, rather than a packaging box including a cache as seen from the product packaging. The processor described in the embodiments of the present application may correspond to the physical core of a processor described in some literature.

[0033] There are multiple levels of cache, the first-level cache 110 has the smallest storage capacity, the second-level cache 120 is larger than the first level, and so on. In the first-level cache 110 with extremely small storage capacity, it is sometimes divided into instruction cache and data cache. Only the data cache can store data, which further reduces the size of data that can be stored in the first-level cache. Generally, one processor 100 has one first-level cache 110, and multiple processors share one second-level cache 120. In some embodiments, one processor can also have one first-level cache 110 and one second-level cache 120, and multiple processors share one third-level cache, and so on. The processors 100 achieve data exchange with each other through shared cache. The cache has faster access speed than the memory block and larger storage capacity than the processor.

[0034] Memory 130, memory is a storage unit that stores all instructions and data, with large storage capacity but slow access speed.

[0035] The processor 100 is connected to the exclusive first-level cache 110, the first-level cache 110 is connected to the second-level cache 120, and finally connected to the memory 130. The exclusive first-level cache 110 generally has a small storage space and only stores the associated data currently processed by the corresponding processor. When there is no hit in the first-level cache 110, it will go to the second-level cache 120 to search. For example, in some embodiments, the second-level cache 120 serves multiple processors, but can only provide services to one processor at a time. Different processors access each other and access the memory through the second-level cache. In other embodiments, the second-level cache 120 is still exclusive to one processor, and the third-level cache is shared. The processor 100 avoids direct access to the memory 130 by accessing the cache, thereby avoiding the time waste caused by the huge speed difference and improving efficiency.

[0036] High performance computing usually has a clear processing order. Figure 1 The reading of two matrices A and B in the L2 cache structure shown is taken as an example for explanation.

[0037] In some high performance computing embodiments, it is assumed that the matrix A includes data a 0 、a 1 、a 2 ,........,a n , matrix B includes data b 0 、b 1 、b 2 ,......,b m , and matrix A is the matrix to be processed first, so when processing data, first process the data a in matrix A 0 、a 1 、a 2 ,........,a n After receiving the data returned based on the read request and processing the data, the data b in matrix B will be read. 0 、b 1 、b 2 ,......,b m to read.

[0038] However, during the data reading process, the first-level cache 110 first receives the data reading request. If the data is missing in the first-level cache 110, it is necessary to read from the second-level cache 120, so that the first-level cache 110 will be idle. If the data still does not hit in the second-level cache 120, it is necessary to read from the third-level cache or the memory 130, so not only will the first-level cache be idle, but the second-level cache 120 or the third-level cache will also be idle.

[0039] When each cache level is idle, the time utilization of the cache can be shown as follows: Figure 2 As shown, Figure 2 A schematic diagram of the cache time situation at each level.

[0040] As shown in the figure, for example: when a 1 When the first-level cache misses, the data needs to be obtained from the second-level cache and returned, so a 2 The time interval is longer, which results in lower time utilization.

[0041] In order to improve the time utilization of cache at each level, the reading of the data of matrix B can be interspersed in the process of reading and operating each data of matrix A, so that the time utilization of the cache presented can be as follows: Figure 3 As shown, Figure 3 Another schematic diagram of the cache time situation at each level.

[0042] In this way, when a 1 If the cache misses in the first-level cache, data a is obtained from the second-level cache. 1 At the same time, get data b from the first-level cache 0 , thereby shortening the idle time of the first-level cache and improving time utilization.

[0043] However, since all read requests need to return data after hitting, this operation method will make data b 0 Returning to the processor too early can easily cause the computing unit to obtain erroneous data. The wrong return order may lead to calculation errors or increase the complexity of the calculation process.

[0044] To this end, the data reading method provided in the embodiment of the present application can, after receiving a data reading request from the processor that does not need to be processed at the moment, not return the found data to the processor, but store it in a cache at a specified level of storage, thereby avoiding data errors while improving time utilization and reducing the increase in workload caused by improving time utilization.

[0045] Please refer to Figure 4 , Figure 4 A flow chart of a data reading method provided in an embodiment of the present application is shown, and the flow chart is applicable to storage modules of caches at all levels.

[0046] like Figure 4 As shown, the data reading method provided in the embodiment of the present application may include the following steps:

[0047] In step S210 , a special request for reading first data is received.

[0048] A special request is relative to an ordinary request, wherein an ordinary request refers to a request in which the requested data is data that the processor currently needs to process, and a special request refers to a request in which the first data requested is data that the processor currently does not need to process. Specifically, it can be identified by setting an identification bit in the data read request.

[0049] Specifically, the processor currently needs to process means that after sending a request, the processor needs to wait for returned data and then perform subsequent calculations and processing; the processor currently does not need to process means that after sending a request, the processor does not need to wait for the return of data, nor does it need to perform subsequent calculations and processing.

[0050] It is easy to understand that the receiving of the special request for reading the first data described in this article does not mean that the caches at all levels only receive special requests, but means that in the data processing process, the data requests received by the caches at all levels include both ordinary requests and special requests, but at the current moment, what is received is a special request, and the subsequent steps are the specific processing methods after receiving the special request.

[0051] Of course, when a special request can be received and whether the received request is a special request or an ordinary request is not determined by the caches at all levels that receive the request, but by the processor that issues the request. However, the received special request is not necessarily issued directly by the processor. Specifically: when the current level cache that receives the special request is the first level cache, the special request is directly issued by the processor; when the current level cache that receives the special request is the second level cache, the special request is directly issued by the first level cache.

[0052] Furthermore, the first data is data that the processor does not need to process currently, which means that the data is not the data that the processor is waiting for. For example, the data that needs to be processed currently is one of the data in matrix A, and the first data is one of the data in matrix B; or the data that needs to be processed currently is a of matrix A. 1 data, and the first data is in the processing order a 1 The data behind the data a n , of course, when the processing order is in a 1 The data behind the data a n In order to avoid receiving a n , and in the process of processing it, it receives a n Ordinary requests, resulting in a waste of processing resources, can be selected with a 1 Data has a certain interval.

[0053] In step S220, it is determined whether the current level cache receiving the special request is a storage designated level cache, if so, step S230 is executed, if not, step S260 is executed.

[0054] After receiving the special request, firstly, the similarities and differences between the current level cache receiving the special request and the storage designated level cache are determined according to the storage designated level cache information carried in the special request.

[0055] It is easy to understand that the storage designated level cache refers to a module used to store the first data, which can be any level of the first level cache, the second level cache or the third level cache. After the first data is stored in the storage designated level cache, the first data can be quickly returned to the processor after receiving a normal request to obtain the first data, thereby improving data processing efficiency.

[0056] Since the storage space of the first-level cache is small, and the first-level cache with a small storage space is sometimes divided into an instruction cache and a data cache, only the data cache can store data, which will cause the storage space of the data that can be stored in the first-level cache to be further reduced. If the first data that the processor does not currently need to process is stored in the first-level cache, on the one hand, it is very likely to replace the data that the processor currently needs to process, affecting data processing. At the same time, it is also very likely to be replaced when processing subsequent data. Although the third-level cache has a larger space, when a normal request to obtain the first data is received, it is still necessary to read the data from the third-level cache, affecting the data reading efficiency. Therefore, in a specific implementation, the storage specified level cache can be a second-level cache.

[0057] Of course, if it is a multi-core processor, in order to facilitate each processor core to obtain the first data in a timely manner, the storage designated level cache can be a high-speed cache shared by multiple processor cores.

[0058] After the current level cache receives the special request, it first determines whether the current level cache is storing the designated level cache. If so, step S230 is executed; otherwise, step S260 is executed.

[0059] It is easy to understand that when the current level cache is not the storage specified level cache, the current level cache should be a module located between the storage specified level cache and the processor, that is, the previous level cache of the storage specified level cache. This is because if the current level cache is a module located after the storage specified level cache, then when the current level cache is the storage specified level cache, step S230 is executed, and the judgment result will no longer be negative.

[0060] In step S230, it is determined whether the first data hits in the current level cache, if so, step S240 is executed, if not, step S250 is executed.

[0061] When the current level cache is a storage designated level cache, it is further determined whether the first data hits in the current level cache. If it hits, the storage location of the first data has met the requirements, and step S240 is executed. If it does not hit, the storage location of the first data has not met the requirements, and step S250 needs to be executed.

[0062] It is easy to understand that the hit described in this article means that the requested data is found in the current level cache.

[0063] In step S240, stop returning the first data.

[0064] It is easy to understand that the stopping of returning the first data described in this article means that when it is determined that the first data hits the current level cache, the execution of the special request has been completed and no further processing is required.

[0065] In addition, the solution provided by the present application not only does not return the first data, but in order to avoid occupying the return bandwidth, when it is determined that the first data hits the current level cache, it does not return the first data acquisition response, that is, the processor only issues a special request to read the first data of the specified level, but does not need to know whether the request is completed and how the completion is. When the first data needs to be read to the processor, a normal request to read the first data can be issued.

[0066] Of course, in other embodiments, a response for obtaining the first data may also be returned.

[0067] In this way, the data reading method provided in the embodiment of the present application can ensure in advance that the first data that does not need to be processed at present is stored in the storage specified level cache. When the first data needs to be processed later, it can be directly obtained from the storage specified level cache, thereby improving the overall reading efficiency; and, since the storage location of the first data is currently determined in advance, it can be executed when the current level cache is idle, thereby making full use of the time of the current level cache and improving the time utilization of the current level cache; further, the first data stored in advance to the storage specified level cache will not be returned to the processor, thereby avoiding the calculation errors caused by the processor receiving the data that does not need to be processed at present and using it as the data that needs to be processed at present; at the same time, since there is no need to return the first data from the storage specified level cache to the processor step by step, the application for cache network authorization can be avoided, thereby reducing the pressure on the cache network caused by improving the time utilization of the current level cache.

[0068] In step S250, the first data is read from a next-level cache of the current-level cache.

[0069] When the first data does not hit in the current level cache, the first data is further read from the next level cache of the current level cache until the first data hits in the current level cache.

[0070] For the specific steps of reading the first data from the next level cache of the current level cache, please refer to Figure 5 , Figure 5 A flowchart of reading first data of the data reading method provided in an embodiment of the present application.

[0071] As shown in the figure, when the first data does not hit in the current level cache, the current level cache and the next level cache perform the following operations:

[0072] Step S2500: Send a data request for obtaining first data to the next level cache.

[0073] When the first data does not hit in the current level cache, a data request is first sent to the next level cache to obtain the first data from the next level cache.

[0074] Step S2501, determine whether the first data hits in the next-level cache, if yes, execute step S2502, if not, execute step S2503.

[0075] Step S2502, reading the first data from the next level cache.

[0076] If the first data hits in the next-level cache, the next-level cache returns the first data to the current-level cache, that is, the current-level cache reads the first data from the next-level cache.

[0077] Step S2503: Send a data request for acquiring the first data through the next-level cache.

[0078] If the first data still does not hit in the next-level cache, a data request for acquiring the first data is sent through the next-level cache, specifically, the data request is sent to the next-level cache of the next-level cache or the memory.

[0079] In this way, no matter which level the current level cache is, the first data can be finally acquired through the above method and returned to the current level cache.

[0080] Of course, when the current level cache obtains the first data, step S240 is still executed.

[0081] In this way, the data reading method provided in the embodiment of the present application can store the first data that does not need to be processed currently in the storage specified level cache in advance when the first data hits in the current level cache. When the first data needs to be processed subsequently, it can be directly obtained from the storage specified level cache, thereby further improving the reading efficiency as a whole.

[0082] In step S260, the special request is directly sent to the next level cache, and the next level cache receiving the special request is used as the new current level cache, and the process turns to step S220.

[0083] When the current level cache is not the storage designated level cache, in order to save processing flow, no hit or miss operation is performed in the current level cache, and a special request for the first data is directly sent to the next level cache.

[0084] The next level cache receiving the special request is used as a new current level cache, and step S220 is further performed until the current level cache is the storage designated level cache.

[0085] It can be seen that the technical solution provided in the embodiment of the present application does not judge whether the first data hits in the caches at each level between the processor and the specified level cache of the storage, but directly sends a special request, thereby reducing the complexity of the process and the amount of calculation, thereby further improving the data processing efficiency.

[0086] Of course, in another embodiment, each level of cache between the processor and the storage designated level cache may also perform a check on whether the first data hits. For details, please refer to Figure 6 , Figure 6 Another schematic flow chart of the data reading method provided in an embodiment of the present application is shown.

[0087] like Figure 6 As shown, the data reading method provided in the embodiment of the present application may also include:

[0088] In step S310 , a special request for reading first data is received.

[0089] In step S320, it is determined whether the current level cache receiving the special request is a storage designated level cache, if so, step S330 is executed, if not, step S360 is executed.

[0090] Based on the above discussion, it can be known that if the current level cache is not the storage specified level cache, then it should be the previous level cache of the current specified level cache, that is, when the current level cache receiving the special request is the previous level cache of the storage specified level cache, execute step S360, and when the current level cache receiving the special request is the storage specified level cache, execute step S330.

[0091] In step S330, it is determined whether the first data hits in the current level cache, if so, step S340 is executed, if not, step S350 is executed.

[0092] In step S340, stop returning the first data.

[0093] In step S350, the first data is read from a next-level cache of the current-level cache.

[0094] The specific contents of steps S310 to S350 can be found in Figure 4 The description of steps S210 to S250 shown are not repeated here.

[0095] In step S360, it is determined whether the first data hits in the current level cache, if yes, step S340 is executed, if not, step S370 is executed.

[0096] That is, when the current level cache is a previous level cache storing the designated level cache, a check is still performed on whether the first data hits the current level cache.

[0097] If there is a hit, then step S340 is directly executed, that is, the special request to read the first data is completed, and no other processing is required. This is because the data stored in the previous-level cache will be stored in the next-level cache. If the first data in the previous-level cache hits, then the storage designated-level cache located after the previous-level cache will definitely hit. Therefore, there is no need to further send subsequent data requests and judge whether it is a hit or not, and step S340 can be directly executed.

[0098] If there is no hit, then step S370 needs to be executed, that is, a data request for obtaining the first data is sent to the next level cache.

[0099] In step S370, a request for obtaining the first data is sent to the next level cache.

[0100] In step S380, the next level cache that receives the special request is used as a new current level cache, and step S320 is executed.

[0101] For details of step S370 and step S380, please refer to Figure 4 The description of step S260 and step S270 shown in the figure will not be repeated here.

[0102] It can be seen that the data reading method provided in the embodiment of the present application also determines whether the data is hit when the current level cache is the previous level cache that stores the specified level cache. If it is hit, the subsequent process is directly stopped, and only when it does not hit, a special request is sent, thereby avoiding further transmission of some special requests and simplifying the process.

[0103] It is easy to understand that in addition to the cache receiving and executing the special request to read the first data in order to improve the data reading efficiency and the time utilization of cache modules at all levels, the processor also needs to send special requests at appropriate times. For this purpose, an embodiment of the present invention also provides a data reading method suitable for the processor.

[0104] Please refer to Figure 7 , Figure 7 A flow chart of a data reading method provided in an embodiment of the present application is shown.

[0105] like Figure 7 As shown, the data reading method provided in the embodiment of the present application includes:

[0106] In step S400, it is determined whether a predetermined condition for sending a special request is met, if yes, step S410 is executed, if not, step S430 is executed.

[0107] It is easy to understand that the processor will continue to send data read requests during operation, and the data processing requests include not only special requests but also ordinary requests, wherein the specific concepts of special requests and ordinary requests are described in the foregoing content of this article. Therefore, the judgment of whether the predetermined conditions for sending a special request are met in the embodiment of the present application is likely to have been sent before the ordinary request for data reading is sent, and the judgment is made in the gap between sending the previous data read request and sending the next data read request.

[0108] For the convenience of description, the second data is used to represent the data requested by the previous data read request, that is, the second data is the data that the processor currently needs to process before the special request is sent; the third data is used to represent the data requested by the subsequent data read request, that is, the third data is the data that the processor currently needs to process after the special request is sent.

[0109] Specifically, the predetermined condition may include that the second data is not received within a first predetermined time, or that an interval between issuing a common request to read the third data satisfies a second predetermined time.

[0110] The following is a description of each reservation condition:

[0111] 1) If the second data is not received within the first scheduled time, and no response is returned as to whether the second data is hit, the timing can be started from sending a normal request to obtain the second data. When the first scheduled time is met and the data is not received, it means that the second data needs to be found in a lower level cache, so a special request can be sent to improve the time utilization of the corresponding level cache. Of course, the first scheduled time can be determined as needed.

[0112] 2) It is necessary to determine the third data to be read by the next ordinary request. After the processor receives the second data, it needs to perform calculations to determine whether the next data request is to obtain data C or D. Therefore, there will be a determination time. At this time, all levels of cache are in a waiting state, so that special requests can be sent to improve the time utilization of the corresponding level of cache.

[0113] Therefore, various situations that reduce the time utilization of caches at all levels can be fully utilized to improve the time utilization of the cache and the data reading efficiency.

[0114] Specifically, in one embodiment, the second data and the third data may both be data of the second matrix, and the first data may be data of the first matrix, thereby avoiding the situation where the time when the data requested by the special request and the data requested by the ordinary request should be processed in the processor is too close.

[0115] In step S410, a special request for reading first data is sent to the first-level cache.

[0116] If the predetermined condition for sending the special request is met, the processor sends a special request to read the first data to the first-level cache, and after receiving the special request, the cache executes a data reading method suitable for the cache.

[0117] In step S420, the reception of the first data is stopped.

[0118] It is easy to understand that the stopping of receiving the first data mentioned in this article means that after issuing a special request, for the processor, the execution of the request has been completed and no subsequent processing is required. It may mean continuing to send other requests. For the purpose of emphasis, this article specifically clarifies the stopping of receiving the first data. In fact, the processor does not perform any operation.

[0119] In step S430, the second data is received or a common request for reading the third data is sent to the first-level cache.

[0120] If the predetermined condition for sending the special request is not met, then the processing of the ordinary request may continue, such as receiving the second data or sending an ordinary request to read the third data to the first-level cache.

[0121] It can be seen that the data reading method provided in the embodiment of the present application can request the first data that does not need to be processed currently in advance, and store the first data in the storage specified level cache. When the first data needs to be processed subsequently, it can be directly obtained from the storage specified level cache, thereby improving the reading efficiency as a whole; and it is executed when the current level cache is idle, thereby making full use of the time of the current level cache and improving the time utilization of the current level cache; further, the processor does not receive the first data, thereby avoiding the calculation errors caused by the processor receiving the data that does not need to be processed currently and using it as the data that needs to be processed currently, and also avoiding the application for cache network authorization, thereby reducing the pressure on the cache network caused by improving the time utilization of the current level cache.

[0122] The above describes multiple implementation schemes provided by the embodiments of the present application. The various optional methods introduced in each implementation scheme can be combined and cross-referenced with each other without conflict, thereby extending a variety of possible implementation schemes, which can all be considered as implementation schemes disclosed and open in the embodiments of the present application.

[0123] The present application also provides a data reading device, which can be considered as a cache or a functional module of a processor required to implement the data processing method provided in the present application. The device content described below can be referenced to the method content described above.

[0124] As an optional implementation, Figure 8 A structural block diagram of a data reading device provided in an embodiment of the present application is shown.

[0125] like Figure 8 As shown, the data reading device 600 is suitable for use in a cache memory and may include:

[0126] The data acquisition request accepting module 610 is adapted to receive a special request for reading first data, where the first data requested by the special request is data that the processor does not need to process currently.

[0127] The data acquisition response module 620 is adapted to stop returning the first data when it is determined that the current level cache receiving the special request is a storage designated level cache and the first data hits in the current level cache.

[0128] Based on the description of the data reading method, it can be known that when the request processed by the current level module is a common request, the data acquisition response module 620 needs to return the corresponding data.

[0129] In some embodiments, the data reading device 600 provided in the embodiment of the present application further includes:

[0130] The data acquisition module 630 is adapted to read the first data from a next-level cache of the current-level cache when it is determined that the current-level cache is a storage-specified-level cache and the first data is missing in the current-level cache.

[0131] In some embodiments, the data acquisition module 630 includes:

[0132] A data acquisition request sending module 631, adapted to send an acquisition request for the first data to the next level cache;

[0133] The data reading module 632 is adapted to read the first data from the next level cache when it is determined that the first data hits the next level cache.

[0134] In some embodiments, the data reading module 632 is further adapted to send a data request for acquiring the first data through the next level cache when it is determined that the first data is missing in the next level cache.

[0135] In some embodiments, the data acquisition module 632 is also suitable for sending the special request directly to the next level cache when it is determined that the current level cache is the previous level cache of the storage specified level cache, and using the next level cache that receives the special request as the new current level cache until the storage specified level cache receives the special request.

[0136] In some embodiments, the data acquisition response module 632 is further adapted to stop returning the first data when it is determined that the current level cache is a previous level cache of the specified level cache and the first data hits in the current level cache.

[0137] In some further embodiments, the device may further include one or more functional modules, or Figure 8 The functions are increased based on one or more functional modules shown, and also include:

[0138] The data acquisition request sending module 631 is suitable for sending a special request for the first data to the next level cache when it is determined that the current level cache is the previous level cache of the specified level cache and the first data is missing in the current level cache, and the next level cache that receives the special request is used as the new current level cache.

[0139] The data reading device provided in the embodiment of the present application can ensure in advance that the first data that does not need to be processed at present is stored in the storage specified level cache. When the first data needs to be processed later, it can be directly obtained from the storage specified level cache, thereby improving the overall reading efficiency; and, since the storage location of the first data is currently determined in advance, it can be executed when the current level cache is idle, thereby making full use of the time of the current level cache and improving the time utilization rate of the current level cache; further, the first data stored in advance to the storage specified level cache will not be returned to the processor, thereby avoiding the calculation errors caused by the processor receiving the data that does not need to be processed at present and using it as the data that needs to be processed at present; at the same time, since there is no need to return the first data from the storage specified level cache to the processor level by level, it is also possible to avoid the application for cache network authorization, thereby reducing the pressure on the cache network caused by improving the time utilization rate of the current level cache.

[0140] Fig. 9 A structural block diagram of a data reading device provided in an embodiment of the present application is shown. Fig. 9 The data reading device shown is suitable for use in a processor. Fig. 9 As shown, the data reading device 700 may include:

[0141] The data acquisition request sending module 710 is adapted to send a special request to the first-level cache to read first data when it is determined that a predetermined condition for sending a special request is met, wherein the first data is data that the processor does not need to process currently;

[0142] The data acquisition response receiving module 720 is adapted to stop receiving the first data.

[0143] In some embodiments, the predetermined condition may include that the second data is not received within a first predetermined time, or that third data to be read by the next ordinary request needs to be determined, wherein the second data is data that the requested processor currently needs to process before the special request is sent, and the third data is data that the requested processor currently needs to process after the special request is sent.

[0144] In some embodiments, the second data and the third data are both data of a second matrix, and the first data are data of a first matrix.

[0145] The data reading device provided in the embodiment of the present application can request in advance the first data that does not need to be processed currently, and store the first data in a storage-specified level cache. When the first data needs to be processed subsequently, it can be directly obtained from the storage-specified level cache, thereby improving the reading efficiency as a whole; and it is executed when the current level cache is idle, thereby making full use of the time of the current level cache and improving the time utilization of the current level cache; further, the processor does not receive the first data, thereby avoiding the calculation errors caused by the processor receiving the data that does not need to be processed currently and using it as the data that needs to be processed currently, and avoiding the application for cache network authorization, thereby reducing the pressure on the cache network caused by improving the time utilization of the current level cache.

[0146] The embodiment of the present application also provides a processor, which executes computer executable instructions to implement the data reading method provided by the embodiment of the present application.

[0147] An embodiment of the present application also provides an electronic device, which may include the processor provided in the embodiment of the present application.

[0148] 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 subject to the scope defined by the claims.

Claims

1. A data reading method, It is characterized in that Applicable to cache memory, including: receiving a special request to read first data, where the first data requested by the special request is data that the processor does not need to process currently; When it is determined that the current level cache receiving the special request is a storage designated level cache and the first data hits in the current level cache, the first data is stopped from being returned.

2. The data reading method according to claim 1, It is characterized in that Also includes: When it is determined that the current level cache is a storage designated level cache and the first data is missing in the current level cache, the first data is read from a next level cache of the current level cache.

3. The data reading method according to claim 2, It is characterized in that The step of reading the first data from a next-level cache of the current-level cache includes: Sending a data request to the next level cache to obtain the first data; When it is determined that the first data hits the next-level cache, the first data is read from the next-level cache.

4. The data reading method according to claim 3, It is characterized in that The step of reading the first data from a next-level cache of the current-level cache further includes: When it is determined that the first data is missing in the next-level cache, a data request for acquiring the first data is sent through the next-level cache.

5. The data reading method according to claim 1, It is characterized in that Also includes: When it is determined that the current level cache is the previous level cache of the storage designated level cache, the special request is directly sent to the next level cache, and the next level cache that receives the special request is used as the new current level cache until the storage designated level cache receives the special request.

6. The data reading method according to claim 1, It is characterized in that Also includes: When it is determined that the current level cache is a previous level cache of the storage designated level cache, and the first data hits in the current level cache, the first data is stopped from being returned.

7. The data reading method according to claim 6, It is characterized in that Also includes: When it is determined that the current level cache is the previous level cache of the storage specified level cache and the first data is missing in the current level cache, a special request for the first data is sent to the next level cache, and the next level cache receiving the special request is used as the new current level cache.

8. The data reading method according to any one of claims 1 to 7, It is characterized in that The storage-specified level cache includes a level 2 cache.

9. A data reading method, It is characterized in that For processors including: When it is determined that a predetermined condition for sending a special request is met, a special request for reading first data is sent to the first-level cache, where the first data is data that the processor does not need to process currently, wherein the predetermined condition is a condition for meeting the sending of the special request; Stop receiving the first data.

10. The data reading method according to claim 9, It is characterized in that The predetermined condition includes that the second data is not received within the first predetermined time, or the third data to be read by the next ordinary request needs to be determined, wherein the ordinary request refers to a request that the requested data is data that the processor currently needs to process, the second data is data that the processor currently needs to process that is requested before the special request is sent, and the third data is data that the processor currently needs to process that is to be requested after the special request is sent.

11. The data reading method according to claim 10, It is characterized in that The second data and the third data are both data of the second matrix, and the first data are data of the first matrix.

12. A data reading device, It is characterized in that Applies to cache, including: A data acquisition request receiving module, adapted to receive a special request for reading first data, where the first data requested by the special request is data that the processor does not need to process currently; The data acquisition response module is adapted to stop returning the first data when it is determined that the current level cache receiving the special request is a storage designated level cache and the first data hits in the current level cache.

13. The data reading device according to claim 12, It is characterized in that Also includes: The data acquisition module is adapted to read the first data from a next-level cache of the current-level cache when it is determined that the current-level cache is a storage-specified-level cache and the first data is missing in the current-level cache.

14. The data reading device according to claim 13, It is characterized in that The data acquisition module comprises: The data acquisition request sending module is adapted to send an acquisition request for the first data to the next level cache; the data reading module is adapted to read the first data from the next level cache when it is determined that the first data hits the next level cache.

15. The data reading device according to claim 14, It is characterized in that The data reading module is further adapted to send a data request for acquiring the first data through the next level cache when it is determined that the first data is missing in the next level cache.

16. The data reading device according to claim 13, It is characterized in that The data acquisition module is also suitable for directly sending the special request to the next level cache when determining that the current level cache is the previous level cache of the storage specified level cache, and using the next level cache that receives the special request as the new current level cache until the storage specified level cache receives the special request.

17. The data reading device according to claim 12, Features: The data acquisition response module is further adapted to stop returning the first data when it is determined that the current level cache is a previous level cache of the designated level cache and the first data hits in the current level cache.

18. The data reading device according to claim 17, It is characterized in that Also includes: The data acquisition request sending module is suitable for sending a special request for the first data to the next level cache when it is determined that the current level cache is the previous level cache of the specified level cache and the first data is missing in the current level cache, and the next level cache that receives the special request is used as the new current level cache.

19. A data reading device, It is characterized in that For processors including: a data acquisition request sending module, adapted to send a special request to the first-level cache to read first data when it is determined that a predetermined condition for sending a special request is met, wherein the first data is data that the processor does not need to process currently, wherein the predetermined condition is a condition for meeting the sending of the special request; The data acquisition response receiving module is adapted to stop receiving the first data.

20. The data reading device according to claim 19, It is characterized in that The predetermined condition includes that the second data is not received within the first predetermined time, or the third data to be read by the next ordinary request needs to be determined, wherein the ordinary request refers to a request that the requested data is data that the processor currently needs to process, the second data is data that the processor currently needs to process before the special request is sent, and the third data is data that the processor currently needs to process after the special request is sent.

21. The data reading device according to claim 20, It is characterized in that The second data and the third data are both data of the second matrix, and the first data are data of the first matrix.

22. A processor, It is characterized in that The processor executes computer executable instructions to implement the data reading method according to any one of claims 1 to 11.

23. The processor of claim 22, It is characterized in that The processor includes a general purpose graphics processor.

24. An electronic device, It is characterized in that Comprising a processor as claimed in claim 22 or 23.

Citation Information

Patent Citations

  • Cache method and device for improving spatial locality of data in cache

    CN106126440A

  • A data processing method and apparatus

    CN109521957A

  • Data reading method, device and equipment and storage medium

    CN110764708A

  • Data reading method and data reading circuit

    CN112506567A

  • Data storage device and operating method thereof

    CN113342254A