A method for pre-fetching data and related equipment
Through the neural network model, the problem of low cache hit rate in the prior art is solved, and system performance and data access efficiency are improved.
Patent Information
- Application Number
- CN201910985051.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-16
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2039-10-16
AI Technical Summary
Existing data prefetching methods cannot effectively prefetch data to cache when access addresses are not sequential but strongly associated, resulting in low cache hit rate and affecting system performance.
Using neural network models, especially skip gram, recurrent neural network and convolutional neural network models, predict the data addresses to be accessed and prefetch them into the cache. Through training the model, learn the relationship between addresses and dynamic adjustments The number of prefetches addresses to improve cache hit rate.
It improves cache hit rate and processor performance, and is suitable for scenarios where access addresses are not sequential but strongly correlated, and enhances the system's data access efficiency.
Smart Images

Figure CN112667528B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and in particular to a data pre-fetching method and related equipment. Background Art
[0002] Memory is one of the core components of a computer, and its performance is directly related to the performance of the entire computer system. How to design a memory system with a capacity and speed that meets the requirements of the computer system has always been one of the key issues in computer architecture design. It is difficult to achieve this goal using only a single memory. The current solution to this problem is to use multiple memory technologies to form a multi-level storage hierarchy. Figure 1 As shown in the figure, it is a typical two-level storage model, including high-speed input / output (I / O) devices with small capacity but fast speed, such as static random access memory (SRAM), and low-speed I / O devices with large capacity but slow speed, such as hard disks. All data is stored on the low-speed I / O devices, and the high-speed I / O devices are used as a cache. When reading data, it always searches the high-speed I / O devices first to see if there is a copy of the data.
[0003] Cache is an important part of data processing devices (such as computers, mobile terminals, etc.). The function of cache is to temporarily store instructions and data in the central processing unit (CPU), and to exchange data with external storage devices such as hard disks, so that the CPU can achieve faster access, shorten access time, and improve system performance. Figure 1 The principle on which the cache is based is the local behavior of program execution and data access, that is, within a certain program execution time and space, the accessed code is concentrated in a part.
[0004] If the data accessed by the user can be found in the cache, it is called a cache hit; if it cannot be found, it is called a cache miss. In order to improve the cache hit rate, it not only depends on the local behavior of program execution and data access, but also requires the use of data prefetching technology, that is, taking the data to be used by the CPU from the hard disk into the cache in advance.
[0005] At present, the main method is to analyze the access address of the access request and determine whether the access address is continuous or equally spaced, and then perform sequential stream prefetching and interval stream prefetching. However, in most cases, there is no sequentiality but strong association between the access addresses, and the existing data prefetching method is no longer applicable. Therefore, how to prefetch the data that the CPU is about to access into the cache to improve the cache hit rate when the access addresses are not sequential but strongly associated is a problem that needs to be solved urgently. Summary of the invention
[0006] The embodiment of the present invention discloses a data pre-fetching method and related equipment, which can predict data to be accessed and pre-fetch the data into a cache in advance, thereby improving the cache hit rate.
[0007] In a first aspect, the present application provides a method for data prefetching, the method comprising: a processor receives a first read request; the processor inputs the address of the data read by the first read request into a neural network model, the neural network model outputs probability values of multiple addresses, the probability value of each address represents the probability that the data corresponding to each address is the data read by a second read request, and the second read request is the next read request of the first read request; the processor obtains N addresses from the output of the neural network model according to the probability value, so that the data corresponding to the N addresses are stored in a cache.
[0008] Optionally, the neural network model may be a skip gram model, a recurrent neural network model, or a convolutional neural network model.
[0009] In an embodiment of the present application, the processor inputs the received read request into a trained neural network model, uses the neural network model to predict the data that may be read by subsequent read requests, selects the address with a larger probability value output by the neural network model and stores its corresponding data in the cache, thereby avoiding reading data from the hard disk and improving the cache hit rate and processor performance.
[0010] In combination with the first aspect, in a possible implementation of the first aspect, the processor determines M addresses among the N addresses whose corresponding data are not in the cache, where M is a positive integer greater than or equal to 1; the processor stores the data corresponding to the M addresses in the cache.
[0011] In an embodiment of the present application, when the processor is storing data in the cache, it is necessary to first determine whether the data has been stored in the cache. Only if the data is not stored in the cache will it be stored in the cache. This can avoid data duplication, reduce waste of cache space, and improve cache utilization.
[0012] In combination with the first aspect, in a possible implementation of the first aspect, the neural network model includes a first neural network model and a second neural network model, wherein the first neural network model is used to train the address of write data, and the second neural network model is used to train the address of read data; the processor inputs the address of the data read by the first read request into the first neural network model and the second neural network model respectively; the processor obtains the first N1 addresses from the output of the first neural network model in order from large to small probability values, and obtains the first N2 addresses from the output of the second neural network model in order from large to small probability values, wherein the sum of N1 and N2 is equal to N.
[0013] In an embodiment of the present application, the first neural network model and the second neural network model are used to predict the first read request respectively, and N1 addresses and N2 addresses are selected from their respective outputs according to the size of the probability values and stored in the cache, which can further improve the cache hit rate and processor performance.
[0014] In combination with the first aspect, in a possible implementation of the first aspect, the processor obtains an address set for writing data, and the write time interval of two data with adjacent write times in the address set is less than a preset value; the processor trains the addresses in the address set through the first neural network model, so that after the first address in the address set is input into the first neural network model, the probability of at least one address after the first address in the probabilities of multiple addresses output by the first neural network model increases, and the first address is any address in the address set.
[0015] In an embodiment of the present application, the processor uses an address set of write data with adjacent write times as training samples and inputs them into the first neural network model for training, so that the first neural network model can learn the association between the addresses in the address set after training, and then after any address in the address set is input into the first neural network model, the probability of at least one address after the address is increased, thereby improving the accuracy of the prediction of the first neural network model.
[0016] In combination with the first aspect, in a possible implementation of the first aspect, the processor obtains an address set for reading data, wherein the reading time interval of two data with adjacent reading times in the address set is less than a preset value; the processor trains the addresses in the address set through the second neural network model, so that after the first address in the address set is input into the second neural network model, the probability of at least one address after the first address in the probabilities of multiple addresses output by the second neural network model increases, and the first address is any address in the address set.
[0017] In an embodiment of the present application, the processor uses an address set of read data with adjacent read times as a training sample and inputs it into the second neural network model for training, so that the second neural network model can learn the association between the addresses in the address set after training, and then after any address in the address set is input into the second neural network model, the probability of at least one address after the address is increased, thereby improving the accuracy of the second neural network model's prediction.
[0018] In combination with the first aspect, in a possible implementation of the first aspect, the processor counts the number A of addresses obtained from the output of the first neural network model that hit the cache within a preset time length, and the number B of addresses obtained from the output of the second neural network model that hit the cache; the processor adjusts the number N1 of addresses obtained from the output of the first neural network model and the number N2 of addresses obtained from the output of the second neural network model based on A and B.
[0019] In an embodiment of the present application, the number of addresses N1 obtained by the processor from the output of the first neural network model and the number of addresses N2 obtained from the output of the second neural network model are not always constant, but are dynamically adjusted according to the number of hits in the cache, thereby further improving the cache hit rate and processor performance.
[0020] In a second aspect, the present application provides a computing device, comprising: a receiving unit, for receiving a first read request; a prediction unit, for inputting the address of the data read by the first read request into a neural network model, the neural network model outputting probability values of multiple addresses, the probability value of each address representing the probability that the data corresponding to each address is the data read by a second read request, and the second read request is the next read request of the first read request; obtaining N addresses from the output of the neural network model according to the probability value, so that the data corresponding to the N addresses are stored in a cache.
[0021] In combination with the second aspect, in a possible implementation of the second aspect, the prediction unit is also used to: determine M addresses among the N addresses whose corresponding data are not in the cache, where M is a positive integer greater than or equal to 1; and store the data corresponding to the M addresses in the cache.
[0022] In combination with the second aspect, in a possible implementation of the second aspect, the neural network model includes a first neural network model and a second neural network model, wherein the first neural network model is used to train the address of write data, predict the address of the data read by the first read request, and output probability values of multiple addresses; the second neural network model is used to train the address of read data, predict the address of the data read by the first read request, and output probability values of multiple addresses; the prediction unit is also used to obtain the first N1 addresses from the output of the first neural network model in order from large to small probability values, and obtain the first N2 addresses from the output of the second neural network model in order from large to small probability values, wherein the sum of N1 and N2 is equal to N.
[0023] In combination with the second aspect, in a possible implementation of the second aspect, the prediction unit is further used to: obtain an address set for writing data, wherein the write time interval of two data with adjacent write times in the address set is less than a preset value; train the addresses in the address set so that after the first address in the address set is input into the first neural network model, the probability of at least one address after the first address in the probabilities of multiple addresses output by the first neural network model increases, and the first address is any address in the address set.
[0024] In combination with the second aspect, in a possible implementation of the second aspect, the prediction unit is further used to: obtain an address set for reading data, wherein the reading time interval of two data with adjacent reading times in the address set is less than a preset value; train the addresses in the address set so that after the first address in the address set is input into the second neural network model, the probability of at least one address after the first address in the probabilities of multiple addresses output by the second neural network model increases, and the first address is any address in the address set.
[0025] In combination with the second aspect, in a possible implementation of the second aspect, the computing device also includes a processing unit for counting the number A of addresses obtained from the output of the first neural network model that hit the cache within a preset time length, and the number B of addresses obtained from the output of the second neural network model that hit the cache; based on A and B, adjusting the number N1 of addresses obtained from the output of the first neural network model and the number N2 of addresses obtained from the output of the second neural network model.
[0026] In a third aspect, the present application provides a smart chip having instructions burned into it, and the smart chip executes the instructions to execute the data prefetching method provided in the first aspect and in combination with any one of the implementations of the first aspect.
[0027] In a fourth aspect, the present application provides a computing device, comprising a processor and a memory, wherein the processor and the memory are connected via an internal bus, the memory stores instructions, and the processor calls the instructions in the memory to execute the data prefetching method provided in the first aspect and in combination with any one of the implementations of the first aspect.
[0028] In a fifth aspect, the present application provides a computing device, comprising a processor, a memory and a smart chip, wherein the smart chip is connected to the processor via a serial bus and to the memory via a PCIe interface, and instructions are burned into the smart chip, and the smart chip executes the instructions to execute the data prefetching method provided in the first aspect and in combination with any one of the implementation methods of the first aspect.
[0029] In a sixth aspect, the present application provides a computer storage medium storing a computer program. When the computer program is executed by a processor, the process of the data prefetching method provided in the above-mentioned first aspect and in combination with any one of the implementation methods in the above-mentioned first aspect can be implemented.
[0030] In a seventh aspect, the present application provides a computer program product, which includes instructions. When the computer program is executed by a computer, the computer can execute the process of the data prefetching method provided in the above-mentioned first aspect and in combination with any one of the implementation methods in the above-mentioned first aspect.
[0031] In an eighth aspect, the present invention provides a computing device, comprising a processor and a memory, wherein the memory stores program instructions, and the processor executes the instructions in the memory to execute the data prefetching method provided in the first aspect and in combination with any one of the implementation methods in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] 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 will be briefly introduced below. Obviously, the accompanying drawings described below are 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 any creative work.
[0033] Figure 1 is a schematic diagram of a storage model provided in an embodiment of the present application;
[0034] Figure 2A is a schematic diagram of data access provided by an embodiment of the present application;
[0035] Figure 2B is a schematic diagram of another data access provided by an embodiment of the present application;
[0036] Figure 3 It is a schematic diagram of a system architecture provided by an embodiment of the present application;
[0037] Figure 4 It is a structural schematic diagram of a data pre-fetching system provided in an embodiment of the present application;
[0038] Figure 5 It is a flowchart of a method for pre-fetching data provided by an embodiment of the present application;
[0039] Figure 6 It is a flowchart of a first neural network model training method provided in an embodiment of the present application;
[0040] Figure 7 It is a schematic diagram of write request stream segmentation provided by an embodiment of the present application;
[0041] Figure 8 It is a flow chart of a second neural network model training method provided in an embodiment of the present application;
[0042] Fig. 9 It is a structural diagram of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The technical solutions in the embodiments of the present application are clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0044] First, some of the terms and related technologies involved in this application are explained in conjunction with the accompanying drawings to facilitate understanding by those skilled in the art.
[0045] Logical block address (LBA) is a common mechanism for describing the block where data is located on a storage device, and is generally used in auxiliary memory devices such as hard disks. LBA can refer to the address of a data block, and a logical block is generally 512 or 1024 bits.
[0046] Cache is generally used for random access memory (RAM) to store temporary data. Cache is a memory that can exchange data at high speed. It has an extremely fast storage rate and can solve the speed difference between CPU speed and hard disk speed. It exchanges data with the CPU before the hard disk. The cache has a small capacity and can only store a small part of the data in the hard disk, but this small part is about to be accessed by the CPU in a short time. When the CPU calls a large amount of data, it can bypass the hard disk and call it directly from the cache, thereby speeding up the reading speed. When data is stored in the cache, it is stored in the form of key-value pairs, that is, the cache stores both LBA and the value corresponding to LBA.
[0047] Prefetching technology refers to loading data from the main memory (such as a hard disk) into the cache memory (cache) in advance before the CPU accesses the data, so as to reduce the pause time of the CPU accessing the data and improve the performance of the CPU.
[0048] Skip-gram is an unsupervised learning technology that can independently learn the context of words. It can automatically complete sentences or analyze the relevance of sentences by learning the relationship between words, and is used to predict the context words corresponding to a given central word. Unsupervised learning refers to unlabeled training data sets, and samples need to be analyzed based on regular statistics between samples, such as task clustering.
[0049] A recurrent neural network (RNN) is an artificial neural network whose nodes are connected in a loop in a directional manner. The internal state of this network can unfold dynamic temporal behaviors. RNN not only considers the input of the previous moment, but also gives the network a memory function for the previous content. The RNN network is mainly composed of an input layer, a hidden layer, and an output layer. The network memorizes the previous information and applies it to the calculation of the current output, that is, the nodes between the hidden layers are no longer disconnected but connected, and the input of the hidden layer includes not only the output of the input layer but also the output of the hidden layer at the previous moment. RNN can be used in fields such as natural language processing (NLP), machine translation, speech recognition, image description generation, and text similarity calculation. For example, in this application, RNN can be used to implement data pre-fetching.
[0050] Convolutional neural networks (CNNs) are a type of feedforward neural network with deep structure and convolutional calculations. They are one of the representative algorithms of deep learning. CNNs have the ability to represent learning and can classify input information in a translation-invariant manner according to their hierarchical structure. CNNs are constructed by imitating the visual perception mechanism of organisms and can perform supervised and unsupervised learning. The convolution kernel parameter sharing in the hidden layer and the sparsity of the inter-layer connections enable convolutional neural networks to learn grid features such as pixels and audio with a small amount of computation, with stable results and no additional feature engineering requirements for the data.
[0051] In the data processing process, since the cache is closer to the CPU and the data access speed is faster, when processing an access request, the CPU always searches the cache for the data to be accessed first. If the data to be accessed is not found in the cache, it will further search the hard disk for the data to be accessed, which will reduce the CPU access rate. In order to shorten the access time and improve the access efficiency, it is necessary to use prefetching technology to prefetch the data that the CPU is about to access into the cache to improve the cache hit rate. Figure 2A As shown, data block 1, data block 2, ..., data block n are continuous in space. When the CPU accesses, it will access data block 1, data block 2, ..., data block n in sequence. For example, the CPU accesses some large files in this way. The CPU can identify the sequential stream by analyzing the relationship between access addresses (such as LBA), that is, the addresses corresponding to the data accessed by the CPU are continuous. The sequential stream prefetching technology is used to prefetch the data that the CPU needs to access into the cache in advance. In this way, when the data is used, it can be guaranteed to be found in the cache, which improves the cache hit rate and reduces the data access latency. Figure 2B As shown in the figure, data block 1, data block 2, ..., data block n are continuous in space. When the CPU accesses, it does not strictly access in sequence, but accesses at certain intervals. For example, the CPU accesses with 2 data blocks as an interval, that is, after the CPU accesses data block 1, it will access data block 4, and then access data block 7. The CPU identifies the interval stream by analyzing the relationship between the access addresses, that is, the addresses corresponding to the data accessed by the CPU are equally spaced. The interval stream prefetching technology is used to prefetch the data that the CPU needs to access into the cache in advance, which can improve the cache hit rate and reduce the data access latency.
[0052] Sequential stream prefetching technology and interval stream prefetching technology can only be applied to scenarios where the access addresses are continuous or evenly spaced. If there is no order between the access addresses but there is a strong correlation, the above methods will no longer apply. For example, when a virtual machine is started, the operating system will read several configuration files in a fixed order. The addresses corresponding to these files are not sequential or evenly spaced, but they will be read in this order every time they are started. The corresponding addresses have a strong correlation. Sequential stream prefetching technology or interval stream prefetching technology cannot prefetch the data that the CPU is about to access, that is, it cannot improve the cache hit rate and cannot reduce data access latency.
[0053] Based on the above, the present application provides a data prefetching method and related equipment, which can analyze the correlation between access addresses, identify address access patterns, pre-fetch the data corresponding to the address to be accessed into the cache in advance, improve the cache hit rate, reduce data access latency, and improve system performance.
[0054] The technical solutions of the embodiments of the present application can be applied to various scenarios that require data pre-fetching, including but not limited to enterprise storage, distributed storage, cloud storage, etc.
[0055] In a specific embodiment, the data pre-fetching system can be deployed in any computing device involved in data pre-fetching. Figure 3 As shown, it can be deployed on one or more computing devices (such as central servers) in a cloud environment, or one or more computing devices (edge computing devices) in an edge environment, where the edge computing device can be a server. The cloud environment refers to a cluster of central computing devices owned by a cloud service provider that is used to provide computing, storage, and communication resources, and has large storage and computing resources; the edge environment refers to a cluster of edge computing devices that is geographically close to terminal devices and is used to provide computing, storage, and communication resources.
[0056] The data prefetch system is used to analyze the access address of the business access request and prefetch the data corresponding to the address that the CPU is about to access into the cache. The units inside the data prefetch system can be divided in many ways, and this application does not impose any restrictions on this. Figure 4 is an exemplary division method, such as Figure 4 As shown, the functions of each functional unit will be briefly described below.
[0057] The data prefetching system 400 shown includes multiple functional units, among which, an acquisition unit 410 is used to obtain data access requests, which data access requests include read requests and write requests; a prediction unit 420 is used to input the access address corresponding to the data access request obtained by the acquisition unit 410 into a neural network model for training, and predict the address to be accessed subsequently; a processing unit 430 is used to prefetch the data corresponding to the access address predicted by the prediction unit 420 into the cache.
[0058] Optionally, the data pre-fetch system 400 further includes a sequence segmentation unit 440, which is used to segment the read requests and write requests acquired by the acquisition unit 410 based on the arrival time of each data access request to obtain multiple read request sequences and multiple write request sequences. The neural network model includes a first neural network model 4210 and a second neural network model 4220, wherein the first neural network model 4210 is used to train the addresses corresponding to the multiple write request sequences segmented by the segmentation unit 440, and predict the addresses to be accessed later; the second neural network model 4220 is used to train the addresses corresponding to the multiple read request sequences segmented by the segmentation unit 440, and predict the addresses to be accessed later. The data pre-fetch system 400 further includes a statistics unit 450, which is used to count the number of first associated addresses predicted and output by the first neural network model 4210, the number of second associated addresses predicted and output by the second neural network model 4220, the number of first associated addresses hit in the cache, and the number of second associated addresses hit in the cache. The data pre-fetching system 400 shown also includes an updating unit 460, which is used to update the corresponding weights of the first neural network model 4210 and the second neural network model 4220 according to the data obtained by the statistics unit 450, that is, the number of first associated addresses predicted and input by the first neural network model 4210 and the number of second associated addresses predicted and output by the second neural network model 4220 are not always equal, and are output according to the weight ratio. For example, a total of 10 associated addresses need to be predicted and output, the weight of the first neural network model 4210 is 0.4, and the weight of the second neural network model 4220 is 0.6, then 4 first associated addresses predicted by the first neural network model 4210 are selected and output, and 6 second associated addresses predicted by the second neural network model 4220 are selected and output.
[0059] In the present application, the data pre-fetching system 400 may be a software system, and the various parts and functional units included therein may be deployed on hardware devices in a flexible manner.
[0060] It is worth noting that the cache prefetch system can be an independent chip, connected to the CPU via a serial bus, receiving a data access request sent by the CPU, training the access address corresponding to the data access request, and outputting the predicted address that the next access request of the access request may access. The independent chip can be a field-programmable gate array (FPGA), which is an integrated circuit that can be configured by the user, or other programmable logic devices, which is not limited in this application.
[0061] Figure 5 The data pre-fetching method provided by the embodiment of the present application is described. Figure 5 As shown, the method includes but is not limited to the following steps:
[0062] S510: The computing device obtains a first read request.
[0063] Specifically, the computing device is deployed with the above Figure 4 In the data pre-fetching system 400 shown, the first read request may be a request generated by an application program in a computing device, etc., for accessing data stored in the computing device, wherein the first read request carries the address corresponding to the data to be read, which may be an LBA. After receiving the first read request, the acquisition unit 410 in the computing device finds the corresponding data according to the LBA and returns it. The search order of the computing device is to search from the cache first. If the data is found in the cache, it is called a cache hit, and the data is returned directly. Since only a small portion of the data is stored in the cache, the data may not be found in the cache. If the data is not found in the cache, the data will be further searched from the hard disk and returned.
[0064] S520: The computing device inputs the address of the data read by the first read request into the neural network model, and outputs probability values of multiple addresses.
[0065] Specifically, since the data in the cache is read very quickly and can match the speed of the CPU, in order to shorten the data access time and improve the cache hit rate, thereby further improving system performance. Therefore, the address corresponding to the first read request is input into the trained neural network model, which can be Figure 4 The prediction unit 420 shown in the figure predicts the address of the data that may be accessed by the second read request after the first read request using a neural network model, and outputs the probability values of the predicted multiple addresses, and obtains N associated addresses according to the probability values to increase the possibility that the second read request finds the data accessed by the second read request from the cache, and the N associated addresses have a strong correlation with the access address corresponding to the first read request. Wherein, N is a positive integer greater than 1.
[0066] In a possible implementation, the neural network model includes a first neural network model and a second neural network model. The first neural network model may be Figure 4 The first neural network model 4210 shown in FIG. 4 may be Figure 4 The computing device inputs the address corresponding to the first read request into the first neural network model and the second neural network model respectively, so that the first neural network model outputs probability values of multiple addresses, and selects N1 addresses therefrom as first associated addresses, so that the second neural network model also outputs probability values of multiple addresses, and selects N2 addresses therefrom as second associated addresses, wherein N1 and N2 are positive integers greater than or equal to 1, and the sum of N1 and N2 is equal to N. The first neural network model is obtained by training the computing device according to the address of the written data, and the second neural network model is obtained by training the computing device according to the address of the read data. How the first neural network model and the second neural network model are specifically trained will be described in detail in subsequent steps.
[0067] It can be understood that the computing device uses the address of the write data (i.e., the address corresponding to the write request obtained before the prediction by the first neural network model) as a training sample and the address of the read data (i.e., the address corresponding to the read request obtained before the prediction by the second neural network model) as a training sample for training, and can analyze the correlation between the addresses of the data and find the access rules, so that the first neural network model and the second neural network model can increase the accuracy of the address corresponding to the second read request after the first read request predicted based on the address of the write data and the address of the read data, and pre-fetch the data corresponding to the address into the cache in advance, thereby improving the cache hit rate, shortening the access time, and improving the system performance.
[0068] S530: The computing device obtains N addresses from the output of the neural network model according to the probability value and stores the corresponding data in the cache.
[0069] Specifically, after the first read request is input into the neural network model, the neural network model will predict and output the probability values of multiple addresses, and select N associated addresses with larger probability values, but the data corresponding to these N associated addresses may partially already exist in the cache. Therefore, the processing unit 430 in the computing device must first determine which of the N associated addresses have data corresponding to data that already exists in the cache, that is, the data does not need to be pre-fetched, and then use the associated addresses that are not stored in the cache as target associated addresses, and pre-fetch the corresponding data from the hard disk to the cache.
[0070] It should be understood that the capacity of the cache is relatively small and the data stored is relatively limited. Therefore, it is necessary to set the associated address of the obtained neural network model output, that is, to set the value of N, and avoid setting the value of N too large to improve the utilization of the cache and ensure that the cache can reserve enough capacity to support the next pre-fetch operation.
[0071] Further, the computing device sorts the probability values corresponding to the multiple first associated addresses predicted by the first neural network model according to size, and selects N1 first associated addresses in sequence from large to small for output, wherein the probability value of each first associated address represents the probability that the data corresponding to each first associated address is the data read by the second read request, and the second read request is the next read request of the first read request; in addition, the computing device sorts the probability values corresponding to the multiple second associated addresses predicted by the second neural network model according to size, and selects N2 second associated addresses in sequence from large to small for output, wherein the probability value of each second associated address represents the probability that the data corresponding to each second associated address is the data read by the second read request, and the second read request is the next read request of the first read request.
[0072] It should be noted that, in the initialization phase, the weights of the first neural network model and the second neural network model are the same, both 0.5. In other words, in the initial phase, the number of first associated addresses selected by the computing device is the same as the number of second associated addresses, that is, the value of N1 is equal to N2. However, as time changes, the computing device will periodically adjust the weights of the first neural network model and the second neural network model to ensure that the address corresponding to the next read request (i.e., the second read request) of the current read request can be predicted more accurately, thereby improving the cache hit rate.
[0073] In one possible implementation, a statistical unit 450 in a computing device counts the number A of the first associated addresses hit in the cache and the number B of the second associated addresses hit in the preset time period, and the computing device updates the weights of the first neural network model and the second neural network model according to the values of the parameters obtained by the statistical unit 450, i.e., A and B.
[0074] Specifically, the computing device updates the weights corresponding to the two models according to the values of parameter A and parameter B. The weight corresponding to the first neural network model is a=A1 / (A1+B1); the weight corresponding to the second neural network model is b=B1 / (A1+B1). The computing device adjusts the number of first associated addresses and the number of second associated addresses pre-fetched into the cache according to the calculated a and b, ensuring that the addresses pre-fetched into the cache have the strongest correlation with the addresses corresponding to the current read request, thereby improving the cache hit rate.
[0075] Exemplarily, the calculated value of a is 0.3, the value of b is 0.7, and the computing device needs to prefetch the data corresponding to 10 associated addresses into the cache each time. The computing device will select 3 first associated addresses from all first associated addresses predicted and output by the first neural network model, and prefetch their corresponding data into the cache; at the same time, the computing device will select 7 second associated addresses from all second associated addresses predicted and output by the second neural network model, and prefetch their corresponding data into the cache.
[0076] It can be seen that the computing device timely adjusts the weight corresponding to the model according to the statistical parameters, and can dynamically adjust the number of first associated addresses and the number of second associated addresses pre-fetched into the cache, ensuring that the associated address with the strongest correlation with the address corresponding to the current read request can always be pre-fetched, thereby improving the cache hit rate and thus improving system performance.
[0077] In addition, due to the limited capacity of the cache, data from storage devices such as hard disks cannot be pre-fetched into the cache indefinitely. Therefore, in order to ensure the high performance of the cache and improve the cache hit rate, the computing device also needs to periodically update (i.e., delete) the data stored in the cache so that the cache has sufficient capacity to store the latest pre-fetched data into the cache.
[0078] Optionally, the computing device may update the data stored in the cache using a corresponding replacement algorithm, including but not limited to a least recently used (LRU) algorithm, a pseudo least recently used (pseudo LRU) algorithm, a least frequently used (LFU) algorithm, and a random algorithm. It is easy to understand that the computing device may further improve the cache hit rate by periodically updating the data stored in the cache using a replacement algorithm.
[0079] It should be noted that the above is only explained by taking the example of prefetching data from the hard disk to the cache. For any two-level storage structure, such as prefetching data from the memory to the CPU cache, or prefetching data from the hard disk to the memory, the method provided in this application is also applicable. For the sake of brevity, it will not be repeated here.
[0080] The specific training process of the first neural network model and the second neural network model will be described in detail below. It should be understood that the neural network models selected in this application include but are not limited to skip-gram models, CNN models, and RNN models. In addition, the first neural network model and the second neural network model can be models of the same type, such as both are skip-gram models, or models of different types, such as the first neural network model is a skip-gram model and the second neural network model is an RNN model, which is not limited in this application.
[0081] For ease of understanding and explanation, a specific description is given by taking the first neural network model and the second neural network model as skip-gram models as an example.
[0082] Figure 6 is a flow chart of a first neural network model training method provided in an embodiment of the present application. Figure 6 As shown, the method includes but is not limited to the following steps:
[0083] S610: The computing device obtains multiple write requests.
[0084] Specifically, the acquisition unit 410 in the computing device acquires the write requests generated by the application within a period of time, and records the write time and write address corresponding to each write request, and temporarily stores them in the cache.
[0085] Exemplarily, the computing device obtains a write request at time t0, whose write address is a; obtains a write request at time t1, whose write address is b; obtains a write request at time t2, whose write address is c; obtains a write request at time t3, whose write address is d. The computing device temporarily stores these four write requests in the cache in the order of write time, for example, in the form of [{t0, a}, {t1, b}, {t2, c}, {t3, d}].
[0086] S620: The computing device divides the multiple write requests into multiple address sets for writing data.
[0087] Specifically, continuous write requests constitute a write request stream. It should be understood that in a write request stream, if two write requests are too far apart, that is, the write times of the two write requests differ too much, it means that the correlation between the write addresses corresponding to the two write requests is weak, and it can be determined that there is no correlation between the two write requests. Therefore, the sequence segmentation unit 440 in the computing device needs to segment the write request stream, and the multiple shorter write request streams obtained by segmentation have no correlation, but the write addresses corresponding to the write requests in each write request stream are correlated, wherein each segment is a set of addresses for writing data.
[0088] Furthermore, the sequence segmentation unit 440 in the computing device performs segmentation based on the write time of each write request. When the write time between two write requests exceeds a preset time length, they need to be segmented, that is, the write time interval between two data with adjacent write times in each address set is less than the preset time length. The preset time length can be set according to actual needs, and this application does not limit this.
[0089] For example, Figure 7 As shown, a write request with a write address of a is obtained at time t0, a write request with a write address of b is obtained at time t1, a write request with a write address of c is obtained at time t2, a write request with a write address of d is obtained at time t3, a write request with a write address of e is obtained at time t4, a write request with a write address of a is obtained at time t5, and a write request with a write address of d is obtained at time t6. Among them, there are 3 time units (for example, 3 milliseconds) between t0 and t1, 4 time units between t1 and t2, 5 time units between t2 and t3, 11 time units between t3 and t4, 2 time units between t4 and t5, and 5 time units between t5 and t6. The preset duration is 10 time units, and there are 11 time units between t3 and t4, which exceeds 10 time units, so it needs to be segmented to obtain two address sets, namely (a, b, c, d) and (e, a, b). In addition, the address sets corresponding to the segmented multiple write request streams constitute a training set.
[0090] S630: The computing device inputs each address set as a training sample into the skip-gram model for training.
[0091] Specifically, the computing device inputs the address set corresponding to each write request stream into the skip-gram model for training in turn, continuously updates the parameters of the model, and ultimately enables the skip-gram model through training to have the ability to predict the address of the data accessed by the second read request, where the second read request is the next read request of the current read request (i.e., the first read request).
[0092] Furthermore, the skip-gram model mainly includes a hidden layer and an output layer. All parameters exist in the weight matrix W1 of the hidden layer and the weight matrix W2 of the output layer. The essence of model training is actually to update the parameters in W1 and W2. When using the skip-gram model, W1 and W2 must be initialized first. During the initialization process, the parameters contained in W1 and W2 can be randomly selected, and then the randomly selected parameters are continuously updated through the subsequent training process.
[0093] It should also be noted that all the addresses described above (including the address corresponding to the read request, the address corresponding to the write request, etc.) do not specifically refer to the address of a certain data, but refer to the address corresponding to a data block. The size of the data block can be divided as needed, for example, it can be divided into 64KB, 128KB, etc., and the address can be obtained by logically encoding the data block. In addition, the storage address space of each computing device is fixed and can be logically divided. For example, the size of the memory address space is 1GB. The memory address space can be divided into 16384 data blocks according to 64KB. Each data block corresponds to an address (such as LBA), that is, the size of the address space composed of all addresses is 16384.
[0094] For example, assuming that a certain address set obtained after segmentation is (a, b, c, d, e), construct address pairs [a, b], [a, c], [a, d], [a, e], and input one address pair into the skip-gram model for training each time, where the previous address of each address pair is the model input, and the latter address is used to correct the address predicted and output by the model to update the model parameters.
[0095] After the address pair is constructed, the address pair [a, b] is trained first. A is encoded with a one-hot code. The essence of one-hot coding is that there are as many bits as there are states, and only one bit is 1, and the others are all 0. Here, the total number of states refers to the size of the memory address space. Therefore, when the memory address space is 1GB and divided into 64KB, after a is one-hot encoded, a is actually converted into a 16384-dimensional vector, represented by x.
[0096] Then, x is passed to the hidden layer, and the hidden layer performs a dot product operation on the weight matrix W1 and x to obtain the result h, that is, h = x*W1. It should be understood that x is a 1*16384 vector, W1 can be a 16384*k matrix, then h is a 1*k vector, and the value of k can be set as needed. Generally speaking, the value of k is relatively small, for example, it can be 5, 10, etc. Through the dot product operation, x can be reduced in dimension, that is, a can be represented by a lower-dimensional vector. It is easy to understand that after the dimension is reduced, the amount of calculation can be greatly reduced and the training efficiency can be improved.
[0097] Next, h is passed to the output layer, which performs a dot product operation on the weight matrix W2 and h to obtain the result y, that is, y = h*W2. y is the result predicted by the skip-gram model. It should be understood that W2 is a k*16384 matrix, so y is a 1*16384 vector.
[0098] After obtaining y, it can be passed to the regression classifier to perform normalization calculation using the softmax function to obtain y1. y1 represents the probability of occurrence of 16,384 addresses predicted by the skip-gram model. The sum of the probability values of all addresses in y1 is equal to 1.
[0099] It should be understood that the predicted results are not completely consistent with the actual results, that is, there is an error between the predicted results and the actual results. Therefore, it is necessary to use the back propagation algorithm to correct the weight matrices W1 and W2.
[0100] Optionally, after obtaining y1, the following two methods can be used to perform error back propagation to achieve correction of W1 and W2.
[0101] 1. First, after obtaining y1, calculate the average error value v between y1 and b, c, d, and e. That is, calculate the difference v1 between the vectors corresponding to y1 and b, calculate the difference v2 between y1 and c, calculate the difference v3 between y1 and d, and calculate the difference v4 between y1 and e. After obtaining v1, v2, v3, and v4, calculate the average error value v, that is, v = (v1+v2+v3+v4) / 4.
[0102] Then, h and v are used to calculate the increment ΔW2 of the weight matrix W2, that is, ΔW2 = h*v. The calculated ΔW2 is used to correct W2, that is, the weight matrix of the corrected output layer = W2 + α * ΔW2, where α represents the learning rate, which ranges from 0 to 1 and can be set as needed. The increment ΔW1 of the weight matrix W1 is calculated using x, W2, and v, that is, ΔW1 = x*(W2*e). The calculated ΔW1 is used to correct W1, that is, the weight matrix of the corrected hidden layer = W1 + α*ΔW2.
[0103] 2. After obtaining y1, calculate the error value of this training, that is, calculate the difference v1 between the vectors corresponding to y1 and b.
[0104] Then, h and v1 are used to calculate the increment ΔW2 of the weight matrix W2, that is, ΔW2 = h*v1. The calculated ΔW2 is used to correct W2, that is, the corrected weight matrix of the output layer = W2 + α * ΔW2, where α represents the learning rate, which ranges from 0 to 1 and can be set as needed. The increment ΔW1 of the weight matrix W1 is calculated using x, W2 and v1, that is, ΔW1 = x*(W2*e). The calculated ΔW1 is used to correct W1, that is, the corrected weight matrix of the hidden layer = W1 + α*ΔW2.
[0105] Next, the address pair [a, c] is trained. The specific process is the same as above and will not be repeated for brevity. After obtaining the new output y1, the difference v2 between the vectors corresponding to y1 and c is calculated, and then h and v2 are used to correct W1 and W2 again.
[0106] After a is used as the model input and the correction of W1 and W2 is completed, the address pairs [b, c], [b, d], [b, e] are constructed, and then each address pair is input into the skip-gram model for training in turn. It should be understood that any of the above two methods can be used for error back propagation to complete the correction of W1 and W2. The specific training process is consistent with the above and will not be repeated.
[0107] Similarly, using c as the model input, construct the address pairs [c, d] and [c, e], input them into the skip-gram model training, and use any of the above methods to complete the correction of W1 and W2.
[0108] After completing the training of one training sample in the training set, that is, completing the training of one address set, another training sample is trained to continue to correct (update) W1 and W2, and the specific training process is consistent with the above. It should be noted that the samples in the training set are not only trained once, but may need to be input into the skip-gram model for training multiple times. When the overall error on the entire training set is less than the preset threshold, that is, for any address pair or address set in the training set, the calculated error value (such as v1) or the average error value (such as v) is less than the preset threshold, it means that the skip-gram model has reached the convergence condition, that is, the skip-gram model has the ability to predict the address corresponding to the second read request, and the trained skip-gram model can be used for prediction to support data prefetching.
[0109] It should also be noted that in the process of training the training samples in the training set and updating W1 and W2, the number of the same address pairs is positively correlated with the probability value corresponding to the address pair predicted by the skip-gram model. For example, if the number of the above address pairs [a, b] is large and the number of [a, c] is small, then when the model predicts the address after a, it will be more inclined to b rather than c. In other words, when predicting a, the probability value of b appearing after a calculated by the model is much greater than the probability value of c appearing after a.
[0110] Figure 8 is a flow chart of a second neural network model training method provided in an embodiment of the present application. Figure 8 As shown, the method includes but is not limited to the following steps:
[0111] S810: The computing device obtains multiple read requests.
[0112] Specifically, the specific implementation of S810 may refer to the relevant description in the above S610.
[0113] S820: The computing device divides the multiple read requests into multiple address sets for reading data.
[0114] Specifically, the specific implementation of S820 may refer to the relevant description in the above S620.
[0115] S830: The computing device inputs each address set as a training sample into the skip-gram model for training.
[0116] Specifically, the specific implementation of S830 may refer to the relevant description in the above S630.
[0117] It should be understood that the difference between the first neural network model and the second neural network model lies only in the different training sets. One is trained on a set of addresses for writing data, and the other is trained on a set of addresses for reading data. However, the specific training methods are the same and can be referenced to each other, so they will not be repeated here.
[0118] The method of the embodiment of the present application is described in detail above. In order to facilitate better implementation of the above scheme of the embodiment of the present application, correspondingly, related equipment for cooperating in implementing the above scheme is also provided below.
[0119] The present application also provides a data pre-fetching system. Figure 4 The data pre-fetching system 400 is used to execute the aforementioned data pre-fetching method. The present application does not limit the division of the functional units of the data pre-fetching system, and the various units in the data pre-fetching system can be increased, decreased or merged as needed. Figure 4 An exemplary division of a functional unit is provided:
[0120] The data pre-fetching system includes an acquisition unit 410 , a prediction unit 420 , a processing unit 430 and a sequence segmentation unit 440 .
[0121] Specifically, the acquisition unit 410 is used to execute the aforementioned steps S510, S610 and S810, and optionally execute the optional method in the aforementioned steps to acquire the first read request.
[0122] The sequence segmentation unit 440 is used to execute the aforementioned steps S620 and S820, and optionally execute the optional method in the aforementioned steps to segment the acquired read request or write request to obtain multiple address sets as training samples.
[0123] The prediction unit 420 is used to execute the aforementioned steps S520, S630 and S830, and optionally execute the optional method in the aforementioned steps to train the neural network model, and use the trained neural network model to output probability values of multiple addresses.
[0124] The processing unit 430 is used to execute the aforementioned step S530, and optionally execute the optional method in the aforementioned step, obtain N addresses from the output of the prediction unit 420 according to the probability value and store the corresponding data in the cache.
[0125] The above four units can transmit data to each other through a communication path. It should be understood that each unit included in the data pre-fetching system 400 can be a software unit, a hardware unit, or partly a software unit and partly a hardware unit.
[0126] See also Fig. 9 , Fig. 9 Schematic diagram of a computing device provided in an embodiment of the present application. Fig. 9 As shown, the computing device 900 includes: a processor 910, a communication interface 920 and a memory 930, wherein the processor 910, the communication interface 920 and the memory 930 are interconnected via an internal bus 940. It should be understood that the computing device may be a database server.
[0127] The processor 910 may be composed of one or more general-purpose processors, such as a central processing unit (CPU), or a combination of a CPU and a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0128] The bus 940 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus 940 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0129] The memory 930 may include a volatile memory, such as a random access memory (RAM); the memory 930 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); the memory 930 may also include a combination of the above types. The program code may be used to implement the functional modules shown in the data prefetching system 400, or to implement Figure 5 The method steps in the method embodiment shown are performed by a computing device.
[0130] The present application also provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the program can implement part or all of the steps of any one of the above method embodiments, and implement the above method. Figure 4 The function of any functional module described.
[0131] The embodiment of the present application also provides a computer program product, which, when executed on a computer or processor, enables the computer or processor to perform one or more steps in any of the above methods. If the components of the above-mentioned devices are implemented in the form of software functional units and sold or used as independent products, they can be stored in the computer-readable storage medium.
[0132] In the above embodiments, the description of each embodiment has different emphases. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0133] It should be understood that the first, second, third, fourth and various numerical numbers involved in this document are only distinguished for the convenience of description and are not used to limit the scope of the present application.
[0134] It should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0135] It should also be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0136] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0137] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0138] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0139] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0140] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0141] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0142] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.
[0143] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.
[0144] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for pre-fetching data, It is characterized in that include: receiving a first read request; The address of the data read by the first read request is input into a neural network model, and the neural network model outputs probability values of multiple addresses, wherein the probability value of each address represents the probability that the data corresponding to each address is the data read by the second read request, and the second read request is the next read request of the first read request; the address of the read data indicates the address of the block where the read data is stored; Obtaining N addresses from the output of the neural network model according to the probability value, so that data corresponding to the N addresses are stored in a cache; The neural network model includes a first neural network model and a second neural network model, wherein the first neural network model is trained according to the address of write data, and the second neural network model is trained according to the address of read data; The step of inputting the address of the data read by the first read request into the neural network model comprises: The addresses of the data read by the first read request are input into the first neural network model and the second neural network model respectively.
2. The method according to claim 1, It is characterized in that The storing the data corresponding to the N addresses in a cache includes: Determine M addresses among the N addresses whose corresponding data are not in the cache, where M is a positive integer greater than or equal to 1; The data corresponding to the M addresses are stored in the cache.
3. The method according to claim 1, It is characterized in that The obtaining N addresses from the output of the neural network model according to the probability value comprises: Obtain first N1 addresses from the output of the first neural network model in descending order of probability values, and obtain first N2 addresses from the output of the second neural network model in descending order of probability values, wherein the sum of the N1 and the N2 is equal to the N.
4. The method according to claim 3, It is characterized in that The method further comprises: Acquire an address set for writing data, wherein the time interval between two data with adjacent writing times in the address set is less than a preset value; The addresses in the address set are trained through the first neural network model so that after the first address in the address set is input into the first neural network model, the probability of at least one address after the first address in the probabilities of multiple addresses output by the first neural network model increases, and the first address is any address in the address set.
5. The method according to claim 3, It is characterized in that The method further comprises: Acquire an address set for reading data, wherein the reading time interval between two data with adjacent reading times in the address set is less than a preset value; The addresses in the address set are trained through the second neural network model so that after the first address in the address set is input into the second neural network model, the probability of at least one address after the first address in the probabilities of multiple addresses output by the second neural network model increases, and the first address is any address in the address set.
6. The method according to any one of claims 3 to 5, It is characterized in that The method further comprises: Counting the number A of addresses obtained from the output of the first neural network model that hit the cache within a preset time period, and the number B of addresses obtained from the output of the second neural network model that hit the cache; According to A and B, the number of addresses N1 obtained from the output of the first neural network model and the number of addresses N2 obtained from the output of the second neural network model are adjusted.
7. A computing device, It is characterized in that include: A receiving unit, configured to receive a first read request; A prediction unit, configured to input the address of the data read by the first read request into a neural network model, wherein the neural network model outputs probability values of multiple addresses, wherein the probability value of each address indicates the probability that the data corresponding to each address is the data read by the second read request, and the second read request is the next read request of the first read request; the address of the read data indicates the address of the block where the read data is stored; and N addresses are obtained from the output of the neural network model according to the probability values, so that the data corresponding to the N addresses are stored in a cache; The neural network model includes a first neural network model and a second neural network model, wherein: The first neural network model is used to train the address of the written data, predict the address of the data read by the first read request, and output probability values of multiple addresses; The second neural network model is used to train the addresses of the read data, predict the addresses of the data read by the first read request, and output probability values of multiple addresses.
8. The computing device of claim 7, It is characterized in that The prediction unit is further used for: Determine M addresses among the N addresses whose corresponding data are not in the cache, where M is a positive integer greater than or equal to 1; The data corresponding to the M addresses are stored in the cache.
9. The computing device of claim 7, It is characterized in that The prediction unit is also used to obtain the first N1 addresses from the output of the first neural network model in order of probability values from large to small, and to obtain the first N2 addresses from the output of the second neural network model in order of probability values from large to small, wherein the sum of the N1 and the N2 is equal to the N.
10. The computing device of claim 9, It is characterized in that The prediction unit is further used for: Acquire an address set for writing data, wherein the time interval between two data with adjacent writing times in the address set is less than a preset value; The addresses in the address set are trained so that after a first address in the address set is input into the first neural network model, the probability of at least one address after the first address in the probabilities of multiple addresses output by the first neural network model increases, and the first address is any one of the addresses in the address set.
11. The computing device of claim 9, It is characterized in that The prediction unit is further used for: Acquire an address set for reading data, wherein the reading time interval between two data with adjacent reading times in the address set is less than a preset value; The addresses in the address set are trained so that after a first address in the address set is input into the second neural network model, the probability of at least one address after the first address in the probabilities of multiple addresses output by the second neural network model increases, and the first address is any one of the addresses in the address set.
12. A computing device as claimed in any one of claims 9 to 11, It is characterized in that The computing device further includes a processing unit configured to count the number A of addresses obtained from the output of the first neural network model that hit the cache within a preset time period, and the number B of addresses obtained from the output of the second neural network model that hit the cache; According to A and B, the number of addresses N1 obtained from the output of the first neural network model and the number of addresses N2 obtained from the output of the second neural network model are adjusted.
13. A smart chip, It is characterized in that Instructions are burned into the smart chip, and the smart chip executes the instructions to perform the method according to any one of claims 1-6.
14. A computing device, It is characterized in that The method comprises a processor and a memory, wherein the memory stores program instructions, and the processor executes the instructions in the memory to perform the method according to any one of claims 1 to 6.
