Data reading method and apparatus, device, and readable storage medium
By obtaining the reference state identifier in the pulsating array and controlling the reading of weight attribute data and feature mapping attribute data, the problem of data reading in the storage unit occupying a large amount of storage resources is solved, achieving efficient data processing and reducing the chip area.
Patent Information
- Application Number
- PCT/CN2024/073958
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-09
- Filing Date
- 2024-01-25
- Publication Date
- 2024-09-12
AI Technical Summary
In the existing technology, the process of reading data in a storage unit into a systolic array requires a large amount of storage resources, resulting in a large chip area, increased read latency, increased queue depth, and more storage resources.
By obtaining the reference status identifier, the status of the weight attribute register in the systolic array is determined, and only when certain conditions are met, the read request for weight attribute data and feature mapping attribute data is responded to, and the data is read into the systolic array to avoid unnecessary queue formation. , reduce storage resource requirements.
It effectively reduces the chip area, reduces the occupation of storage resources, improves data reading efficiency, reduces computing time, and achieves efficient data reading and processing.
Smart Images

Figure CN2024073958_12092024_PF_FP_ABST
Abstract
Description
Data reading method, device, equipment and readable storage medium
[0001] Related applications
[0002] This application claims priority to Chinese patent application number 2023102548749, entitled “Data reading method, device, apparatus and readable storage medium,” filed on March 9, 2023, the entire text of which is incorporated herein by reference. Technical Field
[0003] The embodiments of the present application relate to the field of computer technology, and in particular to a data reading method, apparatus, device, and readable storage medium. Background Art
[0004] Peak computing power is an indicator in the field of computer technology to measure computer performance. Peak computing power refers to the maximum number of calculations that a processor can achieve per unit time, and the ability to read data from storage units is closely related to peak computing power.
[0005] In the related art, there is an array structure comprising multiple rows and columns of processing engines, known as a systolic array. Data from storage cells can be read into the systolic array, where it can be efficiently computed. Typically, if the conditions for reading data from the storage cells into the systolic array are not met, in response to a read request for the target data, the target data from the storage cells is stored in a queue. If the conditions for reading data from the storage cells into the systolic array are met, the target data is removed from the queue and sent to the systolic array.
[0006] Generally speaking, chips can be used as carriers for objects with data storage functions, such as memory cells and queues. However, queues require a certain amount of storage resources, which can easily lead to a large chip area.
[0007] Summary of the Invention
[0008] According to various embodiments of the present application, a data reading method, apparatus, device, and readable storage medium are provided.
[0009] In one aspect, a method is provided for performing a method performed by a processor of an electronic device, the electronic device comprising a systolic array and a storage unit respectively connected to the processor, the systolic array comprising a weight attribute register, the method comprising:
[0010] Obtaining a first weight read request and a first feature map read request, wherein the first weight read request is used to request reading weight attribute data from a storage unit, and the first feature map read request is used to request reading feature map attribute data from the storage unit;
[0011] Obtaining a reference state identifier, the reference state identifier being used to represent a state of a weight attribute register in the systolic array after a preset running time from a current time, the weight attribute register being used to store the weight attribute data;
[0012] When the reference state flag satisfies a first preset condition, reading the weight attribute data stored in the storage unit into the systolic array in response to the first weight read request; and
[0013] When the reference state identifier satisfies a second preset condition, the feature map attribute data stored in the storage unit is read into the systolic array based on the first feature map read request, and the systolic array is used to perform calculations based on the weight attribute data and the feature map attribute data.
[0014] In another aspect, a storage system is provided, the storage system comprising a processing unit and a storage unit;
[0015] The storage unit is used to store weight attribute data and feature map attribute data;
[0016] The processing unit is configured to obtain a first weight read request and a first feature map read request, wherein the first weight read request is configured to read weight attribute data from the storage unit, and the first feature map read request is configured to request to read feature map attribute data from the storage unit;
[0017] The processing unit is further configured to obtain a reference state identifier, the reference state identifier being used to represent a state of a weight attribute register in the systolic array after a preset running time from a current time, the weight attribute register being used to store the weight attribute data;
[0018] The processing unit is further configured to read the weight attribute data stored in the storage unit into the systolic array in response to the first weight read request when the reference state identifier satisfies a first preset condition; and
[0019] The processing unit is further configured to read the feature mapping attribute data stored in the storage unit into the systolic array based on the first feature mapping read request when the reference state identifier satisfies a second preset condition, and the systolic array is configured to perform calculations based on the weight attribute data and the feature mapping attribute data.
[0020] In another aspect, a data reading device is provided, comprising:
[0021] an acquisition module, configured to acquire a first weight read request and a first feature map read request, wherein the first weight read request is used to request reading weight attribute data from a storage unit, and the first feature map read request is used to request reading feature map attribute data from the storage unit;
[0022] The acquisition module is further configured to acquire a reference state identifier, wherein the reference state identifier is configured to represent a state of a weight attribute register in the systolic array after a preset running time from a current time, wherein the weight attribute register is configured to store the weight attribute data;
[0023] a reading module, configured to read the weight attribute data stored in the storage unit into the systolic array in response to the first weight read request when the reference state identifier satisfies a first preset condition; and
[0024] The reading module is further configured to read the feature mapping attribute data stored in the storage unit into the systolic array based on the first feature mapping read request when the reference state identifier satisfies a second preset condition, and the systolic array is configured to perform calculations based on the weight attribute data and the feature mapping attribute data.
[0025] On the other hand, an electronic device is provided, comprising a processor and a memory, wherein the memory stores at least one computer-readable instruction, and the at least one computer-readable instruction is loaded and executed by the processor so that the electronic device implements any of the above-mentioned data reading methods.
[0026] On the other hand, a computer-readable storage medium is provided, in which at least one computer-readable instruction is stored. The at least one computer-readable instruction is loaded and executed by a processor to enable an electronic device to implement any of the above-mentioned data reading methods.
[0027] On the other hand, a computer program product is also provided, wherein at least one computer-readable instruction is stored in the computer program product, and the at least one computer-readable instruction is loaded and executed by a processor to enable an electronic device to implement any of the above-mentioned data reading methods.
[0028] The details of one or more embodiments of the present application are set forth in the accompanying drawings and the description below. Other features, objects, and advantages of the present application will become apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the conventional technology, the following briefly introduces the drawings required for use in the embodiments or the conventional technology descriptions. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without any creative work.
[0030] FIG1 is a schematic diagram of an implementation environment of a data reading method provided in an embodiment of the present application;
[0031] FIG2 is a schematic diagram of data loading of a systolic array provided in an embodiment of the present application;
[0032] FIG3 is a flow chart of a data reading method provided in an embodiment of the present application;
[0033] FIG4 is a schematic diagram of updating a status indicator provided in an embodiment of the present application;
[0034] FIG5 is a schematic diagram of determining whether a sub-request is valid according to an embodiment of the present application;
[0035] FIG6 is a schematic diagram of a data collection process provided in an embodiment of the present application;
[0036] FIG7 is an architecture diagram of a storage system provided in an embodiment of the present application;
[0037] FIG8 is a schematic structural diagram of an arbitration unit provided in an embodiment of the present application;
[0038] FIG9 is a schematic structural diagram of a data reading device provided in an embodiment of the present application;
[0039] FIG10 is a schematic structural diagram of a terminal device provided in an embodiment of the present application;
[0040] FIG11 is a schematic structural diagram of a server provided in an embodiment of the present application;
[0041] FIG12 is an architectural diagram of another storage system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0043] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0044] FIG1 is a schematic diagram of an implementation environment of a data reading method provided in an embodiment of the present application. As shown in FIG1 , the implementation environment includes a terminal device 101 and a server 102. The data reading method in the embodiment of the present application can be executed by the terminal device 101, or by the server 102, or by both the terminal device 101 and the server 102.
[0045] The terminal device 101 can be a smart phone, a game console, a desktop computer, a tablet computer, a laptop computer, a smart TV, a smart car device, an intelligent voice interaction device, a smart home appliance, etc. The server 102 can be a single server, or a server cluster consisting of multiple servers, or any one of a cloud computing platform and a virtualization center, which is not limited in the embodiments of the present application. The server 102 can be connected to the terminal device 101 via a wired network or a wireless network. The server 102 can have functions such as data processing, data storage, and data transmission and reception, which are not limited in the embodiments of the present application. The number of terminal devices 101 and servers 102 is not limited and can be one or more.
[0046] To facilitate understanding of the following optional embodiments, the systolic array is described below in conjunction with Figure 2. Please refer to Figure 2, which is a schematic diagram of data loading of a systolic array provided in an embodiment of the present application.
[0047] A systolic array (Systolic Array) is an array structure whose operation and processes can be compared to the human circulatory system. In a systolic array, data flows rhythmically between its processing engines (PEs) in a predefined pipeline. During this data flow, all processing engines process the data in parallel, enabling systolic arrays to achieve very high parallel processing speeds.
[0048] The systolic array includes M rows and N columns of processing engines, where M and N are both positive integers greater than 1. Optionally, a beat register can be inserted between any two columns of processing engines in the systolic array, and / or a beat register can be inserted between any two rows of processing engines in the systolic array. On the one hand, due to the large size of the systolic array, by inserting the beat register, layout and wiring can be facilitated, which is conducive to physical implementation. On the other hand, since it takes a certain amount of time for the processing engine to process data, and the time required for data to flow through a column of processing engines is less than the time required for data to flow through the entire systolic array, by inserting the beat register, the clock frequency can be increased, the clock cycle can be reduced, and the delay can be reduced. In an exemplary embodiment, the beat register is a first-level beat register. For example, the systolic array shown in Figure 2 includes 8 rows and 8 columns of processing engines, and a beat register is inserted between every two columns of processing engines in the systolic array.
[0049] The electronic device may include a processor, a storage unit, and a systolic array. The electronic device includes a systolic array and a storage unit respectively connected to the processor, and the systolic array includes a weight attribute register. The electronic device can read data from the storage unit and load the data into the systolic array. The embodiment of the present application does not limit the storage unit. Exemplarily, the storage unit is any one of L1 memory, L2 memory, internal disk, etc.
[0050] The embodiments of the present application are applicable to the field of artificial intelligence technology. In the field of artificial intelligence technology, neural network models can be used to extract and classify the features of media information such as images, text, and audio. The essence of how a neural network model processes the features of media information is to calculate the model parameters of the neural network model and the features of the media information. In the embodiments of the present application, the features of the media information belong to feature map (FM) attribute data, and the model parameters of the neural network model belong to weight (WT) attribute data.
[0051] The data in the storage unit includes weight attribute data and feature map attribute data. When the weight attribute data and feature map attribute data are loaded into the systolic array, the loading of the weight attribute data and the loading of the feature map attribute data have a certain timing relationship.
[0052] Taking Figure 2 as an example, an electronic device can read weight attribute data from a storage unit. The read weight attribute data needs to be clocked by a triangularization array, converting the horizontal data into triangular data before inputting it into a systolic array. Because the systolic array includes a clock register, the weight attribute data needs to be clocked by the triangularization array.
[0053] Specifically, the systolic array includes 8 rows and 8 columns of processing engines. In the first clock cycle, the electronic device can load the weight attribute data from the storage unit based on a read request for the weight attribute data, and the weight attribute data is input into the systolic array after passing through the triangulated array. At this time, the weight attribute data is located in the processing engine of the first row of the first column of the systolic array. In the second clock cycle, the electronic device can load the weight attribute data from the storage unit based on a read request for the weight attribute data, and the weight attribute data is input into the systolic array after passing through the triangulated array. At this time, the weight attribute data is located in the processing engines of the first row of the first column, the second row of the first column, and the first row of the second column of the systolic array. Among them, the weight attribute data loaded in the first clock cycle is located in the processing engine of the second row of the first column, and the weight attribute data loaded in the second clock cycle is located in the processing engines of the first row of the first column and the first row of the second column. In the third clock cycle, the electronic device can load the weight attribute data from the storage unit based on the read request for the weight attribute data. The weight attribute data is input into the systolic array after being triangulated. At this time, the weight attribute data is located in the processing engines of the first column, first row to the third row, the second column, first row to the second row, and the third column, first row of the systolic array. The weight attribute data loaded in the first clock cycle is located in the processing engine of the first column, third row; the weight attribute data loaded in the second clock cycle is located in the processing engine of the first column, second row, and second column, second row; the weight attribute data loaded in the third clock cycle is located in the processing engines of the first column, first row, second column, first row, and third column, first row, and so on.
[0054] From the description of the first three clock cycles above, it can be seen that the weight attribute data loaded in the first clock cycle flows from the processing engine in the first column, row, to the processing engine in the first column, row, and then to the processing engine in the first column, row, and then to the processing engine in the first column, row, and then to the processing engine in the second clock cycle. The weight attribute data loaded in the second clock cycle flows from the processing engines in the first column, row, and row, to the processing engines in the first column, row, and row, and then to the processing engines in the second column, row, and then to the processing engines in the first column, row, and row, and then to the processing engines in the first column, row, and row, and then to the processing engines in the second column, row, and row, and then to the processing engines in the first column, row, and row, and then to the processing engines in the second column, row, and row, and then to the processing engines in the third clock cycle. In other words, each clock cycle loads a new row of weight attribute data into the systolic array, and this row of weight attribute data has one more row than the weight attribute data in the previous clock cycle.
[0055] Since each clock cycle causes the weight attribute data already loaded into the systolic array to sink by one row, and a new row of weight attribute data is loaded into the systolic array, with one more column than the weight attribute data from the previous clock cycle, after eight clock cycles, the weight attribute data is located in the processing engines in rows 1 to 8 of column 1, rows 1 to 7 of column 2, rows 1 to 6 of column 3, rows 1 to 5 of column 4, rows 1 to 4 of column 5, rows 1 to 3 of column 6, rows 1 to 2 of column 7, and row 1 of column 8, as shown in the gray processing engines in Figure 2.
[0056] It should be noted that since the systolic array includes M rows and N columns of processing engines, and each clock cycle loads a new row of weight attribute data into the systolic array, and this row of weight attribute data has one more column than the weight attribute data in the previous clock cycle, if a row of N weight attribute data is newly loaded into the systolic array in a certain clock cycle, then a new row of N weight attribute data will be loaded into the systolic array in each clock cycle thereafter. In other words, the number of newly loaded weight attribute data in a clock cycle is no greater than the number of processing engines in a row.
[0057] When all processing engines in the first column of the systolic array are loaded with weight attribute data, the electronic device can read feature map attribute data from the storage unit. During any clock cycle, the electronic device can load feature map attribute data from the storage unit based on a read request for the feature map attribute data. The feature map attribute data flows from the input side (e.g., the left side) of the systolic array to the processing engines in the first column of the systolic array. The weight attribute data residing in the processing engines and the feature map attribute data flowing into the processing engines are calculated by each processing engine in the first column. Optionally, the processing engines perform at least one of multiplication and addition calculations on the weight attribute data and the feature map attribute data.
[0058] Next, a clock cycle ends and enters the next clock cycle of the clock cycle. The next clock cycle of the clock cycle is the current clock cycle at the current time. In the current clock cycle, the electronic device can load the weight attribute data from the storage unit based on the read request for the weight attribute data. The weight attribute data is input into the systolic array after the triangulation array. At this time, the weight attribute data loaded into the systolic array sinks one row, and a new row of weight attribute data is loaded into the systolic array, so that all the processing engines in the first column and all the processing engines in the second column of the systolic array are loaded with weight attribute data. In this case, the feature mapping attribute data loaded in the previous clock cycle flows into the processing engines in the second column of the systolic array. Through each processing engine in the second column, the weight attribute data residing in the processing engine and the feature mapping attribute data flowing into the processing engine are calculated. Furthermore, in the current clock cycle, the electronic device can load the feature map attribute data from the storage unit based on a read request for the feature map attribute data. The feature map attribute data flows from the input side (e.g., the left side) of the systolic array to the first column of processing engines of the systolic array. Each processing engine in the first column then calculates the weight attribute data residing in the processing engine and the feature map attribute data flowing into the processing engine. And so on.
[0059] That is to say, when all the processing engines in the first column of the systolic array are loaded with weight attribute data, in each clock cycle, the weight attribute data loaded into the systolic array sinks one row, and the feature mapping attribute data loaded into the systolic array shifts one column to the right. At the same time, a new row of weight attribute data is loaded into the systolic array, and a new column of feature mapping attribute data is loaded into the systolic array. In addition, the feature mapping attribute data flowing through each processing engine will participate in the calculation together with the weight attribute data flowing through the processing engine. Ultimately, the weight attribute data flows out from the first output side of the systolic array (such as the side adjacent to the input side, specifically the lower side), while the feature mapping attribute data flows out from the second output side of the systolic array (such as the side opposite to the input side, specifically the right side).
[0060] Based on the above, it can be seen that the electronic device needs to load the weight attribute data in the storage unit into the first column processing engine of the systolic array before it can load the feature mapping attribute data in the storage unit into the first column processing engine of the systolic array. It takes at least one clock cycle for the electronic device to load the weight attribute data in the storage unit into the first column processing engine of the systolic array. In addition, only when the weight attribute data residing in the first column processing engine of the systolic array and the feature mapping attribute data flowing into the first column processing engine are calculated, can the electronic device load the weight attribute data in the storage unit into the systolic array again. Based on the above, it can be seen that the loading of weight attribute data and the loading of feature mapping attribute data have a certain timing relationship.
[0061] Because the weight attribute data in the storage unit must be loaded into the first column processing engine of the systolic array after at least one clock cycle, the feature map attribute data in the storage unit can be loaded into the systolic array, and the feature map attribute data in the storage unit can only be loaded into the systolic array again after the weight attribute data in the first column processing engine of the systolic array and the feature map attribute data flowing into the first column processing engine are calculated. Therefore, the related art instantiates a queue in the storage unit. When the read data terminal (the port in the storage unit used to input feature map attribute data or weight attribute data to the systolic array) is not capable of receiving data, that is, when the feature map attribute data or weight attribute data in the storage unit cannot be loaded into the systolic array, in response to a read request, data is read from the storage unit and stored in the queue. When the read data terminal is capable of receiving data, that is, when the feature map attribute data or weight attribute data in the storage unit can be loaded into the systolic array, data is retrieved from the queue and sent to the systolic array through the read data terminal.
[0062] Since the data in the storage unit includes weight attribute data and feature mapping attribute data, it is necessary to instantiate queues corresponding to the weight attribute data and queues corresponding to the feature mapping attribute data. Due to the existence of read latency, the depth of the queue needs to be greater than or equal to the read latency. For example, if the read latency is 10 clock cycles, the depth of the queue must be at least 10 to avoid data loss. As the amount of processed data increases, the read latency will also increase, causing the two queues to occupy a large amount of storage resources, resulting in a large chip area.
[0063] The embodiment of the present application provides a data reading method, which can be applied in the above-mentioned implementation environment and can reduce the chip area. Taking the flowchart of a data reading method provided by the embodiment of the present application shown in Figure 3 as an example, for the convenience of description, the terminal device 101 or server 102 that executes the data reading method in the embodiment of the present application is referred to as an electronic device. The method can be executed by an electronic device, specifically, by a processor of the electronic device. The electronic device also includes a systolic array and a storage unit respectively connected to the processor, and the systolic array includes a weight attribute register. As shown in Figure 3, the method includes the following steps.
[0064] Step 301: Obtain a first weight read request and a first feature map read request, wherein the first weight read request is used to request to read weight attribute data from a storage unit, and the first feature map read request is used to request to read feature map attribute data from a storage unit.
[0065] The data reading method of the embodiment of the present application is applicable to the field of artificial intelligence technology, and in the field of artificial intelligence technology, the features of media information are often processed through neural network models. Among them, the weight attribute data belongs to the model parameters of the neural network model, and specifically can be a layer in the neural network model, which characterizes the contribution of the variable corresponding to the weight attribute data to the calculation result of the layer. The neural network model can be a feature extraction model for extracting features from media information, or the neural network model can also be a classification model for classifying media information. The feature mapping attribute data belongs to the features of the media information. In an exemplary embodiment, the media information includes at least one of images, text, audio, etc., that is, the feature mapping attribute data belongs to at least one of image features, text features or audio features.
[0066] The electronic device can obtain a first weight read (wt_rd) request in any clock cycle, and the first weight read request is used to read weight (wt) attribute data. In addition, the electronic device can obtain a first feature map read (fm_rd) request in any clock cycle, and the first feature map read request is used to read feature map (fm) attribute data.
[0067] The embodiment of the present application does not limit the order of the first weighted read request and the first feature mapping read request. That is, the first weighted read request and the first feature mapping read request can be obtained at the same time, the first weighted read request can be obtained first, and then the first feature mapping read request can be obtained, or the first feature mapping read request can be obtained first and then the first weighted read request.
[0068] Step 302: Obtain a reference state identifier, wherein the reference state identifier is used to represent the state of a weight attribute register in the systolic array after a preset running time from the current time, and the weight attribute register is used to store weight attribute data.
[0069] Optionally, the electronic device includes an arbiter unit that coordinates the timing relationship between weight attribute data and feature map attribute data by maintaining a reference state register. The reference state register can be denoted as a weight occupancy (wt_occupy) register, which is used to store a reference state identifier. Optionally, the reference state identifier can be denoted as wt_occupy. The reference state identifier is used to represent the state of the weight attribute register in the systolic array after a preset elapsed time from the current time, and the weight attribute register is used to store weight attribute data. The preset elapsed time, also known as pre-defined elapsed time, can be a preset duration calculated from a certain point in time. Optionally, the preset elapsed time is the time from the moment when the reference state identifier is determined to satisfy a first preset condition to the moment when the corresponding data enters the systolic array. The time from the moment when the reference state identifier is determined to satisfy the first preset condition to the moment when the corresponding data enters the systolic array can be the same as the time from the moment when the reference state identifier is determined to satisfy a second preset condition to the moment when the corresponding data enters the systolic array. Since the clock frequency is regular, the preset running time can be pre-set.
[0070] Step 303 : When the reference state flag satisfies a first preset condition, the weight attribute data stored in the storage unit is read into the systolic array in response to a first weight read request.
[0071] When the electronic device obtains the reference state identifier from the reference state register, it is equivalent to obtaining the state of the weight attribute register after the preset operation time. The state of the weight attribute register is: the weight attribute register is in a state where the weight attribute register is in a state where the weight attribute data is waiting to be stored, or the weight attribute register is in a state where the weight attribute data has been stored. The systolic array operates regularly at a certain frequency, so it can determine at the current time whether the weight attribute register in the systolic array is in a state where the weight attribute data is waiting to be stored, or has been stored, from the current time to the preset operation time.
[0072] In one possible implementation, if all processing engines in the first column of the systolic array have weight attribute data, the weight attribute register is in a state where the weight attribute data has been stored; if all or some of the processing engines in the first column of the systolic array do not have weight attribute data, the weight attribute register is in a state where weight attribute data is waiting to be stored.
[0073] In another possible implementation, if unused weight attribute data exists for the processing engines in the first column of the systolic array, the weight attribute register is in a state where the weight attribute data has been stored; if unused weight attribute data does not exist for the processing engines in the first column of the systolic array, the weight attribute register is in a state where weight attribute data is pending for storage. If the weight attribute data residing in any processing engine is calculated with the feature map attribute data flowing through that processing engine, the weight attribute data is considered used; if the weight attribute data residing in any processing engine is not calculated with the feature map attribute data flowing through that processing engine, the weight attribute data is considered unused.
[0074] For example, if all or some of the processing engines in the first column of the systolic array do not have weight attribute data, the weight attribute register is in a state of waiting to store weight attribute data. If all of the processing engines in the first column of the systolic array have weight attribute data, and if all or some of the processing engines have unused weight attribute data, the weight attribute register is in a state of having stored weight attribute data; if all of the processing engines have used weight attribute data, the weight attribute register is in a state of waiting to store weight attribute data.
[0075] Based on the state of the weight attribute register after the preset running time, it can be determined whether the reference state flag meets the first preset condition, thereby determining whether the weight attribute data can be loaded into the systolic array.
[0076] In an exemplary embodiment, in step 303, the reference state flag satisfies a first preset condition: the reference state flag indicates that the weight attribute register is in a state ready to store weight attribute data after a preset running time from the current time.
[0077] There are two possibilities that could cause the weight attribute register to be in a state where weight attribute data is pending. The first possibility is that all or some of the processing engines in the first column of the systolic array have never received weight attribute data. The second possibility is that all of the processing engines in the first column of the systolic array have received weight attribute data, but the weight attribute data in all or some of the processing engines has been calculated with the feature map attribute data flowing through the processing engines, causing the weight attribute data in the processing engines to have been used.
[0078] In the event that all or some of the processing engines in the first column of the systolic array do not have weight attribute data, and / or the weight attribute data of all the processing engines in the first column of the systolic array have been used, the electronic device may load the weight attribute data in the storage unit into the systolic array. Based on this principle, when the reference state identifier indicates that the weight attribute register is in a state where weight attribute data is to be stored after a preset running time from the current time, the electronic device determines that the reference state identifier satisfies a first preset condition, so as to read the weight attribute data stored in the storage unit into the systolic array, so that all the processing engines in the first column of the systolic array have weight attribute data, and all or some of the processing engines have unused weight attribute data.
[0079] It is understandable that when the reference state identifier indicates that the weight attribute register is in a state where all weight attribute data has been stored after a preset running time from the current time, it means that all processing engines in the first column of the systolic array have weight attribute data, and all or some of the processing engines have unused weight attribute data. In this case, the electronic device cannot load the weight attribute data in the storage unit into the systolic array. Based on this principle, the electronic device determines that the reference state identifier does not meet the first preset condition. At this time, the electronic device will block the first weight read request.
[0080] Step 304 : When the reference state flag satisfies the second preset condition, in response to the first feature map read request, the feature map attribute data stored in the storage unit is read into the systolic array, and the systolic array is used to perform calculations based on the weight attribute data and the feature map attribute data.
[0081] Step 304 may be performed after step 302. Based on the state of the weight attribute register after the preset running time, it may be determined whether the reference state flag meets the second preset condition, thereby determining whether the feature map attribute data can be loaded into the systolic array.
[0082] In some embodiments, performing calculations based on the weight attribute data and the feature map attribute data specifically includes: determining a relationship between the weight attribute data and the feature map attribute data according to the structure of the neural network model, and then organizing the weight attribute data and the feature map attribute data to participate in the calculation of the neural network model based on the relationship between the weight attribute data and the feature map attribute data, to obtain a calculation result. The calculation result can be an intermediate calculation result or a final output result of the neural network model.
[0083] In some embodiments, the relationship between the weight attribute data and the feature map attribute data can be such that the weight attribute data and the feature map attribute data are respectively used as input data for a specific function in the neural network model, and the output data of the function is a calculation result obtained by calculating the weight attribute data and the feature map attribute data. The relationship between the weight attribute data and the feature map attribute data can be a dot product multiplication relationship.
[0084] In an exemplary embodiment, in step 304 , the reference state flag satisfies the second preset condition: the reference state flag indicates that the weight attribute register is in a state where all weight attribute data are stored after a preset running time from the current time.
[0085] If the reference state identifier indicates that the weight attribute register is in a state where all weight attribute data has been stored after a preset run time from the current time, this indicates that all processing engines in the first column of the systolic array have weight attribute data, and all or some of the processing engines have unused weight attribute data. The electronic device can then load the feature mapping attribute data in the storage unit into the systolic array. Based on this principle, when the reference state identifier indicates that the weight attribute register is in a state where all weight attribute data has been stored after a preset run time from the current time, the electronic device determines that the reference state identifier satisfies the second preset condition, so as to facilitate reading the feature mapping attribute data stored in the storage unit into the systolic array, allowing all processing engines in the first column of the systolic array to calculate the weight attribute data residing in the processing engines and the feature mapping attribute data flowing through the processing engines.
[0086] It is understandable that the reference state identifier indicates that after a preset running time from the current time, when the weight attribute register is in a state where weight attribute data is to be stored, it indicates that all or part of the processing engines in the first column of the systolic array do not have weight attribute data, and / or the weight attribute data of all processing engines in the first column of the systolic array have been used. In this case, the electronic device cannot load the feature mapping attribute data in the storage unit into the systolic array. Based on this principle, the electronic device determines that the reference state identifier does not meet the second preset condition. At this time, the electronic device will block the first feature mapping read request.
[0087] When the reference state identifier satisfies a first preset condition, the weight attribute data can be directly read based on the first weight read request, and the first feature map read request can also be shielded. When the reference state identifier satisfies a second preset condition, the feature map attribute data can be directly read based on the first feature map read request, and the first weight read request can also be shielded. By arbitrating the reference state identifier, it is beneficial to establish a timing between the weight attribute data and the feature map attribute data, and facilitate calculations based on the weight attribute data and the feature map attribute data through the systolic array.
[0088] Optionally, before step 304, steps 306 to 307 as shown below are also included (not shown in FIG. 3 ).
[0089] Step 306 : Obtain a first state flag, where the first state flag indicates whether the weight attribute register has stored weight attribute data for a set number of clock cycles after a preset running time from the current time.
[0090] In an embodiment of the present application, the reference state identifier can be arbitrated by an arbitration unit, and when the reference state identifier meets the first preset condition, the weight attribute data is read based on the first weight read request, or when the reference state identifier does not meet the first preset condition, the first weight read request is shielded.
[0091] Based on this, the arbitration unit can maintain a first state register and store the first state identifier through the first state register. When the first weighted read request of any clock cycle arrives at the arbitration unit, if the clock cycle is a set number of clock cycles, the first state identifier is set to the third value; if the clock cycle is not a set number of clock cycles, the first state identifier is set to the fourth value. It can be understood that the value of the first state identifier is the third value only within the set number of clock cycles, and the value within other clock cycles is the fourth value. Optionally, the first state identifier can be recorded as wt_last_beat.
[0092] When the first state flag is set from the third value to the fourth value, it indicates that after the preset running time from the current time, the weight attribute register has finished storing the weight attribute data for the set number of clock cycles. When the first state flag is set from the fourth value to the third value, it indicates that after the preset running time from the current time, the weight attribute register has started to store the weight attribute data for the set number of clock cycles.
[0093] The embodiment of the present application does not limit the magnitude of the third value and the fourth value. For example, the third value is 1 and the fourth value is 0.
[0094] Step 307, in response to the first state identification indicating that the weight attribute register has stored the weight attribute data for a set number of clock cycles after the preset running time from the current time, it is determined that the reference state identification indicates that the weight attribute register is in a state of storing the weight attribute data after the preset running time from the current time.
[0095] When the first state identifier is set from the third value to the fourth value, it indicates that the weight attribute register has stored the weight attribute data of the set number of clock cycles after the preset running time, that is, the weight attribute register is in a state of storing the weight attribute data after the preset running time. In this case, the electronic device sets the reference state identifier from the first value to the second value. When the reference state identifier is the first value, it indicates that the weight attribute register is in a state of waiting to store the weight attribute data after the preset running time; when the reference state identifier is the second value, it indicates that the weight attribute register is in a state of storing the weight attribute data after the preset running time. The embodiment of the present application does not limit the size of the first value and the second value. For example, the first value is 0 and the second value is 1.
[0096] Please refer to Figure 4, which is a schematic diagram of updating a state identifier provided in an embodiment of the present application. As can be seen from Figure 4, when the first state identifier is set from 1 (i.e., the third value) to 0 (i.e., the fourth value), the reference state identifier is set from 0 (i.e., the first value) to 1 (i.e., the second value).
[0097] In an exemplary embodiment, the method further includes steps 308 and 309 (not shown in FIG. 3 ). Optionally, steps 308 and 309 may be performed after step 307 .
[0098] Step 308 : Obtain a second state flag, where the second state flag indicates whether the weight attribute data in the weight attribute register is calculated with the feature mapping attribute data of the first clock cycle after a preset running time from the current time.
[0099] After the feature mapping read request of any clock cycle passes through the arbitration unit, if the second preset condition is met, the feature mapping attribute data corresponding to the feature mapping read request is calculated through the pulsation array and the weight attribute data stored in the weight attribute register after the preset running time. Based on this, the arbitration unit can maintain a second state register, and store the second state identifier through the second state register. When the feature mapping read request of any clock cycle reaches the arbitration unit, if the clock cycle is the first clock cycle, the second state identifier is set to the fifth value, and if the clock cycle is not the first clock cycle, the second state identifier is set to the sixth value. It can be understood that the value of the second state identifier is the fifth value only in the first clock cycle, and the value in other clock cycles is the sixth value. Optionally, the second state identifier can be recorded as fm_update_first_beat.
[0100] When the second state flag is set from the fifth value to the sixth value, it indicates that the weight attribute data in the weight attribute register and the feature map attribute data of the first clock cycle have completed calculation after the preset running time from the current time. When the second state flag is set from the sixth value to the fifth value, it indicates that the weight attribute data in the weight attribute register and the feature map attribute data of the first clock cycle have started calculation.
[0101] The embodiment of the present application does not limit the magnitude of the fifth value and the sixth value. For example, the fifth value is 1 and the sixth value is 0.
[0102] Step 309, when the second state identification represents that the weight attribute data in the weight attribute register and the feature mapping attribute data of the first clock cycle are calculated after the preset running time from the current time, it is determined that the reference state identification represents that the weight attribute register is in a state of waiting to store weight attribute data after the preset running time from the current time.
[0103] When the second state flag is set from the fifth value to the sixth value, it indicates that the weight attribute data in the weight attribute register and the feature mapping attribute data of the first clock cycle have completed calculation after the preset running time. In this case, the electronic device sets the reference state flag from the second value to the first value. As can be seen from Figure 4, when the second state flag is set from 1 (i.e., the fifth value) to 0 (i.e., the sixth value), the reference state flag is set from 1 (i.e., the second value) to 0 (i.e., the first value).
[0104] In summary, the initial value of the reference state flag is the first value, indicating that after a preset run time from the current time, the weight attribute register is in a state where weight attribute data is to be stored. In this case, the reference state flag satisfies the first preset condition. Therefore, the weight attribute data stored in the storage unit can be read into the systolic array in response to the first weight read request. If the first feature map read request is obtained, the first feature map read request is blocked. This process continues for several clock cycles until the reference state flag is set from the first value to the second value.
[0105] Since the reference state identifier is the second value, it can be represented that the weight attribute register is in a state where the weight attribute data is stored. In this case, the reference state identifier satisfies the second preset condition. Therefore, within one clock cycle, the feature mapping attribute data stored in the storage unit can be read to the systolic array in response to the first feature mapping read request. If the first weight read request is obtained, the first weight read request is shielded. After the clock cycle, the reference state identifier is set from the second value to the first value. Next, implementation method A or implementation method B is executed.
[0106] In implementation A, the reference state identifier is a first value. In the next clock cycle, the weight attribute data stored in the storage unit can be read into the systolic array in response to the first weight read request, and the first feature map read request is shielded. After this clock cycle, the reference state identifier is set from the first value to the second value. In the next clock cycle, the feature map attribute data stored in the storage unit can be read into the systolic array in response to the first feature map read request, and the first weight read request is shielded. After this clock cycle, the reference state identifier is set from the second value to the first value. This process is repeated until the reading stops.
[0107] In implementation B, the reference state identifier is the first value. Next, steps 310 to 311 are executed (not shown in FIG3 ). Steps 310 to 311 can be executed after step 304 or after the reference state identifier is set from the second value to the first value.
[0108] Step 310: Obtain a second weight read request and a second feature map read request, where the second weight read request is used to request reading weight attribute data from a storage unit, and the second feature map read request is used to request reading feature map attribute data from a storage unit.
[0109] The electronic device may also obtain a second weighted read request in any clock cycle, where the second weighted read request is used to read the wt attribute data. The electronic device may also obtain a second feature map read request in any clock cycle, where the second feature map read request is used to read the fm attribute data. The electronic device may obtain the second weighted read request and the second feature map read request simultaneously, or may obtain the second weighted read request first and then the second feature map read request, or may obtain the second feature map read request first and then the second weighted read request.
[0110] Step 311: Based on the second weight read request, the weight attribute data stored in the storage unit is read into the systolic array; based on the second feature map read request, the feature map attribute data stored in the storage unit is read into the systolic array; the read delay of the weight attribute data and the read delay of the feature map attribute data are preset runtimes.
[0111] Since the read delay of the weight attribute data and the read delay of the feature mapping attribute data are both preset running times, that is, the read delay of the weight attribute data and the read delay of the feature mapping attribute data are equal. Therefore, every time the weight attribute data of one clock cycle is loaded into the systolic array, correspondingly, there will be one clock cycle of feature mapping attribute data flowing into the systolic array and calculated with the weight attribute data residing in the systolic array, so that the timing relationship between the weight attribute data and the feature mapping attribute data is maintained. Based on this, there is no need to determine whether the reference state identifier meets the first preset condition or the second preset condition, and the weight attribute data stored in the storage unit can be directly read into the systolic array based on the second weight read request, and the feature mapping attribute data stored in the storage unit can be read into the systolic array based on the second feature mapping read request.
[0112] Since the timing relationship between the weight attribute data and the feature map attribute data can be maintained when the read delay of the weight attribute data is equal to the read delay of the feature map attribute data, there is no need to introduce a queue to store the data, which reduces the storage resources required for the queue and helps to reduce the chip area. In addition, there is no need to determine whether the reference state identifier meets the first preset condition or the second preset condition. The corresponding data is read directly based on the second weight read request or the second feature map read request, which can achieve efficient switching between the weight read request and the feature map read request, speed up data reading efficiency, and reduce calculation time.
[0113] In an embodiment of the present application, a first weighted read request includes at least one first weighted sub-request, and a storage unit includes at least one first storage block. For example, a first weighted read request includes four first weighted sub-requests, respectively denoted as req0 to req3, and a storage unit includes four first storage blocks, respectively denoted as bg0 to bg3.
[0114] In step 303 , “reading the weight attribute data stored in the storage unit to the systolic array in response to the first weight read request” includes steps 3031 to 3032 as shown below (not shown in FIG. 3 ).
[0115] Step 3031: For any first weight sub-request, if any first weight sub-request is a valid request, determine the first storage block corresponding to any first weight sub-request, and read the weight attribute data corresponding to any first weight sub-request from the first storage block corresponding to any first weight sub-request.
[0116] The electronic device may directly determine any first weighted sub-request as a valid request, or may compare any first weighted sub-request with a reference first weighted sub-request and determine whether any first weighted sub-request is a valid request based on the comparison result.
[0117] In an exemplary embodiment, "determining any first weight sub-request as a valid request" in step 3031 includes: extracting the address of the first storage block corresponding to any first weight sub-request from any first weight sub-request; in response to the address of the first storage block corresponding to any first weight sub-request being different from the address of the first storage block corresponding to the reference first weight sub-request, determining that any first weight sub-request is a valid request, and the reference first weight sub-request is at least one first weight sub-request among multiple first weight sub-requests other than any first weight sub-request.
[0118] Any first weighted sub-request includes an identification bit and an address (Address, Addr), wherein the identification bit is used to indicate that the first weighted sub-request is a valid request, and the address is the storage address of the data corresponding to the first weighted sub-request.
[0119] In an embodiment of the present application, it is necessary to read the data corresponding to any first weight sub-request from the storage unit. Since the storage unit includes at least one first storage block, any first weight sub-request includes the address of the first storage block to realize reading the weight attribute data corresponding to the first weight sub-request from the first storage block.
[0120] It is understandable that any first-weighted sub-request corresponds to the address of a first storage block, and any two first-weighted sub-requests may correspond to the same first storage block address or to different first storage block addresses. Based on this, it is necessary to determine whether two first-weighted sub-requests correspond to the same first storage block address.
[0121] Optionally, since any first weighted sub-request includes the address of the first storage block, the address of the corresponding first storage block can be extracted from the first weighted sub-request. The address of the first storage block corresponding to any first weighted sub-request is compared with the address of the first storage block corresponding to the reference first weighted sub-request. If the comparison result shows that the two addresses are different, then any first weighted sub-request is determined to be a valid request; if the comparison result shows that the two addresses are the same, then any first weighted sub-request is determined to be an invalid request.
[0122] The number of reference first-weight sub-requests is at least one. In the case of at least two reference first-weight sub-requests, if the address of the first storage block corresponding to any first-weight sub-request is different from the address of the first storage block corresponding to each reference first-weight sub-request, then any first-weight sub-request is determined to be an invalid request; if the address of the first storage block corresponding to any reference first-weight sub-request is the same as the address of the first storage block corresponding to any first-weight sub-request, then any first-weight sub-request is determined to be an invalid request.
[0123] The embodiments of the present application do not limit the method for determining the reference first weighted sub-request. In an exemplary embodiment, each first weighted sub-request other than any first weighted sub-request among the multiple first weighted sub-requests may be used as the reference first weighted sub-request, or each first weighted sub-request before (or after) any first weighted sub-request among the multiple first weighted sub-requests may be used as the reference first weighted sub-request.
[0124] Please refer to Figure 5, which is a schematic diagram of determining whether a sub-request is valid provided in an embodiment of the present application. In an embodiment of the present application, the first weighted read request includes four first weighted sub-requests, which are respectively denoted as sub-request 0 to sub-request 3. For any first weighted sub-request, the first weighted sub-request includes an identification bit for indicating that the first weighted sub-request is valid and an address for storing data corresponding to the first weighted sub-request. All or part of the address included in any first weighted sub-request is the address of the first storage block. For example, Figure 5 shows that sub-requests 0 to 3 all include an identification bit and an address indicating "valid", and part of the address is the address of the corresponding first storage block.
[0125] For sub-request 0, the electronic device may directly determine whether sub-request 0 is valid. For example, the electronic device may directly determine that sub-request 0 is a valid request.
[0126] For sub-request 1, the electronic device can compare the address of the first storage block corresponding to sub-request 0 with the address of the first storage block corresponding to sub-request 1. When the comparison result is different (wherein, "!=" is an operation symbol in a computer, indicating that the two variables are not equal), and the flag bit of sub-request 1 indicates "valid", the comparison result and the flag bit are logically ANDed to obtain that sub-request 1 is valid. Among them, for the logical AND operation, the operation result is determined to be true when both operands are true. In an embodiment of the present application, when the comparison result is different, the operand corresponding to the comparison result indicates that sub-request 1 is "valid", which is equivalent to true. In addition, the flag bit of sub-request 1 indicates that sub-request 1 is "valid", which is equivalent to true. Therefore, the operation result is true, that is, the operation result is that sub-request 1 is "valid".
[0127] It is understood that if the comparison results are identical and the flag bit of subrequest 1 indicates that subrequest 1 is "valid," a logical AND operation is performed on the comparison result and the flag bit to determine that subrequest 1 is invalid. If the comparison results are identical, the operand corresponding to the comparison result indicates that subrequest 1 is "invalid."
[0128] For subrequest 2, based on principles similar to subrequest 1, the address of the first storage block corresponding to subrequest 2 can be compared with the addresses of the first storage blocks corresponding to subrequests 0 and 1. If the comparison result is different and the flag bit of subrequest 2 indicates "valid", a logical AND operation is performed on the comparison result and the flag bit to determine that subrequest 2 is valid. If the comparison result is the same and the flag bit of subrequest 2 indicates "valid", a logical AND operation is performed on the comparison result and the flag bit to determine that subrequest 2 is invalid.
[0129] For subrequest 3, based on principles similar to subrequest 1, the address of the first storage block corresponding to subrequest 3 can be compared with the addresses of the first storage blocks corresponding to subrequests 0, 1, and 2. If the comparison result is different and the flag bit of subrequest 3 indicates "valid," a logical AND operation is performed on the comparison result and the flag bit, indicating that subrequest 3 is valid. If the comparison result is the same and the flag bit of subrequest 3 indicates "valid," a logical AND operation is performed on the comparison result and the flag bit, indicating that subrequest 3 is invalid.
[0130] Optionally, for any first-weighted sub-request, when the flag bit of the first-weighted sub-request is the seventh value, the flag bit of the first-weighted sub-request is determined to indicate "valid", and when the flag bit of the first-weighted sub-request is the eighth value, the flag bit of the first-weighted sub-request is determined to indicate "invalid". This embodiment of the application does not limit the seventh and eighth values. In an exemplary embodiment, the seventh value is 1 and the eighth value is 0.
[0131] Since any first weight sub-request includes the address of the first storage block, based on the address of the first storage block included in any first weight sub-request, the first storage block corresponding to the first weight sub-request can be determined, and the data corresponding to the first weight sub-request can be read from the first storage block.
[0132] In an exemplary embodiment, any first storage block includes at least one second storage block. For example, first storage block 0 includes second storage blocks 0 and 1, first storage block 1 includes second storage blocks 0 and 1, first storage block 2 includes second storage blocks 0 and 1, and first storage block 3 includes second storage blocks 0 and 1. Since a first storage block includes at least one second storage block, the second storage block can be denoted as a storage module (Bank), and the first storage block can be denoted as a storage module group (Bank Group).
[0133] In step 3031, "reading the weight attribute data corresponding to any first weight sub-request from the first storage block corresponding to any first weight sub-request" includes: determining the second storage block corresponding to any first weight sub-request based on any first weight sub-request; reading the weight attribute data corresponding to any first weight sub-request from the second storage block corresponding to any first weight sub-request.
[0134] Since any first weight sub-request includes the address of a first storage block, and the first storage block includes at least one second storage block, any first weight sub-request may include the address of a second storage block. Based on the address of the second storage block included in any first weight sub-request, the second storage block corresponding to the first weight sub-request may be determined, and the weight attribute data corresponding to the first weight sub-request may be read from the second storage block.
[0135] Step 3032: Send the weight attribute data corresponding to each first weight sub-request to the systolic array.
[0136] Since the electronic device needs to determine whether each first weight sub-request in the first weight read request is a valid request, and can only read the data corresponding to the first weight sub-request if the first weight sub-request is a valid request, there are differences in the reading completion time of the data corresponding to each first weight sub-request. The data corresponding to each first weight sub-request can be collected by a collection unit. After the collection unit collects the data corresponding to each first weight sub-request, according to the export command (for example, the reg command), the data corresponding to each first weight sub-request is exported to the storage unit as the weight attribute data corresponding to the first weight read request, thereby sending the weight attribute data to the systolic array.
[0137] Please refer to Figure 6, which is a schematic diagram of a data collection process provided by an embodiment of the present application. In the embodiment of the present application, the first weighted read request includes four first weighted sub-requests, namely sub-requests 0 to 3. At time T0, the collection unit did not collect the data corresponding to any of the first weighted sub-requests, at time T1, the collection unit collected the data corresponding to sub-requests 0 and 1, at time T2, the collection unit collected the data corresponding to sub-requests 0 to 2, and at time T3, the collection unit collected the data corresponding to sub-requests 0 to 3. In this case, according to the export command, the data corresponding to sub-requests 0 to 3 are exported to the storage unit as the weight attribute data corresponding to the first weighted read request.
[0138] It should be noted that the first feature mapping read request includes at least one first feature mapping sub-request, the second weighted read request includes at least one second weighted sub-request, and the second feature mapping read request includes at least one second feature mapping sub-request. Regarding the implementation methods of "reading the feature mapping attribute data stored in the storage unit into the systolic array in response to the first feature mapping read request," "reading the weighted attribute data stored in the storage unit into the systolic array based on the second weighted read request," and "reading the feature mapping attribute data stored in the storage unit into the systolic array based on the second feature mapping read request," please refer to the description of steps 3031 to 3032 above. The implementation methods of the two are similar and will not be repeated here.
[0139] In an exemplary embodiment, the method further includes steps 312 to 313 (not shown in FIG. 3 ).
[0140] Step 312: Get a write request.
[0141] The electronic device can obtain a write request at any clock cycle, and the write request is used to write weight attribute data or feature map attribute data into the storage unit. It is understood that the write request can be a data move write (write, wr) request based on direct memory access (Direct Memory Access, DMA), which is used to move data from other storage to the storage unit. Therefore, the write request can be recorded as a dma_wr request.
[0142] Step 313: Write the corresponding weight attribute data or feature map attribute data into the storage unit based on the write request.
[0143] Optionally, the write request includes at least one third sub-request, and the storage unit includes at least one first storage block. For example, the write request includes four third sub-requests, and the storage unit includes four first storage blocks.
[0144] In this case, step 313 includes: for any third sub-request, determining the first storage block corresponding to any third sub-request; and writing the data corresponding to any third sub-request into the first storage block corresponding to any third sub-request based on any third sub-request.
[0145] In an embodiment of the present application, any third sub-request includes the address of the first storage block. Therefore, based on the address of the first storage block included in any third sub-request, the first storage block corresponding to the third sub-request can be determined, and the weight attribute data or feature mapping attribute data corresponding to the third sub-request can be written into the first storage block corresponding to the third sub-request.
[0146] In an exemplary embodiment, any first storage block includes at least one second storage block. In this case, "writing data corresponding to any third sub-request into the first storage block corresponding to any third sub-request based on any third sub-request" includes: determining the second storage block corresponding to any third sub-request based on any third sub-request; and writing the data corresponding to any third sub-request into the second storage block corresponding to any third sub-request.
[0147] Because any third sub-request includes the address of a first storage block, and the first storage block includes at least one second storage block, any third sub-request may include the address of a second storage block. Based on the address of the second storage block included in any third sub-request, the second storage block corresponding to the third sub-request may be determined, and the data corresponding to the third sub-request may be written into the second storage block corresponding to the third sub-request.
[0148] Since the electronic device can receive not only write requests, but also feature map read requests and weight read requests, the priorities of various requests can be coordinated by the scheduler. Optionally, the scheduler is a strict priority (SP) scheduler.
[0149] Since the weight attribute data and the feature mapping attribute data have a certain timing relationship, generally, after the weight attribute data is loaded into the first column processing engine of the systolic array, the feature mapping attribute data needs to be loaded into the systolic array first, so as to calculate the feature mapping attribute data flowing through the systolic array and the weight attribute data residing in the systolic array before the weight attribute data can be loaded into the systolic array again. Based on the above content, the priority of the (first or second) weight read request is lower than the priority of the (first or second) feature mapping read request, wherein the priority of the write request can be higher than the priority of the weight read request, or lower than the priority of the weight read request, and can be higher than the priority of the feature mapping read request, or lower than the priority of the feature mapping read request. Exemplarily, the priority of the feature mapping read request is higher than the priority of the weight read request, and the priority of the weight read request is higher than the priority of the write request.
[0150] The scheduler coordinates the priorities of various requests so that data can be read and written in an orderly manner, achieving efficient switching between multiple requests and improving data processing efficiency.
[0151] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant region. For example, the first data, second data, third data, etc. involved in this application are all obtained with full authorization.
[0152] The above method characterizes the state of the weight attribute register in the systolic array through a reference state identifier. When the reference state identifier satisfies a first preset condition, the weight attribute data stored in the storage unit is read to the systolic array in response to a first weight read request; when the reference state identifier satisfies a second preset condition, the feature mapping attribute data stored in the storage unit is read to the systolic array in response to a first feature mapping read request. Compared with the storage resources required for the queue, the storage resources required for the reference state identifier are fewer. This method can be applied to chips. Since the fewer the storage resources, the smaller the chip area, the chip has the conditions to reduce the chip area.
[0153] The above describes the data reading method of the embodiment of the present application from the perspective of method steps. The following is a systematic and comprehensive explanation. Please refer to Figure 7, which is an architectural diagram of a storage system provided by an embodiment of the present application. The storage system includes a conflict detection unit, a hash unit, at least one processing block, and a collection unit. Each processing block includes an arbitration unit, at least one second storage block, and a selection unit.
[0154] It should be noted that FIG7 does not show the storage unit and the first storage block. In the embodiment of the present application, a first storage block includes each second storage block in a processing block, that is, one processing block corresponds to one first storage block, and the storage unit includes each first storage block. As shown in FIG7 , the storage unit includes the first storage block corresponding to processing block 0, the first storage block corresponding to processing block 1, the first storage block corresponding to processing block 2, and the first storage block corresponding to processing block 3. The first storage block corresponding to processing block 0 includes the second storage blocks 0 and 1 in processing block 0; the first storage block corresponding to processing block 1 includes the second storage blocks 0 and 1 in processing block 1; the first storage block corresponding to processing block 2 includes the second storage blocks 0 and 1 in processing block 2; the first storage block corresponding to processing block 3 includes the second storage blocks 0 and 1 in processing block 3.
[0155] In an embodiment of the present application, the electronic device can read feature mapping attribute data from a storage unit based on a feature mapping read request, and can also read weight attribute data from a storage unit based on a weight read request. The processing method for feature mapping read requests in the embodiment of the present application is similar to the processing method for weight read requests. Therefore, the processing method for feature mapping read requests in the embodiment of the present application is described below using feature mapping read requests as an example.
[0156] After the electronic device obtains the feature mapping read request (corresponding to the first feature mapping read request and the second feature mapping read request), it performs conflict detection on the feature mapping read request through the conflict detection unit, wherein the principle of conflict detection is shown in Figure 5. In the embodiment of the present application, the feature mapping read request includes sub-requests 0 to 3. For sub-request 0, sub-request 0 is directly determined to be valid; for sub-request 1, when the address of the first storage block corresponding to sub-request 0 is different from the address of the first storage block corresponding to sub-request 1, sub-request 1 is determined to be valid, otherwise, sub-request 1 is determined to be invalid; for sub-request 2, when the addresses of the first storage blocks corresponding to sub-requests 0 and 1 are different from the address of the first storage block corresponding to sub-request 2, sub-request 2 is determined to be valid, otherwise, sub-request 2 is determined to be invalid; for sub-request 3, when the addresses of the first storage blocks corresponding to sub-requests 0 to 2 are different from the address of the first storage block corresponding to sub-request 3, sub-request 3 is determined to be valid, otherwise, sub-request 3 is determined to be invalid.
[0157] After performing conflict detection on a feature map read request, it is possible to determine whether each sub-request included in the feature map read request is valid. For any sub-request, if the sub-request is valid, the hash unit determines the first storage block corresponding to the sub-request based on the address of the first storage block corresponding to the sub-request, and sets the request path of the processing block where the first storage block corresponding to the sub-request is located to be valid, so that the sub-request can reach the corresponding first storage block. If the sub-request is invalid, the hash unit sets the request path of the processing block where the first storage block corresponding to the sub-request is located to be invalid, preventing the sub-request from reaching the corresponding first storage block.
[0158] For example, subrequest 0 corresponds to first storage block 0, and processing block 0 includes first storage block 0. If subrequest 0 is valid, the hash unit sets the request path of processing block 0 to be valid, so that subrequest 0 can reach first storage block 0. If subrequest 0 is invalid, the hash unit sets the request path of processing block 0 to be invalid, preventing subrequest 0 from reaching first storage block 0.
[0159] In an embodiment of the present application, the storage system includes at least one processing block, each processing block including an arbitration unit, a first storage block (not shown), and a selection unit, wherein the first storage block includes at least one second storage block. A schematic diagram of the structure of the arbitration unit can be seen in FIG8 .
[0160] For any sub-request of the feature map read request, after the sub-request is input into the corresponding processing block, the sub-request is first arbitrated by the arbitration unit. As shown in Figure 8, the arbitration unit is configured with the update logic of the reference state flag, which is shown in Figure 4.
[0161] Specifically, the initial values of the reference state identifier, the first state identifier, and the second state identifier are all 0. In the first clock cycle, the electronic device can read the weight attribute data from the storage unit, and load it into the weight attribute register of the systolic array after the preset running time. If the weight attribute register is in a state of waiting to store the weight attribute data after the preset running time, then in the second clock cycle, the electronic device can also read the weight attribute data from the storage unit, and load it into the weight attribute register of the systolic array after the preset running time. This loading method will continue for several clock cycles until the weight attribute register is in a state of storing the weight attribute data after the preset running time. The clock cycle at this time can be recorded as the set number of clock cycles. That is to say, in the set number of clock cycles, the electronic device reads the weight attribute data from the storage unit, and loads it into the weight attribute register of the systolic array after the preset running time. At this time, the weight attribute register is in a state of storing the weight attribute data.
[0162] When a sub-request of a weight read request corresponding to a set number of clock cycles flows into the arbitration unit, the first state flag may be set from 0 to 1, and when the sub-request flows out of the arbitration unit, the first state flag may be set from 1 to 0. When the first state flag is set from 1 to 0, it may indicate that after a preset running time, the weight attribute register has completed storing weight attribute data for the set number of clock cycles. At this time, the reference state flag is set from 0 to 1.
[0163] When the weight attribute register has stored the weight attribute data for a set number of clock cycles, it is considered to be in a state where the weight attribute register has stored all the weight attribute data. In this case, the electronic device can read the feature map attribute data from the storage unit at any clock cycle. After a preset runtime, the feature map attribute data flows into the systolic array and is calculated with the weight attribute data in the weight attribute register. This clock cycle is the first clock cycle for reading the feature map attribute data.
[0164] When a sub-request of the feature map read request corresponding to the first clock cycle flows into the arbitration unit, the second state flag can be set from 0 to 1. When the sub-request flows out of the arbitration unit, the second state flag can be set from 1 to 0. When the second state flag is set from 1 to 0, it can be indicated that the weight attribute data of the weight attribute register after the preset running time and the feature map attribute data of the first clock cycle are calculated. At this time, the reference state flag is set from 1 to 0.
[0165] In summary, the reference state identifier is first set from 0 to 1, and then from 1 to 0. When any sub-request of the feature mapping read request is arbitrated by the arbitration unit, the reference state identifier can be obtained. If the reference state identifier is equal to 1, it is determined that the sub-request meets the second preset condition, and the second storage block to which the sub-request belongs is determined based on the address carried by the sub-request, and the sub-request is sent to the corresponding second storage block through the scheduler; if the reference state identifier is equal to 0, it is determined that the sub-request does not meet the second preset condition, and the sub-request is shielded. For example, if the sub-request meets the second preset condition and the sub-request belongs to the second storage block 0, the sub-request is sent to the second storage block 0 through the scheduler; if the sub-request meets the second preset condition and the sub-request belongs to the second storage block 1, the sub-request is sent to the second storage block 1 through the scheduler.
[0166] Next, the selection unit, based on any sub-request of the feature map read request, reads the data corresponding to the sub-request from the second storage block corresponding to the sub-request. The collection unit collects the data corresponding to each sub-request. This collection process is described in FIG6 and will not be further described here. Once the collection unit has collected the data corresponding to each sub-request of the feature map read request, it has collected the feature map attribute data corresponding to the feature map read request. This feature map attribute data is then input into the systolic array via an export command.
[0167] It is understandable that when the arbitration unit arbitrates the various sub-requests of the feature mapping read request of one clock cycle, the arbitration results of the various sub-requests are the same. Based on this, after the arbitration unit arbitrates the feature mapping read request of one clock cycle, the feature mapping read request can be input into the conflict detection unit for the above-mentioned processing. In this case, the arbitration unit can be used to arbitrate the various sub-requests of the feature mapping read request in the processing block, or the processing block may not include the arbitration unit. In other words, the hash unit can be used to directly send the various sub-requests of the feature mapping read request to the corresponding second storage block, or the hash unit can be used to directly send the various sub-requests of the feature mapping read request to the corresponding scheduler, and then sent to the corresponding second storage block after being scheduled by the scheduler.
[0168] Following the aforementioned processing method for feature map read requests, weighted read requests can be similarly processed. Specifically, when the arbitration unit arbitrates any sub-request of a weighted read request, if the reference state flag is equal to 0, the sub-request is determined to meet the first preset condition, the second storage block to which the sub-request belongs is determined based on the address carried by the sub-request, and the sub-request is sent to the corresponding second storage block via the scheduler. If the reference state flag is equal to 1, the sub-request is determined to not meet the first preset condition, and the sub-request is blocked.
[0169] Normally, the arbitration unit will determine that the sub-request of the weighted read request (corresponding to the first weighted read request) meets the first preset condition in each clock cycle of several clock cycles. As time goes by, when the arbitration unit determines that the sub-request of the weighted read request does not meet the first preset condition, the arbitration unit can determine that the sub-request of the feature mapping read request (corresponding to the first feature mapping read request) meets the second preset condition. Once the arbitration unit determines that the sub-request of the feature mapping read request meets the second preset condition, when the read delay of the weight attribute data and the read delay of the feature mapping attribute data are the same, the subsequent reading of the weight attribute data and the reading of the feature mapping attribute data can be performed without the arbitration of the arbitration unit, that is, the subsequent sub-requests of the weighted read request (corresponding to the second weighted read request) and the sub-requests of the feature mapping read request (corresponding to the second feature mapping read request) can be performed without the arbitration of the arbitration unit. This is because the read latency of the weight attribute data and the read latency of the feature mapping attribute data are both reference time periods. Therefore, every time the weight attribute data of one clock cycle is loaded into the systolic array, correspondingly, the feature mapping attribute data of one clock cycle will flow into the systolic array and be calculated with the weight attribute data residing in the systolic array, so that the timing relationship between the weight attribute data and the feature mapping attribute data is maintained. Therefore, there is no need for arbitration by the arbitration unit.
[0170] In an embodiment of the present application, the electronic device can write feature mapping attribute data and weight attribute data into a storage unit based on a write request. The following describes how to process the write request.
[0171] A write request includes at least one sub-request (corresponding to a third sub-request). For any sub-request, a hash unit determines the first storage block corresponding to the sub-request based on the address of the first storage block corresponding to the sub-request, and sets the request path of the processing block where the first storage block corresponding to the sub-request is located to be valid, so that the sub-request can reach the corresponding first storage block. If the sub-request is invalid, the hash unit sets the request path of the processing block where the first storage block corresponding to the sub-request is located to be invalid, preventing the sub-request from reaching the corresponding first storage block. The second storage block to which the sub-request belongs can be determined based on the address carried by the sub-request, and the sub-request is sent to the corresponding second storage block through the scheduler to write the data corresponding to the sub-request into the second storage block.
[0172] Because the scheduler can receive subrequests of feature map read requests, weighted read requests, and write requests, it is possible to configure the priorities of the various subrequests. Optionally, the priority of a feature map read request subrequest is higher than the priority of a weighted read request subrequest, and the priority of a weighted read request subrequest is higher than the priority of a write request subrequest. Based on the priorities of the various subrequests, the scheduler sequentially sends the various subrequests to the second storage block.
[0173] In this embodiment of the present application, an arbitration unit determines, based on a reference state flag, whether a sub-request of a feature map read request satisfies a second preset condition, or whether a sub-request of a weighted read request satisfies a first preset condition. If the conditions are met, data corresponding to the sub-request is read from the second storage block. Compared to the register resources required for a queue, the register resources required for a reference state flag are fewer, thus reducing chip area.
[0174] For example, for a memory access system with a read latency of 6 and a read data width of 2 kilobits (kb), the related art requires setting up two queues with a depth of 6 and a width of 2kb, one of which is used to store weight attribute data and the other is used to store feature map attribute data. These two queues consume 24kb of registers. Compared to the chip area required by the related art, the chip area required by the embodiment of the present application can be reduced by 29491.2 square microns (um2).
[0175] In addition, when the sub-request of the weight read request meets the first preset condition or the sub-request of the feature mapping read request meets the second preset condition, the corresponding data can be directly read, and when the sub-request does not meet the condition, the sub-request is blocked. The arbitration unit performs arbitration on the sub-request, which is conducive to constructing the timing between the weight attribute data and the feature mapping attribute data. Once it is determined by the arbitration unit that the sub-request of the feature mapping read request meets the second preset condition, when the read delay of the weight attribute data and the read delay of the feature mapping attribute data are the same, the subsequent reading of the weight attribute data and the reading of the feature mapping attribute data can directly read the corresponding data without going through the arbitration of the arbitration unit, and the timing between the weight attribute data and the feature mapping attribute data can also be maintained. Based on the above content, the embodiment of the present application can achieve efficient switching between multiple requests, which is conducive to improving the efficiency of data reading.
[0176] 12 is an architecture diagram of another storage system provided in an embodiment of the present application. The storage system includes a processing unit 1201, and further includes a storage unit 1202 and a systolic array 1203 connected to the processing unit 1201.
[0177] The storage unit 1202 is used to store weight attribute data and feature map attribute data.
[0178] The processing unit 1201 is used to obtain a first weight read request and a first feature map read request, where the first weight read request is used to request to read weight attribute data from the storage unit, and the first feature map read request is used to request to read feature map attribute data from the storage unit.
[0179] The processing unit 1201 is further configured to obtain a reference state identifier, which is used to represent the state of a weight attribute register in the systolic array 1203 after a preset running time from the current time, and the weight attribute register is used to store weight attribute data.
[0180] The processing unit 1201 is further configured to read the weight attribute data stored in the storage unit to the systolic array 1203 in response to a first weight read request when the reference state flag satisfies a first preset condition.
[0181] The processing unit 1201 is further configured to read the feature map attribute data stored in the storage unit into the systolic array 1203 in response to the first feature map read request when the reference state identifier satisfies the second preset condition;
[0182] The systolic array 1203 is used to perform calculations based on the weight attribute data and the feature map attribute data.
[0183] In one possible implementation, the processing unit 1201 includes a first status register, a reference status register, and a determination unit;
[0184] A first state register is used to store a first state flag, the first state flag indicating whether the weight attribute register has stored weight attribute data for a set number of clock cycles after a preset running time from the current time;
[0185] A reference status register, used for storing a reference status identifier;
[0186] A determination unit is used to obtain a first state identifier; when the first state identifier represents that after a preset running time from the current time, the weight attribute register has stored the weight attribute data of a set number of clock cycles, it is determined that the reference state identifier represents that after the preset running time from the current time, the weight attribute register is in a state where the weight attribute data has been stored, and the reference state identifier satisfies a second preset condition: the reference state identifier represents that after the preset running time from the current time, the weight attribute register is in a state where the weight attribute data has been stored.
[0187] In one possible implementation, the processing unit 1201 includes a second status register, a reference status register, and a determination unit;
[0188] A second state register is used to store a second state flag, the second state flag indicating whether the weight attribute data in the weight attribute register is calculated with the feature mapping attribute data of the first clock cycle after a preset running time from the current time;
[0189] A reference status register, used for storing a reference status identifier;
[0190] A determination unit is used to obtain a second state identifier; when the second state identifier represents that after a preset running time from the current time, the weight attribute data in the weight attribute register and the feature mapping attribute data of the first clock cycle are calculated, it is determined that the reference state identifier represents that after the preset running time from the current time, the weight attribute register is in a state where the weight attribute data is to be stored, and the reference state identifier satisfies the first preset condition: the reference state identifier represents that after the preset running time from the current time, the weight attribute register is in a state where the weight attribute data is to be stored.
[0191] In one possible implementation, the processing unit 1201 is further configured to obtain a second weight read request and a second feature map read request, wherein the second weight read request is used to request reading weight attribute data from the storage unit, and the second feature map read request is used to request reading feature map attribute data from the storage unit;
[0192] The processing unit 1201 is further configured to read the weight attribute data stored in the storage unit to the systolic array 1203 based on the second weight read request;
[0193] The processing unit 1201 is further configured to read the feature map attribute data stored in the storage unit to the systolic array 1203 based on the second feature map read request, wherein the read delay of the weight attribute data and the read delay of the feature map attribute data are preset runtimes.
[0194] In one possible implementation, the processing unit 1201 includes a hashing unit, a reading unit, and a collecting unit, and the storage unit 1202 includes at least one first storage block;
[0195] Any first storage block, used to store weight attribute data and feature map attribute data;
[0196] a hash unit, configured to determine, for any first weighted sub-request, a first storage block corresponding to any first weighted sub-request if any first weighted sub-request is a valid request, the first weighted read request including at least one first weighted sub-request;
[0197] a reading unit, configured to read weight attribute data corresponding to any first weight sub-request from a first storage block corresponding to any first weight sub-request;
[0198] The collecting unit is configured to collect the weight attribute data corresponding to each first weight sub-request, and send the weight attribute data corresponding to each first weight sub-request to the systolic array 1203 .
[0199] In one possible implementation, the system further includes a conflict detection unit;
[0200] a conflict detection unit, configured to extract, from any first weighted sub-request, an address of a first storage block corresponding to any first weighted sub-request;
[0201] The conflict detection unit is further used to determine that any first weight sub-request is a valid request in response to the address of the first storage block corresponding to any first weight sub-request being different from the address of the first storage block corresponding to the reference first weight sub-request, and the reference first weight sub-request is at least one first weight sub-request among multiple first weight sub-requests other than any first weight sub-request.
[0202] In a possible implementation, any first storage block includes at least one second storage block;
[0203] Any second storage block, used to store weight attribute data and feature map attribute data;
[0204] The reading unit is configured to determine a second storage block corresponding to any first weight sub-request; and read weight attribute data corresponding to any first weight sub-request from the second storage block corresponding to any first weight sub-request.
[0205] In one possible implementation, the processing unit 1201 is further used to obtain a write request, which is used to write weight attribute data or feature mapping attribute data into the storage unit; and write the weight attribute data or feature mapping attribute data corresponding to the write request into the storage unit.
[0206] In one possible implementation, the processing unit 1201 includes a hash unit and a write unit, and the storage unit 1202 includes at least one first storage block;
[0207] a hash unit, configured to determine, for any third sub-request, a first storage block corresponding to any third sub-request, wherein the write request includes at least one third sub-request;
[0208] The writing unit is configured to write the weight attribute data or feature mapping attribute data corresponding to any third sub-request into the first storage block corresponding to any third sub-request.
[0209] The functions of the first state register, the second state register, the reference state register, and the determination unit can be implemented by the arbitration unit shown in FIG7 . The functions of the hash unit can be implemented by the hash unit shown in FIG7 . The functions of the read unit can be implemented by the scheduler and selection unit shown in FIG8 . The functions of the collection unit can be implemented by the collection unit shown in FIG7 . The functions of the conflict detection unit can be implemented by the conflict detection unit shown in FIG7 . The functions of the second storage block can be implemented by the second storage block shown in FIG7 . The functions of the write unit can be implemented by the scheduler shown in FIG8 .
[0210] It should be understood that the system and method embodiments provided in FIG12 above belong to the same concept, and their specific implementation process is detailed in the method embodiment. In addition, the contents in the system provided in FIG12 corresponding to FIG7 and FIG8 can be found in the description of FIG7 and FIG8, and will not be repeated here.
[0211] The above system characterizes the state of the weight attribute register in the systolic array through a reference state identifier. When the reference state identifier satisfies a first preset condition, the weight attribute data stored in the storage unit is read to the systolic array in response to a first weight read request; when the reference state identifier satisfies a second preset condition, the feature mapping attribute data stored in the storage unit is read to the systolic array in response to a first feature mapping read request. Compared with the storage resources required for the queue, the storage resources required for the reference state identifier are fewer. The system can be applied to chips. Since the fewer the storage resources, the smaller the chip area, the chip has the conditions to reduce the chip area.
[0212] FIG9 is a schematic diagram showing the structure of a data reading device provided in an embodiment of the present application. As shown in FIG9 , the device includes:
[0213] An acquisition module 901 is configured to acquire a first weight read request and a first feature map read request, wherein the first weight read request is used to request reading weight attribute data from a storage unit, and the first feature map read request is used to request reading feature map attribute data from a storage unit;
[0214] The acquisition module 901 is further configured to acquire a reference state identifier, which is used to represent the state of a weight attribute register in the systolic array after a preset running time from the current time, and the weight attribute register is used to store weight attribute data;
[0215] a reading module 902 configured to read the weight attribute data stored in the storage unit into the systolic array in response to a first weight read request when the reference state flag satisfies a first preset condition;
[0216] The reading module 902 is further configured to read the feature mapping attribute data stored in the storage unit into the systolic array in response to the first feature mapping read request when the reference state identifier satisfies the second preset condition. The systolic array is configured to perform calculations based on the weight attribute data and the feature mapping attribute data.
[0217] In a possible implementation, the reference state flag satisfies the first preset condition: the reference state flag indicates that the weight attribute register is in a state ready to store weight attribute data after a preset running time from the current time;
[0218] The reference state flag satisfies the second preset condition: the reference state flag indicates that the weight attribute register is in a state of storing all weight attribute data after a preset running time from the current time.
[0219] In one possible implementation, the acquisition module 901 is further configured to acquire a first state flag, the first state flag indicating whether the weight attribute register has stored weight attribute data for a set number of clock cycles after a preset running time from the current time.
[0220] The device also includes:
[0221] The determination module is used to determine that the reference state identification represents that the weight attribute register is in a state of storing the weight attribute data after the preset running time from the current time, when the first state identification represents that the weight attribute register has stored the weight attribute data of the set number of clock cycles after the preset running time from the current time.
[0222] In one possible implementation, the acquisition module 901 is further configured to acquire a second state flag, where the second state flag indicates whether the weight attribute data in the weight attribute register is calculated with the feature map attribute data of the first clock cycle after a preset running time from the current time.
[0223] The device also includes:
[0224] A determination module is used to determine that the reference state identification represents that the weight attribute register is in a state where the weight attribute data is to be stored after the preset running time from the current time, when the second state identification represents that the weight attribute data in the weight attribute register and the feature mapping attribute data of the first clock cycle are calculated.
[0225] In one possible implementation, the acquisition module 901 is further configured to acquire a second weight read request and a second feature map read request, the second weight read request being used to request reading weight attribute data from the storage unit, and the second feature map read request being used to request reading feature map attribute data from the storage unit;
[0226] The reading module 902 is further used to read the weight attribute data stored in the storage unit to the systolic array based on the second weight read request; and read the feature mapping attribute data stored in the storage unit to the systolic array based on the second feature mapping read request, and the read delay of the weight attribute data and the read delay of the feature mapping attribute data are preset running times.
[0227] In one possible implementation, the first weighted read request includes at least one first weighted sub-request, and the storage unit includes at least one first storage block;
[0228] The reading module 902 is used to determine the first storage block corresponding to any first weight sub-request when any first weight sub-request is a valid request, read the weight attribute data corresponding to any first weight sub-request from the first storage block corresponding to any first weight sub-request, and send the weight attribute data corresponding to each first weight sub-request to the systolic array.
[0229] In a possible implementation, the apparatus further includes:
[0230] an extraction module, configured to extract, from any first weighted sub-request, an address of a first storage block corresponding to any first weighted sub-request;
[0231] A determination module is used to determine that any first weight sub-request is a valid request in response to the address of the first storage block corresponding to any first weight sub-request being different from the address of the first storage block corresponding to the reference first weight sub-request, and the reference first weight sub-request is the first weight sub-request among multiple first weight sub-requests other than any first weight sub-request.
[0232] In a possible implementation, any first storage block includes at least one second storage block;
[0233] The reading module 902 is configured to determine the second storage block corresponding to any first weight sub-request; and read the weight attribute data corresponding to any first weight sub-request from the second storage block corresponding to any first weight sub-request.
[0234] In a possible implementation, the acquisition module 901 is further configured to acquire a write request, where the write request is configured to write the third data into the storage unit, where the third data is weight attribute data or feature map attribute data;
[0235] The device also includes:
[0236] The writing module is used to write the weight attribute data or feature mapping attribute data corresponding to the write request into the storage unit.
[0237] In one possible implementation, the write request includes at least one third sub-request, and the storage unit includes at least one first storage block;
[0238] A writing module is used to determine the first storage block corresponding to any third sub-request; and write the weight attribute data or feature mapping attribute data corresponding to any third sub-request into the first storage block corresponding to any third sub-request.
[0239] The above-mentioned device characterizes the state of the weight attribute register in the systolic array through a reference state identifier. When the reference state identifier satisfies a first preset condition, the weight attribute data stored in the storage unit is read to the systolic array in response to a first weight read request; when the reference state identifier satisfies a second preset condition, the feature mapping attribute data stored in the storage unit is read to the systolic array in response to a first feature mapping read request. Compared with the storage resources required for the queue, the storage resources required for the reference state identifier are fewer. The device can be applied to chips. Since the fewer the storage resources, the smaller the chip area, the chip has the conditions to reduce the chip area.
[0240] It should be understood that the device provided in FIG. 9 is merely an example of the division of the functional modules described above when implementing its functions. In actual applications, the functions described above can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0241] FIG10 shows a block diagram of a terminal device 1000 according to an exemplary embodiment of the present application. The terminal device 1000 includes a processor 1001 and a memory 1002 .
[0242] The processor 1001 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1001 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 1001 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1001 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1001 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0243] The memory 1002 may include one or more computer-readable storage media, which may be non-transitory. The memory 1002 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1002 is used to store at least one computer-readable instruction, which is used to be executed by the processor 1001 to implement the data reading method provided in the method embodiment of the present application.
[0244] In some embodiments, terminal device 1000 may optionally include a peripheral device interface 1003 and at least one peripheral device. Processor 1001, memory 1002, and peripheral device interface 1003 may be connected via a bus or signal lines. Each peripheral device may be connected to peripheral device interface 1003 via a bus, signal lines, or circuit boards. Specifically, the peripheral device may include at least one of a radio frequency circuit 1004, a display screen 1005, a camera assembly 1006, an audio circuit 1007, and a power supply 1008.
[0245] The peripheral device interface 1003 can be used to connect at least one I / O (Input / Output)-related peripheral device to the processor 1001 and the memory 1002. In some embodiments, the processor 1001, the memory 1002, and the peripheral device interface 1003 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1001, the memory 1002, and the peripheral device interface 1003 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0246] The RF circuit 1004 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 1004 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 1004 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the RF circuit 1004 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The RF circuit 1004 can communicate with other terminals via at least one wireless communication protocol. Such wireless communication protocols include, but are not limited to, the World Wide Web, metropolitan area networks, intranets, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 1004 may also include circuitry related to Near Field Communication (NFC), which is not limited in this application.
[0247] The display screen 1005 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1005 is a touch screen display, the display screen 1005 also has the ability to collect touch signals on the surface or above the surface of the display screen 1005. The touch signal can be input as a control signal to the processor 1001 for processing. At this time, the display screen 1005 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, there can be one display screen 1005, which is set on the front panel of the terminal device 1000; in other embodiments, there can be at least two display screens 1005, which are respectively set on different surfaces of the terminal device 1000 or in a folding design; in other embodiments, the display screen 1005 can be a flexible display screen, which is set on the curved surface or folding surface of the terminal device 1000. Even more, the display screen 1005 can be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 1005 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0248] The camera assembly 1006 is used to capture images or videos. Optionally, the camera assembly 1006 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 1006 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0249] The audio circuit 1007 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals that are input into the processor 1001 for processing, or input into the RF circuit 1004 to achieve voice communication. For the purpose of stereo sound collection or noise reduction, there may be multiple microphones, each located in different parts of the terminal device 1000. The microphone may also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert electrical signals from the processor 1001 or the RF circuit 1004 into sound waves. The speaker may be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert electrical signals into sound waves audible to humans, but also convert electrical signals into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 1007 may also include a headphone jack.
[0250] Power supply 1008 is used to power various components in terminal device 1000. Power supply 1008 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 1008 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged via a wired line, while a wireless rechargeable battery is a battery that is charged via a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0251] In some embodiments, the terminal device 1000 further includes one or more sensors 1009 . The one or more sensors 1009 include, but are not limited to, an acceleration sensor 1011 , a gyroscope sensor 1012 , a pressure sensor 1013 , an optical sensor 1014 , and a proximity sensor 1015 .
[0252] The accelerometer 1011 can detect the magnitude of acceleration along the three coordinate axes of the coordinate system established by the terminal device 1000. For example, the accelerometer 1011 can be used to detect the components of gravity acceleration along the three coordinate axes. The processor 1001 can control the display screen 1005 to display the user interface in a landscape or portrait view based on the gravity acceleration signal collected by the accelerometer 1011. The accelerometer 1011 can also be used to collect game or user motion data.
[0253] The gyroscope sensor 1012 can detect the body direction and rotation angle of the terminal device 1000. The gyroscope sensor 1012 can cooperate with the acceleration sensor 1011 to collect the user's 3D movements of the terminal device 1000. Based on the data collected by the gyroscope sensor 1012, the processor 1001 can implement the following functions: motion sensing (such as changing the UI based on the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0254] The pressure sensor 1013 can be set on the side frame of the terminal device 1000 and / or the lower layer of the display screen 1005. When the pressure sensor 1013 is set on the side frame of the terminal device 1000, it can detect the user's grip signal of the terminal device 1000, and the processor 1001 performs left and right hand recognition or shortcut operations based on the grip signal collected by the pressure sensor 1013. When the pressure sensor 1013 is set on the lower layer of the display screen 1005, the processor 1001 controls the operable controls on the UI interface based on the user's pressure operation on the display screen 1005. The operable controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0255] Optical sensor 1014 is used to detect ambient light intensity. In one embodiment, processor 1001 can control the display brightness of display screen 1005 based on the ambient light intensity detected by optical sensor 1014. Specifically, when the ambient light intensity is high, the display brightness of display screen 1005 is increased; when the ambient light intensity is low, the display brightness of display screen 1005 is decreased. In another embodiment, processor 1001 can also dynamically adjust the shooting parameters of camera assembly 1006 based on the ambient light intensity detected by optical sensor 1014.
[0256] The proximity sensor 1015, also known as a distance sensor, is typically disposed on the front panel of the terminal device 1000. The proximity sensor 1015 is used to detect the distance between the user and the front of the terminal device 1000. In one embodiment, when the proximity sensor 1015 detects that the distance between the user and the front of the terminal device 1000 is gradually decreasing, the processor 1001 controls the display screen 1005 to switch from the screen-on state to the screen-off state. When the proximity sensor 1015 detects that the distance between the user and the front of the terminal device 1000 is gradually increasing, the processor 1001 controls the display screen 1005 to switch from the screen-off state to the screen-on state.
[0257] Those skilled in the art will understand that the structure shown in FIG10 does not constitute a limitation on the terminal device 1000 , and may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0258] FIG11 is a schematic diagram of the structure of the server provided in an embodiment of the present application. The server 1100 may have relatively large differences due to different configurations or performances, and may include one or more processors 1101 and one or more memories 1102, wherein the one or more memories 1102 store at least one computer-readable instruction, and the at least one computer-readable instruction is loaded and executed by the one or more processors 1101 to implement the data reading method provided in each of the above method embodiments. Exemplarily, the processor 1101 is a CPU. Of course, the server 1100 may also have components such as a wired or wireless network interface, a keyboard, and an input / output interface for input and output. The server 1100 may also include other components for implementing device functions, which will not be described in detail here.
[0259] In an exemplary embodiment, a computer-readable storage medium is further provided, in which at least one computer-readable instruction is stored. The at least one computer-readable instruction is loaded and executed by a processor to enable an electronic device to implement any of the above-mentioned data reading methods.
[0260] Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, or the like.
[0261] In an exemplary embodiment, a computer program product is further provided. The computer program product stores at least one computer-readable instruction. The at least one computer-readable instruction is loaded and executed by a processor to enable an electronic device to implement any of the above-mentioned data reading methods.
[0262] It should be understood that the term "plurality" used herein refers to two or more. "And / or" describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone. The character " / " generally indicates an "or" relationship between the associated objects.
[0263] The above description is merely an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the principles of the present application shall be included in the scope of protection of the present application.
[0264] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0265] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A data reading method, executed by a processor of an electronic device, wherein the electronic device comprises a systolic array and a storage unit respectively connected to the processor, wherein the systolic array comprises a weight attribute register, and the method comprises: Obtaining a first weight read request and a first feature map read request, wherein the first weight read request is used to request to read weight attribute data from the storage unit, and the first feature map read request is used to request to read feature map attribute data from the storage unit; Acquire a reference state identifier, wherein the reference state identifier is used to represent a state of a weight attribute register in a systolic array after a preset running time, wherein the weight attribute register is used to store the weight attribute data; In a case where the reference state identifier satisfies a first preset condition, reading the weight attribute data stored in the storage unit to the systolic array in response to the first weight read request; and When the reference state identifier satisfies a second preset condition, the feature map attribute data stored in the storage unit is read into the systolic array in response to the first feature map read request, and the systolic array is used to perform calculations based on the weight attribute data and the feature map attribute data.
2. According to the method of claim 1, the reference state identifier satisfies the first preset condition that: the reference state identifier indicates that after the preset running time from the current time, the weight attribute register is in a state of waiting to store weight attribute data.
3. According to the method described in claim 1 or 2, the reference state identifier satisfies the second preset condition that: the reference state identifier indicates that after the preset running time from the current time, the weight attribute register is in a state of storing all the weight attribute data.
4. The method according to claim 2, further comprising: Obtaining a first state flag, the first state flag indicating whether the weight attribute register has stored weight attribute data for a set number of clock cycles after the preset running time from the current time; When the first state identifier represents that: after the preset running time from the current time, the weight attribute register has stored the weight attribute data of a set number of clock cycles, then it is determined that the reference state identifier represents that after the preset running time from the current time, the weight attribute register is in a state of storing the weight attribute data.
5. The method according to claim 3, further comprising: Acquire a second state flag, wherein the second state flag indicates whether the weight attribute data in the weight attribute register is calculated with the feature mapping attribute data of the first clock cycle after the preset running time from the current time; When the second state identification represents: after the preset running time from the current time, the weight attribute data in the weight attribute register and the feature mapping attribute data of the first clock cycle are calculated, it is determined that the reference state identification represents that after the preset running time from the current time, the weight attribute register is in a state of waiting to store weight attribute data.
6. The method according to any one of claims 1 to 5, after reading the feature map attribute data stored in the storage unit to the systolic array based on the first feature map read request, further comprising: Obtaining a second weight read request and a second feature map read request, wherein the second weight read request is used to request to read the weight attribute data from the storage unit, and the second feature map read request is used to request to read the feature map attribute data from the storage unit; reading the weight attribute data stored in the storage unit to the systolic array based on the second weight read request; The feature map attribute data stored in the storage unit is read to the systolic array based on the second feature map read request, and the read delay of the weight attribute data and the read delay of the feature map attribute data are the preset running time.
7. The method according to any one of claims 1 to 6, wherein the first weight read request comprises at least one first weight sub-request, and the storage unit comprises at least one first storage block; The step of reading the weight attribute data stored in the storage unit to the storage unit in response to the first weight read request. The systolic array comprises: For any first weight sub-request, if any first weight sub-request is a valid request, determining a first storage block corresponding to any first weight sub-request, and reading weight attribute data corresponding to any first weight sub-request from the first storage block corresponding to any first weight sub-request; The weight attribute data corresponding to each first weight sub-request is sent to the systolic array.
8. The method according to claim 7, further comprising: Extracting an address of a first storage block corresponding to any one of the first weight sub-requests from any one of the first weight sub-requests; When the address of the first storage block corresponding to any one of the first weight sub-requests is different from the address of the first storage block corresponding to the reference first weight sub-request, it is determined that any one of the first weight sub-requests is a valid request, and the reference first weight sub-request is at least one first weight sub-request among the multiple first weight sub-requests other than the any one of the first weight sub-requests.
9. The method according to claim 7, any first storage block includes at least one second storage block; The step of reading the weight attribute data corresponding to any one of the first weight sub-requests from the first storage block corresponding to any one of the first weight sub-requests includes: Determine a second storage block corresponding to any one of the first weight sub-requests; The weight attribute data corresponding to any one of the first weight sub-requests is read from the second storage block corresponding to any one of the first weight sub-requests.
10. The method according to any one of claims 1 to 9, further comprising: Obtaining a write request, wherein the write request is used to write the weight attribute data or the feature mapping attribute data into the storage unit; The weight attribute data or feature mapping attribute data corresponding to the write request is written into the storage unit.
11. The method according to claim 10, wherein the write request comprises at least one third sub-request, and the storage unit comprises at least one first storage block; Writing the weight attribute data or feature mapping attribute data corresponding to the write request into the storage unit includes: For any third sub-request, determine a first storage block corresponding to the any third sub-request; The weight attribute data or feature mapping attribute data corresponding to any one of the third sub-requests is written into the first storage block corresponding to any one of the third sub-requests.
12. A storage system, the storage system comprising a processing unit, further comprising a storage unit and a systolic array respectively connected to the processor, the systolic array comprising a weight attribute register; The storage unit is used to store weight attribute data and feature mapping attribute data; The processing unit is used to obtain a first weight read request and a first feature map read request, wherein the first weight read request is used to read weight attribute data from the storage unit, and the first feature map read request is used to request to read feature map attribute data from the storage unit; The processing unit is further used to obtain a reference state identifier, the reference state identifier is used to represent the state of a weight attribute register in the systolic array after a preset running time from a current time, the weight attribute register is used to store the weight attribute data; The processing unit is further configured to read the weight attribute data stored in the storage unit to the systolic array in response to the first weight read request when the reference state identifier satisfies a first preset condition; and The processing unit is further configured to read the feature map attribute data stored in the storage unit to the systolic array based on the first feature map read request when the reference state identifier satisfies a second preset condition; The systolic array is used to perform calculations based on the weight attribute data and the feature map attribute data.
13. The system according to claim 12, wherein the processing unit comprises a first status register, a reference status register and a determination unit; The first status register is used to store a first status flag, wherein the first status flag indicates that whether the weight attribute register has stored the weight attribute data of the set number of clock cycles after the preset running time starts; The reference state register is used to store the reference state identifier; The determination unit is used to obtain the first state identifier; when the first state identifier represents that: after the preset running time from the current time, the weight attribute register has stored the weight attribute data of the set number of clock cycles, then it is determined that the reference state identifier represents that after the preset running time from the current time, the weight attribute register is in a state where the weight attribute data has been stored, and the reference state identifier satisfies the second preset condition: the reference state identifier represents that after the preset running time from the current time, the weight attribute register is in a state where the weight attribute data has been stored.
14. The system according to claim 12 or 13, wherein the processing unit comprises a second state register, a reference state register and a determination unit; The second state register is used to store a second state flag, wherein the second state flag indicates whether the weight attribute data in the weight attribute register is calculated with the feature mapping attribute data of the first clock cycle after the preset running time from the current time; The reference state register is used to store the reference state identifier; The determination unit is used to obtain a second state identifier; when the second state identifier represents that the weight attribute data in the weight attribute register and the feature mapping attribute data of the first clock cycle are calculated after the preset running time from the current time, it is determined that the reference state identifier represents that after the preset running time from the current time, the weight attribute register is in a state where the weight attribute data is to be stored, and the reference state identifier satisfies a first preset condition: the reference state identifier represents that after the preset running time from the current time, the weight attribute register is in a state where the weight attribute data is to be stored.
15. The system according to any one of claims 12 to 14, wherein the processing unit is further used to obtain a second weight read request and a second feature map read request, wherein the second weight read request is used to request to read the weight attribute data from the storage unit, and the second feature map read request is used to request to read the feature map attribute data from the storage unit; The processing unit is further configured to read the weight attribute data stored in the storage unit to the systolic array based on the second weight read request; The processing unit is further configured to read the feature mapping attribute data stored in the storage unit to the systolic array based on the second feature mapping read request, wherein a read delay of the weight attribute data and a read delay of the feature mapping attribute data are the preset running time.
16. The system according to any one of claims 12 to 15, wherein the processing unit comprises a hashing unit, a reading unit and a collecting unit, and the storage unit comprises at least one first storage block; Any first storage block, used to store the weight attribute data and the feature map attribute data; The hash unit is used to determine, for any first weighted sub-request, a first storage block corresponding to any first weighted sub-request if the any first weighted sub-request is a valid request, the first weighted read request including at least one first weighted sub-request; The reading unit is used to read the weight attribute data corresponding to any first weight sub-request from the first storage block corresponding to any first weight sub-request; The collecting unit is used to collect the weight attribute data corresponding to each first weight sub-request, and send the weight attribute data corresponding to each first weight sub-request to the systolic array.
17. The system according to claim 16, further comprising a conflict detection unit; The conflict detection unit is used to extract the address of the first storage block corresponding to any one of the first weight sub-requests from any one of the first weight sub-requests; The conflict detection unit is further configured to determine that any of the first weighted sub-requests is a valid request when the address of the first storage block corresponding to any of the first weighted sub-requests is different from the address of the first storage block corresponding to the reference first weighted sub-request, and the reference first weighted sub-request is one of the plurality of first weighted sub-requests except for any of the first weighted sub-requests. At least one first weight sub-request outside the request.
18. The system according to claim 16, wherein any first storage block includes at least one second storage block; Any second storage block, used to store the weight attribute data and the feature map attribute data; The reading unit is used to determine the second storage block corresponding to any one of the first weight sub-requests; and read the weight attribute data corresponding to any one of the first weight sub-requests from the second storage block corresponding to any one of the first weight sub-requests.
19. According to the system according to any one of claims 12 to 18, the processing unit is also used to obtain a write request, and the write request is used to write the weight attribute data or the feature mapping attribute data into the storage unit; and write the weight attribute data or the feature mapping attribute data corresponding to the write request into the storage unit.
20. The system according to claim 19, wherein the processing unit comprises a hash unit and a write unit, and the storage unit comprises at least one first storage block; The hash unit is configured to determine, for any third sub-request, a first storage block corresponding to the any third sub-request, the write request including at least one third sub-request; The writing unit is used to write the weight attribute data or feature mapping attribute data corresponding to any one of the third sub-requests into the first storage block corresponding to any one of the third sub-requests.
21. A data reading device, comprising: An acquisition module, used to acquire a first weight read request and a first feature map read request, wherein the first weight read request is used to request to read weight attribute data from a storage unit, and the first feature map read request is used to request to read feature map attribute data from the storage unit; The acquisition module is further used to acquire a reference state identifier, wherein the reference state identifier is used to represent the state of a weight attribute register in the systolic array after a preset running time from a current time, wherein the weight attribute register is used to store the weight attribute data; a reading module, configured to read the weight attribute data stored in the storage unit to the systolic array in response to the first weight read request when the reference state identifier satisfies a first preset condition; and The reading module is further used to read the feature mapping attribute data stored in the storage unit to the systolic array based on the first feature mapping read request when the reference state identifier meets the second preset condition, and the systolic array is used to perform calculations based on the weight attribute data and the feature mapping attribute data.
22. An electronic device, comprising a processor and a memory, wherein the memory stores at least one computer-readable instruction, and the at least one computer-readable instruction is loaded and executed by the processor so that the electronic device implements the data reading method as described in any one of claims 1 to 11.
23. A computer-readable storage medium, wherein at least one computer-readable instruction is stored in the computer-readable storage medium, and the at least one computer-readable instruction is loaded and executed by a processor to enable an electronic device to implement the data reading method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Neural network processor based on systolic array
CN107578098A
Systolic array-based neural network processing device
CN110785778A
Neural network arithmetic device and control method thereof
CN112639839A
Area-friendly storage address mapping method for systolic array
CN114218136A
Data reading method, device and equipment and readable storage medium
CN116959532A
