WO2019127922A1 - Data transfer method, computing device and computer readable storage medium - Google Patents
Data transfer method, computing device and computer readable storage medium Download PDFInfo
- Publication number
- WO2019127922A1 WO2019127922A1 PCT/CN2018/079368 CN2018079368W WO2019127922A1 WO 2019127922 A1 WO2019127922 A1 WO 2019127922A1 CN 2018079368 W CN2018079368 W CN 2018079368W WO 2019127922 A1 WO2019127922 A1 WO 2019127922A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- unit
- storage
- target data
- data block
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/14—Handling requests for interconnection or transfer
- G06F13/20—Handling requests for interconnection or transfer for access to input/output bus
- G06F13/28—Handling requests for interconnection or transfer for access to input/output bus using burst mode transfer, e.g. direct memory access DMA, cycle steal
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/06—Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
- G06N3/063—Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means
Definitions
- the present invention relates to the field of data processing technologies, and in particular, to a data handling method, a computing device, and a computer readable storage medium.
- the multi-dimensional direct memory access (DMA) data carrying method uses a continuous storage address to store the carried data, which only considers how to complete the data transfer, and does not consider the subsequent processing of the data. , brings unnecessary trouble to the read/write operations of subsequent data.
- this data storage method can not be well matched with the operator, reducing the data read and write rate, thereby reducing the data processing efficiency.
- the technical problem to be solved by the embodiments of the present invention is to provide a data carrying method, a computing device, and a computer readable storage medium, which can improve the efficiency of data transmission.
- an embodiment of the present invention provides a data handling method, which is applied to a computing device, where the computing device includes a storage medium, a register unit, and a storage control unit.
- the method includes:
- the storage control unit acquires a data handling instruction, where the data handling instruction includes indication information, where the indication information is used to indicate target data to be carried and a storage format of the first data block where the target data is located;
- the storage control unit completes the handling of the target data between the storage medium and the register unit according to a storage format of the first data block.
- an embodiment of the present invention further provides a computing device, including a storage medium, a register unit, and a storage control unit.
- the storage medium and the register unit are both used to store data
- the storage control unit is configured to acquire a data handling instruction, where the data handling instruction includes indication information, where the indication information is used to indicate target data to be carried and a storage format of the first data block where the target data is located;
- the storage control unit is further configured to complete the handling of the target data between the storage medium and the register unit according to a storage format of the first data block.
- an embodiment of the present invention further provides a computing device, including: a processor, a memory, a communication interface, and a bus; the processor, the memory, and the communication interface are connected through the bus and complete each other Inter-communication; the memory stores executable program code; the processor runs a program corresponding to the executable program code by reading executable program code stored in the memory to perform the first aspect as described above The method described.
- an embodiment of the present invention further provides a computer readable storage medium storing program code for data handling.
- the program code includes instructions for performing the method described in the first aspect above.
- the storage control unit in the computing device in the embodiment of the present invention acquires a data handling instruction, where the data handling instruction includes indication information, where the indication information is used to indicate target data to be carried and storage of the first data block where the target data is located a format, and then the storage control unit completes the handling of the target data between the storage medium and the register unit according to a storage format of the first data block.
- FIG. 1 is a schematic structural diagram of a computing device according to an embodiment of the present invention.
- FIGS. 2A and 2B are schematic diagrams of two types of data storage provided by an embodiment of the present invention.
- FIG. 3 is a schematic flow chart of a data handling method according to an embodiment of the present invention.
- FIG. 4 is a schematic diagram of still another data storage provided by an embodiment of the present invention.
- FIG. 5A is a schematic structural diagram of a first storage control unit according to an embodiment of the present invention.
- FIG. 5B is a schematic flowchart diagram of still another data handling method according to an embodiment of the present invention.
- FIG. 6A is a schematic structural diagram of a second storage control unit according to an embodiment of the present invention.
- FIG. 6B is a schematic flowchart diagram of still another data handling method according to an embodiment of the present invention.
- FIG. 7 is a schematic structural diagram of still another computing device according to an embodiment of the present invention.
- FIG. 8 is a schematic structural diagram of still another computing device according to an embodiment of the present invention.
- the present application proposes an efficient data handling method, which is applied to a computing device.
- a schematic diagram of the structure of one possible computing device is shown in FIG.
- the computing device 100 includes a storage medium 102, a register unit 104, and a storage control unit 106;
- the storage medium 102 is for storing external data; the external data refers to data stored outside the neural network processor.
- the storage medium may be an external memory, a cache, and a Double Rate Synchronous Dynamic Random Access (DDR) memory independently of the neural network processor.
- DDR Double Rate Synchronous Dynamic Random Access
- the register unit 104 is used to store internal data, where the internal data refers to data stored inside the neural network processor, and the register unit 104 may be a memory installed inside the neural network processor, such as a cache, a flash memory. and many more.
- the external data and the internal data are collectively referred to as data, including but not limited to image data, text data, voice data, and the like.
- the neural network processor may also be referred to as a deep learning processor, or other processor/chip for processing big data, which is not limited herein.
- the Enhanced Direct Memory Access (EDMA, also referred to as Enhanced Direct Memory Access) is used to implement data transfer between the storage medium and the register unit.
- the storage control unit includes a first storage control unit 1062 (Enhanced Output Direct Memory Access, EoDMA, also referred to as enhanced output direct memory access) and a second storage control unit 1064 (Enhanced Iutput Direct Memory Access, EiDMA, also known as enhanced input direct memory access).
- the first storage control unit EoDMA is configured to transport data in the register unit to the storage medium for storage.
- the second storage control unit EiDMA is configured to carry data in the storage medium inward into the register unit for storage. How to carry out the handling of data between the register unit and the storage medium will be explained in detail below.
- the granularity of data processing supported within the neural network processor is a channel, specifically a data block/data transmitted through a channel.
- the channel comprises an input channel CI and an output channel CO.
- the CI is used to implement data transmission of the storage medium to the register unit;
- the CO is used to implement data transmission of the register unit to the storage medium. That is, the storage medium needs to carry data to the register unit through the input channel CI, and the register unit needs to carry data to the storage medium through the output channel CO for storage.
- the minimum granularity of data storage supported in the register unit internal to the neural network processor is pixel pixels.
- a plurality of pixel combinations may be defined as a slice of data, and a plurality of slices of data may be combined and defined as a block of data. That is, the storage of data in the storage format of the data block bank is supported in the register unit.
- the number of pixel pixels included in the data piece and the number of data slice slices included in the data block may be customized for the user side or the computing device side, which is not limited in this application.
- a combination of 7 pixels is defined as a slice
- a combination of 2 slices is defined as a bank, etc., which is not limited in this application.
- FIG. 2A A schematic diagram of data storage in a register unit is shown in Figure 2A.
- the data blocks bank0 and bank1 corresponding to the two channels CI/CO are respectively shown, wherein each data block is composed of two data slice slices, and each data slice is composed of 7 pixel pixels. It is shown that each piece of data is composed of 7 pixels in the width direction (ie, in the row direction).
- the portion corresponding to the black line indicates the storage of valid data (such as image data) in the register unit; the remaining portion indicates the invalid data stored in the register unit or no data storage.
- FIG. 2A shows a storage diagram of an 8*4 image data in a register unit.
- the storage format supporting the data in the storage medium outside the neural network processor is continuous storage.
- data is sequentially stored in sequence according to a transmission sequence of the channel CI/CO (such as CI0, CI1, CI2, etc.).
- CI/CO such as CI0, CI1, CI2, etc.
- FIG. 2B A schematic diagram of data storage in a storage medium is shown in Figure 2B.
- the data blocks in the two channels CI/CO are stored in the storage medium in a continuous storage manner.
- the CI/CO0 channel is continuously stored in the direction of the arrow shown in the figure. All the data in the data block, after storing the data block of the CI/CO0 channel, is then stored in the data block of the next CI/CO1 channel.
- FIG. 2B shows a storage diagram of data blocks in the CI/CO0 channel. Specifically, the first row of data may be stored first, and then the second row of data may be stored.
- FIG. 3 is a schematic flowchart of a data handling method according to an embodiment of the present invention.
- the method shown in FIG. 3 includes the following implementation steps:
- Step S202 The storage control unit 106 acquires a data handling instruction, where the data handling instruction includes indication information, where the indication information is used to indicate target data to be carried and a storage format of the first data block where the target data is located.
- the target data may be data in a first data block
- the first data block may be represented as C*H*W, that is, composed of C H*W data blocks.
- C is the number of channels required to transmit the data block
- H and W are the height and width of the data block, respectively, and the height H and data of the data block in the height direction (ie, column direction) can be understood as shown in FIG. 2A.
- the width W of the block in the width direction ie, in the row direction).
- an image is transmitted by a computing device, and image data corresponding to the image may be represented as C*H*W, where C represents the number of channels transmitting the image, and H*W represents the size of the image in a two-dimensional plane.
- C represents the number of channels transmitting the image
- H*W represents the size of the image in a two-dimensional plane.
- the image can be a grayscale image
- red Red data of the image can be transmitted in one channel, and one channel is transmitted.
- the green Green data of the picture one channel transmits the blue Blue data of the image.
- the RGB image can be formed from a combination of color data transmitted in the three channels, which is not described in detail herein.
- Step S204 The storage control unit 106 completes the handling of the target data between the storage medium and the register unit according to the storage format of the first data block.
- the indication information in the data handling instruction includes, but is not limited to, a combination of any one or more of the following multi-dimensional information, where the multi-dimensional information is specifically:
- Dimension 1 a first transport indication of the data block in the width direction (ie, in the row direction), the first transport indication being used to indicate that the target data for a required transport is determined for each successive K1 data.
- the first transport indication is specifically configured to indicate that each consecutive K1 data is stored in the width direction, and one read from the storage medium is stored.
- the first transport indication is specifically for indicating that one data is extracted for each consecutive K1 data in the width direction, as being carried into the storage medium
- the target data is valid data
- the data stored in the data block may be valid data or invalid data, except for the target data, and may be invalid data, which is not limited in this application.
- the invalid data may be stored in the data block by using a preset character, a preset value, a preset letter, or the like.
- the invalid data may be replaced with zero or invalid bubble data, etc., and the present application is not limited thereto.
- Dimension 2 the width W of the data block in the width direction (ie, in the row direction), that is, the width of all data included in the width direction of the data block, wherein the data may be valid data and/or invalid data.
- the width may also be a width of valid data of the data block in a width direction or the like.
- Dimension 3 a second transport indication of the data block in the height direction (ie, in the column direction), the second transport indication being used to indicate that the target data for a required transport is determined for each successive K2 data. That is, the data for each successive K2 line determines the target data to be carried in a row.
- the second handling indication is specifically for indicating that one row of data is determined for each consecutive K2 rows of data in the height direction for storing from the storage medium.
- the second handling indication is specifically for indicating that one row of data is extracted for each consecutive K2 rows of data in the height direction, as being carried into the storage medium
- Dimension 4 The height H of the data block in the height direction (ie, in the column direction), that is, the height of all data included in the height direction of the data block.
- the data may be valid data and/or invalid data.
- the height may refer to a height of the valid data of the data block in the height direction, and the like.
- the above dimension 1 to dimension 4 define the storage format of the data block of one channel CI/CO in the register unit.
- the multi-dimensional information may further include:
- Dimension 5 a storage interval between the two of the data blocks in the width direction (i.e., in the row direction), and/or a storage amount M1 of the data blocks in the width direction (i.e., in the row direction).
- M1 is a positive integer.
- Dimension 6 a storage interval between the two data blocks in the height direction (i.e., in the column direction), and/or a storage amount M2 of the data blocks in the height direction (i.e., in the column direction).
- M2 is a positive integer.
- the storage space of the register unit in the neural network processor is limited, and M1 and M2 may be customized for the computing device side or the user side, which is not limited herein.
- M1 and M2 may be customized for the computing device side or the user side, which is not limited herein.
- the processing capability of the neural network processor ie, the data handling capability of the computing device, which may also be referred to as processing capability
- the amount of data to be carried is limited each time, and thus may involve multiple tours. Round data handling.
- the multi-dimensional information may further include:
- Dimension 7 The storage interval of the batch data block in the height direction (ie, the column direction), that is, the storage interval between every two rounds.
- the total number of data blocks contained in each round ie, the batch data block referred to in this application) is M1*M2.
- the data block M1*M2 included in each round is customized for the user side or the computing device side, and is not limited in this application.
- the indication information may further include other parameter information, such as a priority of the data block, and the like, which is not limited in this application.
- dimension 1 to dimension 7 respectively define the storage format of the channel CI/CO data block in the register unit, and also define the target data to be carried in the data block.
- step S204 the following two specific embodiments exist in step S204.
- the storage control unit first proceeds from the storage medium according to the data transfer instruction.
- the target data to be carried is continuously read, and then the target data is stored into the register unit in a storage format of the first data block according to the indication of the indication information.
- the storage control unit continuously reads the target data that needs to be transported from the storage medium, as shown in FIG. 4, first completes the channel in a channel CI/CO data block according to the dimension 1 and the dimension 2. Up to the storage of the target data, that is, as shown by the direction of the arrow in FIG. 4, the target data is sequentially stored from the low to the high in the row direction of one channel CI/CO block. Next, the storage of the target data in the column direction of one channel CI/CO data block is completed according to the dimension 3 and the dimension 4. At this point, the storage of the target data in a channel CI/CO data block can be completed.
- the storage of the target data in the other channel CI/CO data block in the row/column direction may be completed according to the dimension 5 or the dimension 6, that is, the subsequent reading according to the dimension 5 or the dimension 6
- the target data is stored in other channel CI/CO data blocks in the row/column direction until a round of storage for the target data is completed.
- the specific storage method for the target data in each round is the same, and will not be described here.
- the computing device stores the target data in the row direction to the data block CI/CO0 of the register unit according to the indication of the indication information according to the dimension 1 and the dimension 2, and then according to the dimension 3 and the dimension 4 storing the target data in the column direction in the data block CI/CO0 of the register unit. That is, the target data is first stored in the data block CI/CO0 of the register unit according to the dimension 1 to the dimension 4, that is, the storage for the target data in the data block CI/CO0 is completed first. The subsequently read target data is then stored in dimension 5 or dimension 6 to the data block CI/CO1 or CI/CO2 corresponding to the register unit in the row/column direction.
- the number of data blocks defining the channel CI/CO for each round support processing is 4 according to the processing capability of the neural network processor in the present application.
- the storage The control unit also needs to complete the storage of the target data in the next round according to the dimension 7, that is, the target data to be subsequently carried is stored in the channel CI/CO data block of the next round.
- the storage control unit is configured to perform an indication of the indication information in the data transfer instruction. First reading the first data block in which the target data is located from the register unit, and then extracting the target data to be transmitted from the first data block, and then sequentially transmitting the target data sequentially And stored in the storage medium.
- the target data to be carried in the row direction of the channel CI/CO data block is first read and extracted according to the dimension 1 and the dimension 2, that is, as shown by the direction of the arrow in FIG. 4, in one channel CI/
- the target data to be transported is sequentially read from the low position to the high level in the row direction of the CO data block.
- the target data to be carried in the column direction of the channel CI/CO data block is read and extracted in accordance with dimension 3 and dimension 4. At this point, the acquisition of all the target data to be carried in a channel CI/CO data block can be completed.
- the storage control unit may perform reading of the target data block to be carried in other channel CI/CO data blocks in the row/column direction according to the indication of the indication information, and then according to the dimension 5 or the dimension 6 until Completing the reading of the target data in a round. Then, according to the actual situation, that is, the number C of the first data block and the number of batch data blocks M1*M2 supported by each round, whether to continue reading the target data in other rounds according to the dimension 7 And handling.
- the storage control unit may continuously send to the storage medium, so as to continuously store the target data to the storage. In the medium.
- the computing device reads the target data to be carried in the row direction of the data block CI/CO0 of the register unit according to the indication of the indication information according to the dimension 1 and the dimension 2, and The target data is continuously sent to the storage medium for storage, that is, the handling of the target data in the channel data block CI/CO0 row direction is completed first according to the dimension 1 and the dimension 2. Then, reading the target data to be carried in the data block CI/CO0 of the register unit along the column direction according to the dimension 3 and the dimension 4, and continuously transmitting the target data to the storage medium for storage. That is, the handling of the target data in the channel direction of the channel data block CI/CO0 is completed in accordance with the dimension 3 and the dimension 4.
- the handling of the target data in the data block CI/CO0 can be completed first according to the dimension 1 to the dimension 4. Then, according to the dimension 5 or the dimension 6, the reading and carrying of the target data in the other channel CI/CO data block in the row/column direction are implemented, and so on, until the reading and handling of the target data in a round is completed. . It is assumed that the number of data blocks defining the channel CI/CO for each round support processing is 4 according to the processing capability of the neural network processor in the present application. Accordingly, if the target data to be carried in the register unit is stored in a 6-channel CI/CO data block, specifically in the data block CI/CO0 to the data block CI/CO5 of FIG. It can be seen that the storage control unit also needs to complete the reading and handling of the target data in the next round according to the dimension 7.
- FIG. 5A shows a schematic structural diagram of a first storage control unit EoDMA.
- the first storage control unit as shown in FIG. 5A includes a first control unit 202, a first read data unit 204, and a first write data unit 206.
- a first first in first out (FIFO) unit 208 and a first authorization unit 210 may also be included.
- the first control unit 202 includes an instruction storage unit and an instruction control unit, which are not shown. among them,
- the instruction storage unit (EoDMA_iq) is configured to receive the data handling instruction sent by the neural network processor, which of course includes parameters such as indication information included in the data handling instruction.
- the instruction control unit (EoDMA_ctrl) is configured to be responsible for distributing the data handling instruction (specifically, parameters in the instruction, such as indication information), starting EoDMA, and controlling completion of multi-dimensional information other than dimension 1 in the indication information. Switch between etc.
- the first authorization unit (Rd_dm_grant) is responsible for reading the authorization of the register unit (ie, whether to support reading the target data to be carried from the register unit). It should be understood that the authorization of the register unit may be related to the following information, such as the target data to be carried in the register unit or the priority of the first data block in which the target data is located, for example, multiple pieces.
- the registration unit may consider the priority of the target data to be carried, and the higher the priority, the earlier the authorization is performed. If the priority is low, the target data with higher priority is processed, and the target data with lower priority is transported.
- the first authorization unit is further configured to: according to a read enable of the first FIFO (ie, learn the occupied storage space in the first FIFO unit by using a read enable command) and the first read data unit Read enable (ie, a data read instruction sent to the register unit to know the amount of data of the target data to be carried in the register unit) to predict whether the first FIFO will overflow or The storage space of the first FIFO unit exceeds a preset threshold or the like.
- the method further includes: feeding back, to the first read data unit, a corresponding data read authorization indication, where the data read authorization indication is used to indicate whether to authorize reading data from the register unit, that is, Whether to authorize the reading of data.
- the data read authorization indication that is fed back is used to indicate that the register unit is not authorized. Reading of data; otherwise used to indicate that the reading of data in the register unit is authorized.
- the first read data unit is configured to read, from the register unit, the target data to be carried, according to the indication of the indication information in the instruction, when the data read authorization indication is used to indicate the authorization data reading, and
- the target data is continuously sent to the cache in the first FIFO unit.
- the first read data unit which may also be referred to as an extract valid data, is used to read the first data block where the target data is located from the register unit through an interface (such as an Xbar interface). And responsible for implementing extraction of the target data based on dimension 1 in the indication information; and simultaneously buffering the extracted target data into the first FIFO unit.
- an interface such as an Xbar interface
- the first FIFO unit is configured to continuously cache the target data to be carried.
- the first write data unit which may also be referred to as a data data unit, is used to continuously send the cached target data from the first FIFO unit to the storage medium for storage.
- the first write data unit is further configured to be responsible for interfacing with a bus in the computing device, controlled by a bus, allowing/disabling the continuous writing of the target data to the storage medium for storage.
- FIG. 5B is a schematic flowchart of still another data handling method according to an embodiment of the present invention.
- the method as shown in FIG. 5B may include the following implementation steps:
- Step 301 The first control unit 202 receives the data handling instruction sent by the neural network processor, and sends the data handling instruction to the first read data unit 204.
- the data handling instruction includes the indication information, the indication information is used to indicate that data is transferred from the register unit to the storage medium, and optionally includes target data to be carried and the target
- the storage format of the first data block where the data is located refer to the related description in the foregoing embodiment, and details are not described herein again.
- Step S302 The first authorization unit 210 determines a data read authorization indication according to an authorization factor.
- the data read authorization indication is used to indicate whether the first read data unit 204 is authorized to read the target data to be carried from the register unit, that is, whether to authorize data reading.
- the authorization factor includes a combination of any one or more of the following: whether the occupied storage space in the first FIFO unit exceeds a preset threshold, a priority of the target data, and the first data block Priority, or other factors used to affect data transmission, etc., are not limited in this application.
- Step S303 the first read data unit 204 receives the data handling instruction, and in the case that the data read authorization indication is used to indicate authorization data reading, according to the first data block in the data handling instruction
- the storage format reads the target data to be carried from the register unit. Accordingly, the first read data unit 204 continuously caches the read target data into the first FIFO unit 208.
- Step S304 the first FIFO unit 208 continuously buffers the target data to be carried.
- Step S305 the first write data unit 206 acquires the target data from the first FIFO unit 208, and continuously writes/stores the target data into the storage medium.
- FIG. 6A shows a schematic structural diagram of a second storage control unit EiDMA.
- the second storage control unit as shown in FIG. 6A includes a second control unit 302, a second read data unit 304, and a second write data unit 306.
- a second first in first out (FIFO) unit 308 and a second authorization unit 310 may also be included.
- the second control unit 302 includes an instruction storage unit and an instruction control unit, which are not shown. among them,
- the instruction storage unit (EiDMA_iq) is configured to receive the data handling instruction sent by the neural network processor, which of course includes parameters such as indication information included in the data handling instruction.
- the instruction control unit (EiDMA_ctrl) is responsible for the distribution of the data handling instructions (specifically parameters in the instructions, such as indication information) and the initiation of EiDMA.
- the second authorization unit (Rd_dm_grant) is responsible for reading the authorization of the storage medium (ie, whether to support reading the target data required for transportation from the storage medium).
- the authorization of the storage medium may be related to the following information, such as the target data to be transported stored in the storage medium or the priority of the first data block in which the target data is located, for example, multiple pieces.
- the storage medium can take into consideration the priority of the target data to be carried, and the higher the priority, the earlier the authorization is performed. If the priority is low, the target data with higher priority is processed, and the target data with lower priority is transported.
- the second authorization unit is further configured to: according to a read enable of the second FIFO (ie, learn the occupied storage space in the second FIFO unit by using a read enable command) and the second read data unit Reading enable (ie, a data read instruction sent to the storage medium to know the amount of data of the target data to be carried in the storage medium) predicting whether the second FIFO will overflow or The storage space of the second FIFO unit exceeds a preset threshold or the like.
- the method further includes: feeding back, to the second read data unit, a corresponding data read authorization indication, where the data read authorization indication is used to indicate whether to authorize reading data from the storage medium, that is, Whether to authorize the reading of data.
- the data read authorization indication that is fed back is used to indicate that the storage medium is not authorized. Reading of data; otherwise used to indicate that the reading of data in the storage medium is authorized.
- the second read data unit (Rd_ext_data) is configured to read target data to be carried from the storage medium according to a data transfer instruction when the data read authorization indication is used to indicate authorization data reading, and The target data is sent to the second FIFO unit for buffering.
- it is further configured to be responsible for interfacing with a bus in the computing device, controlled by a bus, allowing/disabling reading of the target data.
- the second FIFO unit is configured to cache the target data to be carried.
- the second write data unit (Wr_dm_data) is configured to send the cached target data from the second FIFO unit to the indication in a storage format of the first data block according to the indication of the indication information in the instruction. Storage in the storage medium. Specifically, the second write data unit is configured to be responsible for controlling mutual switching between the multi-dimensional information in the indication information to complete storage of the target data in the register unit.
- FIG. 6B is a schematic flowchart of still another data handling method according to an embodiment of the present invention.
- the method shown in FIG. 6B includes the following implementation steps:
- Step S401 The second control unit 302 receives the data handling instruction sent by the neural network processor, and sends the data handling instruction to the second read data unit 304.
- the data handling instruction includes the indication information
- the indication information is used to indicate that data is carried from the storage medium to the register unit, optionally further comprising target data to be carried and the target
- the storage format of the data in the register unit that is, the storage format of the first data block in which the target data is located in the present application, refer to the related description in the foregoing embodiment, and details are not described herein again.
- Step S402 The second authorization unit 310 determines a data read authorization indication according to the authorization factor.
- the data read authorization indication is used to indicate whether the second read data unit 304 is authorized to read the target data to be carried from the storage medium, that is, whether to authorize data reading.
- the authorization factor includes a combination of any one or more of the following: whether the occupied storage space in the second FIFO unit exceeds a preset threshold, a priority of the target data, and the first data block Priority, or other factors used to affect data transmission, etc., are not limited in this application.
- Step S403 the second read data unit 304 receives the data transfer instruction, and in the case that the data read authorization indication is used to indicate the authorization data read, continuously reading from the storage medium according to the data transfer instruction. Take the target data that needs to be transported.
- the second read data unit 304 may further cache the target data according to the storage format of the first data block according to the storage format of the first data block indicated by the indication information in the instruction to In the second FIFO unit 308.
- Step S404 the second FIFO unit 308 buffers the target data to be transported.
- Step S405 The second write data unit 306 reads, from the second FIFO unit, the target data that needs to be transported according to the storage format of the first data block, and matches the first data block.
- the target data of the storage format is sent to the register unit for storage.
- the present application can design a storage format of the multi-dimensional DMA data according to the data format supported by the neural network processor, that is, the data storage format matched with the neural network processor can be used to store the data, which can be improved.
- the read/write rate of data enables efficient data handling and improves data handling/data processing efficiency.
- FIG. 7 is a schematic structural diagram of still another computing device according to an embodiment of the present invention.
- the computing device as described in FIG. 7 includes a storage medium 70, a register unit 72, and a storage control unit 74, wherein
- the storage medium 70 and the register unit 72 are both used to store data
- the storage control unit 74 is configured to acquire a data handling instruction, where the data handling instruction includes indication information, where the indication information is used to indicate target data to be carried and a storage format of the first data block where the target data is located;
- the storage control unit 74 is further configured to complete the handling of the target data between the storage medium and the register unit according to a storage format of the first data block.
- the first data block is composed of C H*W data blocks, C represents the number of channels required to transmit the first data block, and H and W respectively represent the data block. Height and width;
- the indication information includes at least one of the following information: a first transport indication of the data block in the width direction, a width W of the data block in the width direction, and a second transport of the data block in the height direction.
- the upper storage interval, the storage amount M2 of the data block in the height direction, and the storage interval of the batch data block in the height direction, the total number of data blocks included in the batch data block is M1*M2, used to indicate The data handling capability of the computing device;
- the first transport indication is used to indicate that the data block determines a target data to be transported for every consecutive K1 data in the width direction;
- the second transport indication is used to indicate that the data block determines a target data to be transported for every consecutive K2 data in the height direction;
- the target data is data in the data block, and M1, M2, K1, and K2 are all positive integers.
- the storage control unit 74 includes a first storage control unit 720 and a second storage control unit 730;
- the first storage control unit 720 is configured to extract target data in the first data block from the register unit according to a storage format of the first data block, and continuously store the target data to the storage.
- the medium In the medium;
- the second storage control unit 722 is configured to acquire the continuously stored target data from the storage medium, and store the target data into the register unit according to a storage format of the first data block.
- the first storage control unit 720 includes a first control unit 721, a first read data unit 722, a first write data unit 723, a first FIFO FIFO unit 724, and a first authorization unit 725. ;
- the first control unit 721 is configured to acquire the data handling instruction, and send the data handling instruction to the first read data unit 722;
- the first authorization unit 725 is configured to determine, according to an authorization factor, a data read authorization indication, where the data read authorization indication is used to indicate whether to authorize reading the target data to be carried, the authorization factor includes the following At least one item: whether the occupied storage space in the first FIFO unit exceeds a preset threshold, a priority of the target data, and a priority of the first data block;
- the first read data unit 722 is configured to extract the first from the register unit according to a storage format of the first data block if the data read authorization indication is used to indicate authorization data read Target data in the data block, and continuously buffering the target data into the first FIFO unit 724;
- the first FIFO unit 724 is configured to continuously cache the target data that needs to be transported;
- the first write data unit 723 is configured to continuously extract the target data to be transported from the first FIFO unit 724 and send the target data to the storage medium for storage.
- the second storage control unit 730 includes a second control unit 731, a second read data unit 732, a second write data unit 733, a second FIFO FIFO unit 734, and a second authorization unit 735. ;
- the second control unit 731 is configured to acquire the data handling instruction, and send the data handling instruction to the second read data unit 732;
- the second authorization unit 735 is configured to determine a data read authorization indication according to an authorization factor, and send the data read authorization indication to the second read data unit 732; wherein the data read authorization indication is used for Determining whether to authorize reading the target data to be carried, the authorization factor comprising at least one of: whether the occupied storage space in the second FIFO unit exceeds a preset threshold, and the target data is prioritized Level and priority of the first data block;
- the second read data unit 732 is configured to continuously extract the target to be transported from the storage medium according to the data handling instruction, in a case where the data read authorization indication is used to indicate authorization data reading. Data, the target data is buffered into the second FIFO unit 734 according to a storage format of the first data block;
- the second FIFO unit 734 is configured to cache the target data that meets the storage format
- the second write data unit 733 is configured to extract the target data conforming to the storage format from the second FIFO unit 734, and send the target data to the register unit for storage.
- FIG. 8 is a schematic structural diagram of a computing device according to an embodiment of the present invention.
- the computing device may be a device with a neural network processor and a communication network function, such as a smart phone, a tablet computer, or a smart wearable device.
- the computing device in the embodiment of the present invention may include a display screen and a button. a module, a speaker, a pickup, etc., and further comprising: at least one bus 501, at least one processor 502 connected to the bus 501, and at least one memory 503 connected to the bus 501, and a communication device 505 for implementing a communication function, which consumes power for each terminal Module powered power supply unit 504.
- the processor 502 can call the code stored in the memory 503 to perform related functions via the bus 501, wherein the memory 503 includes an operating system, a data handling application.
- the processor 502 is configured to perform all or part of the implementation steps provided by the method embodiment as described above.
- the embodiment of the present invention further provides a computer readable storage medium, wherein the computer readable storage medium can store a program, and the program includes some or all of the steps described in the foregoing method embodiments.
- the embodiment of the present application further provides a computer program product, comprising: a non-transitory computer readable storage medium storing a computer program, the computer program being operative to cause a computer to perform the operations as recited in the foregoing method embodiments Some or all of the steps.
- the disclosed apparatus may be implemented in other ways.
- the device embodiments described above are merely illustrative.
- the division of the unit is only a logical function division.
- there may be another division manner for example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not executed.
- the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical or otherwise.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
- each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
- the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
- the technical solution of the present invention which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium.
- a number of instructions are included to cause a computer device (which may be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
- the foregoing storage medium includes: a U disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk, and the like. .
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- General Engineering & Computer Science (AREA)
- Molecular Biology (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Data Mining & Analysis (AREA)
- Computing Systems (AREA)
- Computational Linguistics (AREA)
- Artificial Intelligence (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Neurology (AREA)
- Bus Control (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
A data transfer method, a computing device and a computer readable storage medium. The method is applied in a computing device, and the computing device comprises a storage medium, a register unit, and a storage control unit, wherein the method comprises: the storage control unit acquiring a data transfer instruction, the data transfer instruction comprising target data to be transferred and the storage format of a first data block in which the target data is located (S202); the storage control unit, according to the storage format of the first data block, completing the transfer of the target data between the storage medium and the register unit (S204); The method may increase the speed and efficiency of data transfer, thereby improving the efficiency of data processing.
Description
本申请要求于2017年12月29日提交中国专利局,申请号为201711479137.X、发明名称为“一种数据搬运方法、相关产品及计算机存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on December 29, 2017, the Chinese Patent Office, the application number is 201711479137.X, the invention name is "a data handling method, related products and computer storage media", the entire contents thereof This is incorporated herein by reference.
本发明涉及数据处理技术领域,尤其涉及一种数据搬运方法、计算装置以及计算机可读存储介质。The present invention relates to the field of data processing technologies, and in particular, to a data handling method, a computing device, and a computer readable storage medium.
随着人工智能(Artificial Intelligence,AI)的发展和深入研究,芯片对数据的供给要求越来越高。现有技术中多维直接内存存取(Direct Memory Access,DMA)数据搬运方法是采用连续的存储地址来存储所搬运的数据,其仅仅考虑到如何完成数据的搬运,并没考虑到数据的后续处理,给后续数据的读/写操作带来一些不必要的麻烦。例如在深度学习模型中这种数据存储方法无法很好地与运算器相匹配,降低数据的读写速率,从而降低了数据的处理效率。With the development and in-depth research of Artificial Intelligence (AI), the demand for data supply from chips is getting higher and higher. In the prior art, the multi-dimensional direct memory access (DMA) data carrying method uses a continuous storage address to store the carried data, which only considers how to complete the data transfer, and does not consider the subsequent processing of the data. , brings unnecessary trouble to the read/write operations of subsequent data. For example, in the deep learning model, this data storage method can not be well matched with the operator, reducing the data read and write rate, thereby reducing the data processing efficiency.
发明内容Summary of the invention
本发明实施例所要解决的技术问题在于,提供一种数据搬运方法、计算装置及计算机可读存储介质,能够提升数据传输的效率。The technical problem to be solved by the embodiments of the present invention is to provide a data carrying method, a computing device, and a computer readable storage medium, which can improve the efficiency of data transmission.
第一方面,本发明实施例公开提供了一种数据搬运方法,应用于计算装置中,所述计算装置包括存储介质、寄存器单元以及存储控制单元所述方法包括:In a first aspect, an embodiment of the present invention provides a data handling method, which is applied to a computing device, where the computing device includes a storage medium, a register unit, and a storage control unit. The method includes:
所述存储控制单元获取数据搬运指令,所述数据搬运指令包括指示信息,所述指示信息用于指示待搬运的目标数据以及所述目标数据所在的第一数据块的存储格式;The storage control unit acquires a data handling instruction, where the data handling instruction includes indication information, where the indication information is used to indicate target data to be carried and a storage format of the first data block where the target data is located;
所述存储控制单元根据所述第一数据块的存储格式,在所述存储介质和所述寄存器单元之间完成所述目标数据的搬运。The storage control unit completes the handling of the target data between the storage medium and the register unit according to a storage format of the first data block.
第二方面,本发明实施例还公开提供了一种计算装置,包括存储介质、寄存器单元以及存储控制单元,In a second aspect, an embodiment of the present invention further provides a computing device, including a storage medium, a register unit, and a storage control unit.
所述存储介质和所述寄存器单元均用于存储数据;The storage medium and the register unit are both used to store data;
所述存储控制单元用于获取数据搬运指令,所述数据搬运指令包括指示信息,所述指示信息用于指示待搬运的目标数据以及所述目标数据所在的第一数据块的存储格式;The storage control unit is configured to acquire a data handling instruction, where the data handling instruction includes indication information, where the indication information is used to indicate target data to be carried and a storage format of the first data block where the target data is located;
所述存储控制单元还用于根据所述第一数据块的存储格式,在所述存储介质和所述寄存器单元之间完成所述目标数据的搬运。The storage control unit is further configured to complete the handling of the target data between the storage medium and the register unit according to a storage format of the first data block.
第三方面,本发明实施例还公开提供了一种计算装置,包括:处理器、存储器、通信接口和总线;所述处理器、所述存储器和所述通信接口通过所述总线连接并完成相互间的通信;所述存储器存储可执行程序代码;所述处理器通过读取所述存储器中存储的可执行程序代码来运行与所述可执行程序代码对应的程序,以执行如上第一方面所述的方法。In a third aspect, an embodiment of the present invention further provides a computing device, including: a processor, a memory, a communication interface, and a bus; the processor, the memory, and the communication interface are connected through the bus and complete each other Inter-communication; the memory stores executable program code; the processor runs a program corresponding to the executable program code by reading executable program code stored in the memory to perform the first aspect as described above The method described.
第四方面,本发明实施例还公开提供了一种计算机可读存储介质,所述计算机可读存储介质存储了用于数据搬运的程序代码。所述程序代码包括用于执行上述第一方面描述的方法的指令。In a fourth aspect, an embodiment of the present invention further provides a computer readable storage medium storing program code for data handling. The program code includes instructions for performing the method described in the first aspect above.
本发明实施例中计算装置中的存储控制单元获取数据搬运指令,所述数据搬运指令包括指示信息,该指示信息用于指示待搬运的目标数据以及所述目标数据所在的第一数据块的存储格式,然后所述存储控制单元根据所述第一数据块的存储格式在所述存储介质和所述寄存器单元之间完成所述目标数据的搬运。采用本发明实施例,能够高效完成数据的搬运,提升数据搬运的效率。The storage control unit in the computing device in the embodiment of the present invention acquires a data handling instruction, where the data handling instruction includes indication information, where the indication information is used to indicate target data to be carried and storage of the first data block where the target data is located a format, and then the storage control unit completes the handling of the target data between the storage medium and the register unit according to a storage format of the first data block. By adopting the embodiment of the invention, data can be efficiently carried out and the efficiency of data handling can be improved.
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present invention, and other drawings can be obtained from those skilled in the art without any creative work.
图1是本发明实施例提供的一种计算装置的结构示意图;1 is a schematic structural diagram of a computing device according to an embodiment of the present invention;
图2A和图2B是本发明实施例提供的两种数据存储的示意图;2A and 2B are schematic diagrams of two types of data storage provided by an embodiment of the present invention;
图3是本发明实施例的一种数据搬运方法的流程示意图;3 is a schematic flow chart of a data handling method according to an embodiment of the present invention;
图4是本发明实施例提供的又一种数据存储的示意图;4 is a schematic diagram of still another data storage provided by an embodiment of the present invention;
图5A是本发明实施例提供的一种第一存储控制单元的结构示意图;FIG. 5A is a schematic structural diagram of a first storage control unit according to an embodiment of the present invention; FIG.
图5B是本发明实施例提供的又一种数据搬运方法的流程示意图;FIG. 5B is a schematic flowchart diagram of still another data handling method according to an embodiment of the present invention; FIG.
图6A是本发明实施例提供的一种第二存储控制单元的结构示意图;6A is a schematic structural diagram of a second storage control unit according to an embodiment of the present invention;
图6B是本发明实施例提供的又一种数据搬运方法的流程示意图;FIG. 6B is a schematic flowchart diagram of still another data handling method according to an embodiment of the present invention; FIG.
图7是本发明实施例提供的又一种计算装置的结构示意图;FIG. 7 is a schematic structural diagram of still another computing device according to an embodiment of the present invention; FIG.
图8是本发明实施例提供的又一种计算装置的结构示意图。FIG. 8 is a schematic structural diagram of still another computing device according to an embodiment of the present invention.
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is an embodiment of the invention, but not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of the present invention.
本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”和“第三”(如果存在)等是用于区别不同对象,而非用于描述特定顺序。此外,术语“包括”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、***、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second" and "third" (if any) and the like in the description and claims of the present invention and the above drawings are used to distinguish different objects, and are not intended to describe a particular order. Moreover, the term "comprise" and any variants thereof are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or device that comprises a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units not listed, or alternatively Other steps or units inherent to these processes, methods, products or equipment.
为解决现有技术中数据搬运效率较低等问题,本申请特提出一种高效的数据搬运方法,该方法应用于计算装置中。如图1示出一种可能的计算装置的结构示意图。如图1,该计算装置100包括存储介质102、寄存器单元104以及存储控制单元106;其中,In order to solve the problems of low data handling efficiency in the prior art, the present application proposes an efficient data handling method, which is applied to a computing device. A schematic diagram of the structure of one possible computing device is shown in FIG. As shown in FIG. 1, the computing device 100 includes a storage medium 102, a register unit 104, and a storage control unit 106;
所述存储介质102用于存储外部数据;所述外部数据是指存储在神经网络处理器之外的数据。相应地,所述存储介质可以是外部存储器、高速缓存器以及双倍速率同步动态随机存储器(Double Data Rate,DDR)等独立存在于神经网络处理器之外的存储器。The storage medium 102 is for storing external data; the external data refers to data stored outside the neural network processor. Correspondingly, the storage medium may be an external memory, a cache, and a Double Rate Synchronous Dynamic Random Access (DDR) memory independently of the neural network processor.
所述寄存器单元104用于存储内部数据,这里的内部数据是指存储在神经 网络处理器内部的数据,所述寄存器单元104可为安装在神经网络处理器内部的存储器,例如高速缓存器、闪存等等。本申请中,将所述外部数据和所述内部数据均统称为数据,该数据包括但不限于图像数据、文本数据、语音数据等等。所述神经网络处理器也可称为深度学习处理器,或者其他用于处理大数据的处理器/芯片,本申请不做限定。The register unit 104 is used to store internal data, where the internal data refers to data stored inside the neural network processor, and the register unit 104 may be a memory installed inside the neural network processor, such as a cache, a flash memory. and many more. In the present application, the external data and the internal data are collectively referred to as data, including but not limited to image data, text data, voice data, and the like. The neural network processor may also be referred to as a deep learning processor, or other processor/chip for processing big data, which is not limited herein.
所述存储控制单元106(Enhanced Direct Memory Access,EDMA,也可称为增强型直接内存存取)用于实现所述存储介质和所述寄存器单元之间的数据搬运。具体的,所述存储控制单元包括第一存储控制单元1062(Enhanced Output Direct Memory Access,EoDMA,也可称为增强型输出直接内存存取)和第二存储控制单元1064(Enhanced Iutput Direct Memory Access,EiDMA,也可称为增强型输入直接内存存取)。其中,所述第一存储控制单元EoDMA用于将所述寄存器单元中的数据往外搬运至所述存储介质中进行存储。所述第二存储控制单元EiDMA用于将所述存储介质中的数据向内搬运至所述寄存器单元中进行存储。关于在所述寄存器单元和所述存储介质之间如何完成数据的搬运将在下文中进行详细阐述。The Enhanced Direct Memory Access (EDMA, also referred to as Enhanced Direct Memory Access) is used to implement data transfer between the storage medium and the register unit. Specifically, the storage control unit includes a first storage control unit 1062 (Enhanced Output Direct Memory Access, EoDMA, also referred to as enhanced output direct memory access) and a second storage control unit 1064 (Enhanced Iutput Direct Memory Access, EiDMA, also known as enhanced input direct memory access). The first storage control unit EoDMA is configured to transport data in the register unit to the storage medium for storage. The second storage control unit EiDMA is configured to carry data in the storage medium inward into the register unit for storage. How to carry out the handling of data between the register unit and the storage medium will be explained in detail below.
应理解的,在神经网络处理器内部支持数据处理的颗粒度为通道,具体是指通过通道传输的数据块/数据。其中,所述通道包括输入通道CI和输出通道CO。其中,CI用于实现所述存储介质到所述寄存器单元的数据传输;CO用于实现所述寄存器单元到所述存储介质的数据传输。也即是,所述存储介质需通过输入通道CI将数据搬运至所述寄存器单元中存储,所述寄存器单元需通过输出通道CO将数据搬运至所述存储介质中存储。It should be understood that the granularity of data processing supported within the neural network processor is a channel, specifically a data block/data transmitted through a channel. Wherein, the channel comprises an input channel CI and an output channel CO. The CI is used to implement data transmission of the storage medium to the register unit; the CO is used to implement data transmission of the register unit to the storage medium. That is, the storage medium needs to carry data to the register unit through the input channel CI, and the register unit needs to carry data to the storage medium through the output channel CO for storage.
此外,在神经网络处理器内部的所述寄存器单元中支持数据存储的最小颗粒度为像素pixel。可选地,可将多个pixel合并定义为数据片slice,还可将多个数据片slice合并定义为数据块bank。即是,在所述寄存器单元中支持以数据块bank的存储格式来存储数据。Furthermore, the minimum granularity of data storage supported in the register unit internal to the neural network processor is pixel pixels. Alternatively, a plurality of pixel combinations may be defined as a slice of data, and a plurality of slices of data may be combined and defined as a block of data. That is, the storage of data in the storage format of the data block bank is supported in the register unit.
其中,所述数据片中包含的像素pixel数量以及所述数据块中包含的数据片slice数量可为用户侧或计算装置侧自定义设置的,本申请不做限定。例如7个pixel合并定义为一个slice,2个slice合并定义为一个bank等等,本申请不做限定。The number of pixel pixels included in the data piece and the number of data slice slices included in the data block may be customized for the user side or the computing device side, which is not limited in this application. For example, a combination of 7 pixels is defined as a slice, and a combination of 2 slices is defined as a bank, etc., which is not limited in this application.
如图2A示出一种在寄存器单元中数据存储的示意图。如图2A,示出两个 个通道CI/CO各自对应的数据块bank0和bank1,其中,每个数据块是由两个数据片slice组成的,每个数据片是由7个像素pixel组成的,图示为在宽度方向上(即行方向上)每个数据片是由7个pixel组成。其中,黑色线条对应的部分表示有效数据(如图像数据)在寄存器单元中的存储;其余部分表示在寄存器单元中存储的无效数据或没有数据存储。以所述数据为图像数据为例,图2A示出一张8*4的图像数据在寄存器单元中的存储示意图。A schematic diagram of data storage in a register unit is shown in Figure 2A. 2A, the data blocks bank0 and bank1 corresponding to the two channels CI/CO are respectively shown, wherein each data block is composed of two data slice slices, and each data slice is composed of 7 pixel pixels. It is shown that each piece of data is composed of 7 pixels in the width direction (ie, in the row direction). Wherein, the portion corresponding to the black line indicates the storage of valid data (such as image data) in the register unit; the remaining portion indicates the invalid data stored in the register unit or no data storage. Taking the data as image data as an example, FIG. 2A shows a storage diagram of an 8*4 image data in a register unit.
在神经网络处理器外部的所述存储介质中支持数据的存储格式为连续存储。具体的,在所述存储介质中,数据是按照通道CI/CO的传输顺序(如CI0,CI1,CI2,等等)依次连续存储的。如图2B示出一种在存储介质中数据存储的示意图。如图2B,给出两个通道CI/CO中的数据块在存储介质中以连续存储的方式存放数据,例如在第一个CI/CO0通道中按照图示箭头方向连续存放CI/CO0通道对应的数据块中的所有数据,在存放完CI/CO0通道的数据块后,在接着存放下一个CI/CO1通道的数据块中包含的所有数据。针对每个通道的数据块而言,可按照行的顺序从低位至高位依次存储数据块中的数据。如图2B示出CI/CO0通道中数据块的存储示意图,具体的可先将第一行数据存放完后,再接着存放第二行数据。The storage format supporting the data in the storage medium outside the neural network processor is continuous storage. Specifically, in the storage medium, data is sequentially stored in sequence according to a transmission sequence of the channel CI/CO (such as CI0, CI1, CI2, etc.). A schematic diagram of data storage in a storage medium is shown in Figure 2B. As shown in FIG. 2B, the data blocks in the two channels CI/CO are stored in the storage medium in a continuous storage manner. For example, in the first CI/CO0 channel, the CI/CO0 channel is continuously stored in the direction of the arrow shown in the figure. All the data in the data block, after storing the data block of the CI/CO0 channel, is then stored in the data block of the next CI/CO1 channel. For the data blocks of each channel, the data in the data block can be sequentially stored from the lower to the highest in the order of the rows. FIG. 2B shows a storage diagram of data blocks in the CI/CO0 channel. Specifically, the first row of data may be stored first, and then the second row of data may be stored.
基于图1所示的计算装置,请参阅图3,是本发明实施例提供的一种数据搬运方法的流程示意图。如图3所示的方法包括如下实施步骤:Based on the computing device shown in FIG. 1, FIG. 3 is a schematic flowchart of a data handling method according to an embodiment of the present invention. The method shown in FIG. 3 includes the following implementation steps:
步骤S202、存储控制单元106获取数据搬运指令,所述数据搬运指令包括指示信息,该指示信息用于指示待搬运的目标数据以及所述目标数据所在的第一数据块的存储格式。Step S202: The storage control unit 106 acquires a data handling instruction, where the data handling instruction includes indication information, where the indication information is used to indicate target data to be carried and a storage format of the first data block where the target data is located.
本申请中,所述目标数据可为第一数据块中的数据,该第一数据块可表示为C*H*W,即由C个H*W的数据块组成。其中,C表示传输所述数据块所需的通道数,H和W分别为该数据块的高度和宽度,如图2A中可理解数据块在高度方向(即列方向上)的高度H和数据块在宽度方向上(即行方向上)的宽度W。In the present application, the target data may be data in a first data block, and the first data block may be represented as C*H*W, that is, composed of C H*W data blocks. Where C is the number of channels required to transmit the data block, H and W are the height and width of the data block, respectively, and the height H and data of the data block in the height direction (ie, column direction) can be understood as shown in FIG. 2A. The width W of the block in the width direction (ie, in the row direction).
例如,利用计算装置传输一张图像,该图像对应的图像数据可表示为C*H*W,其中C表示传输所述图像的通道数,H*W表示该图像在二维平面中的尺寸大小。当C=1时,该图像可为灰度图像;当C=3时,该图像可为彩色图 像,如以RGB图像为例,可1个通道传输该图像的红色Red数据,1个通道传输该图片的绿色Green数据,1个通道传输该图像的蓝色Blue数据。相应地,该RGB图像可由这三个通道中传输的颜色数据组合形成,本申请不做过多详述。For example, an image is transmitted by a computing device, and image data corresponding to the image may be represented as C*H*W, where C represents the number of channels transmitting the image, and H*W represents the size of the image in a two-dimensional plane. . When C=1, the image can be a grayscale image; when C=3, the image can be a color image. For example, in the case of RGB image, red Red data of the image can be transmitted in one channel, and one channel is transmitted. The green Green data of the picture, one channel transmits the blue Blue data of the image. Accordingly, the RGB image can be formed from a combination of color data transmitted in the three channels, which is not described in detail herein.
步骤S204、存储控制单元106根据所述第一数据块的存储格式,在所述存储介质和所述寄存器单元之间完成所述目标数据的搬运。Step S204: The storage control unit 106 completes the handling of the target data between the storage medium and the register unit according to the storage format of the first data block.
具体的,所述数据搬运指令中的指示信息包括但不限于以下多维信息中的任一项或多项的组合,所述多维信息具体为:Specifically, the indication information in the data handling instruction includes, but is not limited to, a combination of any one or more of the following multi-dimensional information, where the multi-dimensional information is specifically:
维度1:所述数据块在宽度方向上(即行方向上)的第一搬运指示,所述第一搬运指示用于指示每连续K1个数据确定一个所需搬运的所述目标数据。其中K1为正整数,当K1=1时,表示所述数据块中在行方向上存储的每个数据均为所述目标数据,均需被搬运。Dimension 1: a first transport indication of the data block in the width direction (ie, in the row direction), the first transport indication being used to indicate that the target data for a required transport is determined for each successive K1 data. Where K1 is a positive integer, and when K1=1, it means that each data stored in the row direction in the data block is the target data, and all need to be carried.
具体的,如果在从存储介质向所述寄存器单元搬运数据的场景中,所述第一搬运指示具体用于指示在宽度方向上每连续K1个数据存放一个从所述存储介质中读取的所需搬运的所述目标数据。例如,当K1=1时具体表示所述数据块中在行方向上存储的每个数据均为所述计算装置从所述存储介质中获取的连续的待搬运的所述目标数据。Specifically, in a scenario in which data is transferred from the storage medium to the register unit, the first transport indication is specifically configured to indicate that each consecutive K1 data is stored in the width direction, and one read from the storage medium is stored. The target data to be handled. For example, when K1=1, it is specifically indicated that each data stored in the row direction in the data block is the continuous target data to be carried obtained by the computing device from the storage medium.
如果在从所述寄存器单元向所述存储介质搬运数据的场景中,所述第一搬运指示具体用于指示在宽度方向上每连续K1个数据提取一个数据,作为需搬运至所述存储介质中的一个待搬运的所述目标数据。例如,当K1=1时具体表示所述数据块中在行方向上存储的每个数据均为待搬运的所述目标数据,即所述计算装置需将行方向上的每个数据搬运至所述存储介质中存储。In the scenario of carrying data from the register unit to the storage medium, the first transport indication is specifically for indicating that one data is extracted for each consecutive K1 data in the width direction, as being carried into the storage medium The target data to be carried. For example, when K1=1, it specifically indicates that each data stored in the row direction in the data block is the target data to be carried, that is, the computing device needs to carry each data in the row direction to the storage. Stored in the media.
应理解的,所述目标数据为有效数据,除所述目标数据外所述数据块中存储的数据也可有效数据或者无效数据,优选地为了区分,可为无效数据,本申请不做限定。It should be understood that the target data is valid data, and the data stored in the data block may be valid data or invalid data, except for the target data, and may be invalid data, which is not limited in this application.
可选的,所述无效数据在所述数据块中可用预设字符、预设数值、预设字母等形式来存储表示。例如,所述无效数据可用0或无效的气泡数据填充代替等,本申请不做限定。Optionally, the invalid data may be stored in the data block by using a preset character, a preset value, a preset letter, or the like. For example, the invalid data may be replaced with zero or invalid bubble data, etc., and the present application is not limited thereto.
维度2:所述数据块在宽度方向上(即行方向上)的宽度W,即是所述数据块在宽度方向上包含的所有数据的宽度,其中所述数据可为有效数据和/或无 效数据。可选的,所述宽度也可为所述数据块在宽度方向上的有效数据的宽度等。Dimension 2: the width W of the data block in the width direction (ie, in the row direction), that is, the width of all data included in the width direction of the data block, wherein the data may be valid data and/or invalid data. . Optionally, the width may also be a width of valid data of the data block in a width direction or the like.
维度3:所述数据块在高度方向上(即列方向上)的第二搬运指示,所述第二搬运指示用于指示每连续K2个数据确定一个所需搬运的所述目标数据。也即是,每连续K2行的数据确定一行所需搬运的所述目标数据。其中,K2为正整数。当K2=1时,表示所述数据块中在列方向上的每行数据均为所述目标数据,需被搬运。Dimension 3: a second transport indication of the data block in the height direction (ie, in the column direction), the second transport indication being used to indicate that the target data for a required transport is determined for each successive K2 data. That is, the data for each successive K2 line determines the target data to be carried in a row. Where K2 is a positive integer. When K2=1, it means that each row of data in the column direction in the data block is the target data, and needs to be carried.
具体的,如果在从存储介质向所述寄存器单元搬运数据的场景中,所述第二搬运指示具体用于指示在高度方向上每连续K2行数据确定一行数据,用于存放从所述存储介质中读取的所需搬运的所述目标数据。例如,当K2=1时具体表示所述数据块中在高度方向上的每行数据均用于存放所述计算装置从所述存储介质中读取的待搬运的所述目标数据。Specifically, in the scenario of carrying data from the storage medium to the register unit, the second handling indication is specifically for indicating that one row of data is determined for each consecutive K2 rows of data in the height direction for storing from the storage medium. The target data to be carried in the read. For example, when K2=1, it is specifically indicated that each row of data in the height direction in the data block is used to store the target data to be carried by the computing device from the storage medium.
如果在从所述寄存器单元向所述存储介质搬运数据的场景中,所述第二搬运指示具体用于指示在高度方向上每连续K2行数据提取一行数据,作为需搬运至所述存储介质中的待搬运的所述目标数据。例如,当K2=1时具体表示所述数据块中在高度方向上存储的每行数据均为待搬运的所述目标数据,即所述计算装置需将高度方向上的每行数据搬运至所述存储介质中存储。In the scenario of carrying data from the register unit to the storage medium, the second handling indication is specifically for indicating that one row of data is extracted for each consecutive K2 rows of data in the height direction, as being carried into the storage medium The target data to be carried. For example, when K2=1, it is specifically indicated that each row of data stored in the height direction in the data block is the target data to be transported, that is, the computing device needs to carry each row of data in the height direction to the location. Stored in a storage medium.
关于所述目标数据以及无效数据的相关阐述,可参见前述实施例所述,这里不再赘述。For the related description of the target data and the invalid data, refer to the foregoing embodiment, and details are not described herein again.
维度4:所述数据块在高度方向上(即列方向上)的高度H,即是所述数据块在高度方向上包含的所有数据的高度。可选的,所述数据可为有效数据和/或无效数据。可选的,所述高度可指所述数据块在高度方向上的有效数据的高度等。Dimension 4: The height H of the data block in the height direction (ie, in the column direction), that is, the height of all data included in the height direction of the data block. Optionally, the data may be valid data and/or invalid data. Optionally, the height may refer to a height of the valid data of the data block in the height direction, and the like.
应理解的,上述维度1至维度4,定义了一个通道CI/CO的数据块在所述寄存器单元中的存储格式。可选的,所述多维信息还可包括:It should be understood that the above dimension 1 to dimension 4 define the storage format of the data block of one channel CI/CO in the register unit. Optionally, the multi-dimensional information may further include:
维度5:每两个所述数据块之间在宽度方向上(即行方向上)的存储间隔,和/或,所述数据块在宽度方向上(即行方向上)的存储数量M1。其中,M1为正整数。Dimension 5: a storage interval between the two of the data blocks in the width direction (i.e., in the row direction), and/or a storage amount M1 of the data blocks in the width direction (i.e., in the row direction). Where M1 is a positive integer.
维度6:每两个所述数据块之间在高度方向上(即列方向上)的存储间隔,和/或,所述数据块在高度方向上(即列方向上)的存储数量M2。其中,M2 为正整数。Dimension 6: a storage interval between the two data blocks in the height direction (i.e., in the column direction), and/or a storage amount M2 of the data blocks in the height direction (i.e., in the column direction). Where M2 is a positive integer.
应理解的,受限于神经网络处理器中所述寄存器单元的存储空间,M1和M2可为所述计算装置侧或用户侧自定义设置的,本申请不做限定。可选的,受限于神经网络处理器的处理能力(即所述计算装置的数据搬运能力,也可称为处理能力),每次搬运的数据量有所限制,因此可能会涉及多个巡回round的数据搬运。可选地,所述多维信息还可包括:It should be understood that the storage space of the register unit in the neural network processor is limited, and M1 and M2 may be customized for the computing device side or the user side, which is not limited herein. Optionally, limited by the processing capability of the neural network processor (ie, the data handling capability of the computing device, which may also be referred to as processing capability), the amount of data to be carried is limited each time, and thus may involve multiple tours. Round data handling. Optionally, the multi-dimensional information may further include:
维度7:批数据块在高度方向(即列方向)上的存储间隔,即是每两个round之间的存储间隔。每个round(即本申请称的批数据块)中包含的数据块的总数量为M1*M2。Dimension 7: The storage interval of the batch data block in the height direction (ie, the column direction), that is, the storage interval between every two rounds. The total number of data blocks contained in each round (ie, the batch data block referred to in this application) is M1*M2.
可选的,每个round(即每个批数据块)中所包含的数据块M1*M2为用户侧或所述计算装置侧自定义设置的,本申请不做限定。Optionally, the data block M1*M2 included in each round (ie, each batch of data blocks) is customized for the user side or the computing device side, and is not limited in this application.
可选的,所述指示信息还可包括其他参数信息,例如所述数据块的优先级等信息,本申请不做限定。Optionally, the indication information may further include other parameter information, such as a priority of the data block, and the like, which is not limited in this application.
相应地,如图4给出一种数据存储的示意图。如图4,维度1至维度7分别定义了通道CI/CO数据块在所述寄存器单元中的存储格式,同时也定义出所述数据块中所需搬运的所述目标数据。Accordingly, a schematic diagram of a data storage is given in FIG. As shown in FIG. 4, dimension 1 to dimension 7 respectively define the storage format of the channel CI/CO data block in the register unit, and also define the target data to be carried in the data block.
基于此,相应地步骤S204存在如下两种具体实施方式。Based on this, correspondingly, the following two specific embodiments exist in step S204.
第一种实施方式中,若所述数据搬运指令用于指示从所述存储介质向所述寄存器单元中搬运数据,则所述存储控制单元根据所述数据搬运指令,先从所述存储介质中连续读取所需搬运的所述目标数据,然后根据所述指示信息的指示将所述目标数据以所述第一数据块的存储格式存放至所述寄存器单元中。In a first embodiment, if the data transfer instruction is used to instruct to transfer data from the storage medium to the register unit, the storage control unit first proceeds from the storage medium according to the data transfer instruction. The target data to be carried is continuously read, and then the target data is stored into the register unit in a storage format of the first data block according to the indication of the indication information.
具体的,所述存储控制单元在从所述存储介质中连续读取到所需搬运的所述目标数据后,如图4,先按照维度1和维度2完成一个通道CI/CO数据块中行方向上针对所述目标数据的存放,即如图4中箭头方向所示,在一个通道CI/CO数据块的行方向上从低位到高低依次存储所述目标数据。接着,按照维度3和维度4完成一个通道CI/CO数据块中列方向上针对所述目标数据的存放。此时即可完成一个通道CI/CO数据块中针对所述目标数据的存储。之后,接着可根据所述指示信息的指示再按照维度5或维度6完成行/列方向上其他通道CI/CO数据块中所述目标数据的存储,即按照维度5或维度6将后续读取的所述目标数据存储至行/列方向上其他通道CI/CO数据块中,直至完成一个round 的针对所述目标数据的存储。然后,还可根据实际情况,即所需搬运的所述目标数据的数据量决定是否还需按照维度7完成多个round的所述目标数据的存储。关于每个round中针对所述目标数据的具体存储方式都相同,这里不再赘述。Specifically, after the storage control unit continuously reads the target data that needs to be transported from the storage medium, as shown in FIG. 4, first completes the channel in a channel CI/CO data block according to the dimension 1 and the dimension 2. Up to the storage of the target data, that is, as shown by the direction of the arrow in FIG. 4, the target data is sequentially stored from the low to the high in the row direction of one channel CI/CO block. Next, the storage of the target data in the column direction of one channel CI/CO data block is completed according to the dimension 3 and the dimension 4. At this point, the storage of the target data in a channel CI/CO data block can be completed. Then, according to the indication of the indication information, the storage of the target data in the other channel CI/CO data block in the row/column direction may be completed according to the dimension 5 or the dimension 6, that is, the subsequent reading according to the dimension 5 or the dimension 6 The target data is stored in other channel CI/CO data blocks in the row/column direction until a round of storage for the target data is completed. Then, according to the actual situation, that is, the data amount of the target data to be transported, it is determined whether or not the storage of the target data of the plurality of rounds is still required to be completed according to the dimension 7. The specific storage method for the target data in each round is the same, and will not be described here.
例如图4,所述计算装置根据所述指示信息的指示按照维度1和维度2沿着行方向将所述目标数据存储至所述寄存器单元的数据块CI/CO0中,然后按照维度3和维度4沿着列方向上将所述目标数据存储至所述寄存器单元的数据块CI/CO0中。即是按照维度1至维度4先将所述目标数据存储至所述寄存器单元的数据块CI/CO0中,即先完成数据块CI/CO0中针对所述目标数据的存储。然后在按照维度5或维度6将后续读取的所述目标数据存储至所述寄存器单元对应在行/列方向上的数据块CI/CO1或者CI/CO2。依次类推,假设本申请中依据神经网络处理器的处理能力,定义每个round支持处理的通道CI/CO的数据块的数量为4。相应地,如果所述存储介质中所需搬运的所述目标数量的数据量较多,超过4个通道CI/CO数据块中针对所述目标数据存储的数据量时,相应地,所述存储控制单元还需按照维度7完成下一个round中针对所述目标数据的存放,即将后续所需搬运的所述目标数据存放到下一个round的通道CI/CO数据块中。For example, in FIG. 4, the computing device stores the target data in the row direction to the data block CI/CO0 of the register unit according to the indication of the indication information according to the dimension 1 and the dimension 2, and then according to the dimension 3 and the dimension 4 storing the target data in the column direction in the data block CI/CO0 of the register unit. That is, the target data is first stored in the data block CI/CO0 of the register unit according to the dimension 1 to the dimension 4, that is, the storage for the target data in the data block CI/CO0 is completed first. The subsequently read target data is then stored in dimension 5 or dimension 6 to the data block CI/CO1 or CI/CO2 corresponding to the register unit in the row/column direction. By analogy, it is assumed that the number of data blocks defining the channel CI/CO for each round support processing is 4 according to the processing capability of the neural network processor in the present application. Correspondingly, if the amount of data of the target quantity to be handled in the storage medium is large, more than the amount of data stored in the 4 channel CI/CO data block for the target data, correspondingly, the storage The control unit also needs to complete the storage of the target data in the next round according to the dimension 7, that is, the target data to be subsequently carried is stored in the channel CI/CO data block of the next round.
第二种实施方式中,若所述数据搬运指令用于指示从所述寄存器单元向所述存储介质中搬运数据,则所述存储控制单元根据所述数据搬运指令中所述指示信息的指示,先从所述寄存器单元中读取所述目标数据所在的第一数据块,然后从所述第一数据块中提取出所需传输的所述目标数据,接着将所述目标数据依次连续地发送并存储至所述存储介质中。In a second embodiment, if the data transfer instruction is used to instruct to transfer data from the register unit to the storage medium, the storage control unit is configured to perform an indication of the indication information in the data transfer instruction. First reading the first data block in which the target data is located from the register unit, and then extracting the target data to be transmitted from the first data block, and then sequentially transmitting the target data sequentially And stored in the storage medium.
具体的,如图4,先按照维度1和维度2读取并抽取通道CI/CO数据块行方向上所需搬运的所述目标数据,即如图4中箭头方向所示,在一个通道CI/CO数据块的行方向上从低位到高低依次读取所需搬运的所述目标数据。接着,按照维度3和维度4读取并抽取通道CI/CO数据块在列方向上所需搬运的所述目标数据。此时即可完成一个通道CI/CO数据块中所有待搬运的所述目标数据的获取。之后,所述存储控制单元可根据所述指示信息的指示再按照维度5或维度6完成行/列方向上其他通道CI/CO数据块中所需搬运的所述目标数据块的读 取,直至完成一个round中所述目标数据的读取。然后,根据实际情况,即是所述第一数据块的数量C以及每个round支持处理的批数据块的数量M1*M2,确定是否继续按照维度7实现其他round中所述目标数据的读取和搬运。Specifically, as shown in FIG. 4, the target data to be carried in the row direction of the channel CI/CO data block is first read and extracted according to the dimension 1 and the dimension 2, that is, as shown by the direction of the arrow in FIG. 4, in one channel CI/ The target data to be transported is sequentially read from the low position to the high level in the row direction of the CO data block. Next, the target data to be carried in the column direction of the channel CI/CO data block is read and extracted in accordance with dimension 3 and dimension 4. At this point, the acquisition of all the target data to be carried in a channel CI/CO data block can be completed. Afterwards, the storage control unit may perform reading of the target data block to be carried in other channel CI/CO data blocks in the row/column direction according to the indication of the indication information, and then according to the dimension 5 or the dimension 6 until Completing the reading of the target data in a round. Then, according to the actual situation, that is, the number C of the first data block and the number of batch data blocks M1*M2 supported by each round, whether to continue reading the target data in other rounds according to the dimension 7 And handling.
应理解的,所述存储控制单元从所述寄存器单元中读取到所需搬运的所述目标数据后,可连续发送给所述存储介质,以便于将所述目标数据连续存储至所述存储介质中。It should be understood that after the storage control unit reads the target data to be carried from the register unit, it may continuously send to the storage medium, so as to continuously store the target data to the storage. In the medium.
相应地,例如图4,所述计算装置根据所述指示信息的指示按照维度1和维度2读取所述寄存器单元的数据块CI/CO0中行方向上所需搬运的目标数据,并将所述目标数据连续发送至所述存储介质中存储,即先按照维度1和维度2完成通道数据块CI/CO0行方向上的所述目标数据的搬运。接着,按照维度3和维度4读沿着列方向上读取所述寄存器单元的数据块CI/CO0中所需搬运的目标数据,并将所述目标数据连续发送至所述存储介质中存储,即按照维度3和维度4完成通道数据块CI/CO0行方向上的所述目标数据的搬运。相应地,按照维度1至维度4可先完成数据块CI/CO0中所述目标数据的搬运。然后,再按照维度5或维度6实现行/列方向上其他通道CI/CO数据块中所述目标数据的读取和搬运,依次类推,直至完成一个round中所述目标数据的读取和搬运。假设本申请中依据神经网络处理器的处理能力,定义每个round支持处理的通道CI/CO的数据块的数量为4。相应地,如果所述寄存器单元中所需搬运的所述目标数据被存储在6个通道CI/CO数据块中,具体为图4的数据块CI/CO0至数据块CI/CO5中。由此可知,所述存储控制单元还需按照维度7完成下一个round中针对所述目标数据的读取和搬运。Correspondingly, for example, FIG. 4, the computing device reads the target data to be carried in the row direction of the data block CI/CO0 of the register unit according to the indication of the indication information according to the dimension 1 and the dimension 2, and The target data is continuously sent to the storage medium for storage, that is, the handling of the target data in the channel data block CI/CO0 row direction is completed first according to the dimension 1 and the dimension 2. Then, reading the target data to be carried in the data block CI/CO0 of the register unit along the column direction according to the dimension 3 and the dimension 4, and continuously transmitting the target data to the storage medium for storage. That is, the handling of the target data in the channel direction of the channel data block CI/CO0 is completed in accordance with the dimension 3 and the dimension 4. Correspondingly, the handling of the target data in the data block CI/CO0 can be completed first according to the dimension 1 to the dimension 4. Then, according to the dimension 5 or the dimension 6, the reading and carrying of the target data in the other channel CI/CO data block in the row/column direction are implemented, and so on, until the reading and handling of the target data in a round is completed. . It is assumed that the number of data blocks defining the channel CI/CO for each round support processing is 4 according to the processing capability of the neural network processor in the present application. Accordingly, if the target data to be carried in the register unit is stored in a 6-channel CI/CO data block, specifically in the data block CI/CO0 to the data block CI/CO5 of FIG. It can be seen that the storage control unit also needs to complete the reading and handling of the target data in the next round according to the dimension 7.
下面介绍本申请中涉及的所述存储控制单元的结构框架以及基于该框架对应给出的数据搬运的具体实施例。The structural framework of the storage control unit referred to in the present application and a specific embodiment of data handling based on the corresponding correspondence of the framework are described below.
如图5A示出一种第一存储控制单元EoDMA的结构示意图。如图5A所示的第一存储控制单元包括第一控制单元202、第一读数据单元204、第一写数据单元206。可选地,还可包括第一先进先出(First In First Out,FIFO)单元208以及第一授权单元210。可选的,所述第一控制单元202包括指令存储单元以及指令控制单元,图未示。其中,FIG. 5A shows a schematic structural diagram of a first storage control unit EoDMA. The first storage control unit as shown in FIG. 5A includes a first control unit 202, a first read data unit 204, and a first write data unit 206. Optionally, a first first in first out (FIFO) unit 208 and a first authorization unit 210 may also be included. Optionally, the first control unit 202 includes an instruction storage unit and an instruction control unit, which are not shown. among them,
所述指令存储单元(EoDMA_iq)用于接收神经网络处理器发送的所述数 据搬运指令,其中当然包括所述数据搬运指令中包含的指示信息等参数。The instruction storage unit (EoDMA_iq) is configured to receive the data handling instruction sent by the neural network processor, which of course includes parameters such as indication information included in the data handling instruction.
所述指令控制单元(EoDMA_ctrl)用于负责所述数据搬运指令(具体为指令中的参数,如指示信息)的分发、启动EoDMA以及控制完成所述指示信息中除维度1之外的其他多维信息之间的切换等。The instruction control unit (EoDMA_ctrl) is configured to be responsible for distributing the data handling instruction (specifically, parameters in the instruction, such as indication information), starting EoDMA, and controlling completion of multi-dimensional information other than dimension 1 in the indication information. Switch between etc.
所述第一授权单元(Rd_dm_grant)用于负责读取所述寄存器单元的授权(即是否支持从所述寄存器单元中读取所需搬运的所述目标数据)。应理解的,所述寄存器单元的授权可与以下信息有关,如所述寄存器单元中存储的所需搬运的所述目标数据或者所述目标数据所在的第一数据块的优先级,例如多条数据搬运指令同时需从所述寄存器单元中搬运数据时,受限于数据传输能力,所述寄存单元可考虑所需搬运的所述目标数据的优先级,如优先级越高,则越早授权;优先级较低,则等待优先级较高的所述目标数据搬运完后再搬运优先级较低的目标数据等等。The first authorization unit (Rd_dm_grant) is responsible for reading the authorization of the register unit (ie, whether to support reading the target data to be carried from the register unit). It should be understood that the authorization of the register unit may be related to the following information, such as the target data to be carried in the register unit or the priority of the first data block in which the target data is located, for example, multiple pieces. When the data transfer instruction needs to transfer data from the register unit at the same time, it is limited by the data transmission capability, and the registration unit may consider the priority of the target data to be carried, and the higher the priority, the earlier the authorization is performed. If the priority is low, the target data with higher priority is processed, and the target data with lower priority is transported.
可选的,所述第一授权单元还用于根据第一FIFO的读使能(即通过读使能指令获知所述第一FIFO单元中被占用的存储空间)以及所述第一读数据单元的读使能(即向所述寄存器单元发送的数据读取指令,以获知所述寄存器单元中所需搬运的所述目标数据的数据量)预测所述第一FIFO是否将溢出或者,所述第一FIFO单元的存储空间超过预设阈值等。可选的,还用于向所述第一读数据单元反馈相应地的数据读取授权指示,所述数据读取授权指示用于指示是否授权从所述寄存器单元中读取数据,也即是是否授权数据的读取。具体的,当所述所述寄存器单元不授权,或者所述第一FIFO单元的存储空间超过预设阈值或溢出时,反馈的所述数据读取授权指示用于指示不授权所述寄存器单元中数据的读取;否则用于指示授权所述寄存器单元中数据的读取。Optionally, the first authorization unit is further configured to: according to a read enable of the first FIFO (ie, learn the occupied storage space in the first FIFO unit by using a read enable command) and the first read data unit Read enable (ie, a data read instruction sent to the register unit to know the amount of data of the target data to be carried in the register unit) to predict whether the first FIFO will overflow or The storage space of the first FIFO unit exceeds a preset threshold or the like. Optionally, the method further includes: feeding back, to the first read data unit, a corresponding data read authorization indication, where the data read authorization indication is used to indicate whether to authorize reading data from the register unit, that is, Whether to authorize the reading of data. Specifically, when the register unit is not authorized, or the storage space of the first FIFO unit exceeds a preset threshold or overflow, the data read authorization indication that is fed back is used to indicate that the register unit is not authorized. Reading of data; otherwise used to indicate that the reading of data in the register unit is authorized.
所述第一读数据单元用于在所述数据读取授权指示用于指示授权数据读取时,根据指令中指示信息的指示从所述寄存器单元中读取所需搬运的目标数据,并将所述目标数据连续发送至所述第一FIFO单元中缓存。The first read data unit is configured to read, from the register unit, the target data to be carried, according to the indication of the indication information in the instruction, when the data read authorization indication is used to indicate the authorization data reading, and The target data is continuously sent to the cache in the first FIFO unit.
具体的,所述第一读数据单元,也可称为数据抽取单元(extract valid data)用于通过接口(如Xbar接口)从所述寄存器单元中读取所述目标数据所在的第一数据块,并负责基于所述指示信息中的维度1来实现所述目标数据的提取;同时将提取的所述目标数据连续缓存至所述第一FIFO单元中。Specifically, the first read data unit, which may also be referred to as an extract valid data, is used to read the first data block where the target data is located from the register unit through an interface (such as an Xbar interface). And responsible for implementing extraction of the target data based on dimension 1 in the indication information; and simultaneously buffering the extracted target data into the first FIFO unit.
所述第一FIFO单元用于连续缓存所需搬运的所述目标数据。The first FIFO unit is configured to continuously cache the target data to be carried.
所述第一写数据单元,也可称为数据发送单元(send data unit)用于从所述第一FIFO单元中将缓存的所述目标数据连续发送到所述存储介质中进行存储。可选的,所述第一写数据单元还可用于负责与所述计算装置中的总线对接,受总线的控制,允许/禁止将所述目标数据连续写入至所述存储介质中存储。The first write data unit, which may also be referred to as a data data unit, is used to continuously send the cached target data from the first FIFO unit to the storage medium for storage. Optionally, the first write data unit is further configured to be responsible for interfacing with a bus in the computing device, controlled by a bus, allowing/disabling the continuous writing of the target data to the storage medium for storage.
相应地基于图5A所示的EoDMA结构示意图,参见图5B是本发明实施例提供的又一种数据搬运方法的流程示意图。如图5B所示的方法可包括如下实施步骤:Based on the schematic diagram of the EoDMA structure shown in FIG. 5A, FIG. 5B is a schematic flowchart of still another data handling method according to an embodiment of the present invention. The method as shown in FIG. 5B may include the following implementation steps:
步骤301、第一控制单元202接收来自神经网络处理器发送的所述数据搬运指令,并将所述数据搬运指令发送给所述第一读数据单元204。其中,所述数据搬运指令包括所述指示信息,该指示信息用于指示从所述寄存器单元中向所述存储介质中搬运数据,可选地还可包括所需搬运的目标数据以及所述目标数据所在的第一数据块的存储格式,具体可参见前述实施例中的相关阐述,这里不再赘述。Step 301: The first control unit 202 receives the data handling instruction sent by the neural network processor, and sends the data handling instruction to the first read data unit 204. The data handling instruction includes the indication information, the indication information is used to indicate that data is transferred from the register unit to the storage medium, and optionally includes target data to be carried and the target For the storage format of the first data block where the data is located, refer to the related description in the foregoing embodiment, and details are not described herein again.
步骤S302、所述第一授权单元210根据授权因素,确定数据读取授权指示。其中,所述数据读取授权指示用于指示是否授权所述第一读数据单元204从所述寄存器单元中读取所需搬运的所述目标数据,即指示是否授权数据读取。所述授权因素包括以下中的任一项或多项的组合:所述第一FIFO单元中被占用的存储空间是否超过预设阈值、所述目标数据的优先级、所述第一数据块的优先级、或者其他用于影响数据传输的因素等等,本申请不做限定。Step S302: The first authorization unit 210 determines a data read authorization indication according to an authorization factor. The data read authorization indication is used to indicate whether the first read data unit 204 is authorized to read the target data to be carried from the register unit, that is, whether to authorize data reading. The authorization factor includes a combination of any one or more of the following: whether the occupied storage space in the first FIFO unit exceeds a preset threshold, a priority of the target data, and the first data block Priority, or other factors used to affect data transmission, etc., are not limited in this application.
步骤S303、所述第一读数据单元204接收所述数据搬运指令,在所述数据读取授权指示用于指示授权数据读取的情况下,根据所述数据搬运指令中所述第一数据块的存储格式,从所述寄存器单元中读取所需搬运的目标数据。相应地,所述第一读数据单元204将读取的所述目标数据连续缓存至所述第一FIFO单元208中。关于所述目标数据的读取可参见前述实施例中的相关介绍,这里不再赘述。Step S303, the first read data unit 204 receives the data handling instruction, and in the case that the data read authorization indication is used to indicate authorization data reading, according to the first data block in the data handling instruction The storage format reads the target data to be carried from the register unit. Accordingly, the first read data unit 204 continuously caches the read target data into the first FIFO unit 208. For the reading of the target data, refer to related descriptions in the foregoing embodiments, and details are not described herein again.
步骤S304、所述第一FIFO单元208连续缓存所需搬运的所述目标数据。Step S304, the first FIFO unit 208 continuously buffers the target data to be carried.
步骤S305、所述第一写数据单元206从所述第一FIFO单元208中获取所述目标数据,并将所述目标数据连续写入/存储至所述存储介质中。Step S305, the first write data unit 206 acquires the target data from the first FIFO unit 208, and continuously writes/stores the target data into the storage medium.
如图6A示出一种第二存储控制单元EiDMA的结构示意图。如图6A所示的第二存储控制单元包括第二控制单元302、第二读数据单元304、第二写数据单元306。可选地,还可包括第二先进先出(First In First Out,FIFO)单元308以及第二授权单元310。可选的,所述第二控制单元302包括指令存储单元以及指令控制单元,图未示。其中,FIG. 6A shows a schematic structural diagram of a second storage control unit EiDMA. The second storage control unit as shown in FIG. 6A includes a second control unit 302, a second read data unit 304, and a second write data unit 306. Optionally, a second first in first out (FIFO) unit 308 and a second authorization unit 310 may also be included. Optionally, the second control unit 302 includes an instruction storage unit and an instruction control unit, which are not shown. among them,
所述指令存储单元(EiDMA_iq)用于接收神经网络处理器发送的所述数据搬运指令,其中当然包括所述数据搬运指令中包含的指示信息等参数。The instruction storage unit (EiDMA_iq) is configured to receive the data handling instruction sent by the neural network processor, which of course includes parameters such as indication information included in the data handling instruction.
所述指令控制单元(EiDMA_ctrl)用于负责所述数据搬运指令(具体为指令中的参数,如指示信息)的分发以及启动EiDMA。The instruction control unit (EiDMA_ctrl) is responsible for the distribution of the data handling instructions (specifically parameters in the instructions, such as indication information) and the initiation of EiDMA.
所述第二授权单元(Rd_dm_grant)用于负责读取所述存储介质的授权(即是否支持从所述存储介质中读取所需搬运的所述目标数据)。应理解的,所述存储介质的授权可与以下信息有关,如所述存储介质中存储的所需搬运的所述目标数据或者所述目标数据所在的第一数据块的优先级,例如多条数据搬运指令同时需从所述存储介质中搬运数据时,受限于数据传输能力,所述存储介质可考虑所需搬运的所述目标数据的优先级,如优先级越高,则越早授权;优先级较低,则等待优先级较高的所述目标数据搬运完后再搬运优先级较低的目标数据等等。The second authorization unit (Rd_dm_grant) is responsible for reading the authorization of the storage medium (ie, whether to support reading the target data required for transportation from the storage medium). It should be understood that the authorization of the storage medium may be related to the following information, such as the target data to be transported stored in the storage medium or the priority of the first data block in which the target data is located, for example, multiple pieces. When the data handling instruction needs to carry data from the storage medium at the same time, it is limited by the data transmission capability, and the storage medium can take into consideration the priority of the target data to be carried, and the higher the priority, the earlier the authorization is performed. If the priority is low, the target data with higher priority is processed, and the target data with lower priority is transported.
可选的,所述第二授权单元还用于根据第二FIFO的读使能(即通过读使能指令获知所述第二FIFO单元中被占用的存储空间)以及所述第二读数据单元的读使能(即向所述存储介质发送的数据读取指令,以获知所述存储介质中所需搬运的所述目标数据的数据量)预测所述第二FIFO是否将溢出或者,所述第二FIFO单元的存储空间超过预设阈值等。可选的,还用于向所述第二读数据单元反馈相应地的数据读取授权指示,所述数据读取授权指示用于指示是否授权从所述存储介质中读取数据,也即是是否授权数据的读取。具体的,当所述所述存储介质不授权,或者所述第二FIFO单元的存储空间超过预设阈值或溢出时,反馈的所述数据读取授权指示用于指示不授权所述存储介质中数据的读取;否则用于指示授权所述存储介质中数据的读取。Optionally, the second authorization unit is further configured to: according to a read enable of the second FIFO (ie, learn the occupied storage space in the second FIFO unit by using a read enable command) and the second read data unit Reading enable (ie, a data read instruction sent to the storage medium to know the amount of data of the target data to be carried in the storage medium) predicting whether the second FIFO will overflow or The storage space of the second FIFO unit exceeds a preset threshold or the like. Optionally, the method further includes: feeding back, to the second read data unit, a corresponding data read authorization indication, where the data read authorization indication is used to indicate whether to authorize reading data from the storage medium, that is, Whether to authorize the reading of data. Specifically, when the storage medium is not authorized, or the storage space of the second FIFO unit exceeds a preset threshold or overflow, the data read authorization indication that is fed back is used to indicate that the storage medium is not authorized. Reading of data; otherwise used to indicate that the reading of data in the storage medium is authorized.
所述第二读数据单元(Rd_ext_data)用于在所述数据读取授权指示用于指示授权数据读取时,根据数据搬运指令从所述存储介质中读取所需搬运的目标数据,并将所述目标数据发送至所述第二FIFO单元中进行缓存。The second read data unit (Rd_ext_data) is configured to read target data to be carried from the storage medium according to a data transfer instruction when the data read authorization indication is used to indicate authorization data reading, and The target data is sent to the second FIFO unit for buffering.
可选的,还用于负责与所述计算装置中的总线对接,受总线的控制,允许/禁止所述目标数据的读取。Optionally, it is further configured to be responsible for interfacing with a bus in the computing device, controlled by a bus, allowing/disabling reading of the target data.
所述第二FIFO单元用于缓存所需搬运的所述目标数据。The second FIFO unit is configured to cache the target data to be carried.
所述第二写数据单元(Wr_dm_data)用于从所述第二FIFO单元中将缓存的所述目标数据按照指令中所述指示信息的指示以所述第一数据块的存储格式发送到所述存储介质中进行存储。具体的,所述第二写数据单元可用于负责控制所述指示信息中多维信息之间的相互切换,以完成在所述寄存器单元中针对所述目标数据的存储。The second write data unit (Wr_dm_data) is configured to send the cached target data from the second FIFO unit to the indication in a storage format of the first data block according to the indication of the indication information in the instruction. Storage in the storage medium. Specifically, the second write data unit is configured to be responsible for controlling mutual switching between the multi-dimensional information in the indication information to complete storage of the target data in the register unit.
基于图6A所示的结构示意图,参见图6B是本发明实施例提供的又一种数据搬运方法的流程示意图。如图6B所示的方法包括如下实施步骤:Based on the structural diagram shown in FIG. 6A, FIG. 6B is a schematic flowchart of still another data handling method according to an embodiment of the present invention. The method shown in FIG. 6B includes the following implementation steps:
步骤S401、第二控制单元302接收来自神经网络处理器发送的所述数据搬运指令,并将所述数据搬运指令发送给所述第二读数据单元304。其中,所述数据搬运指令包括所述指示信息,该指示信息用于指示从所述存储介质中向所述寄存器单元中搬运数据,可选地还可包括所需搬运的目标数据以及所述目标数据在所述寄存器单元中的存储格式,即本申请中所述目标数据所在的第一数据块的存储格式,具体可参见前述实施例中的相关阐述,这里不再赘述。Step S401: The second control unit 302 receives the data handling instruction sent by the neural network processor, and sends the data handling instruction to the second read data unit 304. Wherein the data handling instruction includes the indication information, the indication information is used to indicate that data is carried from the storage medium to the register unit, optionally further comprising target data to be carried and the target For the storage format of the data in the register unit, that is, the storage format of the first data block in which the target data is located in the present application, refer to the related description in the foregoing embodiment, and details are not described herein again.
步骤S402、第二授权单元310根据授权因素,确定数据读取授权指示。其中,所述数据读取授权指示用于指示是否授权所述第二读数据单元304从所述存储介质中读取所需搬运的所述目标数据,即指示是否授权数据读取。所述授权因素包括以下中的任一项或多项的组合:所述第二FIFO单元中被占用的存储空间是否超过预设阈值、所述目标数据的优先级、所述第一数据块的优先级、或者其他用于影响数据传输的因素等等,本申请不做限定。Step S402: The second authorization unit 310 determines a data read authorization indication according to the authorization factor. The data read authorization indication is used to indicate whether the second read data unit 304 is authorized to read the target data to be carried from the storage medium, that is, whether to authorize data reading. The authorization factor includes a combination of any one or more of the following: whether the occupied storage space in the second FIFO unit exceeds a preset threshold, a priority of the target data, and the first data block Priority, or other factors used to affect data transmission, etc., are not limited in this application.
步骤S403、第二读数据单元304接收所述数据搬运指令,在所述数据读取授权指示用于指示授权数据读取的情况下,根据所述数据搬运指令,从所述存储介质中连续读取所需搬运的所述目标数据。相应地,所述第二读数据单元304还可进一步根据指令中所述指示信息指示的所述第一数据块的存储格式,将所述目标数据按照所述第一数据块的存储格式缓存至第二FIFO单元308中。Step S403, the second read data unit 304 receives the data transfer instruction, and in the case that the data read authorization indication is used to indicate the authorization data read, continuously reading from the storage medium according to the data transfer instruction. Take the target data that needs to be transported. Correspondingly, the second read data unit 304 may further cache the target data according to the storage format of the first data block according to the storage format of the first data block indicated by the indication information in the instruction to In the second FIFO unit 308.
步骤S404、第二FIFO单元308缓存所需搬运的所述目标数据。Step S404, the second FIFO unit 308 buffers the target data to be transported.
步骤S405、第二写数据单元306从所述第二FIFO单元中读取符合所述第 一数据块的存储格式的所需搬运的所述目标数据,并将所述符合所述第一数据块的存储格式的所述目标数据发送至所述寄存器单元中存储。关于所述目标数据如何按照所述指示信息中所述第一数据块的存储格式进行存储,可参见前述实施例中的相关阐述,这里不再赘述。Step S405: The second write data unit 306 reads, from the second FIFO unit, the target data that needs to be transported according to the storage format of the first data block, and matches the first data block. The target data of the storage format is sent to the register unit for storage. For the storage of the target data according to the storage format of the first data block in the indication information, refer to the related description in the foregoing embodiment, and details are not described herein again.
由此可以看出,本申请可根据神经网络处理器支持处理的数据格式来设计多维DMA数据的存储格式,即利用与神经网络处理器所匹配的数据存储格式来对应进行数据的存储,可提高数据的读写速率,从而实现数据的高效搬运,提高数据搬运/数据处理的效率。It can be seen that the present application can design a storage format of the multi-dimensional DMA data according to the data format supported by the neural network processor, that is, the data storage format matched with the neural network processor can be used to store the data, which can be improved. The read/write rate of data enables efficient data handling and improves data handling/data processing efficiency.
请参见图7,是本发明实施例提供的又一种计算装置的结构示意图。如图7所述的计算装置包括存储介质70、寄存器单元72以及存储控制单元74,其中,FIG. 7 is a schematic structural diagram of still another computing device according to an embodiment of the present invention. The computing device as described in FIG. 7 includes a storage medium 70, a register unit 72, and a storage control unit 74, wherein
所述存储介质70和所述寄存器单元72均用于存储数据;The storage medium 70 and the register unit 72 are both used to store data;
所述存储控制单元74用于获取数据搬运指令,所述数据搬运指令包括指示信息,所述指示信息用于指示待搬运的目标数据以及所述目标数据所在的第一数据块的存储格式;The storage control unit 74 is configured to acquire a data handling instruction, where the data handling instruction includes indication information, where the indication information is used to indicate target data to be carried and a storage format of the first data block where the target data is located;
所述存储控制单元74还用于根据所述第一数据块的存储格式,在所述存储介质和所述寄存器单元之间完成所述目标数据的搬运。The storage control unit 74 is further configured to complete the handling of the target data between the storage medium and the register unit according to a storage format of the first data block.
在可选实施例中,所述第一数据块是由C个H*W的数据块构成,C表示传输所述第一数据块所需的通道数,H和W分别表示所述数据块的高度和宽度;In an optional embodiment, the first data block is composed of C H*W data blocks, C represents the number of channels required to transmit the first data block, and H and W respectively represent the data block. Height and width;
所述指示信息包括以下信息中的至少一项:所述数据块在宽度方向上的第一搬运指示、所述数据块在宽度方向上的宽度W、所述数据块在高度方向上第二搬运指示、所述数据块在高度方向上的高度H、所述数据块之间在宽度方向上的存储间隔、所述数据块在宽度方向上的存储数量M1、所述数据块之间在高度方向上的存储间隔、所述数据块在高度方向上的存储数量M2以及批数据块在高度方向上的存储间隔,所述批数据块包含的数据块的总数量为M1*M2,用于指示所述计算装置的数据搬运能力;The indication information includes at least one of the following information: a first transport indication of the data block in the width direction, a width W of the data block in the width direction, and a second transport of the data block in the height direction. An indication, a height H of the data block in the height direction, a storage interval between the data blocks in the width direction, a storage amount M1 of the data block in the width direction, and a height direction between the data blocks The upper storage interval, the storage amount M2 of the data block in the height direction, and the storage interval of the batch data block in the height direction, the total number of data blocks included in the batch data block is M1*M2, used to indicate The data handling capability of the computing device;
所述第一搬运指示用于指示所述数据块在宽度方向上每连续K1个数据确定一个所需搬运的目标数据;The first transport indication is used to indicate that the data block determines a target data to be transported for every consecutive K1 data in the width direction;
所述第二搬运指示用于指示所述数据块在高度方向上每连续K2个数据确定一个所需搬运的目标数据;The second transport indication is used to indicate that the data block determines a target data to be transported for every consecutive K2 data in the height direction;
其中,所述目标数据为所述数据块中的数据,M1、M2、K1和K2均为正整数。The target data is data in the data block, and M1, M2, K1, and K2 are all positive integers.
在可选实施例中,所述存储控制单元74包括第一存储控制单元720和第二存储控制单元730;其中,In an optional embodiment, the storage control unit 74 includes a first storage control unit 720 and a second storage control unit 730;
所述第一存储控制单元720用于根据所述第一数据块的存储格式从所述寄存器单元中提取所述第一数据块中的目标数据,并将所述目标数据连续存储至所述存储介质中;The first storage control unit 720 is configured to extract target data in the first data block from the register unit according to a storage format of the first data block, and continuously store the target data to the storage. In the medium;
所述第二存储控制单元722用于从所述存储介质中获取连续存储的所述目标数据,并按照所述第一数据块的存储格式将所述目标数据存储至所述寄存器单元中。The second storage control unit 722 is configured to acquire the continuously stored target data from the storage medium, and store the target data into the register unit according to a storage format of the first data block.
在可选实施例中,所述第一存储控制单元720包括第一控制单元721、第一读数据单元722、第一写数据单元723、第一先进先出FIFO单元724以及第一授权单元725;In an optional embodiment, the first storage control unit 720 includes a first control unit 721, a first read data unit 722, a first write data unit 723, a first FIFO FIFO unit 724, and a first authorization unit 725. ;
所述第一控制单元721用于获取所述数据搬运指令,并将所述数据搬运指令发送给所述第一读数据单元722;The first control unit 721 is configured to acquire the data handling instruction, and send the data handling instruction to the first read data unit 722;
所述第一授权单元725用于根据授权因素确定数据读取授权指示,所述数据读取授权指示用于指示是否授权读取所需搬运的所述目标数据,所述授权因素包括以下中的至少一项:所述第一FIFO单元中被占用的存储空间是否超过预设阈值、所述目标数据的优先级、所述第一数据块的优先级;The first authorization unit 725 is configured to determine, according to an authorization factor, a data read authorization indication, where the data read authorization indication is used to indicate whether to authorize reading the target data to be carried, the authorization factor includes the following At least one item: whether the occupied storage space in the first FIFO unit exceeds a preset threshold, a priority of the target data, and a priority of the first data block;
所述第一读数据单元722用于在所述数据读取授权指示用于指示授权数据读取的情况下,根据所述第一数据块的存储格式从所述寄存器单元中提取所述第一数据块中的目标数据,并将所述目标数据连续缓存至所述第一FIFO单元724中;The first read data unit 722 is configured to extract the first from the register unit according to a storage format of the first data block if the data read authorization indication is used to indicate authorization data read Target data in the data block, and continuously buffering the target data into the first FIFO unit 724;
所述第一FIFO单元724用于连续缓存所需搬运的所述目标数据;The first FIFO unit 724 is configured to continuously cache the target data that needs to be transported;
所述第一写数据单元723用于从所述第一FIFO单元724中连续提取所需搬运的所述目标数据,并发送至所述存储介质中存储。The first write data unit 723 is configured to continuously extract the target data to be transported from the first FIFO unit 724 and send the target data to the storage medium for storage.
在可选实施例中,所述第二存储控制单元730包括第二控制单元731、第二读数据单元732、第二写数据单元733、第二先进先出FIFO单元734以及第二授权单元735;In an optional embodiment, the second storage control unit 730 includes a second control unit 731, a second read data unit 732, a second write data unit 733, a second FIFO FIFO unit 734, and a second authorization unit 735. ;
所述第二控制单元731用于获取所述数据搬运指令,并将所述数据搬运指 令发送给所述第二读数据单元732;The second control unit 731 is configured to acquire the data handling instruction, and send the data handling instruction to the second read data unit 732;
所述第二授权单元735用于根据授权因素确定数据读取授权指示,并将所述数据读取授权指示发送给所述第二读数据单元732;其中,所述数据读取授权指示用于指示是否授权读取所需搬运的所述目标数据,所述授权因素包括以下中的至少一项:所述第二FIFO单元中被占用的存储空间是否超过预设阈值、所述目标数据的优先级及所述第一数据块的优先级;The second authorization unit 735 is configured to determine a data read authorization indication according to an authorization factor, and send the data read authorization indication to the second read data unit 732; wherein the data read authorization indication is used for Determining whether to authorize reading the target data to be carried, the authorization factor comprising at least one of: whether the occupied storage space in the second FIFO unit exceeds a preset threshold, and the target data is prioritized Level and priority of the first data block;
所述第二读数据单元732用于在所述数据读取授权指示用于指示授权数据读取的情况下,根据所述数据搬运指令从所述存储介质中连续提取所需搬运的所述目标数据,按照所述第一数据块的存储格式将所述目标数据缓存至所述第二FIFO单元734中;The second read data unit 732 is configured to continuously extract the target to be transported from the storage medium according to the data handling instruction, in a case where the data read authorization indication is used to indicate authorization data reading. Data, the target data is buffered into the second FIFO unit 734 according to a storage format of the first data block;
所述第二FIFO单元734用于缓存符合所述存储格式的所述目标数据;The second FIFO unit 734 is configured to cache the target data that meets the storage format;
所述第二写数据单元733用于从所述第二FIFO单元734中提取符合所述存储格式的所述目标数据,并将所述目标数据发送至所述寄存器单元中存储。The second write data unit 733 is configured to extract the target data conforming to the storage format from the second FIFO unit 734, and send the target data to the register unit for storage.
再请参见图8,是本发明实施例的一种计算装置的结构示意图。所述计算装置可以为智能手机、平板电脑、智能可穿戴设备等带神经网络处理器以及通信网络功能的设备,如图8所示,本发明实施例的所述计算装置可以包括显示屏、按键、扬声器、拾音器等模块,并且还包括:至少一个总线501、与总线501相连的至少一个处理器502以及与总线501相连的至少一个存储器503,实现通信功能的通信装置505,为终端各耗电模块供电的电源装置504。Referring to FIG. 8, FIG. 8 is a schematic structural diagram of a computing device according to an embodiment of the present invention. The computing device may be a device with a neural network processor and a communication network function, such as a smart phone, a tablet computer, or a smart wearable device. As shown in FIG. 8 , the computing device in the embodiment of the present invention may include a display screen and a button. a module, a speaker, a pickup, etc., and further comprising: at least one bus 501, at least one processor 502 connected to the bus 501, and at least one memory 503 connected to the bus 501, and a communication device 505 for implementing a communication function, which consumes power for each terminal Module powered power supply unit 504.
所述处理器502可通过总线501,调用存储器503中存储的代码以执行相关的功能,其中,存储器503包括操作***、数据搬运应用程序。其中,所述处理器502,用于执行如上所述方法实施例提供的所有或者部分实施步骤。The processor 502 can call the code stored in the memory 503 to perform related functions via the bus 501, wherein the memory 503 includes an operating system, a data handling application. The processor 502 is configured to perform all or part of the implementation steps provided by the method embodiment as described above.
本发明实施例还提供一种计算机可读存储介质,其中,该计算机可读存储介质可存储有程序,该程序执行时包括上述方法实施例中记载的部分或全部步骤。The embodiment of the present invention further provides a computer readable storage medium, wherein the computer readable storage medium can store a program, and the program includes some or all of the steps described in the foregoing method embodiments.
本申请实施例还提供一种计算机程序产品,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序可操作来使计算机执行如上述方法实施例中记载的部分或全部步骤。The embodiment of the present application further provides a computer program product, comprising: a non-transitory computer readable storage medium storing a computer program, the computer program being operative to cause a computer to perform the operations as recited in the foregoing method embodiments Some or all of the steps.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述 为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明所必须的。It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should understand that the present invention is not limited by the described action sequence. Because certain steps may be performed in other sequences or concurrently in accordance with the present invention. In addition, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above embodiments, the descriptions of the various embodiments are different, and the details that are not detailed in a certain embodiment can be referred to the related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided herein, it should be understood that the disclosed apparatus may be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner, for example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical or otherwise.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明的各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium. A number of instructions are included to cause a computer device (which may be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a U disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk, and the like. .
以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to be limiting; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that The technical solutions described in the embodiments are modified, or some of the technical features are replaced by equivalents; and the modifications or substitutions do not deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims (12)
- 一种数据搬运方法,其特征在于,应用于计算装置中,所述计算装置包括:存储介质、寄存器单元以及存储控制单元,所述方法包括:A data handling method, characterized in that it is applied to a computing device, the computing device comprising: a storage medium, a register unit, and a storage control unit, the method comprising:所述存储控制单元获取数据搬运指令,所述数据搬运指令包括指示信息,所述指示信息用于指示待搬运的目标数据以及所述目标数据所在的第一数据块的存储格式;The storage control unit acquires a data handling instruction, where the data handling instruction includes indication information, where the indication information is used to indicate target data to be carried and a storage format of the first data block where the target data is located;所述存储控制单元根据所述第一数据块的存储格式,在所述存储介质和所述寄存器单元之间完成所述目标数据的搬运。The storage control unit completes the handling of the target data between the storage medium and the register unit according to a storage format of the first data block.
- 根据权利要求1所述的方法,其特征在于,所述第一数据块是由C个H*W的数据块构成,其中,C表示传输所述第一数据块所需的通道数,H和W分别表示所述数据块的高度和宽度;The method according to claim 1, wherein said first data block is composed of C H*W data blocks, wherein C represents the number of channels required to transmit said first data block, H and W represents the height and width of the data block, respectively;所述指示信息包括以下信息中的至少一项:所述数据块在宽度方向上的第一搬运指示、所述数据块在宽度方向上的宽度W、所述数据块在高度方向上的第二搬运指示、所述数据块在高度方向上的高度H、所述数据块之间在宽度方向上的存储间隔、所述数据块在宽度方向上的存储数量M 1、所述数据块之间在高度方向上的存储间隔、所述数据块在高度方向上的存储数量M 2以及批数据块在高度方向上的存储间隔;其中,所述批数据块包含的数据块的总数量为M 1*M 2,用于指示所述计算装置的数据搬运能力; The indication information includes at least one of the following information: a first conveyance indication of the data block in the width direction, a width W of the data block in the width direction, and a second dimension of the data block in the height direction. a transport indication, a height H of the data block in the height direction, a storage interval between the data blocks in the width direction, a storage amount M 1 of the data block in the width direction, and a between the data blocks a storage interval in the height direction, a storage amount M 2 of the data block in the height direction, and a storage interval of the batch data block in the height direction; wherein the total number of data blocks included in the batch data block is M 1 * M 2 for indicating data carrying capability of the computing device;所述第一搬运指示用于指示所述数据块在宽度方向上每连续K 1个数据确定一个所需搬运的目标数据; The first indication for instructing conveyance of the data block in the width direction of each successive data K 1 determines a target data handling required;所述第二搬运指示用于指示所述数据块在高度方向上每连续K 2个数据确定一个所需搬运的目标数据; The second transport indication is used to indicate that the data block determines a target data to be transported for every consecutive K 2 data in a height direction;其中,所述目标数据为所述数据块中的数据,M 1、M 2、K 1和K 2均为正整数。 Wherein, the target data is data in the data block, and M 1 , M 2 , K 1 and K 2 are all positive integers.
- 根据权利要求1或2所述的方法,其特征在于,所述存储控制单元包括第一存储控制单元和第二存储控制单元;The method according to claim 1 or 2, wherein the storage control unit comprises a first storage control unit and a second storage control unit;所述存储控制单元根据所述第一数据块的存储格式,在所述存储介质和所述寄存器单元之间完成所述目标数据的搬运包括:The storing, by the storage control unit, performing the handling of the target data between the storage medium and the register unit according to a storage format of the first data block includes:所述第一存储控制单元根据所述第一数据块的存储格式从所述寄存器单元中提取所述第一数据块中的目标数据,并将所述目标数据连续存储至所述存储 介质中;或者,The first storage control unit extracts target data in the first data block from the register unit according to a storage format of the first data block, and continuously stores the target data into the storage medium; or,所述第二存储控制单元从所述存储介质中获取连续存储的所述目标数据,并按照所述第一数据块的存储格式将所述目标数据存储至所述寄存器单元中。The second storage control unit acquires the target data continuously stored from the storage medium, and stores the target data into the register unit according to a storage format of the first data block.
- 根据权利要求1-3中任一项所述的方法,其特征在于,所述第一存储控制单元包括第一控制单元、第一读数据单元、第一写数据单元、第一先进先出FIFO单元以及第一授权单元;The method according to any one of claims 1 to 3, wherein the first storage control unit comprises a first control unit, a first read data unit, a first write data unit, and a first FIFO FIFO. a unit and a first authorization unit;所述存储控制单元根据所述第一数据块的存储格式,在所述存储介质和所述寄存器单元之间完成所述目标数据的搬运包括:The storing, by the storage control unit, performing the handling of the target data between the storage medium and the register unit according to a storage format of the first data block includes:所述第一控制单元将获取的所述数据搬运指令发送给所述第一读数据单元;The first control unit sends the acquired data handling instruction to the first read data unit;所述第一授权单元根据授权因素确定数据读取授权指示,并将所述数据读取授权指示发送给所述第一读数据单元;其中,所述数据读取授权指示用于指示是否授权读取所需搬运的所述目标数据,所述授权因素包括以下中的至少一项:所述第一FIFO单元中被占用的存储空间是否超过预设阈值、所述目标数据的优先级及所述第一数据块的优先级;Determining, by the first authorization unit, a data read authorization indication according to an authorization factor, and transmitting the data read authorization indication to the first read data unit; wherein the data read authorization indication is used to indicate whether to authorize reading Taking the target data to be carried, the authorization factor includes at least one of whether the occupied storage space in the first FIFO unit exceeds a preset threshold, a priority of the target data, and the The priority of the first data block;所述第一读数据单元在所述数据读取授权指示用于指示授权数据读取的情况下,根据所述第一数据块的存储格式从所述寄存器单元中提取所述第一数据块中的目标数据,并将所述目标数据连续缓存至所述第一FIFO单元中;The first read data unit extracts the first data block from the register unit according to a storage format of the first data block, in a case where the data read authorization indication is used to indicate authorization data reading Target data, and continuously buffering the target data into the first FIFO unit;所述第一写数据单元从所述第一FIFO单元中连续提取所需搬运的所述目标数据,并发送至所述存储介质中存储。The first write data unit continuously extracts the target data to be transported from the first FIFO unit, and sends the target data to the storage medium for storage.
- 根据权利要求1-3中任一项所述的方法,其特征在于,所述第二存储控制单元包括第二控制单元、第二读数据单元、第二写数据单元、第二先进先出FIFO单元以及第二授权单元;The method according to any one of claims 1 to 3, wherein the second storage control unit comprises a second control unit, a second read data unit, a second write data unit, and a second FIFO FIFO. a unit and a second authorization unit;所述存储控制单元根据所述第一数据块的存储格式,在所述存储介质和所述寄存器单元之间完成所述目标数据的搬运包括:The storing, by the storage control unit, performing the handling of the target data between the storage medium and the register unit according to a storage format of the first data block includes:所述第二控制单元将获取的所述数据搬运指令发送给所述第二读数据单元;The second control unit sends the acquired data handling instruction to the second read data unit;所述第二授权单元根据授权因素确定数据读取授权指示,并将所述数据读 取授权指示发送给所述第二读数据单元;其中,所述数据读取授权指示用于指示是否授权读取所需搬运的所述目标数据,所述授权因素包括以下中的至少一项:所述第二FIFO单元中被占用的存储空间是否超过预设阈值、所述目标数据的优先级及所述第一数据块的优先级;Determining, by the second authorization unit, a data read authorization indication according to an authorization factor, and transmitting the data read authorization indication to the second read data unit; wherein the data read authorization indication is used to indicate whether to authorize reading Taking the target data to be carried, the authorization factor includes at least one of whether the occupied storage space in the second FIFO unit exceeds a preset threshold, a priority of the target data, and the The priority of the first data block;所述第二读数据单元在所述数据读取授权指示用于指示授权数据读取的情况下,根据所述数据搬运指令从所述存储介质中连续提取所需搬运的所述目标数据,并按照所述第一数据块的存储格式将所述目标数据缓存至所述第二FIFO单元中;The second read data unit continuously extracts the target data to be transported from the storage medium according to the data transfer instruction, in a case where the data read authorization indication is used to indicate authorization data reading, and Caching the target data into the second FIFO unit according to a storage format of the first data block;所述第二写数据单元从所述第二FIFO单元中提取符合所述存储格式对应的所述目标数据,并将所述目标数据存储所述寄存器单元中。The second write data unit extracts the target data corresponding to the storage format from the second FIFO unit, and stores the target data in the register unit.
- 一种计算装置,其特征在于,包括存储介质、寄存器单元以及存储控制单元,A computing device, comprising: a storage medium, a register unit, and a storage control unit,所述存储介质和所述寄存器单元均用于存储数据;The storage medium and the register unit are both used to store data;所述存储控制单元用于获取数据搬运指令,所述数据搬运指令包括指示信息,所述指示信息用于指示待搬运的目标数据以及所述目标数据所在的第一数据块的存储格式;The storage control unit is configured to acquire a data handling instruction, where the data handling instruction includes indication information, where the indication information is used to indicate target data to be carried and a storage format of the first data block where the target data is located;所述存储控制单元还用于根据所述第一数据块的存储格式,在所述存储介质和所述寄存器单元之间完成所述目标数据的搬运。The storage control unit is further configured to complete the handling of the target data between the storage medium and the register unit according to a storage format of the first data block.
- 根据权利要求6所述的计算装置,其特征在于,所述第一数据块是由C个H*W的数据块构成,C表示传输所述第一数据块所需的通道数,H和W分别表示所述数据块的高度和宽度;The computing device according to claim 6, wherein said first data block is composed of C H*W data blocks, and C represents the number of channels required to transmit said first data block, H and W Representing the height and width of the data block, respectively;所述指示信息包括以下信息中的至少一项:所述数据块在宽度方向上的第一搬运指示、所述数据块在宽度方向上的宽度W、所述数据块在高度方向上第二搬运指示、所述数据块在高度方向上的高度H、所述数据块之间在宽度方向上的存储间隔、所述数据块在宽度方向上的存储数量M 1、所述数据块之间在高度方向上的存储间隔、所述数据块在高度方向上的存储数量M 2以及批数据块在高度方向上的存储间隔,所述批数据块包含的数据块的总数量为M 1*M 2,用于指示所述计算装置的数据搬运能力; The indication information includes at least one of the following information: a first transport indication of the data block in the width direction, a width W of the data block in the width direction, and a second transport of the data block in the height direction. An indication, a height H of the data block in the height direction, a storage interval between the data blocks in the width direction, a storage amount M 1 of the data block in the width direction, and a height between the data blocks a storage interval in the direction, a storage amount M 2 of the data block in the height direction, and a storage interval of the batch data block in the height direction, the total number of data blocks included in the batch data block is M 1 *M 2 , Used to indicate data handling capabilities of the computing device;所述第一搬运指示用于指示所述数据块在宽度方向上每连续K 1个数据确定一个所需搬运的目标数据; The first indication for instructing conveyance of the data block in the width direction of each successive data K 1 determines a target data handling required;所述第二搬运指示用于指示所述数据块在高度方向上每连续K 2个数据确定一个所需搬运的目标数据; The second transport indication is used to indicate that the data block determines a target data to be transported for every consecutive K 2 data in a height direction;其中,所述目标数据为所述数据块中的数据,M 1、M 2、K 1和K 2均为正整数。 Wherein, the target data is data in the data block, and M 1 , M 2 , K 1 and K 2 are all positive integers.
- 根据权利要求6或7所述的计算装置,其特征在于,所述存储控制单元包括第一存储控制单元和第二存储控制单元;The computing device according to claim 6 or 7, wherein the storage control unit comprises a first storage control unit and a second storage control unit;所述第一存储控制单元用于根据所述第一数据块的存储格式从所述寄存器单元中提取所述第一数据块中的目标数据,并将所述目标数据连续存储至所述存储介质中;The first storage control unit is configured to extract target data in the first data block from the register unit according to a storage format of the first data block, and continuously store the target data to the storage medium in;所述第二存储控制单元用于从所述存储介质中获取连续存储的所述目标数据,并按照所述第一数据块的存储格式将所述目标数据存储至所述寄存器单元中。The second storage control unit is configured to acquire the continuously stored target data from the storage medium, and store the target data into the register unit according to a storage format of the first data block.
- 根据权利要求8所述的计算装置,其特征在于,所述第一存储控制单元包括第一控制单元、第一读数据单元、第一写数据单元、第一先进先出FIFO单元以及第一授权单元;The computing device of claim 8, wherein the first storage control unit comprises a first control unit, a first read data unit, a first write data unit, a first first in first out FIFO unit, and a first authorization unit;所述第一控制单元用于获取所述数据搬运指令,并将所述数据搬运指令发送给所述第一读数据单元;The first control unit is configured to acquire the data handling instruction, and send the data handling instruction to the first read data unit;所述第一授权单元用于根据授权因素确定数据读取授权指示,所述数据读取授权指示用于指示是否授权读取所需搬运的所述目标数据,所述授权因素包括以下中的至少一项:所述第一FIFO单元中被占用的存储空间是否超过预设阈值、所述目标数据的优先级、所述第一数据块的优先级;The first authorization unit is configured to determine a data read authorization indication according to an authorization factor, where the data read authorization indication is used to indicate whether to authorize reading the target data to be carried, and the authorization factor includes at least An item: whether the occupied storage space in the first FIFO unit exceeds a preset threshold, a priority of the target data, and a priority of the first data block;所述第一读数据单元用于在所述数据读取授权指示用于指示授权数据读取的情况下,根据所述第一数据块的存储格式从所述寄存器单元中提取所述第一数据块中的目标数据,并将所述目标数据连续缓存至所述第一FIFO单元中;The first read data unit is configured to extract the first data from the register unit according to a storage format of the first data block if the data read authorization indication is used to indicate authorization data reading Target data in the block, and continuously buffering the target data into the first FIFO unit;所述第一FIFO单元用于连续缓存所需搬运的所述目标数据;The first FIFO unit is configured to continuously cache the target data that needs to be transported;所述第一写数据单元用于从所述第一FIFO单元中连续提取所需搬运的所述目标数据,并发送至所述存储介质中存储。The first write data unit is configured to continuously extract the target data to be transported from the first FIFO unit, and send the data to the storage medium for storage.
- 根据权利要求8所述的计算装置,其特征在于,所述第二存储控制单元包括第二控制单元、第二读数据单元、第二写数据单元、第二先进先出FIFO单元以及第二授权单元;The computing device of claim 8, wherein the second storage control unit comprises a second control unit, a second read data unit, a second write data unit, a second first in first out FIFO unit, and a second authorization unit;所述第二控制单元用于获取所述数据搬运指令,并将所述数据搬运指令发送给所述第二读数据单元;The second control unit is configured to acquire the data handling instruction, and send the data handling instruction to the second read data unit;所述第二授权单元用于根据授权因素确定数据读取授权指示,并将所述数据读取授权指示发送给所述第二读数据单元;其中,所述数据读取授权指示用于指示是否授权读取所需搬运的所述目标数据,所述授权因素包括以下中的至少一项:所述第二FIFO单元中被占用的存储空间是否超过预设阈值、所述目标数据的优先级及所述第一数据块的优先级;The second authorization unit is configured to determine a data read authorization indication according to an authorization factor, and send the data read authorization indication to the second read data unit, where the data read authorization indication is used to indicate whether Authorizing to read the target data to be carried, the authorization factor comprising at least one of: whether the occupied storage space in the second FIFO unit exceeds a preset threshold, a priority of the target data, and a priority of the first data block;所述第二读数据单元用于在所述数据读取授权指示用于指示授权数据读取的情况下,根据所述数据搬运指令从所述存储介质中连续提取所需搬运的所述目标数据,按照所述第一数据块的存储格式将所述目标数据缓存至所述第二FIFO单元中;The second read data unit is configured to continuously extract the target data to be transported from the storage medium according to the data handling instruction, in a case where the data read authorization indication is used to indicate authorization data reading Caching the target data into the second FIFO unit according to a storage format of the first data block;所述第二FIFO单元用于缓存符合所述存储格式的所述目标数据;The second FIFO unit is configured to cache the target data that meets the storage format;所述第二写数据单元用于从所述第二FIFO单元中提取符合所述存储格式的所述目标数据,并将所述目标数据发送至所述寄存器单元中存储。The second write data unit is configured to extract the target data conforming to the storage format from the second FIFO unit, and send the target data to the register unit for storage.
- 一种计算装置,其特征在于,包括:处理器、存储器、通信接口和总线;所述处理器、所述存储器和所述通信接口通过所述总线连接并完成相互间的通信;所述存储器存储可执行程序代码;所述处理器通过读取所述存储器中存储的可执行程序代码来运行与所述可执行程序代码对应的程序,以执行如权利要求1-5任一项所述的方法。A computing device, comprising: a processor, a memory, a communication interface, and a bus; the processor, the memory, and the communication interface are connected by the bus and complete communication with each other; the memory is stored Executing program code; the processor executing a program corresponding to the executable program code by reading executable program code stored in the memory to perform the method of any one of claims 1-5 .
- 一种计算机可读存储介质,其特征在于,所述计算机存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时使所述处理器执行如权利要求1-5任一项所述的方法。A computer readable storage medium, characterized in that the computer storage medium stores a computer program, the computer program comprising program instructions, the program instructions, when executed by a processor, causing the processor to execute as claimed in claim 1. The method of any of item 5.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711479137.X | 2017-12-29 | ||
CN201711479137.XA CN109992542B (en) | 2017-12-29 | 2017-12-29 | Data handling method, related product and computer storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2019127922A1 true WO2019127922A1 (en) | 2019-07-04 |
Family
ID=67062964
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2018/079368 WO2019127922A1 (en) | 2017-12-29 | 2018-03-16 | Data transfer method, computing device and computer readable storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN109992542B (en) |
WO (1) | WO2019127922A1 (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114356243A (en) * | 2022-01-06 | 2022-04-15 | 苏州挚途科技有限公司 | Data processing method and device and server |
CN114448587A (en) * | 2021-12-21 | 2022-05-06 | 北京长焜科技有限公司 | Method for moving LTE uplink antenna data by using EDMA in DSP |
CN114661644A (en) * | 2022-02-17 | 2022-06-24 | 之江实验室 | Pre-stored DMA device of auxiliary 3D architecture near memory computing accelerator system |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111583095B (en) * | 2020-05-22 | 2022-03-22 | 浪潮电子信息产业股份有限公司 | Image data storage method, image data processing system and related device |
CN111782562B (en) * | 2020-07-22 | 2024-05-17 | Oppo广东移动通信有限公司 | Data transmission method, DMA controller, NPU chip and computer equipment |
CN114399034B (en) * | 2021-12-30 | 2023-05-02 | 北京奕斯伟计算技术股份有限公司 | Data handling method for direct memory access device |
CN116166583B (en) * | 2023-04-26 | 2023-07-11 | 太初(无锡)电子科技有限公司 | Data precision conversion method and device, DMA controller and medium |
CN116909626B (en) * | 2023-09-13 | 2023-12-29 | 腾讯科技(深圳)有限公司 | Data processing method, processor and computer equipment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101552916A (en) * | 2009-05-05 | 2009-10-07 | 北京红旗胜利科技发展有限责任公司 | DMA transfer method, device and DMA controller for YUV video data |
CN101853229A (en) * | 2010-05-17 | 2010-10-06 | 华为终端有限公司 | Method and device for data transportation, and method of data reading operation and data writing operation |
CN102567258A (en) * | 2011-12-29 | 2012-07-11 | 中国科学院自动化研究所 | Multi-dimensional DMA (direct memory access) transmitting device and method |
CN103207847A (en) * | 2013-04-27 | 2013-07-17 | 杭州士兰微电子股份有限公司 | DMA (direct memory access) controller and direct memory access control method |
CN103793342A (en) * | 2012-11-02 | 2014-05-14 | 中兴通讯股份有限公司 | Multichannel direct memory access (DMA) controller |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100369024C (en) * | 2005-01-17 | 2008-02-13 | 北京中星微电子有限公司 | Direct memory access control device and image processing system and transmission method |
CN100468380C (en) * | 2006-06-07 | 2009-03-11 | 普天信息技术研究院 | Length-variable multi-block data transmission method of memory card |
CN100484069C (en) * | 2007-05-21 | 2009-04-29 | 华为技术有限公司 | File data distributing method and relative device |
JP5149567B2 (en) * | 2007-08-29 | 2013-02-20 | キヤノン株式会社 | Image processing apparatus and method |
CN102508800A (en) * | 2011-09-30 | 2012-06-20 | 北京君正集成电路股份有限公司 | Transmission method and transmission system for two-dimension data block |
CN104504137A (en) * | 2014-12-31 | 2015-04-08 | 深圳市科漫达智能管理科技有限公司 | Data storage method and system |
CN105843775B (en) * | 2016-04-06 | 2018-12-04 | 中国科学院计算技术研究所 | On piece data divide reading/writing method, system and its apparatus |
-
2017
- 2017-12-29 CN CN201711479137.XA patent/CN109992542B/en active Active
-
2018
- 2018-03-16 WO PCT/CN2018/079368 patent/WO2019127922A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101552916A (en) * | 2009-05-05 | 2009-10-07 | 北京红旗胜利科技发展有限责任公司 | DMA transfer method, device and DMA controller for YUV video data |
CN101853229A (en) * | 2010-05-17 | 2010-10-06 | 华为终端有限公司 | Method and device for data transportation, and method of data reading operation and data writing operation |
CN102567258A (en) * | 2011-12-29 | 2012-07-11 | 中国科学院自动化研究所 | Multi-dimensional DMA (direct memory access) transmitting device and method |
CN103793342A (en) * | 2012-11-02 | 2014-05-14 | 中兴通讯股份有限公司 | Multichannel direct memory access (DMA) controller |
CN103207847A (en) * | 2013-04-27 | 2013-07-17 | 杭州士兰微电子股份有限公司 | DMA (direct memory access) controller and direct memory access control method |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114448587A (en) * | 2021-12-21 | 2022-05-06 | 北京长焜科技有限公司 | Method for moving LTE uplink antenna data by using EDMA in DSP |
CN114448587B (en) * | 2021-12-21 | 2023-09-15 | 北京长焜科技有限公司 | Method for moving LTE uplink antenna data by using EDMA in DSP |
CN114356243A (en) * | 2022-01-06 | 2022-04-15 | 苏州挚途科技有限公司 | Data processing method and device and server |
CN114661644A (en) * | 2022-02-17 | 2022-06-24 | 之江实验室 | Pre-stored DMA device of auxiliary 3D architecture near memory computing accelerator system |
CN114661644B (en) * | 2022-02-17 | 2024-04-09 | 之江实验室 | Pre-storage DMA device for auxiliary 3D architecture near-memory computing accelerator system |
Also Published As
Publication number | Publication date |
---|---|
CN109992542A (en) | 2019-07-09 |
CN109992542B (en) | 2021-11-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2019127922A1 (en) | Data transfer method, computing device and computer readable storage medium | |
CN109992541B (en) | Data carrying method, computing device and computer storage medium | |
EP3907657A1 (en) | A digital media frame and method for configuring a field of view of a digital media frame | |
US11314457B2 (en) | Data processing method for data format conversion, apparatus, device, and system, storage medium, and program product | |
US9959652B2 (en) | Display method and terminal | |
US20170329409A9 (en) | Smart glasses, and system and method for processing hand gesture command therefor | |
CN105243399B (en) | A kind of method and apparatus that realizing image convolution, the method and apparatus for realizing caching | |
US20160034021A1 (en) | Image processing method and image processing apparatus | |
JP2020135889A (en) | Method for creating and providing mosaic image according to tag of image | |
US11150858B2 (en) | Electronic devices sharing image quality information and control method thereof | |
US11451721B2 (en) | Interactive augmented reality (AR) based video creation from existing video | |
CN113222806A (en) | Storage allocation method and system for big data | |
JP5968011B2 (en) | Image processing apparatus and control method thereof | |
CN111988525A (en) | Image processing method and related device | |
WO2023093694A1 (en) | Image processing method and apparatus, and device and storage medium | |
JP2015191358A (en) | Central person determination system, information terminal to be used by central person determination system, central person determination method, central person determination program, and recording medium | |
CN115714839A (en) | Image processing circuit, device, method, chip and electronic equipment | |
CN109214977A (en) | Image processing apparatus and its control method | |
US20130207882A1 (en) | Methods and apparatus to obtain and present information | |
US20140072244A1 (en) | Image processing and recording system and method thereof | |
US10262624B2 (en) | Separating a compressed stream into multiple streams | |
JP6695454B1 (en) | Information processing apparatus, information processing method, and program | |
WO2017058423A1 (en) | Processing display of digital camera readout with minimal latency | |
US11010661B2 (en) | Neural network chip, method of using neural network chip to implement de-convolution operation, electronic device, and computer readable storage medium | |
CN107240069B (en) | Image stitching processing method, mobile terminal and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 18893359 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 06.10.2020) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 18893359 Country of ref document: EP Kind code of ref document: A1 |