WO2019127538A1 - 数据处理方法、设备、dma控制器及计算机可读存储介质 - Google Patents

数据处理方法、设备、dma控制器及计算机可读存储介质 Download PDF

Info

Publication number
WO2019127538A1
WO2019127538A1 PCT/CN2017/120273 CN2017120273W WO2019127538A1 WO 2019127538 A1 WO2019127538 A1 WO 2019127538A1 CN 2017120273 W CN2017120273 W CN 2017120273W WO 2019127538 A1 WO2019127538 A1 WO 2019127538A1
Authority
WO
WIPO (PCT)
Prior art keywords
configuration
dma
feature map
configuration information
input feature
Prior art date
Application number
PCT/CN2017/120273
Other languages
English (en)
French (fr)
Inventor
赵尧
李似锦
谷骞
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2017/120273 priority Critical patent/WO2019127538A1/zh
Priority to CN201780022803.9A priority patent/CN109074334A/zh
Publication of WO2019127538A1 publication Critical patent/WO2019127538A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/20Handling requests for interconnection or transfer for access to input/output bus
    • G06F13/28Handling requests for interconnection or transfer for access to input/output bus using burst mode transfer, e.g. direct memory access DMA, cycle steal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks

Definitions

  • the present invention relates to the field of image processing technologies, and in particular, to a data processing method, device, DMA (Direct Memory Access) controller, and computer readable storage medium.
  • DMA Direct Memory Access
  • CNN Convolutional Neural Network
  • CNN is a feedforward neural network whose artificial neurons can respond to surrounding units in a part of coverage and perform well for large image processing.
  • CNN is a multi-layered neural network, each layer consisting of multiple two-dimensional planes, each consisting of multiple independent neurons.
  • the CNN can be composed of a convolution layer and a pooling layer.
  • the function of the convolution layer is to extract various features of the image.
  • the function of the pooling layer is to extract the features of the original feature signal twice to reduce the feature resolution. , greatly reduce the training parameters, and can reduce the degree of over-fitting of the model.
  • CNN reduces the complexity of the network with its special structure of local weight sharing, especially the image of multi-dimensional input vector can be directly input into the network, which avoids the complexity of data reconstruction in feature extraction and classification process. widely used.
  • the CNN involves a variety of data transfer tasks.
  • the data transfer task is implemented by a CPU (Central Processing Unit), which has low data transfer efficiency and imposes an excessive burden on the CPU.
  • CPU Central Processing Unit
  • the present invention provides a data processing method, apparatus, DMA controller, and computer readable storage medium.
  • a first aspect of the present invention provides a data processing method for a DMA controller, including:
  • Reading data from the input feature map according to the first DMA read configuration information outputting the read data to the operation logic according to the first DMA write configuration information;
  • a data processing method is provided, which is applied to a DMA controller, and includes:
  • a DMA controller is provided, the DMA controller for:
  • Reading data from the input feature map according to the first DMA read configuration information outputting the read data to the operation logic according to the first DMA write configuration information;
  • a DMA controller is provided, the DMA controller for:
  • a fifth aspect of the present invention provides a data processing device, where the data processing device includes:
  • a memory for storing program code
  • a DMA controller for calling the program code, and when the program code is executed, implementing the data processing method of the claims.
  • a computer readable storage medium stores a plurality of computer instructions, and when the computer instructions are executed, the data processing method is implemented.
  • data movement in the CNN can be implemented by the DMA controller, and the CPU does not need to implement data movement in the CNN, thereby reducing CPU load, moving data more efficiently, and thereby accelerating CNN.
  • the effect of the operation while also losing flexibility.
  • 1A-1G are schematic diagrams showing the working principle of a DMA controller
  • 2A-2I are schematic diagrams of a Pooling operation on an input feature map
  • 3A-3F are schematic diagrams of performing an Element-wise operation and a BN operation on an input feature map
  • FIG. 4 is a block diagram of one embodiment of a data processing device.
  • first, second, third, etc. may be used to describe various information in the present invention, such information should not be limited to these terms. These terms are used to distinguish the same type of information from each other.
  • first information may also be referred to as the second information without departing from the scope of the invention.
  • second information may also be referred to as the first information.
  • word “if” may be interpreted as "at time”, or "when", or "in response to determination.”
  • the embodiment of the invention provides a data processing method, which can be applied to a DMA controller.
  • the data can be moved by the DMA controller, and the CPU does not need to implement data movement, thereby reducing the CPU load and moving the data more efficiently, thereby accelerating the CNN calculation.
  • the DMA controller is a peripheral that moves data inside the system, allowing data exchange between hardware devices of different speeds. This data movement operation does not depend on the CPU.
  • the DMA controller can indicate the data to be processed by the CPU through the DMA interrupt. Already in place. In addition, the CPU only needs to establish DMA transfer, respond to DMA interrupts, and process the data that the DMA controller moves to the internal memory.
  • This stride length is stride information. After each write operation, the sum of the current address and the stride length is the next time. The address processed, this transmission with a "normal" stride length is called a 1D transmission.
  • the DMA controller reads data from the first source address A1
  • the data is written to the first destination address B1.
  • the source address A1 is added with the stride length of 1, to obtain the second source address A2
  • the destination address B1 is added with the stride length of 1, to obtain the second destination address B2
  • the DMA controller reads the data from the source address A2. After that, the data is written to the destination address B2, and so on.
  • the DMA controller reads data from the first source address A1, it writes the data to the first destination address B1. Then, the source address A1 is added to the stride length 2 to obtain the second source address A2, and the destination address B1 is added to the stride length 2 to obtain the second destination address B2, and the DMA controller reads the data from the source address A2. After that, the data is written to the destination address B2, and so on.
  • the "normal" stride length 1 can be modified to an "abnormal" stride length of 2 so that the 1D transmission can skip certain addresses, increasing the flexibility of 1D transmission.
  • 2D transmission is an extension of 1D transmission and is widely used in the field of image processing.
  • the following variables may be involved: X-direction counting configuration (X_COUNT), X-direction stride configuration (X_STRIDE), Y-direction counting configuration (Y_COUNT), and Y-direction stride configuration (Y_STRIDE).
  • the 2D transmission is a nested loop.
  • the inner loop parameters are determined by the X-direction counting configuration and the X-direction stride configuration.
  • the outer loop parameters are determined by the Y-direction counting configuration and the Y-direction stride configuration, and the 1D transmission corresponds to the inner loop of the 2D transmission.
  • the X-direction stride configuration determines the stride length of the address increase each time x is incremented; the Y-direction stride configuration determines the stride length of the address increase each time y is incremented; the X-direction count configuration determines the number of x increments;
  • the frame configuration determines the number of increments of y.
  • the Y-direction stride configuration can be negative, allowing the DMA controller to wrap the address in the buffer.
  • FIG. 1 is a schematic diagram of an application scenario of 1D-to-1D, 1D-to-2D, 2D-to-1D, and 2D-to-2D. Obviously, the above 2D transmission process can enrich DMA. Application scenario.
  • 3D transmission is a further extension of 1D transmission and can involve the following variables: X-direction counting configuration (X_COUNT), X-direction stride configuration (X_STRIDE), Y-direction counting configuration (Y_COUNT), Y-direction stride configuration (Y_STRIDE), Z direction Count configuration (Z_COUNT), Z-direction stride configuration (Z_STRIDE).
  • the 3D transmission is a triple nested loop, and the inner loop parameters are determined by the X-direction counting configuration and the X-direction stride configuration.
  • the intermediate layer loop parameters are determined by the Y-direction counting configuration and the Y-direction stride configuration, and the outer loop parameters are determined by Z.
  • the direction counting configuration and the Z-direction stride configuration are determined.
  • the X-direction stride configuration determines the stride length of the address increase each time x is incremented; the Y-direction stride configuration determines the stride length of the address increase each time y is incremented; the Z-direction stride configuration determines each z-increment When the address is increased by the step length; the X direction counting configuration determines the x increment number; the Y direction stride configuration determines the y increment number; the Z direction counting configuration determines the z increment number.
  • the Y-direction stride configuration can be a negative number, and the Z-direction stride configuration can be a negative number to allow the address to be rewinded in the buffer.
  • the source matrix is stored in row order
  • the starting address is A
  • the destination matrix is stored in row order
  • the starting address is A'
  • the source address is A+7
  • X is configured as 4
  • the X-direction stride configuration is 1
  • the Y-direction count configuration is 4
  • the Y-direction stride configuration is 3
  • the Z-direction count configuration is 0, and the Z-direction stride configuration is 0.
  • the destination address is A'+3
  • the X direction count configuration is 4
  • the X direction stride configuration is 4
  • the Y direction count configuration is 4
  • the Y direction stride configuration is -13
  • the Z direction count configuration is 0,
  • the Z direction step is configured to 0.
  • the DMA controller can read data from source address 0x1 (ie, start address A+7) and write the read data to destination address 0x1 (ie, start address A'+3).
  • the data is read from the source address 0x2 (ie, 0x1 + X direction stride configuration 1), and the read data is written to the destination address 0x2 (ie, 0x1 + X direction stride configuration 4).
  • the data is read from the source address 0x3, and the read data is written to the destination address 0x3.
  • the data is read from the source address 0x4, and the read data is written to the destination address 0x4.
  • the data is read from the source address 0x5, and the read data is written to the destination address 0x5; then, the data is read from the source address 0x6, and the read data is written to the destination address 0x6.
  • the data is read from the source address 0x7, and the read data is written to the destination address 0x7.
  • the X direction is read 4 times, that is, the X direction counting configuration 4 is reached, so that Y is performed once, and in the data writing process, it has been read 4 times in the X direction, that is, the X direction is reached.
  • Count configuration 4 so perform a Y once, and so on, the effect of which is shown in Figure 1G.
  • the DMA controller can use the above parameters to complete the data processing, that is, the DMA controller uses the parameters of the data reading process, reads data from the source address, and uses the parameters of the data writing process, Write data to the destination address.
  • the DMA controller can be used to implement the data movement task, instead of using the CPU to implement the data movement task.
  • FIG. 2A which is an example of a flowchart of the above data processing method in a convolutional neural network, the method may be applied to a DMA controller, and the method may include:
  • Step 201 Generate first DMA read configuration information and first DMA write configuration information according to the feature information of the input feature map, and determine second DMA read configuration information and second DMA write configuration information.
  • Step 202 Read data from the input feature map according to the first DMA read configuration information, and output the read data to the operation logic according to the first DMA write configuration information.
  • Step 203 The operation result of the operation logic is read according to the second DMA read configuration information, and the read operation result is stored in the output feature map according to the second DMA write configuration information.
  • the input feature map is an initial feature map
  • the DMA controller can read data from the input feature map, that is, input the feature map as source data.
  • the output feature map is the target feature map
  • the DMA controller can write data to the output feature map.
  • the DMA controller reads data from the input feature map and outputs the data to the operational logic. Then, the DMA controller can read the operation result of the operation logic and store the read operation result to the output feature map.
  • the first DMA read configuration information is DMA configuration information for reading data from the input feature map. Therefore, the data can be read from the input feature map according to the first DMA read configuration information, that is, the reading process, that is, The process of reading data from a source address (that is, an input feature map).
  • the first DMA write configuration information is DMA configuration information for outputting data to the operation logic. Therefore, the data can be output to the operation logic according to the first DMA write configuration information, and the write process, that is, the source address The process of writing data to the destination address, thereby moving the data from the input feature map to the arithmetic logic, and the arithmetic logic operates on the data in the input feature map.
  • the second DMA read configuration information is DMA configuration information for reading data from the arithmetic logic. Therefore, the operation result of the arithmetic logic can be read according to the second DMA read configuration information.
  • the second DMA write configuration information is used to store the data to the output feature map (ie, the initial configuration of the output feature map, in the initial state, the data is not written into the operation logic, in the following embodiment, the output feature map is introduced
  • the DMA configuration information of the construction process therefore, the data can be written to the output feature map according to the second DMA write configuration information, and the write process, that is, the process of writing the data of the source address to the destination address, thereby enabling the data Move from the arithmetic logic to the output feature map.
  • the first DMA read configuration information, the first DMA write configuration information, the second DMA read configuration information, and the second DMA write configuration information may include an X-direction count configuration (X_COUNT), an X-direction stride configuration (X_STRIDE), and a Y direction.
  • data movement in the CNN can be implemented by the DMA controller, and the CPU does not need to implement data movement in the CNN, thereby reducing CPU load, moving data more efficiently, and thereby accelerating CNN.
  • the effect of the operation while also losing flexibility.
  • the role of the Pooling may include: maintaining the invariance of the input feature map, including the translation, rotation, and scale; retaining the main features and reducing the parameters and the amount of calculation, preventing over-fitting, and improving the generalization ability of the model.
  • the most common pooling operations are average pooling and maximum pooling.
  • the average pooling is used to calculate the average of the image area, and the average value is used as the pooled value of the area.
  • the maximum pooling is used to select the largest image area. The value and the maximum value as the pooled value of the region.
  • the area of the pooling operation can be divided into 2x2, 3x3, roi, global, and the like.
  • the pooling diagram has a convolution kernel size of 3x3 and stride (step) of 2.
  • Step 211 Acquire feature information of the input feature map.
  • the feature information may include, but is not limited to, a width W, a height H of the input feature map, and includes a channel number N of the input feature map.
  • the input feature map (ie, Input Feature Maps) has a width W, a height H, and a channel number N, and is continuously stored in the memory, and the starting address is A. Therefore, the feature information of the input feature map may include, but is not limited to, a width W, a height H, and a channel number N of the input feature map.
  • Step 212 Generate first DMA read configuration information and first DMA write configuration information according to the feature information of the input feature map, and determine second DMA read configuration information and second DMA write configuration information.
  • the first DMA read configuration information is generated according to the feature information of the input feature map, and the DMA controller may generate an X-direction count configuration according to the width W of the input feature map; and generate a Y-direction count according to the height H of the input feature map. Configuration; generate X-direction stride configuration and Y-direction stride configuration according to preset values (such as 1). In addition, the DMA controller may further generate a Z-direction counting configuration according to the channel number N of the input feature map, and generate a Z-direction stride configuration according to the preset value.
  • examples of the first DMA read configuration information may include: an X-direction count configuration: W; a Y-direction count configuration: H; an X-direction stride configuration: 1; and a Y-direction stride configuration: 1.
  • the first DMA read configuration information may further include: a Z-direction counting configuration: N; a Z-direction stride configuration: 1.
  • the first DMA read configuration information is not limited, and may be configured according to experience, and the first DMA read configuration information is taken as an example.
  • Case 2 generating first DMA write configuration information according to the feature information of the input feature map, including: the DMA controller may generate an X-direction count configuration according to the width W and the height H of the input feature map; and generate a Y-direction count configuration according to the preset value, X-direction stride configuration and Y-direction stride configuration.
  • the DMA controller may generate an X-direction counting configuration according to the width W, the height H, and the channel number N of the input feature map; and the DMA controller may generate the Y-direction counting configuration, the X-direction stride configuration, and the Y according to the preset value.
  • the first DMA write configuration information includes: an X-direction count configuration: W*H; a Y-direction count configuration: 0; an X-direction stride configuration: 0; and a Y-direction stride configuration: 0.
  • the first DMA write configuration information may include: X direction counting configuration: W*H*N; Y direction counting configuration: 0; X direction stride configuration: 0; Y direction stride configuration: 0; Z direction counting configuration: 0; Z direction stride configuration: 0.
  • the first DMA write configuration information is only an example, and the first DMA write configuration information is not limited, and may be configured according to experience, taking the first DMA write configuration information as an example.
  • the second DMA read configuration information may include: X direction counting configuration: 1; Y direction counting configuration: 0; X direction stride configuration: 0; Y direction stride configuration: 0.
  • the second DMA read configuration information may include: an X direction count configuration: N; a Y direction count configuration: 0; an X direction step configuration: 0; a Y direction step configuration: 0; a Z direction count configuration: 0; Stride configuration: 0.
  • the second DMA read configuration information is not limited, and may be configured according to experience, and the second DMA read configuration information is taken as an example.
  • the second DMA write configuration information may include: X direction counting configuration: 1; Y direction counting configuration: 1; X direction stride configuration: 0; Y direction stride configuration: 0.
  • the second DMA write configuration information may include: X direction counting configuration: N; Y direction counting configuration: 1; X direction stride configuration: 0; Y direction stride configuration: 0; Z direction counting configuration: 0; Z direction Stride configuration: 0.
  • Step 213 Read data from the input feature map according to the first DMA read configuration information.
  • the DMA controller may read each data in the input feature map from the start address (such as the start address A) corresponding to the input feature map according to the first DMA read configuration information.
  • Step 214 Output the read data to the operation logic according to the first DMA write configuration information.
  • the DMA controller may output, according to the first DMA write configuration information, an entry address corresponding to the operation logic (such as the entry address I), and output each read data to the operation logic.
  • Step 215 Read an operation result of the operation logic according to the second DMA read configuration information.
  • an operation result may be generated.
  • the operation logic may be used to perform an average value operation or a maximum value operation on consecutive W*H data, where W and H are input respectively.
  • the width and height of the feature map. Therefore, the calculation result is the average value or the maximum value corresponding to consecutive W*H data.
  • the DMA controller may start, according to the second DMA read configuration information, an exit address (such as an exit address O) corresponding to the operation logic, and read each operation result generated by the operation logic, such as an operation result or N operation results.
  • the input feature map has W*H data
  • the operation logic performs an average value operation or a maximum value operation on consecutive W*H data to obtain an operation result.
  • an operation result is read from the exit address corresponding to the operation logic.
  • the width of the input feature map is W
  • the height is H
  • the number of channels is N
  • the input feature map has W*H*N data
  • the operation logic performs average operation or maximum value on consecutive W*H data.
  • Step 216 Store the read operation result into the output feature map according to the second DMA write configuration information.
  • the DMA controller may, according to the second DMA write configuration information, start each read operation result from the start address of the output feature map to the output feature map.
  • the operation logic is a Pooling operation logic
  • the Pooling operation logic is a global type
  • the Pooling operation logic is used to perform an average operation on consecutive W*H data.
  • the output feature map has a width of 1, a height of 1, and a channel number of N, which are successively stored in the memory, and the starting address is B.
  • the entry address of the Pooling logic is I
  • the exit address is O. Based on this, the DMA controller can implement the global pooling operation in two steps.
  • the DMA controller outputs the data in the input feature map to the Pooling logic, and the averaging operation is performed by the Pooling logic.
  • the averaging operation is performed by the Pooling logic.
  • each W*H input data corresponds to one average output.
  • N average values are output.
  • the DMA controller stores the N average values of the Pooling logic output in order to the output feature map. In this way, the global pooling function can be realized by the two-step moving operation and the pooling operation logic.
  • the target DMA configuration information corresponding to the input feature map may also be determined, and the output feature map may be constructed according to the target DMA configuration information.
  • the output feature map of this configuration is an output feature map of the initial state, and the data in the input feature map is not yet written.
  • the output feature map may be a specific feature map or a feature map of all 0s or 1s.
  • the data is stored to the output feature map of this construct. After all the data is stored in the output feature map of this configuration, the final output feature map can be obtained.
  • the example of the target DMA configuration information may include: but is not limited to: X direction counting configuration: N; Y direction counting configuration: 1; X direction stride configuration: 0; Y direction stride configuration: 0; Z direction counting configuration: 0; Z direction stride configuration: 0; where N is the number of channels of the input feature map.
  • the above target DMA configuration information is only an example, and the target DMA configuration information is not limited, and can be configured according to experience.
  • This document takes the above-mentioned target DMA configuration information as an example.
  • the output feature map is constructed according to the target DMA configuration information, including: an output feature map of the DMA controller having a size of 1*1*M; wherein, the output feature map is all 0s, and the start address is B.
  • the constructing the output feature map according to the target DMA configuration information includes: the DMA controller reads the specific style information from the specified storage location, and constructs an output feature map corresponding to the specific style information according to the target DMA configuration information. Further, constructing an output feature map corresponding to the specific style information according to the target DMA configuration information includes: the DMA controller constructs an output feature map of all 0s according to the target DMA configuration information. Of course, it is also possible to construct an output feature map of all ones.
  • the DMA controller can be used to implement the data movement task, instead of using the CPU to implement the data movement task.
  • FIG. 3A which is an example of a flowchart of the above data processing method in a convolutional neural network, the method may be applied to a DMA controller, and the method may include:
  • Step 301 Generate first DMA read configuration information and first DMA write configuration information according to feature information of the first input feature map (such as a first input feature map) according to the second input feature map (eg, at least one second input feature).
  • the feature information of FIG. 2 generates second DMA read configuration information and second DMA write configuration information, and determines third DMA read configuration information and third DMA write configuration information.
  • Step 302 Read first data from the first input feature map according to the first DMA read configuration information, and output the read first data to the operation logic according to the first DMA write configuration information.
  • Step 303 Read second data from the second input feature map according to the second DMA read configuration information, and output the read second data to the operation logic according to the second DMA write configuration information.
  • Step 304 Read an operation result of the operation logic according to the third DMA read configuration information, and store the read operation result in the output feature map according to the third DMA write configuration information.
  • the first input feature map and the second input feature map are initial feature maps
  • the DMA controller can read data from the first input feature map and the second input feature map, that is, the first input feature map.
  • the second input feature map is used as source data.
  • the output feature map is the target feature map, and the DMA controller can write data to the output feature map.
  • the DMA controller reads data from the first input feature map and the second input feature map, and outputs the data to the operation logic.
  • the DMA controller can read the operation result of the operation logic and store the read operation result to the output feature map.
  • the first DMA read configuration information is DMA configuration information for reading data from the first input feature map, and therefore, data can be read from the first input feature map according to the first DMA read configuration information, and This data reading process, which is the process of reading data from the source address.
  • the second DMA read configuration information is DMA configuration information for reading data from the second input feature map. Therefore, data can be read from the second input feature map according to the second DMA read configuration information.
  • This data reading process which is the process of reading data from the source address.
  • the first DMA write configuration information is DMA configuration information for outputting data to the operation logic. Therefore, the data is output to the operation logic according to the first DMA write configuration information, and the write process is to write the data of the source address. The process of entering the destination address, thereby moving the data from the first input feature map to the operation logic, and the operation logic operates on the data in the first input feature map.
  • the second DMA write configuration information is DMA configuration information for outputting data to the operation logic. Therefore, the data is output to the operation logic according to the second DMA write configuration information, and the write process is to write the data of the source address. The process of entering the destination address, thereby moving the data from the second input feature map to the operation logic, and the operation logic operates on the data in the second input feature map.
  • the third DMA read configuration information is DMA configuration information for reading data from the arithmetic logic. Therefore, the operation result of the arithmetic logic can be read according to the third DMA read configuration information.
  • the third DMA write configuration information is used to store the data to the output feature map (ie, the initial configuration of the output feature map, in the initial state, the data is not written into the operation logic, in the following embodiment, the output feature map is introduced
  • the DMA configuration information of the construction process therefore, the data can be written to the output feature map according to the third DMA write configuration information, and the write process, that is, the process of writing the data of the source address to the destination address, so that the data can be Move from the arithmetic logic to the output feature map.
  • the first DMA read configuration information, the first DMA write configuration information, the second DMA read configuration information, the second DMA write configuration information, the third DMA read configuration information, and the third DMA write configuration information may each include However, it is not limited to: X-direction counting configuration (X_COUNT), X-direction stride configuration (X_STRIDE), Y-direction counting configuration (Y_COUNT), Y-direction stride configuration (Y_STRIDE), Z-direction counting configuration (Z_COUNT), Z-direction stride Configuration (Z_STRIDE).
  • X_COUNT X-direction counting configuration
  • X_STRIDE X-direction stride configuration
  • Y_COUNT Y-direction counting configuration
  • Y_STRIDE Y-direction stride configuration
  • Z_COUNT Z-direction counting configuration
  • Z_STRIDE Z-direction stride Configuration
  • data movement in the CNN can be implemented by the DMA controller, and the CPU does not need to implement data movement in the CNN, thereby reducing CPU load, moving data more efficiently, and thereby accelerating CNN.
  • the effect of the operation while also losing flexibility.
  • Application scenario 1 for the implementation of Element-wise (Intelligent Element), Element-wise is to operate each element in the multi-layer feature map one by one, including point multiplication, addition and subtraction, taking the maximum value, etc., for merging two Layer information of the same size.
  • FIG. 3B it is a schematic diagram of performing an element-wise addition operation on two feature maps of size W*H*N. If you let the CPU do the above, it will increase the burden on the CPU.
  • BN solves the problem of gradient dispersion and explosion in back propagation, making the update of weights more stable.
  • BN normalizes the output of a layer such that its mean is 0 and the variance is 1.
  • BN is done in the Channel dimension, that is, each channel can be normalized, and if there are n channels, there will be n normalization operations.
  • the BN acts before the nonlinear mapping, that is, Normalization, ⁇ is scale and ⁇ is shift.
  • FIG. 3C it is a schematic diagram of performing a BN operation on an input feature map of size W*H*N. If you let the CPU complete the input feature map and its corresponding scale and shift operations, it will greatly increase the burden on the CPU.
  • the Element-wise operation can be completed by the DMA controller, thereby reducing the burden on the CPU.
  • the BN operation can be completed by the DMA controller, thereby reducing the burden on the CPU.
  • Step 311 Acquire feature information of the first input feature map and feature information of the second input feature map.
  • the input feature map 1 has a width W, a height H, and a channel number N, and is continuously stored in the memory, the start address.
  • the input feature map 2 has a width W, a height H, and a channel number N, and is continuously stored in the memory, and the starting address is B.
  • the input feature map 1 can be used as the first input feature map
  • the input feature map 2 can be used as the second input feature map.
  • the feature information of the first input feature map may include, but is not limited to, a width W and a height H of the first input feature map. It is also possible to include the number N of channels of the first input feature map.
  • the feature information of the second input feature map may include, but is not limited to, a width W and a height H of the second input feature map. It is also possible to include the number N of channels of the second input feature map.
  • the output feature map has a width W, a height H, and a channel number N, and is continuously stored in the memory, and the start address is C.
  • the arithmetic logic can be Element-wise arithmetic logic, and the Element-wise arithmetic logic is used for point multiplication, addition and subtraction, taking maximum values, etc.
  • the Element-wise operation is used for performing a point multiplication operation, that is, multiplying the first data of the first input feature map with the first data of the second input feature map to obtain a first operation result, for the first input feature
  • the second data of the graph is multiplied with the second data of the second input feature map to obtain a second operation result, and so on.
  • the entry address of the Element-wise operation logic is I1 and I2, and the exit address is O.
  • the input feature map 1 has a width W, a height H, and a channel number N, which is continuous in the memory.
  • the starting address is A.
  • the input feature corresponding to the input feature map 1 is ⁇ in the BN, that is, the scale parameter, and the input feature 2 can be a parameter map for the scale parameter, the width is 1, the height is 1, and the number of channels is N, in the memory. Continuous storage, starting address is B.
  • the scale parameter is a constant and can be configured empirically, that is, the input feature map 2 is a parameter map including N scale parameters.
  • the input feature corresponding to the input feature map 1 is ⁇ in the BN, that is, the shift parameter, and the input feature 3 can be a parameter map for the shift parameter, the width is 1, the height is 1, and the number of channels is N, in the memory. Continuous storage, starting address is C.
  • the shift parameter is a constant that can be configured empirically, that is, the input feature Figure 3 is a parameter map that includes N shift parameters.
  • the input feature map 1 can be used as the first input feature map
  • the input feature map 2 and the input feature map 3 can be used as the second input feature map.
  • the feature information of the first input feature map may include, but is not limited to, a width W and a height H of the first input feature map. It is also possible to include the number N of channels of the first input feature map.
  • the feature information of the second input feature map may include, but is not limited to, a width 1, a height 1, of the second input feature map. It is also possible to include the number N of channels of the second input feature map.
  • the output feature map has a width W, a height H, and a channel number N, and is continuously stored in the memory, and the start address is D.
  • the arithmetic logic can be BN arithmetic logic, and the BN arithmetic logic is used to perform linear transformation.
  • the data is linearly transformed using the following formula: x is the data of the input feature map 1, ⁇ is the scale parameter given by the input feature map 2 (ie, the parameter map), ⁇ is the shift parameter given by the input feature map 3 (ie, the parameter map), and the input characteristic is shown in FIG.
  • the continuous W*H data corresponds to the same ⁇ of the input feature graph 2, and corresponds to the same ⁇ of the input feature graph 3, that is, a ⁇ and a ⁇ and W*H data operations.
  • the entry address of the Element-wise operation logic is I1 (corresponding to the input feature map 1), I2 (corresponding to the input feature map 2), I3 (corresponding to the input feature map 3), and the exit address is O.
  • Step 312 generating first DMA read configuration information and first DMA write configuration information according to the feature information of the first input feature map (ie, input feature map 1), according to the second input feature map (ie, input feature map 2 or input feature map)
  • the feature information of 3, etc. generates second DMA read configuration information and second DMA write configuration information, and determines third DMA read configuration information and third DMA write configuration information.
  • Case 1 generating the first DMA read configuration information according to the feature information of the first input feature map, comprising: generating an X-direction count configuration according to the width W of the first input feature map, and generating Y according to the height H of the first input feature map Direction counting configuration, and generating X-direction stride configuration and Y-direction stride configuration according to preset values (such as 1).
  • a Z-direction counting configuration may be generated according to the channel number N of the first input feature map, and a Z-direction stride configuration is generated according to a preset value (such as 1).
  • examples of the first DMA read configuration information may include: an X-direction count configuration: W; a Y-direction count configuration: H; an X-direction stride configuration: 1; and a Y-direction stride configuration: 1.
  • the first DMA read configuration information may further include: a Z-direction count configuration: N; a Z-direction stride configuration: 1.
  • the first DMA read configuration information is not limited, and may be configured according to experience, and the first DMA read configuration information is taken as an example.
  • Case 2 generating first DMA write configuration information according to the feature information of the first input feature map, comprising: the DMA controller may generate an X-direction count configuration according to the width W and the height H of the first input feature map; and, according to the preset value Generate Y-direction count configuration, X-direction stride configuration, and Y-direction stride configuration.
  • the DMA controller may generate an X-direction counting configuration according to the width W, the height H, and the channel number N of the first input feature map; and generate a Y-direction counting configuration, an X-direction stride configuration, and a Y-direction according to the preset value. Amplitude configuration, Z-direction counting configuration, Z-direction stride configuration.
  • the first DMA write configuration information may include: an X-direction count configuration: W*H; a Y-direction count configuration: 0; an X-direction stride configuration: 0; a Y-direction stride configuration: 0.
  • the first DMA write configuration information includes: X direction counting configuration: W*H*N; Y direction counting configuration: 0; X direction stride configuration: 0; Y direction stride configuration: 0; Z direction counting configuration: 0 ; Z direction stride configuration: 0.
  • the foregoing first DMA write configuration information is only an example, and the first DMA write configuration information is not limited, and may be configured according to experience, taking the first DMA write configuration information as an example.
  • case 1 and case 2 can be used.
  • Case 3 generating second DMA read configuration information according to the feature information of the second input feature map, comprising: the DMA controller may generate an X-direction count configuration according to the width W of the second input feature map; according to the height H of the second input feature map Generate a Y-direction count configuration; generate an X-direction stride configuration and a Y-direction stride configuration according to preset values.
  • the DMA controller may further generate a Z-direction counting configuration according to the channel number N of the second input feature map; and generate a Z-direction stride configuration according to the preset value.
  • examples of the second DMA read configuration information may include: an X-direction count configuration: W; a Y-direction count configuration: H; an X-direction stride configuration: 1; and a Y-direction stride configuration: 1.
  • the second DMA read configuration information may further include: a Z-direction count configuration: N; a Z-direction stride configuration: 1.
  • the second DMA read configuration information is not limited, and may be configured according to experience, and the second DMA read configuration information is taken as an example.
  • Case 4 generating second DMA write configuration information according to the feature information of the second input feature map, comprising: the DMA controller may generate an X-direction count configuration according to the width W and the height H of the second input feature map; generating Y according to the preset value Direction counting configuration, X-direction stride configuration, and Y-direction stride configuration.
  • the DMA controller may generate an X-direction counting configuration according to the width W, the height H, and the channel number N of the second input feature map; and generate a Y-direction counting configuration, an X-direction stride configuration, and a Y-direction according to the preset value. Amplitude configuration, Z-direction counting configuration, Z-direction stride configuration.
  • the second DMA write configuration information may include: an X-direction count configuration: W*H; a Y-direction count configuration: 0; an X-direction stride configuration: 0; a Y-direction stride configuration: 0.
  • the second DMA write configuration information includes: X direction counting configuration: W*H*N; Y direction counting configuration: 0; X direction stride configuration: 0; Y direction stride configuration: 0; Z direction counting configuration: 0 ; Z direction stride configuration: 0.
  • the second DMA write configuration information is not limited, and may be configured according to experience, and the second DMA write configuration information is taken as an example.
  • the case 3 and the case 4 process may be used, and for the application scenario 2, the case 3 and the case 4 process are not used. Instead, it can be handled in case five. The situation is described below.
  • Case 5 generating second DMA read configuration information and second DMA write configuration information according to the feature information of the second input feature map, including: if the second input feature map is at least one parameter map (such as the input feature in the application scenario 2 above) 2 and input features FIG. 3), for each parameter map, the second DMA read configuration information may include but is not limited to: X direction counting configuration: 1; Y direction counting configuration: 0; X direction stride configuration: 1 ; Y direction stride configuration: 0. Moreover, the second DMA write configuration information may include, but is not limited to: an X-direction count configuration: 1; a Y-direction count configuration: 0; an X-direction stride configuration: 0; a Y-direction stride configuration: 0.
  • the second DMA read configuration information may include, but is not limited to: an X-direction count configuration: N; a Y-direction count configuration: 0; an X-direction stride configuration: 1; a Y-direction stride configuration: 0; a Z-direction count configuration: 0 ; Z direction stride configuration: 0.
  • the second DMA write configuration information may include, but is not limited to: X-direction count configuration: N; Y-direction count configuration: 0; X-direction stride configuration: 0; Y-direction stride configuration: 0; Z-direction count configuration: 0 ; Z direction stride configuration: 0.
  • the second DMA read configuration information is not limited, and may be configured according to experience, and the second DMA read configuration information is taken as an example.
  • the foregoing second DMA write configuration information is only an example, and the second DMA write configuration information is not limited, and may be configured according to experience, taking the second DMA write configuration information as an example.
  • Case 6 determining the third DMA read configuration information and the third DMA write configuration information, comprising: generating an X-direction count configuration in the third DMA read configuration information according to the width W and the height H of the first input feature map; The value is set to generate the Y-direction count configuration, the X-direction stride configuration, and the Y-direction stride configuration in the third DMA read configuration information.
  • the X-direction counting configuration in the third DMA write configuration information may be generated according to the width W of the first input feature map; and the Y-direction counting configuration in the third DMA write configuration information is generated according to the height H of the first input feature map;
  • the X-direction stride configuration and the Y-direction stride configuration in the third DMA write configuration information are generated according to preset values.
  • the third DMA read configuration information may include, but is not limited to: an X-direction count configuration: W*H; a Y-direction count configuration: 0; an X-direction stride configuration: 0; a Y-direction stride configuration: 0;
  • the third DMA write configuration information may include, but is not limited to: an X-direction count configuration: W; a Y-direction count configuration: H; an X-direction stride configuration: 1; and a Y-direction stride configuration: 1.
  • the foregoing third DMA read configuration information is only an example.
  • the third DMA read configuration information is not limited, and may be configured according to experience, and the third DMA read configuration information is taken as an example.
  • the foregoing third DMA write configuration information is only an example, and the third DMA write configuration information is not limited, and may be configured according to experience, taking the third DMA write configuration information as an example.
  • Case 7 determining the third DMA read configuration information and the third DMA write configuration information, including: generating an X-direction count in the third DMA read configuration information according to the width W, the height H, and the channel number N of the first input feature map
  • the configuration is: generating a Y-direction counting configuration, an X-direction stride configuration, a Y-direction stride configuration, a Z-direction counting configuration, and a Z-direction stride configuration in the third DMA read configuration information according to the preset value.
  • the X-direction counting configuration in the third DMA write configuration information may be generated according to the width W of the first input feature map; and the Y-direction counting configuration in the third DMA write configuration information is generated according to the height H of the first input feature map.
  • the third DMA read configuration information may include, but is not limited to, an X-direction count configuration: W*H*N; a Y-direction count configuration: 0; an X-direction stride configuration: 0; a Y-direction stride configuration: 0; Counting configuration: 0; Z direction stride configuration: 0.
  • the third DMA write configuration information may include, but is not limited to: X direction counting configuration: W; Y direction counting configuration: H; X direction stride configuration: 1; Y direction stride configuration: 1; Z direction counting configuration: N ; Z direction stride configuration: 1.
  • the foregoing third DMA read configuration information is only an example.
  • the third DMA read configuration information is not limited, and may be configured according to experience, and the third DMA read configuration information is taken as an example.
  • the foregoing third DMA write configuration information is only an example, and the third DMA write configuration information is not limited, and may be configured according to experience, taking the third DMA write configuration information as an example.
  • case 6 or case 7 may be used.
  • Step 313 Read first data from the first input feature map according to the first DMA read configuration information, and output the read first data to the operation logic according to the first DMA write configuration information.
  • the DMA controller may read each of the first data in the first input feature map from the start address corresponding to the first input feature map according to the first DMA read configuration information. Further, the DMA controller may further output each of the read first data to the operation logic according to the first DMA write configuration information, starting from the first entry address corresponding to the operation logic.
  • Step 314 Read second data from the second input feature map according to the second DMA read configuration information, and output the read second data to the operation logic according to the second DMA write configuration information.
  • the DMA controller can read each second data in the second input feature map from the start address corresponding to the second input feature map according to the second DMA read configuration information. Further, the DMA controller may further output each of the read second data to the operation logic according to the second DMA write configuration information, starting from the second entry address corresponding to the operation logic.
  • Step 315 the operation result of the operation logic is read according to the third DMA read configuration information, and the read operation result is stored in the output feature map according to the third DMA write configuration information.
  • the DMA controller may read each operation result generated by the operation logic from the exit address corresponding to the operation logic according to the third DMA read configuration information. Further, the DMA controller may further store, according to the third DMA write configuration information, the read operation result from the start address of the output feature map to the output feature map.
  • the arithmetic logic is used to perform an Element-wise operation on the first data and the second data.
  • the DMA controller can implement Element-wise operations in three steps.
  • the DMA controller In the first step, the DMA controller outputs the data in the input feature map 1 to the entry address I1 of the Element-wise operation logic. In the second step, the DMA controller outputs the data in the input feature map 2 to the entry address I2 of the Element-wise operation logic. The Element-wise operation logic then performs an Element-wise operation on the data of the entry address I1 and the entry address I2. In the third step, the DMA controller stores the operation results generated by the element-wise operation logic in order to the output feature map. In summary, the element-wise function is implemented by a three-step shift operation coupled with Element-wise arithmetic logic.
  • the operational logic is configured to perform a BN operation on the first data and the second data.
  • the DMA controller can implement the BN operation in three steps.
  • the DMA controller can output the data in the input feature map 1 to the entry address I1 of the BN operation logic.
  • the DMA controller outputs ⁇ to the entry address I2 of the BN operation logic, and the BN operation logic uses ⁇ to perform a multiplication operation in the linear transformation of the data of the entry address I1.
  • the DMA controller outputs ⁇ to the entry address I3 of the BN operation logic, and the BN operation logic performs the addition operation in the linear transformation using ⁇ on the result of the above multiplication operation.
  • the DMA controller stores the operation results generated by the BN operation logic in order to the output feature map.
  • the function of Batch Normalization can be realized by the four-step moving operation and the BN arithmetic logic.
  • the target DMA configuration information corresponding to the first input feature map may be further determined, and the output corresponding to the first input feature map is constructed according to the target DMA configuration information.
  • Feature map The output feature map of this configuration is an output feature map of the initial state, and the data in the input feature map is not yet written, and may be a specific feature map or a feature map of all 0s or 1s.
  • the data is stored to the output feature map of this configuration. After all the data is stored in the constructed output feature map, the final output feature map can be obtained.
  • the determining the target DMA configuration information corresponding to the first input feature map includes: generating an X-direction count configuration according to the width W of the first input feature map; generating a Y-direction count configuration according to the height H of the first input feature map; The number of channels of the input feature map N generates a Z-direction count configuration; the X-direction stride configuration, the Y-direction stride configuration, and the Z-direction stride configuration are generated according to preset values.
  • the target DMA configuration information may include, but is not limited to, an X-direction counting configuration: W; a Y-direction counting configuration: H; an X-direction stride configuration: 1; a Y-direction stride configuration: 1; a Z-direction counting configuration: N; Z direction stride configuration: 1.
  • W an X-direction counting configuration
  • H a Y-direction counting configuration
  • N a Z-direction counting configuration
  • Z direction stride configuration 1.
  • the above-mentioned target DMA configuration information is only an example, and there is no limitation on this, and it can be configured according to experience. This paper takes the above-mentioned target DMA configuration information as an example.
  • the output feature map corresponding to the first input feature map is configured according to the target DMA configuration information, and includes: an output feature map with a size of W*H*M; wherein the output feature map is all 0s.
  • the output feature map corresponding to the first input feature map is configured according to the target DMA configuration information, including: the DMA controller reads the specific style information from the specified storage location, and constructs an output corresponding to the specific style information according to the target DMA configuration information.
  • Feature map Further, constructing an output feature map corresponding to the specific style information according to the target DMA configuration information includes: constructing an output feature map of all 0s according to the target DMA configuration information. Of course, it is also possible to construct an output feature map of all ones.
  • the DMA controller constructs the process of outputting the feature map based on the target DMA configuration information, which is actually the process of constructing the matrix by the DMA controller, rather than constructing the matrix by the CPU.
  • the DMA controller constructs a Gaussian matrix; if the output feature map is a trigonometric function matrix, the DMA controller constructs a trigonometric function matrix; if the output feature map is an all-zero matrix
  • the DMA controller constructs an all-zero matrix; if the output feature map is an all-one matrix, the DMA controller constructs an all-one matrix; and so on, there is no limitation thereto, and the DMA controller in this embodiment Construct an all-zero matrix as an example.
  • specific style information may be stored at a specified storage location, the specific style information indicating a matrix type.
  • the specific style information when the specific style information is the first identifier, it indicates that the matrix type is an all-zero matrix (for various types of padding or interpolating); when the specific style information is the second identifier, indicating that the matrix type is an all-one matrix ( Used for various types of padding; when the specific style information is the third identifier, the matrix type is a Gaussian matrix (for 2D/3D Gaussian filtering); when the specific style information is the fourth identifier, the matrix type is Laplacian matrix (for edge detection); when the specific style information is the fifth identifier, the matrix type is Sobel matrix (for edge detection); when the specific style information is the sixth identifier, the matrix type is a trigonometric matrix ( For fast Fourier transform or Hough transform); when the specific style information is the seventh identifier, indicating that the matrix type is a Toeplitz matrix (for matrix multiplication acceleration); when
  • the DMA controller can read specific style information from a specified storage location and construct an output feature map corresponding to the specific style information. For example, when the specific style information is the first identifier, an output feature map of all 0s can be constructed. And so on, for other specific style information will not be described.
  • some special addresses can be used as the specified storage location, or some fields of the CFG (Control Flow Graph) register can be used as the specified storage location in the specified storage.
  • the location stores specific style information to specify the matrix type. In this way, the DMA controller can read the specific style information from the specified storage location, then learn the matrix type, and construct an output feature map corresponding to the matrix type.
  • the data in the matrix is generated by the DMA controller itself (such as generating all 0 data), and there is no need to read data from other locations, so there is no need to set the read process.
  • DMA configuration information only need to set DMA configuration information for the write process.
  • seven registers can be set for the write process, which store the start address (DST_STRT_ADDR), the X-direction count configuration (X_COUNT), the X-direction stride configuration (X_STRIDE), and the Y-direction count configuration ( Y_COUNT), Y-direction stride configuration (Y_STRIDE), Z-direction count configuration (Z_COUNT), Z-direction stride configuration (Z_STRIDE).
  • the embodiment of the present invention further provides a DMA controller, where the DMA controller is configured to: generate first DMA read configuration information and first DMA write configuration information according to feature information of the input feature map. And determining second DMA read configuration information and second DMA write configuration information; reading data from the input feature map according to the first DMA read configuration information; reading according to the first DMA write configuration information The fetched data is output to the operation logic; the operation result of the operation logic is read according to the second DMA read configuration information; and the read operation result is stored in the output feature map according to the second DMA write configuration information.
  • the feature information includes: a width W, a height H, and a channel number N of the input feature map;
  • the DMA controller is configured to: when the first DMA read configuration information is generated according to the feature information of the input feature map, generate an X-direction count configuration according to the width W of the input feature map; and generate according to the height H of the input feature map.
  • the feature information includes: a width W and a height H of the input feature map; and the DMA controller is configured to: when generating the first DMA write configuration information according to the feature information of the input feature map, according to the input feature map
  • the width W and the height H generate an X-direction counting configuration; the Y-direction counting configuration, the X-direction stride configuration, and the Y-direction stride configuration are generated according to preset values;
  • the feature information includes: a width W, a height H, and a channel number N of the input feature map; and the DMA controller is configured to: when generating the first DMA write configuration information according to the feature information of the input feature map:
  • the width W, the height H, and the number of channels N of the input feature map generate an X-direction counting configuration; and, according to the preset value, generate a Y-direction counting configuration, an X-direction stride configuration, a Y-direction stride configuration, and a Z-direction counting configuration. , Z direction stride configuration.
  • the DMA controller is configured to: when the data is read from the input feature map according to the first DMA read configuration information, according to the first DMA read configuration information, corresponding to the input feature map Starting from the start address, reading each data in the input feature map;
  • the DMA controller is configured to: when the read data is output to the operation logic according to the first DMA write configuration information, according to the first DMA write configuration information, start from an entry address corresponding to the operation logic And outputting each data read to the operation logic.
  • the DMA controller is configured to: when the operation result of the operation logic is read according to the second DMA read configuration information, start from the egress address corresponding to the operation logic according to the second DMA read configuration information, and read Each operation result generated by the operation logic;
  • the DMA controller is configured to: when the read operation result is stored in the output feature map according to the second DMA write configuration information, to: start address of the output feature map according to the second DMA write configuration information Initially, each of the read operation results is stored to the output feature map.
  • the DMA controller is further configured to: determine target DMA configuration information corresponding to the input feature map before storing the read operation result to the output feature map; and construct an output feature map according to the target DMA configuration information.
  • the DMA controller When the DMA controller constructs the output feature map according to the target DMA configuration information, the DMA controller is configured to: read specific style information from the specified storage location, and construct a corresponding to the specific style information according to the target DMA configuration information. Output feature map.
  • the embodiment of the present invention further provides a DMA controller, where the DMA controller is configured to: generate first DMA read configuration information and first DMA write according to feature information of the first input feature map. Configuring information, generating second DMA read configuration information and second DMA write configuration information according to the feature information of the second input feature map, and determining third DMA read configuration information and third DMA write configuration information; according to the first DMA read Configuring information, reading the first data from the first input feature map; outputting the read first data to the operation logic according to the first DMA write configuration information; and reading the configuration information according to the second DMA Reading the second data in the two input feature map; outputting the read second data to the operation logic according to the second DMA write configuration information; and reading the operation logic according to the third DMA read configuration information As a result, the read operation result is stored in the output feature map according to the third DMA write configuration information.
  • the feature information of the first input feature map includes: a width W, a height H, and a channel number N of the first input feature map; the DMA controller generates a first DMA read according to the feature information of the first input feature map
  • the configuration information is specifically configured to: generate an X-direction counting configuration according to the width W of the first input feature map; generate a Y-direction counting configuration according to the height H of the first input feature map; and generate an X-direction stride according to the preset value
  • the configuration and the Y-direction stride configuration generating a Z-direction counting configuration according to the channel number N of the first input feature map; and generating a Z-direction stride configuration according to the preset value.
  • the feature information of the first input feature map includes: a width W and a height H of the first input feature map; and the DMA controller is specifically used when generating the first DMA write configuration information according to the feature information of the first input feature map : generating an X-direction counting configuration according to the width W and the height H of the first input feature map; generating a Y-direction counting configuration, an X-direction stride configuration, and a Y-direction stride configuration according to the preset value; or the first input
  • the feature information of the feature map includes: a width W, a height H, and a channel number N of the first input feature map; and the DMA controller is specifically configured to: when generating the first DMA write configuration information according to the feature information of the first input feature map: Generating an X-direction counting configuration according to the width W, the height H, and the channel number N of the first input feature map; generating a Y-direction counting configuration, an X-direction stride configuration, a Y-
  • the DMA controller is configured to: when the first data is read from the first input feature map according to the first DMA read configuration information, according to the first DMA read configuration information, from the first input feature Starting with a corresponding start address of the map, reading each first data in the first input feature map;
  • the DMA controller When the DMA controller outputs the read first data to the operation logic according to the first DMA write configuration information, the DMA controller is specifically configured to: according to the first DMA write configuration information, corresponding to the operation logic An entry address begins, and each of the read first data is output to the operational logic.
  • the feature information of the second input feature map includes: a width W, a height H, and a channel number N of the second input feature map; and the DMA controller generates a second DMA read according to the feature information of the second input feature map.
  • the configuration information is specifically configured to: generate an X-direction counting configuration according to the width W of the second input feature map; generate a Y-direction counting configuration according to the height H of the second input feature map; and generate an X-direction stride according to the preset value
  • the configuration and the Y-direction stride configuration generating a Z-direction counting configuration according to the channel number N of the second input feature map; and generating a Z-direction stride configuration according to the preset value.
  • the feature information of the second input feature map includes: a width W and a height H of the second input feature map; and the DMA controller is specifically used when generating the second DMA write configuration information according to the feature information of the second input feature map : generating an X-direction counting configuration according to the width W and the height H of the second input feature map; generating a Y-direction counting configuration, an X-direction stride configuration, and a Y-direction stride configuration according to the preset value; or the second input
  • the feature information of the feature map includes: a width W, a height H, and a channel number N of the second input feature map; and the DMA controller is specifically configured to: when generating the second DMA write configuration information according to the feature information of the second input feature map: Generating an X-direction counting configuration according to a width W, a height H, and a channel number N of the second input feature map; generating a Y-direction counting configuration, an X-direction stride configuration, a
  • the DMA controller is configured to: when the second data is read from the second input feature map according to the second DMA read configuration information, according to the second DMA read configuration information, from the second input feature Starting from a corresponding start address of the map, reading each second data in the second input feature map;
  • the DMA controller is configured to: when the read second data is output to the operation logic according to the second DMA write configuration information, according to the second DMA write configuration information, corresponding to the operation logic The second entry address begins, and each second data read is output to the arithmetic logic.
  • the DMA controller is configured to: when determining the third DMA read configuration information and the third DMA write configuration information, generate the third DMA read configuration information according to the width W and the height H of the first input feature map An X-direction counting configuration; generating a Y-direction counting configuration, an X-direction stride configuration, and a Y-direction stride configuration in the third DMA read configuration information according to a preset value;
  • the DMA controller is configured to: when determining the third DMA read configuration information and the third DMA write configuration information, generate the third DMA according to the width W, the height H, and the channel number N of the first input feature map. Reading an X-direction count configuration in the configuration information; generating a Y-direction count configuration, an X-direction stride configuration, a Y-direction stride configuration, a Z-direction count configuration, and a Z-direction step in the third DMA read configuration information according to a preset value Amplitude configuration
  • the DMA controller is configured to: when the operation result of the operation logic is read according to the third DMA read configuration information, start from an exit address corresponding to the operation logic according to the third DMA read configuration information, Reading each operation result generated by the operation logic;
  • the DMA controller is configured to: when storing the read operation result to the output feature map according to the third DMA write configuration information, according to the third DMA write configuration information, from the output feature map The start address begins, and each of the read operation results is stored in the output feature map.
  • the DMA controller is further configured to: determine target DMA configuration information corresponding to the first input feature map before storing the read operation result to the output feature map; and construct a first input feature map according to the target DMA configuration information Corresponding output feature map.
  • the determining, by the DMA controller, the target DMA configuration information corresponding to the first input feature map is: generating an X-direction counting configuration according to the width W of the first input feature map; according to the first input feature map
  • the height H generates a Y-direction counting configuration; generates a Z-direction counting configuration according to the channel number N of the first input feature map; and generates an X-direction stride configuration, a Y-direction stride configuration, and a Z-direction stride configuration according to preset values.
  • the DMA controller constructs the output feature map corresponding to the first input feature map according to the target DMA configuration information
  • the DMA controller is configured to: read specific style information from the specified storage location, and construct and configure according to the target DMA configuration information. An output feature map corresponding to the specific style information.
  • the embodiment of the present invention further provides a data processing device.
  • the data processing device includes: a memory and a DMA controller; wherein the memory is used for storing Program code; the DMA controller for invoking the program code, when the program code is executed, implementing the data processing method of the claims.
  • the embodiment of the present invention further provides a computer readable storage medium, where the computer readable storage medium stores a plurality of computer instructions, and when the computer instructions are executed, implementing the above claims Data processing method.
  • the system, apparatus, module or unit set forth in the above embodiments may be implemented by a computer chip or an entity, or by a product having a certain function.
  • a typical implementation device is a computer, and the specific form of the computer may be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, and a game control.
  • embodiments of the invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, embodiments of the invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • these computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the instruction means implements the functions specified in one or more blocks of the flowchart or in a flow or block diagram of the flowchart.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • Biophysics (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Image Processing (AREA)
  • Navigation (AREA)

Abstract

一种数据处理方法、设备、DMA控制器及计算机可读存储介质,所述方法包括:根据输入特征图的特征信息生成第一DMA读配置信息和第一DMA写配置信息,并确定第二DMA读配置信息和第二DMA写配置信息(201);根据所述第一DMA读配置信息,从所述输入特征图中读取数据;根据所述第一DMA写配置信息,将读取的数据输出给运算逻辑(202);根据所述第二DMA读配置信息读取运算逻辑的运算结果;根据所述第二DMA写配置信息,将读取的运算结果存储到输出特征图(203)。应用该方法,可以由DMA控制器实现CNN中的数据搬移,不需要由CPU实现CNN中的数据搬移,从而减轻CPU负担,更高效地搬移数据,进而起到加速CNN运算的效果,同时也不失灵活性。

Description

数据处理方法、设备、DMA控制器及计算机可读存储介质 技术领域
本发明涉及图像处理技术领域,尤其是涉及一种数据处理方法、设备、DMA(Direct Memory Access,直接内存存取)控制器及计算机可读存储介质。
背景技术
在机器学习中,CNN(Convolutional Neural Network,卷积神经网络)是一种前馈神经网络,它的人工神经元可以响应一部分覆盖范围内的周围单元,对于大型图像处理具有出色表现。CNN是一个多层的神经网络,每层由多个二维平面组成,每个平面由多个独立的神经元组成。一般地,CNN可以由卷积层和池化层组成,卷积层的作用是提取图像的各种特征,池化层的作用是对原始特征信号进行两次特征提取,以减小特征分辨率,大幅度减少训练参数,并可以减轻模型过拟合的程度。此外,CNN以其局部权值共享的特殊结构,降低网络的复杂性,特别是多维输入向量的图像可以直接输入网络这一特点,避免了特征提取和分类过程中数据重建的复杂度,因而得到广泛应用。
CNN中涉及多种数据搬移任务,数据搬移任务由CPU(Central Processing Unit,中央处理器)实现,其数据搬移效率较低,给CPU增加过多负担。
发明内容
本发明提供数据处理方法、设备、DMA控制器及计算机可读存储介质。
本发明第一方面,提供一种数据处理方法,应用于DMA控制器,包括:
根据输入特征图的特征信息生成第一DMA读配置信息和第一DMA写配置信息,并确定第二DMA读配置信息和第二DMA写配置信息;
根据所述第一DMA读配置信息,从所述输入特征图中读取数据;根据所述第一DMA写配置信息,将读取的数据输出给运算逻辑;
根据所述第二DMA读配置信息读取运算逻辑的运算结果;根据所述第二DMA写配置信息,将读取的运算结果存储到输出特征图。
本发明第二方面,提供一种数据处理方法,应用于DMA控制器,包括:
根据第一输入特征图的特征信息生成第一DMA读配置信息和第一DMA写配置信息,根据第二输入特征图的特征信息生成第二DMA读配置信息和第二DMA写配置信息,并确定第三DMA读配置信息和第三DMA写配置信息;
根据所述第一DMA读配置信息,从第一输入特征图中读取第一数据;根据所述第一DMA写配置信息,将读取的第一数据输出给运算逻辑;
根据所述第二DMA读配置信息,从第二输入特征图中读取第二数据;根据所述第二DMA写配置信息,将读取的第二数据输出给运算逻辑;
根据所述第三DMA读配置信息读取所述运算逻辑的运算结果;根据所述第三DMA写配置信息,将读取的运算结果存储到输出特征图。
本发明第三方面,提供一种DMA控制器,所述DMA控制器用于:
根据输入特征图的特征信息生成第一DMA读配置信息和第一DMA写配置信息,并确定第二DMA读配置信息和第二DMA写配置信息;
根据所述第一DMA读配置信息,从所述输入特征图中读取数据;根据所述第一DMA写配置信息,将读取的数据输出给运算逻辑;
根据所述第二DMA读配置信息读取运算逻辑的运算结果;根据所述第二DMA写配置信息,将读取的运算结果存储到输出特征图。
本发明第四方面,提供一种DMA控制器,所述DMA控制器用于:
根据第一输入特征图的特征信息生成第一DMA读配置信息和第一DMA写配置信息,根据第二输入特征图的特征信息生成第二DMA读配置信息和第二DMA写配置信息,并确定第三DMA读配置信息和第三DMA写配置信息;
根据所述第一DMA读配置信息,从第一输入特征图中读取第一数据;根据所述第一DMA写配置信息,将读取的第一数据输出给运算逻辑;
根据所述第二DMA读配置信息,从第二输入特征图中读取第二数据;根据所述第二DMA写配置信息,将读取的第二数据输出给运算逻辑;
根据所述第三DMA读配置信息读取所述运算逻辑的运算结果;根据所述第三DMA写配置信息,将读取的运算结果存储到输出特征图。
本发明第五方面,提供一种数据处理设备,所述数据处理设备包括:
存储器,用于存储程序代码;DMA控制器,用于调用所述程序代码,当所述程序代码被执行时,实现权利要求上述的数据处理方法。
本发明第六方面,提供一种计算机可读存储介质,计算机可读存储介质上存储有若干计算机指令,所述计算机指令被执行时实现上述数据处理方法。
基于上述技术方案,本发明实施例中,可以由DMA控制器实现CNN中的数据搬移,不需要由CPU实现CNN中的数据搬移,从而减轻CPU负担,更高效地搬移数据,进而起到加速CNN运算的效果,同时也不失灵活性。
附图说明
为了更加清楚地说明本发明实施例或者现有技术中的技术方案,下面将对本发明实施例或者现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据本发明实施例的这些附图获得其它的附图。
图1A-图1G是DMA控制器的工作原理示意图;
图2A-图2I是对输入特征图进行Pooling操作的示意图;
图3A-图3F是对输入特征图进行Element-wise操作、BN操作的示意图;
图4是数据处理设备的一个实施例框图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。 另外,在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。
本发明使用的术语仅仅是出于描述特定实施例的目的,而非限制本发明。本发明和权利要求书所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其它含义。应当理解,本文中使用的术语“和/或”是指包含一个或多个相关联的列出项目的任何或者所有可能的组合。
尽管在本发明可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语用来将同一类型的信息彼此区分开。例如,在不脱离本发明范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,此外,所使用的词语“如果”可以被解释成为“在……时”,或者,“当……时”,或者,“响应于确定”。
本发明实施例提出一种数据处理方法,该方法可以应用于DMA控制器。在CNN中,可以由DMA控制器实现数据搬移,不需要由CPU实现数据搬移,从而减轻CPU负担,更高效地搬移数据,进而起到加速CNN运算的效果。
DMA控制器是一种在系统内部搬移数据的外设,允许不同速度的硬件装置之间交换数据,这个数据搬移操作并不依赖于CPU,DMA控制器可以通过DMA中断指示需要被CPU处理的数据已经就位。此外,CPU只需要建立DMA传输、响应DMA中断,并处理DMA控制器搬移到内部存储器的数据即可。
对于单次DMA传输过程,可以指定1个源地址、1个目的地址和步幅长度,这个步幅长度是stride信息,每次写操作结束后,当前地址与步幅长度之和是下一次需要处理的地址,这种带有“正常”步幅长度的传输称为1D传输。
参见图1A所示,DMA控制器从第一个源地址A1读取数据后,将该数据写入第一个目的地址B1。然后,将源地址A1加上步幅长度1,得到第二个源地址A2,将目的地址B1加上步幅长度1,得到第二个目的地址B2,DMA控制器从源地址A2读取数据后,将该数据写入目的地址B2,以此类推。
参见图1B所示,DMA控制器从第一个源地址A1读取数据后,将该数 据写入第一个目的地址B1。然后,将源地址A1加上步幅长度2,得到第二个源地址A2,将目的地址B1加上步幅长度2,得到第二个目的地址B2,DMA控制器从源地址A2读取数据后,将该数据写入目的地址B2,以此类推。
与图1A相比,在图1B中,可以将“正常”的步幅长度1修改为“非正常”的步幅长度2,使得1D传输可以跳过某些地址,增加1D传输的灵活性。
2D传输是1D传输的扩展,被广泛地应用在图像处理领域。在2D传输过程中,可以涉及如下变量:X方向计数配置(X_COUNT)、X方向步幅配置(X_STRIDE)、Y方向计数配置(Y_COUNT)、Y方向步幅配置(Y_STRIDE)。
2D传输是一个嵌套循环,内循环参数由X方向计数配置和X方向步幅配置决定,外循环参数由Y方向计数配置和Y方向步幅配置决定,1D传输对应2D传输的内循环。X方向步幅配置决定每次x递增时,地址增加的步幅长度;Y方向步幅配置决定每次y递增时,地址增加的步幅长度;X方向计数配置决定x递增次数;Y方向步幅配置决定y递增次数。而且,Y方向步幅配置可以为负数,从而允许DMA控制器在buffer(缓冲区)中地址回卷。
参见图1C-图1F所示,为1D-to-1D,1D-to-2D,2D-to-1D,2D-to-2D的应用场景示意图,显然,上述2D的传输过程,可以丰富DMA的应用场景。
3D传输是1D传输的进一步扩展,可以涉及如下变量:X方向计数配置(X_COUNT)、X方向步幅配置(X_STRIDE)、Y方向计数配置(Y_COUNT)、Y方向步幅配置(Y_STRIDE)、Z方向计数配置(Z_COUNT)、Z方向步幅配置(Z_STRIDE)。其中,3D传输是三重嵌套循环,内层循环参数由X方向计数配置、X方向步幅配置决定,中间层循环参数由Y方向计数配置、Y方向步幅配置决定,外层循环参数由Z方向计数配置、Z方向步幅配置决定。
其中,X方向步幅配置决定每次x递增时,地址增加的步幅长度;Y方向步幅配置决定每次y递增时,地址增加的步幅长度;Z方向步幅配置决定每次z递增时,地址增加的步幅长度;X方向计数配置决定x递增次数;Y方向 步幅配置决定y递增次数;Z方向计数配置决定z递增次数。而且,Y方向步幅配置可以为负数,Z方向步幅配置可以为负数,以允许在buffer中地址回卷。
以下结合一个2D-to-2D的矩阵提取,并旋转90度的例子,对上述过程进行说明。参见图1G所示,假设源矩阵按行顺序存储,起始地址为A,目的矩阵按行顺序存储,起始地址为A',则:在数据读取过程,源地址为A+7,X方向计数配置为4,X方向步幅配置为1,Y方向计数配置为4,Y方向步幅配置为3,Z方向计数配置为0,Z方向步幅配置为0。在数据写入过程,目的地址为A'+3,X方向计数配置为4,X方向步幅配置为4,Y方向计数配置为4,Y方向步幅配置为-13,Z方向计数配置为0,Z方向步幅配置为0。
参见图1G所示,DMA控制器可以从源地址0x1(即起始地址A+7)读取数据,并将读取的数据写入目的地址0x1(即起始地址A'+3)。从源地址0x2(即0x1+X方向步幅配置1)读取数据,并将读取的数据写入目的地址0x2(即0x1+X方向步幅配置4)。从源地址0x3读取数据,并将读取的数据写入目的地址0x3。从源地址0x4读取数据,并将读取的数据写入目的地址0x4。
经过上述处理,在数据读取过程,已经在X方向读取4次,即达到X方向计数配置4,因此,执行一次Y,由于Y方向步幅配置为3,因此将源地址0x4加3,得到源地址0x5。在数据写入过程,已经在X方向读取4次,即达到X方向计数配置4,因此,执行一次Y,由于Y方向步幅配置为-13,因此将目的地址0x4减去13,得到目的地址0x5。综上所述,从源地址0x5读取数据,并将读取的数据写入目的地址0x5;然后,从源地址0x6读取数据,并将读取的数据写入目的地址0x6。从源地址0x7读取数据,并将读取的数据写入目的地址0x7。从源地址0x8读取数据,并将读取的数据写入目的地址0x8。
经过上述处理,在数据读取过程,在X方向读取4次,即达到X方向计数配置4,因此执行一次Y,在数据写入过程,已经在X方向读取4次,即达到X方向计数配置4,因此执行一次Y,以此类推,其效果参见图1G所示。
综上可以看出,只要给出X方向计数配置(X_COUNT)、X方向步幅配置(X_STRIDE)、Y方向计数配置(Y_COUNT)、Y方向步幅配置(Y_STRIDE)、Z方向计数配置(Z_COUNT)、Z方向步幅配置(Z_STRIDE),DMA控制器就可以利用上述参数完成数据处理,即DMA控制器利用数据读取过程的参数,从源地址读取数据,并利用数据写入过程的参数,将数据写入目的地址。
在卷积神经网络中,可以采用DMA控制器实现数据搬移任务,而不再采用CPU实现数据搬移任务。参见图2A所示,为卷积神经网络中,上述数据处理方法的流程图的示例,该方法可以应用于DMA控制器,该方法可以包括:
步骤201,根据输入特征图的特征信息生成第一DMA读配置信息和第一DMA写配置信息,并确定第二DMA读配置信息和第二DMA写配置信息。
步骤202,根据该第一DMA读配置信息,从该输入特征图中读取数据;并根据该第一DMA写配置信息,将读取的数据输出给运算逻辑。
步骤203,根据该第二DMA读配置信息读取运算逻辑的运算结果;并根据该第二DMA写配置信息,将读取的运算结果存储到输出特征图。
在上述实施例中,输入特征图是初始特征图,DMA控制器可以从输入特征图中读取数据,即,输入特征图作为源数据。此外,输出特征图是目标特征图,DMA控制器可以将数据写入到输出特征图。综上所述,DMA控制器从输入特征图中读取数据,并将数据输出给运算逻辑。然后,DMA控制器可以读取运算逻辑的运算结果,并将读取的运算结果存储到输出特征图。
其中,第一DMA读配置信息是用于从输入特征图中读取数据的DMA配置信息,因此,可以根据第一DMA读配置信息从输入特征图中读取数据,这个读取过程,也就是从源地址(即输入特征图)中读取数据的过程。
其中,第一DMA写配置信息是用于将数据输出给运算逻辑的DMA配置信息,因此,可以根据第一DMA写配置信息将数据输出给运算逻辑,这个写入过程,也就是将源地址的数据写入目的地址的过程,从而将数据从输入特征图中搬移到运算逻辑,由运算逻辑对输入特征图中的数据进行运算。
其中,第二DMA读配置信息是用于从运算逻辑读取数据的DMA配置信息,因此,可以根据第二DMA读配置信息读取运算逻辑的运算结果。
其中,第二DMA写配置信息是用于将数据存储到输出特征图(即初始构造的输出特征图,在初始状态,没有写入运算逻辑的数据,在后续实施例中,介绍输出特征图的构造过程)的DMA配置信息,因此,可以根据第二DMA写配置信息将数据写入到输出特征图,这个写入过程,也就是将源地址的数据写入目的地址的过程,从而可以将数据从运算逻辑中搬移到输出特征图。
其中,第一DMA读配置信息、第一DMA写配置信息、第二DMA读配置信息、第二DMA写配置信息可以包括X方向计数配置(X_COUNT)、X方向步幅配置(X_STRIDE)、Y方向计数配置(Y_COUNT)、Y方向步幅配置(Y_STRIDE)、Z方向计数配置(Z_COUNT)、Z方向步幅配置(Z_STRIDE)。
基于上述技术方案,本发明实施例中,可以由DMA控制器实现CNN中的数据搬移,不需要由CPU实现CNN中的数据搬移,从而减轻CPU负担,更高效地搬移数据,进而起到加速CNN运算的效果,同时也不失灵活性。
以下结合具体应用场景,对上述技术方案进行详细说明。本应用场景下,是针对Pooling(池化层)的实现方式。具体的,Pooling的作用可以包括:保持输入特征图的不变性,这种不变性包括平移、旋转和尺度;保留主要特征并减少参数和计算量,防止过拟合,提高模型泛化能力。最常见的池化操作为平均池化和最大池化,平均池化用于计算图像区域的平均值,并将该平均值作为区域池化后的值,最大池化用于选取图像区域的最大值,并将该最大值作为区域池化后的值。池化操作的区域可以分为2x2、3x3、roi、global等。如图2B-2G所示,为卷积核大小为3x3,stride(步幅)为2的pooling示意图。
如果由CPU完成这种滑动窗口的搬运以及Pooling结果的输出,则会大幅增加CPU的负担。基于此,可以由DMA控制器完成滑动窗口的搬运以及Pooling结果的输出,从而减轻CPU的负担,以下结合图2H进行详细说明。
步骤211,获取输入特征图的特征信息。其中,该特征信息可以包括但不限于:输入特征图的宽度W、高度H,并包括输入特征图的通道数N。
其中,输入特征图(即Input Feature Maps)的宽度为W,高度为H,通道数为N,在存储器中连续存储,起始地址为A。因此,输入特征图的特征信息可以包括包括但不限于:输入特征图的宽度W、高度H、通道数N。
步骤212,根据输入特征图的特征信息生成第一DMA读配置信息和第一DMA写配置信息,并确定第二DMA读配置信息和第二DMA写配置信息。
情况一、根据输入特征图的特征信息生成第一DMA读配置信息,包括:DMA控制器可以根据该输入特征图的宽度W生成X方向计数配置;根据该输入特征图的高度H生成Y方向计数配置;根据预设数值(如1)生成X方向步幅配置和Y方向步幅配置。此外,DMA控制器还可以根据该输入特征图的通道数N生成Z方向计数配置,并根据预设数值生成Z方向步幅配置。
例如,第一DMA读配置信息的示例可以包括:X方向计数配置:W;Y方向计数配置:H;X方向步幅配置:1;Y方向步幅配置:1。此外,所述第一DMA读配置信息还可以包括:Z方向计数配置:N;Z方向步幅配置:1。
当然,上述第一DMA读配置信息只是一个示例,对此第一DMA读配置信息不做限制,可以根据经验进行配置,以上述第一DMA读配置信息为例。
情况二、根据输入特征图的特征信息生成第一DMA写配置信息,包括:DMA控制器可以根据输入特征图的宽度W和高度H生成X方向计数配置;根据预设数值生成Y方向计数配置、X方向步幅配置和Y方向步幅配置。或者,DMA控制器可以根据输入特征图的宽度W、高度H和通道数N,生成X方向计数配置;以及,DMA控制器可以根据预设数值生成Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置。
例如,第一DMA写配置信息包括:X方向计数配置:W*H;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0。或者,第一DMA写配置信息可以包括:X方向计数配置:W*H*N;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0。
当然,上述第一DMA写配置信息只是示例,对此第一DMA写配置信息 不做限制,可以根据经验进行配置,以上述第一DMA写配置信息为例。
情况三、第二DMA读配置信息可以包括:X方向计数配置:1;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0。或者,第二DMA读配置信息可以包括:X方向计数配置:N;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0。
当然,上述第二DMA读配置信息只是示例,对此第二DMA读配置信息不做限制,可以根据经验进行配置,以上述第二DMA读配置信息为例。
情况四、第二DMA写配置信息可以包括:X方向计数配置:1;Y方向计数配置:1;X方向步幅配置:0;Y方向步幅配置:0。或者,第二DMA写配置信息可以包括:X方向计数配置:N;Y方向计数配置:1;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0。
步骤213,根据该第一DMA读配置信息,从该输入特征图中读取数据。
具体的,DMA控制器可以根据该第一DMA读配置信息,从该输入特征图对应的起始地址(如起始地址A)开始,读取该输入特征图中的每个数据。
步骤214,根据该第一DMA写配置信息,将读取的数据输出给运算逻辑。
具体的,DMA控制器可以根据该第一DMA写配置信息,从运算逻辑对应的入口地址(如入口地址I)开始,将读取的每个数据输出给运算逻辑。
步骤215,根据该第二DMA读配置信息读取该运算逻辑的运算结果。
具体的,在运算逻辑对输入的数据进行运算后,可以产生运算结果,例如,运算逻辑可以用于对连续W*H个数据进行平均值运算或者最大值运算,其中,W和H分别为输入特征图的宽度和高度。因此,运算结果为连续W*H个数据对应的平均值或者最大值。进一步的,DMA控制器可以根据该第二DMA读配置信息,从该运算逻辑对应的出口地址(如出口地址O)开始,读取该运算逻辑产生的每个运算结果,如1个运算结果或者N个运算结果。
例如,若输入特征图的宽度为W,高度为H,则输入特征图有W*H个数据,运算逻辑对连续W*H个数据进行平均值运算或者最大值运算后,可以得 到一个运算结果,且根据第二DMA读配置信息,从运算逻辑对应的出口地址开始,读取一个运算结果。又例如,若输入特征图的宽度为W,高度为H,通道数为N,则输入特征图有W*H*N个数据,运算逻辑对连续W*H个数据进行平均值运算或者最大值运算后,可以得到N个运算结果,且根据第二DMA读配置信息,从运算逻辑对应的出口地址开始,读取N个运算结果。
步骤216,根据该第二DMA写配置信息,将读取的运算结果存储到输出特征图。具体的,DMA控制器可以根据该第二DMA写配置信息,从该输出特征图的起始地址开始,将读取的每个运算结果存储到该输出特征图。
例如,参见图2I所示,假设运算逻辑为Pooling运算逻辑,Pooling运算逻辑为global(整体)类型,且Pooling运算逻辑用于对连续W*H个数据进行平均值运算。而且,输出特征图的宽度为1,高度为1,通道数为N,在存储器中连续存储,起始地址为B。此外,Pooling运算逻辑的入口地址为I,出口地址为O。基于此,DMA控制器可以通过两步来实现global pooling操作。
第一步,DMA控制器将输入特征图中的数据输出给Pooling运算逻辑,由Pooling运算逻辑完成求平均值的操作,对于global pooling来说,每W*H个输入数据对应1个平均值输出,最终输出N个平均值。第二步,DMA控制器将Pooling运算逻辑输出的N个平均值,按顺序存储到输出特征图。这样,通过两步搬移操作,加上pooling运算逻辑,就能实现global pooling的功能。
在一个例子中,在将读取的运算结果存储到输出特征图之前,还可以确定输入特征图对应的目标DMA配置信息,并根据目标DMA配置信息构造输出特征图。这个构造的输出特征图是初始状态的输出特征图,还没有写入输入特征图中的数据,该输出特征图可以为特定的特征图,也可以是全0或1的特征图。步骤216中,就是将数据存储到这个构造的输出特征图。在将所有数据均存储到这个构造的输出特征图之后,就可以得到最终的输出特征图。
其中,该目标DMA配置信息的示例可以包括但不限于:X方向计数配置:N;Y方向计数配置:1;X方向步幅配置:0;Y方向步幅配置:0;Z方向 计数配置:0;Z方向步幅配置:0;其中,N为输入特征图的通道数。
当然,上述目标DMA配置信息只是一个示例,对此目标DMA配置信息不做限制,可以根据经验进行配置,本文以上述目标DMA配置信息为例。
其中,根据目标DMA配置信息构造输出特征图,包括:DMA控制器构造尺寸为1*1*M的输出特征图;其中,输出特征图为全0,起始地址为B。
其中,根据目标DMA配置信息构造输出特征图,包括:DMA控制器从指定存储位置读取特定样式信息,并根据目标DMA配置信息,构造与该特定样式信息对应的输出特征图。进一步的,根据目标DMA配置信息,构造与该特定样式信息对应的输出特征图,包括:DMA控制器根据该目标DMA配置信息,构造全0的输出特征图。当然,还可以构造全1的输出特征图。
在卷积神经网络中,可以采用DMA控制器实现数据搬移任务,而不再采用CPU实现数据搬移任务。参见图3A所示,为卷积神经网络中,上述数据处理方法的流程图的示例,该方法可以应用于DMA控制器,该方法可以包括:
步骤301,根据第一输入特征图(如一个第一输入特征图)的特征信息生成第一DMA读配置信息和第一DMA写配置信息,根据第二输入特征图(如至少一个第二输入特征图)的特征信息生成第二DMA读配置信息和第二DMA写配置信息,并确定第三DMA读配置信息和第三DMA写配置信息。
步骤302,根据该第一DMA读配置信息,从第一输入特征图中读取第一数据;根据该第一DMA写配置信息,将读取的第一数据输出给运算逻辑。
步骤303,根据该第二DMA读配置信息,从第二输入特征图中读取第二数据;根据该第二DMA写配置信息,将读取的第二数据输出给运算逻辑。
步骤304,根据该第三DMA读配置信息读取运算逻辑的运算结果;根据该第三DMA写配置信息,将读取的运算结果存储到输出特征图。
在上述实施例中,第一输入特征图、第二输入特征图是初始特征图,DMA控制器可以从第一输入特征图、第二输入特征图中读取数据,即,第一输入特征图、第二输入特征图作为源数据。此外,输出特征图是目标特征图,DMA 控制器可以将数据写入到输出特征图。综上所述,DMA控制器从第一输入特征图、第二输入特征图中读取数据,并将数据输出给运算逻辑。DMA控制器可以读取运算逻辑的运算结果,并将读取的运算结果存储到输出特征图。
其中,第一DMA读配置信息是用于从第一输入特征图中读取数据的DMA配置信息,因此,可以根据该第一DMA读配置信息从该第一输入特征图中读取数据,而这个数据读取过程,也就是从源地址中读取数据的过程。
其中,第二DMA读配置信息是用于从第二输入特征图中读取数据的DMA配置信息,因此,可以根据该第二DMA读配置信息从该第二输入特征图中读取数据,而这个数据读取过程,也就是从源地址中读取数据的过程。
其中,第一DMA写配置信息是用于将数据输出给运算逻辑的DMA配置信息,因此,根据第一DMA写配置信息将数据输出给运算逻辑,这个写入过程,就是将源地址的数据写入目的地址的过程,从而将数据从第一输入特征图搬移到运算逻辑,由运算逻辑对第一输入特征图中的数据进行运算。
其中,第二DMA写配置信息是用于将数据输出给运算逻辑的DMA配置信息,因此,根据第二DMA写配置信息将数据输出给运算逻辑,这个写入过程,就是将源地址的数据写入目的地址的过程,从而将数据从第二输入特征图搬移到运算逻辑,由运算逻辑对第二输入特征图中的数据进行运算。
其中,第三DMA读配置信息是用于从运算逻辑读取数据的DMA配置信息,因此,可以根据第三DMA读配置信息读取运算逻辑的运算结果。
其中,第三DMA写配置信息是用于将数据存储到输出特征图(即初始构造的输出特征图,在初始状态,没有写入运算逻辑的数据,在后续实施例中,介绍输出特征图的构造过程)的DMA配置信息,因此,可以根据第三DMA写配置信息将数据写入到输出特征图,这个写入过程,也就是将源地址的数据写入目的地址的过程,从而可以将数据从运算逻辑中搬移到输出特征图。
在上述实施例中,第一DMA读配置信息、第一DMA写配置信息、第二 DMA读配置信息、第二DMA写配置信息、第三DMA读配置信息、第三DMA写配置信息均可以包括但不限于:X方向计数配置(X_COUNT)、X方向步幅配置(X_STRIDE)、Y方向计数配置(Y_COUNT)、Y方向步幅配置(Y_STRIDE)、Z方向计数配置(Z_COUNT)、Z方向步幅配置(Z_STRIDE)。
基于上述技术方案,本发明实施例中,可以由DMA控制器实现CNN中的数据搬移,不需要由CPU实现CNN中的数据搬移,从而减轻CPU负担,更高效地搬移数据,进而起到加速CNN运算的效果,同时也不失灵活性。
以下结合具体应用场景,对上述技术方案进行详细说明。应用场景1,针对Element-wise(智能元素)的实现方式,Element-wise是对多层特征图中每个元素逐个运算,包括点乘、加减法、取最大值等,用于融合两个相同大小的层信息。如图3B所示,是对大小为W*H*N的两个特征图进行element-wise加法运算的示意图。如果让CPU完成上述操作,会额外增加CPU的负担。
应用场景2,针对BN(Batch normalization,标准化)的实现方式,BN解决了反向传播中的梯度弥散和爆炸问题,使得权重的更新更加稳健。BN是将某一层的输出进行归一化,使得其均值为0,方差为1。而且,BN是在Channel(通道)维度进行的,即可以将每个通道都进行归一化,如果有n个通道,就会有n个归一化操作。进一步的,BN作用在非线性映射前,即对
Figure PCTCN2017120273-appb-000001
进行规范化,γ为scale(比例),β为shift(变化)。如图3C所示,是一个对大小为W*H*N的输入特征图进行BN操作的示意图。如果让CPU来完成输入特征图与其对应的scale和shift的运算,则会大大增加CPU的负担。
基于此,针对应用场景1,可以由DMA控制器完成Element-wise操作,从而减轻CPU的负担。针对应用场景2,可以由DMA控制器完成BN操作,从而减轻CPU的负担。以下结合图3D对应用场景1、2进行详细说明。
步骤311,获取第一输入特征图的特征信息、第二输入特征图的特征信息。
针对应用场景1,假设存在两个输入特征图,输入特征图1和输入特征图2,输入特征图1的宽度为W,高度为H,通道数为N,在存储器中连续存储,起始地址为A,输入特征图2的宽度为W,高度为H,通道数为N,在存储 器中连续存储,起始地址为B。可以将输入特征图1作为第一输入特征图,将输入特征图2作为第二输入特征图。基于此,第一输入特征图的特征信息可以包括但不限于:第一输入特征图的宽度W、高度H。还可以包括第一输入特征图的通道数N。第二输入特征图的特征信息可以包括但不限于:第二输入特征图的宽度W、高度H。还可以包括第二输入特征图的通道数N。
在应用场景1中,输出特征图的宽度为W,高度为H,通道数为N,在存储器中连续存储,起始地址为C。运算逻辑可以为Element-wise运算逻辑,Element-wise运算逻辑用于进行点乘、加减法、取最大值等运算,例如,当Element-wise类型为product(乘积)时,则Element-wise运算逻辑用于进行点乘运算,也就是说,对第一输入特征图的第一个数据与第二输入特征图的第一个数据进行乘法运算,得到第一个运算结果,对第一输入特征图的第二个数据与第二输入特征图的第二个数据进行乘法运算,得到第二个运算结果,以此类推。其中,Element-wise运算逻辑的入口地址为I1、I2,出口地址为O。
针对应用场景2,假设存在三个输入特征图,输入特征图1、输入特征图2和输入特征图3,输入特征图1的宽度为W,高度为H,通道数为N,在存储器中连续存储,起始地址为A。与输入特征图1对应的输入特征图2是BN中的γ,即scale参数,输入特征图2可以是针对scale参数的参数图,宽度为1,高度为1,通道数为N,在存储器中连续存储,起始地址为B。scale参数是一个常数,可以根据经验配置,也就是说,输入特征图2是包括N个scale参数的参数图。与输入特征图1对应的输入特征图3是BN中的β,即shift参数,输入特征图3可以是针对shift参数的参数图,宽度为1,高度为1,通道数为N,在存储器中连续存储,起始地址为C。shift参数是一个常数,可以根据经验配置,也就是说,输入特征图3是包括N个shift参数的参数图。
综上所述,可以将输入特征图1作为第一输入特征图,将输入特征图2和输入特征图3作为第二输入特征图。基于此,第一输入特征图的特征信息可以包括但不限于:第一输入特征图的宽度W、高度H。还可以包括第一输入特征图的通道数N。第二输入特征图的特征信息可以包括但不限于:第二 输入特征图的宽度1、高度1。还可以包括第二输入特征图的通道数N。
在应用场景2中,输出特征图的宽度为W,高度为H,通道数为N,在存储器中连续存储,起始地址为D。运算逻辑可以为BN运算逻辑,BN运算逻辑用于完成线性变换。例如,对第一输入特征图的每个数据,采用如下公式对该数据进行线性变换:
Figure PCTCN2017120273-appb-000002
x为输入特征图1的数据,γ是输入特征图2(即参数图)给出的scale参数,β是输入特征图3(即参数图)给出的shift参数,而且,输入特征图1中的连续W*H个数据,对应输入特征图2的同一个γ,并对应输入特征图3的同一个β,即一个γ和一个β与W*H个数据运算。其中,Element-wise运算逻辑的入口地址为I1(对应输入特征图1)、I2(对应输入特征图2)、I3(对应输入特征图3),出口地址为O。
步骤312,根据第一输入特征图(即输入特征图1)的特征信息生成第一DMA读配置信息和第一DMA写配置信息,根据第二输入特征图(即输入特征图2或者输入特征图3等)的特征信息生成第二DMA读配置信息和第二DMA写配置信息,并确定第三DMA读配置信息和第三DMA写配置信息。
情况一、根据第一输入特征图的特征信息生成第一DMA读配置信息,包括:可以根据第一输入特征图的宽度W生成X方向计数配置,并根据第一输入特征图的高度H生成Y方向计数配置,并根据预设数值(如1)生成X方向步幅配置和Y方向步幅配置。此外,还可以根据第一输入特征图的通道数N生成Z方向计数配置,并根据预设数值(如1)生成Z方向步幅配置。
例如,第一DMA读配置信息的示例可以包括:X方向计数配置:W;Y方向计数配置:H;X方向步幅配置:1;Y方向步幅配置:1。此外,第一DMA读配置信息还可以包括:Z方向计数配置:N;Z方向步幅配置:1。
当然,上述第一DMA读配置信息只是一个示例,对此第一DMA读配置信息不做限制,可以根据经验进行配置,以上述第一DMA读配置信息为例。
情况二、根据第一输入特征图的特征信息生成第一DMA写配置信息,包括:DMA控制器可以根据第一输入特征图的宽度W和高度H生成X方向计数配置;以及,根据预设数值生成Y方向计数配置、X方向步幅配置和Y方 向步幅配置。或者,DMA控制器可以根据第一输入特征图的宽度W、高度H和通道数N,生成X方向计数配置;以及,根据预设数值生成Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置。
例如,第一DMA写配置信息可以包括:X方向计数配置:W*H;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0。或者,第一DMA写配置信息包括:X方向计数配置:W*H*N;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0。
当然,上述第一DMA写配置信息只是示例,对此第一DMA写配置信息不做限制,可以根据经验进行配置,以上述第一DMA写配置信息为例。
其中,针对应用场景1和应用场景2,均可以采用情况一和情况二处理。
情况三、根据第二输入特征图的特征信息生成第二DMA读配置信息,包括:DMA控制器可以根据第二输入特征图的宽度W生成X方向计数配置;根据第二输入特征图的高度H生成Y方向计数配置;根据预设数值生成X方向步幅配置和Y方向步幅配置。此外,DMA控制器还可以根据第二输入特征图的通道数N生成Z方向计数配置;根据预设数值生成Z方向步幅配置。
例如,第二DMA读配置信息的示例可以包括:X方向计数配置:W;Y方向计数配置:H;X方向步幅配置:1;Y方向步幅配置:1。此外,第二DMA读配置信息还可以包括:Z方向计数配置:N;Z方向步幅配置:1。
当然,上述第二DMA读配置信息只是一个示例,对此第二DMA读配置信息不做限制,可以根据经验进行配置,以上述第二DMA读配置信息为例。
情况四、根据第二输入特征图的特征信息生成第二DMA写配置信息,包括:DMA控制器可以根据第二输入特征图的宽度W和高度H生成X方向计数配置;根据预设数值生成Y方向计数配置、X方向步幅配置和Y方向步幅配置。或者,DMA控制器可以根据第二输入特征图的宽度W、高度H和通道数N,生成X方向计数配置;以及,根据预设数值生成Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置。
例如,第二DMA写配置信息可以包括:X方向计数配置:W*H;Y方 向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0。或者,第二DMA写配置信息包括:X方向计数配置:W*H*N;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0。
当然,上述第二DMA写配置信息只是示例,对此第二DMA写配置信息不做限制,可以根据经验进行配置,以上述第二DMA写配置信息为例。
其中,在确定第二DMA读配置信息和第二DMA写配置信息的过程中,针对应用场景1,可以采用情况三和情况四处理,而针对应用场景2,不采用情况三和情况四处理,而是可以采用情况五处理,下面介绍情况五。
情况五、根据第二输入特征图的特征信息生成第二DMA读配置信息、第二DMA写配置信息,包括:若第二输入特征图为至少一个参数图(如上述应用场景2中的输入特征图2和输入特征图3),针对每个参数图,则:第二DMA读配置信息可以包括但不限于:X方向计数配置:1;Y方向计数配置:0;X方向步幅配置:1;Y方向步幅配置:0。而且,第二DMA写配置信息可以包括但不限于:X方向计数配置:1;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0。或者,第二DMA读配置信息可以包括但不限于:X方向计数配置:N;Y方向计数配置:0;X方向步幅配置:1;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0。而且,第二DMA写配置信息可以包括但不限于:X方向计数配置:N;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0。
当然,上述第二DMA读配置信息只是示例,对此第二DMA读配置信息不做限制,可以根据经验进行配置,以上述第二DMA读配置信息为例。
此外,上述第二DMA写配置信息只是示例,对此第二DMA写配置信息不做限制,可以根据经验进行配置,以上述第二DMA写配置信息为例。
情况六、确定第三DMA读配置信息和第三DMA写配置信息,包括:可以根据第一输入特征图的宽度W和高度H,生成第三DMA读配置信息中的X方向计数配置;根据预设数值生成第三DMA读配置信息中的Y方向计数配置、X方向步幅配置和Y方向步幅配置。进一步的,可以根据第一输入特 征图的宽度W生成第三DMA写配置信息中的X方向计数配置;根据第一输入特征图的高度H生成第三DMA写配置信息中的Y方向计数配置;根据预设数值生成第三DMA写配置信息中的X方向步幅配置和Y方向步幅配置。
例如,所述第三DMA读配置信息可以包括但不限于:X方向计数配置:W*H;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;此外,所述第三DMA写配置信息可以包括但不限于:X方向计数配置:W;Y方向计数配置:H;X方向步幅配置:1;Y方向步幅配置:1。
当然,上述第三DMA读配置信息只是一个示例,对此第三DMA读配置信息不做限制,可以根据经验进行配置,以上述第三DMA读配置信息为例。此外,上述第三DMA写配置信息只是一个示例,对此第三DMA写配置信息不做限制,可以根据经验进行配置,以上述第三DMA写配置信息为例。
情况七、确定第三DMA读配置信息和第三DMA写配置信息,包括:可以根据第一输入特征图的宽度W、高度H和通道数N,生成第三DMA读配置信息中的X方向计数配置;根据预设数值生成第三DMA读配置信息中的Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置。进一步的,还可以根据第一输入特征图的宽度W生成第三DMA写配置信息中的X方向计数配置;根据第一输入特征图的高度H生成第三DMA写配置信息中的Y方向计数配置;根据第一输入特征图的通道数N生成第三DMA写配置信息中的Z方向计数配置;根据预设数值生成第三DMA写配置信息中的X方向步幅配置、Y方向步幅配置和Z方向步幅配置。
例如,第三DMA读配置信息可以包括但不限于:X方向计数配置:W*H*N;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0。此外,第三DMA写配置信息可以包括但不限于:X方向计数配置:W;Y方向计数配置:H;X方向步幅配置:1;Y方向步幅配置:1;Z方向计数配置:N;Z方向步幅配置:1。
当然,上述第三DMA读配置信息只是一个示例,对此第三DMA读配置信息不做限制,可以根据经验进行配置,以上述第三DMA读配置信息为例。 此外,上述第三DMA写配置信息只是一个示例,对此第三DMA写配置信息不做限制,可以根据经验进行配置,以上述第三DMA写配置信息为例。
其中,针对应用场景1和应用场景2,均可以采用情况六或情况七处理。
步骤313,根据该第一DMA读配置信息,从第一输入特征图中读取第一数据;根据该第一DMA写配置信息,将读取的第一数据输出给运算逻辑。
在一个例子中,DMA控制器可以根据该第一DMA读配置信息,从该第一输入特征图对应的起始地址开始,读取第一输入特征图中的每个第一数据。进一步的,DMA控制器还可以根据该第一DMA写配置信息,从上述运算逻辑对应的第一入口地址开始,将读取的每个第一数据输出给该运算逻辑。
步骤314,根据该第二DMA读配置信息,从第二输入特征图中读取第二数据;根据该第二DMA写配置信息,将读取的第二数据输出给运算逻辑。
在一个例子中,DMA控制器可以根据该第二DMA读配置信息,从该第二输入特征图对应的起始地址开始,读取第二输入特征图中的每个第二数据。进一步的,DMA控制器还可以根据该第二DMA写配置信息,从上述运算逻辑对应的第二入口地址开始,将读取的每个第二数据输出给该运算逻辑。
步骤315,根据该第三DMA读配置信息读取运算逻辑的运算结果;根据该第三DMA写配置信息,将读取的运算结果存储到输出特征图。
在一个例子中,DMA控制器可以根据该第三DMA读配置信息,从上述运算逻辑对应的出口地址开始,读取该运算逻辑产生的每个运算结果。进一步的,DMA控制器还可以根据该第三DMA写配置信息,从该输出特征图的起始地址开始,将读取的每个运算结果存储到所述输出特征图。
针对应用场景1,运算逻辑用于对第一数据和第二数据进行Element-wise运算。参见图3E所示,DMA控制器可以通过三步来实现Element-wise操作。
第一步,DMA控制器将输入特征图1中的数据输出给Element-wise运算逻辑的入口地址I1。第二步,DMA控制器将输入特征图2中的数据输出给Element-wise运算逻辑的入口地址I2。然后,Element-wise运算逻辑对入口地址I1和入口地址I2的数据进行Element-wise操作。第三步,DMA控制器将 Element-wise运算逻辑产生的运算结果,按顺序存储到输出特征图。综上所述,通过三步搬移操作,加上Element-wise运算逻辑,就实现element-wise功能。
针对应用场景2,运算逻辑用于对第一数据和第二数据进行BN运算。参见图3F所示,DMA控制器可以通过三步来实现BN操作。第一步,DMA控制器可以将输入特征图1中的数据输出给BN运算逻辑的入口地址I1。第二步,DMA控制器将γ输出给BN运算逻辑的入口地址I2,BN运算逻辑使用γ对入口地址I1的数据进行线性变换中的乘法操作。第三步,DMA控制器将β输出给BN运算逻辑的入口地址I3,BN运算逻辑使用β对上述乘法操作的结果,进行线性变换中的加法操作。第四步,DMA控制器将BN运算逻辑产生的运算结果,按顺序存储到输出特征图。综上所述,通过四步的搬移操作,加上BN运算逻辑,就可以实现Batch Normalization的功能。
在一个例子中,在将读取的运算结果存储到输出特征图之前,还可以确定第一输入特征图对应的目标DMA配置信息,并根据该目标DMA配置信息构造第一输入特征图对应的输出特征图。这个构造的输出特征图是初始状态的输出特征图,还没有写入输入特征图中的数据,可以为特定的特征图,也可以是全0或1的特征图。步骤315中,是将数据存储到这个构造的输出特征图。在将所有数据存储到构造的输出特征图后,可以得到最终输出特征图。
其中,确定第一输入特征图对应的目标DMA配置信息,包括:根据第一输入特征图的宽度W生成X方向计数配置;根据第一输入特征图的高度H生成Y方向计数配置;根据第一输入特征图的通道数N生成Z方向计数配置;根据预设数值生成X方向步幅配置、Y方向步幅配置和Z方向步幅配置。
其中,该目标DMA配置信息可以包括但不限于:X方向计数配置:W;Y方向计数配置:H;X方向步幅配置:1;Y方向步幅配置:1;Z方向计数配置:N;Z方向步幅配置:1。当然,上述目标DMA配置信息只是示例,对此不做限制,可以根据经验进行配置,本文以上述目标DMA配置信息为例。
其中,根据该目标DMA配置信息构造第一输入特征图对应的输出特征图,包括:构造尺寸为W*H*M的输出特征图;其中,输出特征图为全0。
其中,根据该目标DMA配置信息构造第一输入特征图对应的输出特征图,包括:DMA控制器从指定存储位置读取特定样式信息,并根据目标DMA配置信息,构造与特定样式信息对应的输出特征图。进一步的,根据目标DMA配置信息,构造与该特定样式信息对应的输出特征图,包括:根据该目标DMA配置信息,构造全0的输出特征图。当然,还可以构造全1的输出特征图。
在实际应用中,很多图像算法均涉及固定矩阵的运算,例如,高斯滤波中的Gaussian矩阵、边缘检测中的Laplacian矩阵和Sobel矩阵、快速傅里叶变化或者霍夫变换中的三角函数矩阵、加速矩阵乘法中的Toeplitz矩阵、随机矩阵、全0/1矩阵等。如果上述矩阵由CPU生成,则会增加CPU的负担。基于此,可以由DMA控制器生成上述矩阵,从而可以减轻CPU的负担。
在上述实施例中,DMA控制器根据目标DMA配置信息构造输出特征图的过程,实际上就是DMA控制器构造矩阵的过程,而不是由CPU构造矩阵。
根据实际需要,若输出特征图是Gaussian矩阵,则DMA控制器构造的就是Gaussian矩阵;若输出特征图是三角函数矩阵,则DMA控制器构造的就是三角函数矩阵;若输出特征图是全0矩阵,则DMA控制器构造的就是全0矩阵;若输出特征图是全1矩阵,则DMA控制器构造的就是全1矩阵;以此类推,对此不做限制,本实施例中以DMA控制器构造全0矩阵为例。
为了实现上述过程,可以在指定存储位置存储特定样式信息,该特定样式信息表示矩阵类型。例如,当特定样式信息为第一标识时,表示矩阵类型为全0矩阵(用于各种类型的填充或者间插);当特定样式信息为第二标识时,表示矩阵类型为全1矩阵(用于各种类型的填充);当特定样式信息为第三标识时,表示矩阵类型为Gaussian矩阵(用于二维/三维高斯滤波);当特定样式信息为第四标识时,表示矩阵类型为Laplacian矩阵(用于边缘检测);当特定样式信息为第五标识时,表示矩阵类型为Sobel矩阵(用于边缘检测);当特定样式信息为第六标识时,表示矩阵类型为三角函数矩阵(用于快速傅里叶变换或者霍夫变换);当特定样式信息为第七标识时,表示矩阵类型为Toeplitz矩阵(用于矩阵乘法加速);当特定样式信息为第八标识时,表示矩 阵类型为随机矩阵(用于训练权重的初始化);对此矩阵类型不做限制。
综上所述,DMA控制器可以从指定存储位置读取特定样式信息,并构造与该特定样式信息对应的输出特征图。例如,当特定样式信息为第一标识时,则可以构造全0的输出特征图。以此类推,对于其它特定样式信息不再赘述。
在一个例子中,可以将一些特殊的地址(如0xFFFF_FFFF、0x8765_4321、0x5A5A_5A5A等)作为指定存储位置,或将CFG(Control Flow Graph,控制流图)寄存器的某些域作为指定存储位置,在指定存储位置存储特定样式信息,从而指定矩阵类型。这样,DMA控制器可以从指定存储位置读取特定样式信息,继而获知矩阵类型,并构造与该矩阵类型对应的输出特征图。
在一个例子中,DMA控制器在构造矩阵时,矩阵中的数据由DMA控制器自身产生(如产生全0的数据),不需要从其它位置读取数据,因此,不需要为读取过程设置DMA配置信息,只需要为写入过程设置DMA配置信息。
在一个例子中,可以为写入过程设置七个寄存器,这七个寄存器分别存储起始地址(DST_STRT_ADDR)、X方向计数配置(X_COUNT)、X方向步幅配置(X_STRIDE)、Y方向计数配置(Y_COUNT)、Y方向步幅配置(Y_STRIDE)、Z方向计数配置(Z_COUNT)、Z方向步幅配置(Z_STRIDE)。
基于与上述方法同样的发明构思,本发明实施例中还提供一种DMA控制器,所述DMA控制器用于:根据输入特征图的特征信息生成第一DMA读配置信息和第一DMA写配置信息,并确定第二DMA读配置信息和第二DMA写配置信息;根据所述第一DMA读配置信息,从所述输入特征图中读取数据;根据所述第一DMA写配置信息,将读取的数据输出给运算逻辑;根据所述第二DMA读配置信息读取运算逻辑的运算结果;根据所述第二DMA写配置信息,将读取的运算结果存储到输出特征图。
所述特征信息包括:所述输入特征图的宽度W、高度H、通道数N;
所述DMA控制器在根据输入特征图的特征信息生成第一DMA读配置信息时具体用于:根据所述输入特征图的宽度W生成X方向计数配置;根据所述输入特征图的高度H生成Y方向计数配置;根据预设数值生成X方向步幅 配置和Y方向步幅配置;根据所述输入特征图的通道数N生成Z方向计数配置;根据预设数值生成Z方向步幅配置。
所述特征信息包括:所述输入特征图的宽度W、高度H;所述DMA控制器在根据输入特征图的特征信息生成第一DMA写配置信息时具体用于:根据所述输入特征图的宽度W和高度H生成X方向计数配置;根据预设数值生成Y方向计数配置、X方向步幅配置和Y方向步幅配置;
或者,所述特征信息包括:所述输入特征图的宽度W、高度H、通道数N;所述DMA控制器在根据输入特征图的特征信息生成第一DMA写配置信息时具体用于:根据所述输入特征图的宽度W、高度H和通道数N,生成X方向计数配置;以及,根据预设数值生成Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置。
所述DMA控制器在根据所述第一DMA读配置信息,从所述输入特征图中读取数据时具体用于:根据所述第一DMA读配置信息,从所述输入特征图对应的起始地址开始,读取所述输入特征图中的每个数据;
所述DMA控制器在根据所述第一DMA写配置信息,将读取的数据输出给运算逻辑时具体用于:根据所述第一DMA写配置信息,从所述运算逻辑对应的入口地址开始,将读取的每个数据输出给所述运算逻辑。
所述DMA控制器在根据所述第二DMA读配置信息读取运算逻辑的运算结果时具体用于:根据所述第二DMA读配置信息,从所述运算逻辑对应的出口地址开始,读取所述运算逻辑产生的每个运算结果;
所述DMA控制器在根据所述第二DMA写配置信息,将读取的运算结果存储到输出特征图时具体用于:根据所述第二DMA写配置信息,从输出特征图的起始地址开始,将读取的每个运算结果存储到所述输出特征图。
所述DMA控制器在将读取的运算结果存储到输出特征图之前还用于:确定所述输入特征图对应的目标DMA配置信息;根据所述目标DMA配置信息构造输出特征图。
所述DMA控制器在根据所述目标DMA配置信息构造输出特征图时具体 用于:从指定存储位置读取特定样式信息,并根据所述目标DMA配置信息,构造与所述特定样式信息对应的输出特征图。
基于与上述方法同样的发明构思,本发明实施例中还提供一种DMA控制器,所述DMA控制器用于:根据第一输入特征图的特征信息生成第一DMA读配置信息和第一DMA写配置信息,根据第二输入特征图的特征信息生成第二DMA读配置信息和第二DMA写配置信息,并确定第三DMA读配置信息和第三DMA写配置信息;根据所述第一DMA读配置信息,从第一输入特征图中读取第一数据;根据所述第一DMA写配置信息,将读取的第一数据输出给运算逻辑;根据所述第二DMA读配置信息,从第二输入特征图中读取第二数据;根据所述第二DMA写配置信息,将读取的第二数据输出给运算逻辑;根据所述第三DMA读配置信息读取所述运算逻辑的运算结果;根据所述第三DMA写配置信息,将读取的运算结果存储到输出特征图。
所述第一输入特征图的特征信息包括:所述第一输入特征图的宽度W、高度H、通道数N;所述DMA控制器在根据第一输入特征图的特征信息生成第一DMA读配置信息时具体用于:根据所述第一输入特征图的宽度W生成X方向计数配置;根据所述第一输入特征图的高度H生成Y方向计数配置;根据预设数值生成X方向步幅配置和Y方向步幅配置;根据所述第一输入特征图的通道数N生成Z方向计数配置;根据预设数值生成Z方向步幅配置。
所述第一输入特征图的特征信息包括:第一输入特征图的宽度W、高度H;所述DMA控制器在根据第一输入特征图的特征信息生成第一DMA写配置信息时具体用于:根据所述第一输入特征图的宽度W和高度H生成X方向计数配置;根据预设数值生成Y方向计数配置、X方向步幅配置和Y方向步幅配置;或者,所述第一输入特征图的特征信息包括:第一输入特征图的宽度W、高度H、通道数N;所述DMA控制器在根据第一输入特征图的特征信息生成第一DMA写配置信息时具体用于:根据第一输入特征图的宽度W、高度H和通道数N,生成X方向计数配置;根据预设数值生成Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置。
所述DMA控制器在根据所述第一DMA读配置信息,从第一输入特征图中读取第一数据时具体用于:根据所述第一DMA读配置信息,从所述第一输入特征图对应的起始地址开始,读取所述第一输入特征图中的每个第一数据;
所述DMA控制器在根据所述第一DMA写配置信息,将读取的第一数据输出给运算逻辑时具体用于:根据所述第一DMA写配置信息,从所述运算逻辑对应的第一入口地址开始,将读取的每个第一数据输出给所述运算逻辑。
所述第二输入特征图的特征信息包括:所述第二输入特征图的宽度W、高度H、通道数N;所述DMA控制器在根据第二输入特征图的特征信息生成第二DMA读配置信息时具体用于:根据所述第二输入特征图的宽度W生成X方向计数配置;根据所述第二输入特征图的高度H生成Y方向计数配置;根据预设数值生成X方向步幅配置和Y方向步幅配置;根据所述第二输入特征图的通道数N生成Z方向计数配置;根据预设数值生成Z方向步幅配置。
所述第二输入特征图的特征信息包括:第二输入特征图的宽度W、高度H;所述DMA控制器在根据第二输入特征图的特征信息生成第二DMA写配置信息时具体用于:根据所述第二输入特征图的宽度W和高度H生成X方向计数配置;根据预设数值生成Y方向计数配置、X方向步幅配置和Y方向步幅配置;或者,所述第二输入特征图的特征信息包括:第二输入特征图的宽度W、高度H、通道数N;所述DMA控制器在根据第二输入特征图的特征信息生成第二DMA写配置信息时具体用于:根据第二输入特征图的宽度W、高度H和通道数N,生成X方向计数配置;根据预设数值生成Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置。
所述DMA控制器在根据所述第二DMA读配置信息,从第二输入特征图中读取第二数据时具体用于:根据所述第二DMA读配置信息,从所述第二输入特征图对应的起始地址开始,读取所述第二输入特征图中的每个第二数据;
所述DMA控制器在根据所述第二DMA写配置信息,将读取的第二数据输出给运算逻辑时具体用于:根据所述第二DMA写配置信息,从所述运算逻辑对应的第二入口地址开始,将读取的每个第二数据输出给所述运算逻辑。
所述DMA控制器在确定第三DMA读配置信息和第三DMA写配置信息时具体用于:根据所述第一输入特征图的宽度W和高度H,生成所述第三DMA读配置信息中的X方向计数配置;根据预设数值生成所述第三DMA读配置信息中的Y方向计数配置、X方向步幅配置和Y方向步幅配置;
根据所述第一输入特征图的宽度W生成所述第三DMA写配置信息中的X方向计数配置;根据所述第一输入特征图的高度H生成所述第三DMA写配置信息中的Y方向计数配置;根据预设数值生成所述第三DMA写配置信息中的X方向步幅配置和Y方向步幅配置。
所述DMA控制器在确定第三DMA读配置信息和第三DMA写配置信息时具体用于:根据所述第一输入特征图的宽度W、高度H和通道数N,生成所述第三DMA读配置信息中的X方向计数配置;根据预设数值生成所述第三DMA读配置信息中的Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置;
根据所述第一输入特征图的宽度W生成所述第三DMA写配置信息中的X方向计数配置;根据所述第一输入特征图的高度H生成所述第三DMA写配置信息中的Y方向计数配置;根据所述第一输入特征图的通道数N生成所述第三DMA写配置信息中的Z方向计数配置;根据预设数值生成所述第三DMA写配置信息中的X方向步幅配置、Y方向步幅配置和Z方向步幅配置。
所述DMA控制器在根据所述第三DMA读配置信息读取所述运算逻辑的运算结果时具体用于:根据所述第三DMA读配置信息,从所述运算逻辑对应的出口地址开始,读取所述运算逻辑产生的每个运算结果;
所述DMA控制器在根据所述第三DMA写配置信息,将读取的运算结果存储到输出特征图时具体用于:根据所述第三DMA写配置信息,从所述输出特征图的起始地址开始,将读取的每个运算结果存储到所述输出特征图。
所述DMA控制器在将读取的运算结果存储到输出特征图之前还用于:确定所述第一输入特征图对应的目标DMA配置信息;根据所述目标DMA配置信息构造第一输入特征图对应的输出特征图。
所述DMA控制器在确定所述第一输入特征图对应的目标DMA配置信息时具体用于:根据所述第一输入特征图的宽度W生成X方向计数配置;根据所述第一输入特征图的高度H生成Y方向计数配置;根据所述第一输入特征图的通道数N生成Z方向计数配置;根据预设数值生成X方向步幅配置、Y方向步幅配置和Z方向步幅配置。
所述DMA控制器在根据所述目标DMA配置信息构造第一输入特征图对应的输出特征图时具体用于:从指定存储位置读取特定样式信息,并根据所述目标DMA配置信息,构造与所述特定样式信息对应的输出特征图。
基于与上述方法同样的发明构思,本发明实施例中还提供一种数据处理设备,如图4所示,所述数据处理设备包括:存储器和DMA控制器;其中,所述存储器,用于存储程序代码;所述DMA控制器,用于调用所述程序代码,当所述程序代码被执行时,实现权利要求上述的数据处理方法。
基于与上述方法同样的发明构思,本发明实施例中还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有若干计算机指令,所述计算机指令被执行时,实现权利要求上述的数据处理方法。
上述实施例阐明的系统、装置、模块或单元,可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本发明时可以把各单元的功能在同一个或多个软件和/或硬件中实现。
本领域内的技术人员应明白,本发明实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于 磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可以由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其它可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其它可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
而且,这些计算机程序指令也可以存储在能引导计算机或其它可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或者多个流程和/或方框图一个方框或者多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其它可编程数据处理设备,使得在计算机或者其它可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其它可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
以上所述仅为本发明实施例而已,并不用于限制本发明。对于本领域技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原理之内所作的任何修改、等同替换、改进,均应包含在本发明的权利要求范围之内。

Claims (72)

  1. 一种数据处理方法,其特征在于,应用于直接内存存取DMA控制器,所述方法包括:
    根据输入特征图的特征信息生成第一DMA读配置信息和第一DMA写配置信息,并确定第二DMA读配置信息和第二DMA写配置信息;
    根据所述第一DMA读配置信息,从所述输入特征图中读取数据;根据所述第一DMA写配置信息,将读取的数据输出给运算逻辑;
    根据所述第二DMA读配置信息读取运算逻辑的运算结果;根据所述第二DMA写配置信息,将读取的运算结果存储到输出特征图。
  2. 根据权利要求1所述的方法,其特征在于,
    所述特征信息包括:所述输入特征图的宽度W、高度H;所述根据输入特征图的特征信息生成第一DMA读配置信息,包括:
    根据所述输入特征图的宽度W生成X方向计数配置;
    根据所述输入特征图的高度H生成Y方向计数配置;
    根据预设数值生成X方向步幅配置和Y方向步幅配置。
  3. 根据权利要求2所述的方法,其特征在于,
    所述第一DMA读配置信息包括:X方向计数配置:W;Y方向计数配置:H;X方向步幅配置:1;Y方向步幅配置:1。
  4. 根据权利要求2所述的方法,其特征在于,
    所述特征信息还包括:所述输入特征图的通道数N;所述根据输入特征图的特征信息生成第一DMA读配置信息,包括:
    根据所述输入特征图的通道数N生成Z方向计数配置;
    根据预设数值生成Z方向步幅配置。
  5. 根据权利要求1所述的方法,其特征在于,
    所述特征信息包括:所述输入特征图的宽度W、高度H;所述根据输入特征图的特征信息生成第一DMA写配置信息,包括:
    根据所述输入特征图的宽度W和高度H生成X方向计数配置;
    根据预设数值生成Y方向计数配置、X方向步幅配置和Y方向步幅配置。
  6. 根据权利要求5所述的方法,其特征在于,
    所述第一DMA写配置信息包括:X方向计数配置:W*H;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0。
  7. 根据权利要求1所述的方法,其特征在于,
    所述特征信息包括:所述输入特征图的宽度W、高度H、通道数N;所述根据输入特征图的特征信息生成第一DMA写配置信息,包括:
    根据所述输入特征图的宽度W、高度H和通道数N,生成X方向计数配置;以及,根据预设数值生成Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置。
  8. 根据权利要求7所述的方法,其特征在于,所述第一DMA写配置信息包括:X方向计数配置:W*H*N;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0。
  9. 根据权利要求1所述的方法,其特征在于,所述根据所述第一DMA读配置信息,从所述输入特征图中读取数据,包括:
    根据所述第一DMA读配置信息,从所述输入特征图对应的起始地址开始,读取所述输入特征图中的每个数据。
  10. 根据权利要求1所述的方法,其特征在于,所述根据所述第一DMA写配置信息,将读取的数据输出给运算逻辑,包括:
    根据所述第一DMA写配置信息,从所述运算逻辑对应的入口地址开始,将读取的每个数据输出给所述运算逻辑。
  11. 根据权利要求10所述的方法,其特征在于,
    所述运算逻辑用于对连续W*H个数据进行平均值运算或者最大值运算;其中,W和H分别为所述输入特征图的宽度和高度。
  12. 根据权利要求1所述的方法,其特征在于,所述第二DMA读配置信息包括:X方向计数配置:1;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;所述第二DMA写配置信息包括:X方向计数配置:1;Y 方向计数配置:1;X方向步幅配置:0;Y方向步幅配置:0。
  13. 根据权利要求1所述的方法,其特征在于,所述第二DMA读配置信息包括:X方向计数配置:N;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0;所述第二DMA写配置信息包括:X方向计数配置:N;Y方向计数配置:1;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0。
  14. 根据权利要求1所述的方法,其特征在于,
    根据所述第二DMA读配置信息读取运算逻辑的运算结果,包括:
    根据所述第二DMA读配置信息,从所述运算逻辑对应的出口地址开始,读取所述运算逻辑产生的每个运算结果。
  15. 根据权利要求1所述的方法,其特征在于,所述根据所述第二DMA写配置信息,将读取的运算结果存储到输出特征图,包括:
    根据所述第二DMA写配置信息,从输出特征图的起始地址开始,将读取的每个运算结果存储到所述输出特征图。
  16. 根据权利要求1所述的方法,其特征在于,
    所述将读取的运算结果存储到输出特征图之前,所述方法还包括:
    确定所述输入特征图对应的目标DMA配置信息;
    根据所述目标DMA配置信息构造输出特征图。
  17. 根据权利要求16所述的方法,其特征在于,
    所述目标DMA配置信息包括:X方向计数配置:N;Y方向计数配置:1;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0;其中,所述N为所述输入特征图的通道数。
  18. 根据权利要求16所述的方法,其特征在于,
    所述根据所述目标DMA配置信息构造输出特征图,包括:
    从指定存储位置读取特定样式信息,并根据所述目标DMA配置信息,构造与所述特定样式信息对应的输出特征图。
  19. 一种数据处理方法,其特征在于,应用于直接内存存取DMA控制器, 所述方法包括:
    根据第一输入特征图的特征信息生成第一DMA读配置信息和第一DMA写配置信息,根据第二输入特征图的特征信息生成第二DMA读配置信息和第二DMA写配置信息,并确定第三DMA读配置信息和第三DMA写配置信息;
    根据所述第一DMA读配置信息,从第一输入特征图中读取第一数据;根据所述第一DMA写配置信息,将读取的第一数据输出给运算逻辑;
    根据所述第二DMA读配置信息,从第二输入特征图中读取第二数据;根据所述第二DMA写配置信息,将读取的第二数据输出给运算逻辑;
    根据所述第三DMA读配置信息读取所述运算逻辑的运算结果;根据所述第三DMA写配置信息,将读取的运算结果存储到输出特征图。
  20. 根据权利要求19所述的方法,其特征在于,
    所述第一输入特征图的特征信息包括:所述第一输入特征图的宽度W、高度H;根据第一输入特征图的特征信息生成第一DMA读配置信息,包括:
    根据所述第一输入特征图的宽度W生成X方向计数配置;
    根据所述第一输入特征图的高度H生成Y方向计数配置;
    根据预设数值生成X方向步幅配置和Y方向步幅配置。
  21. 根据权利要求20所述的方法,其特征在于,
    所述第一DMA读配置信息包括:X方向计数配置:W;Y方向计数配置:H;X方向步幅配置:1;Y方向步幅配置:1。
  22. 根据权利要求20所述的方法,其特征在于,
    所述第一输入特征图的特征信息还包括:所述第一输入特征图的通道数N;根据第一输入特征图的特征信息生成第一DMA读配置信息,还包括:
    根据所述第一输入特征图的通道数N生成Z方向计数配置;
    根据预设数值生成Z方向步幅配置。
  23. 根据权利要求19所述的方法,其特征在于,
    所述第一输入特征图的特征信息包括:所述第一输入特征图的宽度W、高度H;根据第一输入特征图的特征信息生成第一DMA写配置信息,包括:
    根据所述第一输入特征图的宽度W和高度H生成X方向计数配置;
    根据预设数值生成Y方向计数配置、X方向步幅配置和Y方向步幅配置。
  24. 根据权利要求23所述的方法,其特征在于,
    所述第一DMA写配置信息包括:X方向计数配置:W*H;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0。
  25. 根据权利要求19所述的方法,其特征在于,所述第一输入特征图的特征信息包括:所述第一输入特征图的宽度W、高度H、通道数N;所述根据第一输入特征图的特征信息生成第一DMA写配置信息,包括:
    根据所述第一输入特征图的宽度W、高度H和通道数N,生成X方向计数配置;以及,根据预设数值生成Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置。
  26. 根据权利要求25所述的方法,其特征在于,所述第一DMA写配置信息包括:X方向计数配置:W*H*N;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0。
  27. 根据权利要求19所述的方法,其特征在于,所述根据所述第一DMA读配置信息,从第一输入特征图中读取第一数据,包括:
    根据所述第一DMA读配置信息,从所述第一输入特征图对应的起始地址开始,读取所述第一输入特征图中的每个第一数据。
  28. 根据权利要求19所述的方法,其特征在于,所述根据所述第一DMA写配置信息,将读取的第一数据输出给运算逻辑,包括:
    根据所述第一DMA写配置信息,从所述运算逻辑对应的第一入口地址开始,将读取的每个第一数据输出给所述运算逻辑。
  29. 根据权利要求19所述的方法,其特征在于,
    所述第二输入特征图的特征信息包括:所述第二输入特征图的宽度W、高度H;根据第二输入特征图的特征信息生成第二DMA读配置信息,包括:
    根据所述第二输入特征图的宽度W生成X方向计数配置;
    根据所述第二输入特征图的高度H生成Y方向计数配置;
    根据预设数值生成X方向步幅配置和Y方向步幅配置。
  30. 根据权利要求29所述的方法,其特征在于,
    所述第二DMA读配置信息包括:X方向计数配置:W;Y方向计数配置:H;X方向步幅配置:1;Y方向步幅配置:1。
  31. 根据权利要求29所述的方法,其特征在于,
    所述第二输入特征图的特征信息还包括:所述第二输入特征图的通道数N;根据第二输入特征图的特征信息生成第二DMA读配置信息,还包括:
    根据所述第二输入特征图的通道数N生成Z方向计数配置;
    根据预设数值生成Z方向步幅配置。
  32. 根据权利要求19所述的方法,其特征在于,
    所述第二输入特征图的特征信息包括:所述第二输入特征图的宽度W、高度H;根据第二输入特征图的特征信息生成第二DMA写配置信息,包括:
    根据所述第二输入特征图的宽度W和高度H生成X方向计数配置;
    根据预设数值生成Y方向计数配置、X方向步幅配置和Y方向步幅配置。
  33. 根据权利要求32所述的方法,其特征在于,
    所述第二DMA写配置信息包括:X方向计数配置:W*H;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0。
  34. 根据权利要求19所述的方法,其特征在于,所述第二输入特征图的特征信息包括:所述第二输入特征图的宽度W、高度H、通道数N;所述根据第二输入特征图的特征信息生成第二DMA写配置信息,包括:
    根据所述第二输入特征图的宽度W、高度H和通道数N,生成X方向计数配置;以及,根据预设数值生成Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置。
  35. 根据权利要求34所述的方法,其特征在于,所述第二DMA写配置信息包括:X方向计数配置:W*H*N;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0。
  36. 根据权利要求19所述的方法,其特征在于,
    若所述第二输入特征图为至少一个参数图,针对每个参数图,所述第二DMA读配置信息包括:X方向计数配置:1;Y方向计数配置:0;X方向步幅配置:1;Y方向步幅配置:0;所述第二DMA写配置信息包括:X方向计数配置:1;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0。
  37. 根据权利要求19所述的方法,其特征在于,若所述第二输入特征图为至少一个参数图,针对每个参数图,所述第二DMA读配置信息包括:X方向计数配置:N;Y方向计数配置:0;X方向步幅配置:1;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0;所述第二DMA写配置信息包括:X方向计数配置:N;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0。
  38. 根据权利要求19所述的方法,其特征在于,所述根据所述第二DMA读配置信息,从第二输入特征图中读取第二数据,包括:
    根据所述第二DMA读配置信息,从所述第二输入特征图对应的起始地址开始,读取所述第二输入特征图中的每个第二数据。
  39. 根据权利要求19所述的方法,其特征在于,所述根据所述第二DMA写配置信息,将读取的第二数据输出给运算逻辑,包括:
    根据所述第二DMA写配置信息,从所述运算逻辑对应的第二入口地址开始,将读取的每个第二数据输出给所述运算逻辑。
  40. 根据权利要求39所述的方法,其特征在于,所述运算逻辑用于对第一数据和第二数据进行element-wise运算或者Batch Normalization运算。
  41. 根据权利要求19所述的方法,其特征在于,
    所述确定第三DMA读配置信息和第三DMA写配置信息,包括:
    根据所述第一输入特征图的宽度W和高度H,生成所述第三DMA读配置信息中的X方向计数配置;根据预设数值生成所述第三DMA读配置信息中的Y方向计数配置、X方向步幅配置和Y方向步幅配置;
    根据所述第一输入特征图的宽度W生成所述第三DMA写配置信息中的X方向计数配置;根据所述第一输入特征图的高度H生成所述第三DMA写 配置信息中的Y方向计数配置;根据预设数值生成所述第三DMA写配置信息中的X方向步幅配置和Y方向步幅配置。
  42. 根据权利要求41所述的方法,其特征在于,所述第三DMA读配置信息包括:X方向计数配置:W*H;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;所述第三DMA写配置信息包括:X方向计数配置:W;Y方向计数配置:H;X方向步幅配置:1;Y方向步幅配置:1。
  43. 根据权利要求19所述的方法,其特征在于,
    所述确定第三DMA读配置信息和第三DMA写配置信息,包括:
    根据所述第一输入特征图的宽度W、高度H和通道数N,生成所述第三DMA读配置信息中的X方向计数配置;根据预设数值生成所述第三DMA读配置信息中的Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置;
    根据所述第一输入特征图的宽度W生成所述第三DMA写配置信息中的X方向计数配置;根据所述第一输入特征图的高度H生成所述第三DMA写配置信息中的Y方向计数配置;根据所述第一输入特征图的通道数N生成所述第三DMA写配置信息中的Z方向计数配置;根据预设数值生成所述第三DMA写配置信息中的X方向步幅配置、Y方向步幅配置和Z方向步幅配置。
  44. 根据权利要求43所述的方法,其特征在于,所述第三DMA读配置信息包括:X方向计数配置:W*H*N;Y方向计数配置:0;X方向步幅配置:0;Y方向步幅配置:0;Z方向计数配置:0;Z方向步幅配置:0;第三DMA写配置信息包括:X方向计数配置:W;Y方向计数配置:H;X方向步幅配置:1;Y方向步幅配置:1;Z方向计数配置:N;Z方向步幅配置:1。
  45. 根据权利要求19所述的方法,其特征在于,
    根据所述第三DMA读配置信息读取所述运算逻辑的运算结果,包括:
    根据所述第三DMA读配置信息,从所述运算逻辑对应的出口地址开始,读取所述运算逻辑产生的每个运算结果。
  46. 根据权利要求19所述的方法,其特征在于,所述根据所述第三DMA 写配置信息,将读取的运算结果存储到输出特征图,包括:
    根据所述第三DMA写配置信息,从所述输出特征图的起始地址开始,将读取的每个运算结果存储到所述输出特征图。
  47. 根据权利要求19所述的方法,其特征在于,
    所述将读取的运算结果存储到输出特征图之前,所述方法还包括:
    确定所述第一输入特征图对应的目标DMA配置信息;
    根据所述目标DMA配置信息构造第一输入特征图对应的输出特征图。
  48. 根据权利要求47所述的方法,其特征在于,
    所述确定所述第一输入特征图对应的目标DMA配置信息,包括:
    根据所述第一输入特征图的宽度W生成X方向计数配置;
    根据所述第一输入特征图的高度H生成Y方向计数配置;
    根据所述第一输入特征图的通道数N生成Z方向计数配置;
    根据预设数值生成X方向步幅配置、Y方向步幅配置和Z方向步幅配置。
  49. 根据权利要求48所述的方法,其特征在于,所述目标DMA配置信息包括:X方向计数配置:W;Y方向计数配置:H;X方向步幅配置:1;Y方向步幅配置:1;Z方向计数配置:N;Z方向步幅配置:1。
  50. 根据权利要求47所述的方法,其特征在于,所述根据所述目标DMA配置信息构造第一输入特征图对应的输出特征图,包括:
    从指定存储位置读取特定样式信息,并根据所述目标DMA配置信息,构造与所述特定样式信息对应的输出特征图。
  51. 一种直接内存存取DMA控制器,其特征在于,DMA控制器用于:
    根据输入特征图的特征信息生成第一DMA读配置信息和第一DMA写配置信息,并确定第二DMA读配置信息和第二DMA写配置信息;
    根据所述第一DMA读配置信息,从所述输入特征图中读取数据;根据所述第一DMA写配置信息,将读取的数据输出给运算逻辑;
    根据所述第二DMA读配置信息读取运算逻辑的运算结果;根据所述第二DMA写配置信息,将读取的运算结果存储到输出特征图。
  52. 根据权利要求51所述的DMA控制器,其特征在于,
    所述特征信息包括:所述输入特征图的宽度W、高度H、通道数N;
    所述DMA控制器在根据输入特征图的特征信息生成第一DMA读配置信息时具体用于:根据所述输入特征图的宽度W生成X方向计数配置;根据所述输入特征图的高度H生成Y方向计数配置;根据预设数值生成X方向步幅配置和Y方向步幅配置;根据所述输入特征图的通道数N生成Z方向计数配置;根据预设数值生成Z方向步幅配置。
  53. 根据权利要求51所述的DMA控制器,其特征在于,
    所述特征信息包括:所述输入特征图的宽度W、高度H;所述DMA控制器在根据输入特征图的特征信息生成第一DMA写配置信息时具体用于:根据所述输入特征图的宽度W和高度H生成X方向计数配置;根据预设数值生成Y方向计数配置、X方向步幅配置和Y方向步幅配置;
    或者,所述特征信息包括:所述输入特征图的宽度W、高度H、通道数N;所述DMA控制器在根据输入特征图的特征信息生成第一DMA写配置信息时具体用于:根据所述输入特征图的宽度W、高度H和通道数N,生成X方向计数配置;以及,根据预设数值生成Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置。
  54. 根据权利要求51所述的DMA控制器,其特征在于,
    所述DMA控制器在根据所述第一DMA读配置信息,从所述输入特征图中读取数据时具体用于:根据所述第一DMA读配置信息,从所述输入特征图对应的起始地址开始,读取所述输入特征图中的每个数据;
    所述DMA控制器在根据所述第一DMA写配置信息,将读取的数据输出给运算逻辑时具体用于:根据所述第一DMA写配置信息,从所述运算逻辑对应的入口地址开始,将读取的每个数据输出给所述运算逻辑。
  55. 根据权利要求51所述的DMA控制器,其特征在于,
    所述DMA控制器在根据所述第二DMA读配置信息读取运算逻辑的运算结果时具体用于:根据所述第二DMA读配置信息,从所述运算逻辑对应的出 口地址开始,读取所述运算逻辑产生的每个运算结果;
    所述DMA控制器在根据所述第二DMA写配置信息,将读取的运算结果存储到输出特征图时具体用于:根据所述第二DMA写配置信息,从输出特征图的起始地址开始,将读取的每个运算结果存储到所述输出特征图。
  56. 根据权利要求51所述的DMA控制器,其特征在于,所述DMA控制器在将读取的运算结果存储到输出特征图之前还用于:确定所述输入特征图对应的目标DMA配置信息;根据所述目标DMA配置信息构造输出特征图。
  57. 根据权利要求56所述的DMA控制器,其特征在于,
    所述DMA控制器在根据所述目标DMA配置信息构造输出特征图时具体用于:从指定存储位置读取特定样式信息,并根据所述目标DMA配置信息,构造与所述特定样式信息对应的输出特征图。
  58. 一种直接内存存取DMA控制器,其特征在于,DMA控制器用于:
    根据第一输入特征图的特征信息生成第一DMA读配置信息和第一DMA写配置信息,根据第二输入特征图的特征信息生成第二DMA读配置信息和第二DMA写配置信息,并确定第三DMA读配置信息和第三DMA写配置信息;
    根据所述第一DMA读配置信息,从第一输入特征图中读取第一数据;根据所述第一DMA写配置信息,将读取的第一数据输出给运算逻辑;
    根据所述第二DMA读配置信息,从第二输入特征图中读取第二数据;根据所述第二DMA写配置信息,将读取的第二数据输出给运算逻辑;
    根据所述第三DMA读配置信息读取所述运算逻辑的运算结果;根据所述第三DMA写配置信息,将读取的运算结果存储到输出特征图。
  59. 根据权利要求58所述的DMA控制器,其特征在于,所述第一输入特征图的特征信息包括:所述第一输入特征图的宽度W、高度H、通道数N;
    所述DMA控制器在根据第一输入特征图的特征信息生成第一DMA读配置信息时具体用于:根据所述第一输入特征图的宽度W生成X方向计数配置;根据所述第一输入特征图的高度H生成Y方向计数配置;根据预设数值生成X方向步幅配置和Y方向步幅配置;根据所述第一输入特征图的通道数N生 成Z方向计数配置;根据预设数值生成Z方向步幅配置。
  60. 根据权利要求58所述的DMA控制器,其特征在于,所述第一输入特征图的特征信息包括:所述第一输入特征图的宽度W、高度H;所述DMA控制器在根据第一输入特征图的特征信息生成第一DMA写配置信息时具体用于:根据所述第一输入特征图的宽度W和高度H生成X方向计数配置;根据预设数值生成Y方向计数配置、X方向步幅配置和Y方向步幅配置;
    或者,所述第一输入特征图的特征信息包括:所述第一输入特征图的宽度W、高度H、通道数N;所述DMA控制器在根据第一输入特征图的特征信息生成第一DMA写配置信息时具体用于:根据第一输入特征图的宽度W、高度H和通道数N,生成X方向计数配置;根据预设数值生成Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置。
  61. 根据权利要求58所述的DMA控制器,其特征在于,
    所述DMA控制器在根据所述第一DMA读配置信息,从第一输入特征图中读取第一数据时具体用于:根据所述第一DMA读配置信息,从所述第一输入特征图对应的起始地址开始,读取所述第一输入特征图中的每个第一数据;
    所述DMA控制器在根据所述第一DMA写配置信息,将读取的第一数据输出给运算逻辑时具体用于:根据所述第一DMA写配置信息,从所述运算逻辑对应的第一入口地址开始,将读取的每个第一数据输出给所述运算逻辑。
  62. 根据权利要求58所述的DMA控制器,其特征在于,所述第二输入特征图的特征信息包括:所述第二输入特征图的宽度W、高度H、通道数N;
    所述DMA控制器在根据第二输入特征图的特征信息生成第二DMA读配置信息时具体用于:根据所述第二输入特征图的宽度W生成X方向计数配置;根据所述第二输入特征图的高度H生成Y方向计数配置;根据预设数值生成X方向步幅配置和Y方向步幅配置;根据所述第二输入特征图的通道数N生成Z方向计数配置;根据预设数值生成Z方向步幅配置。
  63. 根据权利要求58所述的DMA控制器,其特征在于,所述第二输入特征图的特征信息包括:所述第二输入特征图的宽度W、高度H;所述DMA 控制器在根据第二输入特征图的特征信息生成第二DMA写配置信息时具体用于:根据所述第二输入特征图的宽度W和高度H生成X方向计数配置;根据预设数值生成Y方向计数配置、X方向步幅配置和Y方向步幅配置;
    或者,所述第二输入特征图的特征信息包括:所述第二输入特征图的宽度W、高度H、通道数N;所述DMA控制器在根据第二输入特征图的特征信息生成第二DMA写配置信息时具体用于:根据第二输入特征图的宽度W、高度H和通道数N,生成X方向计数配置;根据预设数值生成Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置。
  64. 根据权利要求58所述的DMA控制器,其特征在于,
    所述DMA控制器在根据所述第二DMA读配置信息,从第二输入特征图中读取第二数据时具体用于:根据所述第二DMA读配置信息,从所述第二输入特征图对应的起始地址开始,读取所述第二输入特征图中的每个第二数据;
    所述DMA控制器在根据所述第二DMA写配置信息,将读取的第二数据输出给运算逻辑时具体用于:根据所述第二DMA写配置信息,从所述运算逻辑对应的第二入口地址开始,将读取的每个第二数据输出给所述运算逻辑。
  65. 根据权利要求58所述的DMA控制器,其特征在于,
    所述DMA控制器在确定第三DMA读配置信息和第三DMA写配置信息时具体用于:根据所述第一输入特征图的宽度W和高度H,生成所述第三DMA读配置信息中的X方向计数配置;根据预设数值生成所述第三DMA读配置信息中的Y方向计数配置、X方向步幅配置和Y方向步幅配置;
    根据所述第一输入特征图的宽度W生成所述第三DMA写配置信息中的X方向计数配置;根据所述第一输入特征图的高度H生成所述第三DMA写配置信息中的Y方向计数配置;根据预设数值生成所述第三DMA写配置信息中的X方向步幅配置和Y方向步幅配置。
  66. 根据权利要求58所述的DMA控制器,其特征在于,
    所述DMA控制器在确定第三DMA读配置信息和第三DMA写配置信息时具体用于:根据所述第一输入特征图的宽度W、高度H和通道数N,生成 所述第三DMA读配置信息中的X方向计数配置;根据预设数值生成所述第三DMA读配置信息中的Y方向计数配置、X方向步幅配置、Y方向步幅配置、Z方向计数配置、Z方向步幅配置;
    根据所述第一输入特征图的宽度W生成所述第三DMA写配置信息中的X方向计数配置;根据所述第一输入特征图的高度H生成所述第三DMA写配置信息中的Y方向计数配置;根据所述第一输入特征图的通道数N生成所述第三DMA写配置信息中的Z方向计数配置;根据预设数值生成所述第三DMA写配置信息中的X方向步幅配置、Y方向步幅配置和Z方向步幅配置。
  67. 根据权利要求58所述的DMA控制器,其特征在于,
    所述DMA控制器在根据所述第三DMA读配置信息读取所述运算逻辑的运算结果时具体用于:根据所述第三DMA读配置信息,从所述运算逻辑对应的出口地址开始,读取所述运算逻辑产生的每个运算结果;
    所述DMA控制器在根据所述第三DMA写配置信息,将读取的运算结果存储到输出特征图时具体用于:根据所述第三DMA写配置信息,从所述输出特征图的起始地址开始,将读取的每个运算结果存储到所述输出特征图。
  68. 根据权利要求58所述的DMA控制器,其特征在于,
    所述DMA控制器在将读取的运算结果存储到输出特征图之前还用于:确定所述第一输入特征图对应的目标DMA配置信息;根据所述目标DMA配置信息构造第一输入特征图对应的输出特征图。
  69. 根据权利要求68所述的DMA控制器,其特征在于,
    所述DMA控制器在确定所述第一输入特征图对应的目标DMA配置信息时具体用于:根据所述第一输入特征图的宽度W生成X方向计数配置;根据所述第一输入特征图的高度H生成Y方向计数配置;根据所述第一输入特征图的通道数N生成Z方向计数配置;根据预设数值生成X方向步幅配置、Y方向步幅配置和Z方向步幅配置。
  70. 根据权利要求68所述的DMA控制器,其特征在于,
    所述DMA控制器在根据所述目标DMA配置信息构造第一输入特征图对 应的输出特征图时具体用于:从指定存储位置读取特定样式信息,并根据所述目标DMA配置信息,构造与所述特定样式信息对应的输出特征图。
  71. 一种数据处理设备,其特征在于,所述数据处理设备包括:
    存储器,用于存储程序代码;
    DMA控制器,用于调用所述程序代码,当所述程序代码被执行时,实现权利要求1-18任一所述的数据处理方法,或者,实现权利要求19-50任一所述的数据处理方法。
  72. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有若干计算机指令,所述计算机指令被执行时,实现权利要求1-18任一所述的数据处理方法,或者,实现权利要求19-50任一所述的数据处理方法。
PCT/CN2017/120273 2017-12-29 2017-12-29 数据处理方法、设备、dma控制器及计算机可读存储介质 WO2019127538A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2017/120273 WO2019127538A1 (zh) 2017-12-29 2017-12-29 数据处理方法、设备、dma控制器及计算机可读存储介质
CN201780022803.9A CN109074334A (zh) 2017-12-29 2017-12-29 数据处理方法、设备、dma控制器及计算机可读存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/120273 WO2019127538A1 (zh) 2017-12-29 2017-12-29 数据处理方法、设备、dma控制器及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2019127538A1 true WO2019127538A1 (zh) 2019-07-04

Family

ID=64812380

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/120273 WO2019127538A1 (zh) 2017-12-29 2017-12-29 数据处理方法、设备、dma控制器及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN109074334A (zh)
WO (1) WO2019127538A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021052391A1 (zh) 2019-09-18 2021-03-25 华为技术有限公司 一种构建中间表达的方法、编译器和服务器
CN114328315A (zh) * 2021-11-22 2022-04-12 北京智芯微电子科技有限公司 基于dma的数据预处理方法、dma部件及芯片结构
CN114399034B (zh) * 2021-12-30 2023-05-02 北京奕斯伟计算技术股份有限公司 用于直接存储器访问装置的数据搬运方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070294514A1 (en) * 2006-06-20 2007-12-20 Koji Hosogi Picture Processing Engine and Picture Processing System
CN101552916A (zh) * 2009-05-05 2009-10-07 北京红旗胜利科技发展有限责任公司 视频yuv数据的dma传输方法、装置及dma控制器
CN102567254A (zh) * 2010-12-31 2012-07-11 重庆重邮信科通信技术有限公司 采用dma控制器进行数据归一化处理的方法
CN103207847A (zh) * 2013-04-27 2013-07-17 杭州士兰微电子股份有限公司 Dma控制器及直接内存存取控制方法
CN107391402A (zh) * 2017-07-21 2017-11-24 郑州云海信息技术有限公司 一种数据运算方法、装置及一种数据运算卡

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104899182B (zh) * 2015-06-09 2017-10-31 中国人民解放军国防科学技术大学 一种支持可变分块的矩阵乘加速方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070294514A1 (en) * 2006-06-20 2007-12-20 Koji Hosogi Picture Processing Engine and Picture Processing System
CN101552916A (zh) * 2009-05-05 2009-10-07 北京红旗胜利科技发展有限责任公司 视频yuv数据的dma传输方法、装置及dma控制器
CN102567254A (zh) * 2010-12-31 2012-07-11 重庆重邮信科通信技术有限公司 采用dma控制器进行数据归一化处理的方法
CN103207847A (zh) * 2013-04-27 2013-07-17 杭州士兰微电子股份有限公司 Dma控制器及直接内存存取控制方法
CN107391402A (zh) * 2017-07-21 2017-11-24 郑州云海信息技术有限公司 一种数据运算方法、装置及一种数据运算卡

Also Published As

Publication number Publication date
CN109074334A (zh) 2018-12-21

Similar Documents

Publication Publication Date Title
WO2019127517A1 (zh) 数据处理方法、设备、dma控制器及计算机可读存储介质
US11922132B2 (en) Information processing method and terminal device
KR102402111B1 (ko) 콘볼루션 신경망 정방향 연산 실행용 장치와 방법
US10891353B2 (en) Apparatus and methods for matrix addition and subtraction
KR102486030B1 (ko) 완전연결층 신경망 정방향 연산 실행용 장치와 방법
WO2019127507A1 (zh) 数据处理方法、设备、dma控制器及计算机可读存储介质
KR102470264B1 (ko) 완전연결층 신경망 역방향 트레이닝 실행용 장치와 방법
WO2017185391A1 (zh) 一种用于执行卷积神经网络训练的装置和方法
CN111340200B (zh) 用于执行人工神经网络正向运算的装置和方法
US10534841B2 (en) Appartus and methods for submatrix operations
US11500811B2 (en) Apparatuses and methods for map reduce
WO2019127838A1 (zh) 卷积神经网络实现方法及装置、终端、存储介质
US10860316B2 (en) Apparatus and methods for generating dot product
US11436017B2 (en) Data temporary storage apparatus, data temporary storage method and operation method
WO2019127538A1 (zh) 数据处理方法、设备、dma控制器及计算机可读存储介质
US10853069B2 (en) Apparatus and methods for comparing vectors
US11157593B2 (en) Apparatus and methods for combining vectors
US20190129858A1 (en) Apparatus and methods for circular shift operations
US10831861B2 (en) Apparatus and methods for vector operations
US20210133854A1 (en) Information processing method and terminal device
WO2016208260A1 (ja) 画像認識装置および画像認識方法
US10827120B1 (en) Optical image stabilization device and communication method thereof with enhanced serial peripheral interface communication efficiency
WO2020134927A1 (zh) 一种数据处理方法及装置
WO2019095836A1 (zh) 基于集群的词向量处理方法、装置以及设备
US10997497B2 (en) Calculation device for and calculation method of performing convolution

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: 17936215

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17936215

Country of ref document: EP

Kind code of ref document: A1