A data carrying method, device, equipment and computer readable storage medium

By breaking down the data transfer task into read-in, on-chip shaping, and write-back stages, and optimizing address configuration and data format conversion using inner and outer loop step sizes and loop counts, the problem of low data transfer efficiency in Transformer scenarios is solved, achieving more efficient data transfer and cache utilization.

CN123157147APending Publication Date: 2026-11-24CCORE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611660652.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-26
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

In Transformer scenarios, traditional coarse-grained DMA transfer methods lead to problems such as low on-chip cache utilization, decreased burst transfer efficiency, complex address generation, and asynchronous transfer and computation, which affect data transfer efficiency.

Method used

The data transfer task is divided into a read-in stage, an on-chip shaping stage, and a write-back stage. The read and write addresses are determined by the inner and outer loop step size and the number of loops. The address configuration and data format conversion are optimized by data transfer instructions to achieve pipelined parallel execution.

Benefits of technology

It improves the efficiency of data transfer, reduces redundant configuration and format adaptation overhead, and enhances on-chip cache utilization and transmission efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123157147A_ABST
    Figure CN123157147A_ABST
Patent Text Reader

Abstract

This invention discloses a data transfer method, apparatus, device, and computer-readable storage medium, relating to the field of data processing technology. The method includes: dividing a task into a read-in stage, an on-chip shaping stage, and a write-back stage based on data transfer instructions; in the read-in stage, determining the read address corresponding to each data transfer based on the inner loop step size, outer loop step size, inner loop count, and outer loop count, and performing read-in processing based on the read address to obtain the currently read-in data; in the on-chip shaping stage, performing shaping processing based on the currently read-in data to obtain the currently shaped data; and performing write processing based on the inner loop step size, outer loop step size, and loop count to transfer the currently shaped data to the target storage location. This invention utilizes inner and outer loop parameters to determine the read and write addresses for multiple transfers, reducing sequential configuration operations, and completing on-chip shaping between read-in and write-back operations, reducing the overhead of separate data format conversion and connection, and improving data transfer efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a data transfer method, apparatus, device, and computer-readable storage medium. Background Technology

[0002] Current data movement requires frequent handling of sliding window access, boundary padding, channel rearrangement, and multi-level cache reuse. In Transformer (transformer neural network model) scenarios, operations such as matrix multiplication, attention calculation, KV Cache (Key-Value Cache) access, transposition, concatenation, and reduction introduce a large number of discontinuous, dynamic, or irregular data accesses. If traditional coarse-grained DMA movement methods are still used, it is easy to cause problems such as low on-chip cache utilization, decreased burst transfer efficiency, complex address generation, and asynchrony between movement and computation.

[0003] It is evident that improving the efficiency of data transfer is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a data transfer method, apparatus, device and computer-readable storage medium to solve the technical problem of low data transfer efficiency.

[0005] To address the aforementioned technical problems, this invention provides a data transfer method, comprising: The data transfer task is divided into a read-in stage, an on-chip shaping stage, and a write-back stage based on data transfer instructions. The data transfer instructions include the read inner loop step size, write inner loop step size, read outer loop step size, write outer loop step size, inner loop count, and outer loop count. The inner loop determines the read and write addresses corresponding to each data transfer based on the read inner loop step size and the write inner loop step size. The outer loop determines the starting read and starting write addresses corresponding to each data transfer based on the read outer loop step size and the write outer loop step size. In the reading phase, based on the inner loop step size, the outer loop step size, the number of inner loop iterations, and the number of outer loop iterations, the corresponding read address for each data transfer is determined sequentially, and the reading process is performed based on the read address to obtain the currently read data; In the on-chip shaping stage, shaping processing is performed based on the currently read data to obtain the current shaped data; In the write-back phase, the write process is performed based on the write inner loop step size, the write outer loop step size, the inner loop count, the outer loop count, and the current integer data, and the current integer data is moved to the target storage location.

[0006] Optionally, the above data transfer methods also include: After each data transfer is completed, the read address and write address corresponding to the next data transfer are updated according to the read inner loop step size and the write inner loop step size, respectively, and the next data transfer is performed based on the updated read address and write address, until the inner loop number is reached; After the inner loop count is reached, the starting read address and starting write address of the next outer loop are updated according to the reading outer loop step size and the writing outer loop step size, respectively. The data transfer of the next outer loop is then performed based on the updated starting read address and starting write address until the outer loop count is reached.

[0007] Optionally, the read address corresponding to each data transfer is determined sequentially, and the data is read in based on the read address to obtain the currently read data, including: Read the data based on the current read address to obtain the data to be aligned; The data to be aligned is aligned to obtain aligned data; The alignment data is written to the read-side memory to obtain the currently read data.

[0008] Optionally, during the on-chip shaping stage, shaping processing is performed based on the currently read data to obtain current shaped data, including: The currently read data is shaped based on the configured shaping pattern to obtain the current shaped data; wherein the shaping pattern includes at least one of data rearrangement, row and column transformation, concatenation and splitting.

[0009] Optionally, in the write-back phase, a write process is performed based on the inner loop step size, the outer loop step size, the inner loop count, the outer loop count, and the current integer data, to move the current integer data to the target storage location, including: Based on the configured write operation control information, the current shaped data is written to the write-side memory to obtain the data to be written; The data to be written, read from the write-side memory, is subjected to write alignment processing to obtain write-aligned data; Write the write-aligned data to the target storage location.

[0010] Optionally, after dividing the data transfer task into a read-in stage, an on-chip shaping stage, and a write-back stage based on data transfer instructions, the following may also be included: The execution status of the read-in stage, the on-chip shaping stage, and the write-back stage is monitored. Based on the execution status and the address changes corresponding to the inner and outer loops, the read-in processing, shaping processing, and write-back processing corresponding to subsequent data are continuously scheduled, so that the read-in processing, shaping processing, and write-back processing corresponding to different data are executed in parallel pipeline until the current data to be transferred is transferred.

[0011] Optionally, the above data transfer methods also include: The execution status of the read-in stage, the on-chip shaping stage, and the write-back stage is monitored to identify abnormal states; The corresponding exception handling method is determined based on the exception type of the abnormal state, and the execution of the corresponding stage is controlled based on the exception handling method.

[0012] This invention also provides a data transfer device, comprising: The phase splitting module is used to split the data transfer task into a read phase, an on-chip shaping phase, and a write-back phase based on data transfer instructions. The data transfer instructions include the read inner loop step size, write inner loop step size, read outer loop step size, write outer loop step size, inner loop count, and outer loop count. The inner loop determines the read and write addresses corresponding to each data transfer based on the read inner loop step size and the write inner loop step size. The outer loop determines the starting read and starting write addresses corresponding to each data transfer based on the read outer loop step size and the write outer loop step size. The read-in module is used to determine the read address corresponding to each data transfer in the read-in stage based on the read inner loop step size, the read outer loop step size, the inner loop count and the outer loop count, and to perform read-in processing based on the read address to obtain the currently read-in data; The shaping module is used to perform shaping processing based on the currently read data during the on-chip shaping stage to obtain the current shaped data; The write module is used to perform write processing based on the write inner loop step size, the write outer loop step size, the number of inner loops and the number of outer loops, and the current integer data during the write-back phase, and to move the current integer data to the target storage location.

[0013] This invention also provides a data transfer device, comprising: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the data transfer method described above.

[0014] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described data transfer method.

[0015] The present invention also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the steps of the above-described method.

[0016] As can be seen, this invention divides the data transfer task into a read-in stage, an on-chip shaping stage, and a write-back stage based on data transfer instructions. The data transfer instructions include the read inner loop step size, write inner loop step size, read outer loop step size, write outer loop step size, inner loop count, and outer loop count. The inner loop determines the read and write addresses corresponding to each data transfer sequentially according to the read inner loop step size and write inner loop step size. The outer loop determines the starting read and starting write addresses corresponding to each data transfer sequentially according to the read outer loop step size and write outer loop step size. In the read-in stage, the read address corresponding to each data transfer is determined sequentially based on the read inner loop step size, read outer loop step size, inner loop count, and outer loop count, and read-in processing is performed based on the read address to obtain the currently read data. In the on-chip shaping stage, shaping processing is performed based on the currently read data to obtain the currently shaped data. In the write-back stage, writing processing is performed based on the write inner loop step size, write outer loop step size, inner loop count, outer loop count, and the currently shaped data to transfer the currently shaped data to the target storage location.

[0017] The beneficial effects of this invention are as follows: By describing the read / write address changes during multiple data transfers through the inner and outer loop parameters in the data transfer instructions, the configured parameters can be used to continuously determine the addresses required for multiple transfers, reducing the operation of configuring read / write addresses sequentially; by connecting read, on-chip shaping, and write-back, the currently read data completes layout transformation during the transfer process and reaches the target storage location according to the write-side loop parameters, reducing the overhead of separately performing data rearrangement and its connection. Therefore, it can reduce the overhead of repeated configuration and format adaptation during the transfer process, and improve the efficiency of data transfer.

[0018] In addition, the present invention also provides a data transfer device, apparatus, and computer-readable storage medium, which also have the above-mentioned beneficial effects. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0020] Figure 1 A flowchart of a data transfer method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the first inner and outer circulation provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the second inner and outer circulation provided in an embodiment of the present invention; Figure 4A schematic diagram of a third inner and outer circulation provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the system architecture of a data transfer method provided in an embodiment of the present invention; Figure 6 A flowchart illustrating a data transfer method provided in an embodiment of the present invention; Figure 7 This is a schematic diagram of the structure of a data transfer device provided in an embodiment of the present invention; Figure 8 This is a schematic diagram of a data transfer device provided in an embodiment of the present invention. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0022] Please refer to Figure 1 , Figure 1 A flowchart illustrating a data transfer method provided in an embodiment of the present invention. The method may include: S101, based on the data transfer instructions, the data transfer task is divided into a read-in stage, an on-chip shaping stage, and a write-back stage; wherein, the data transfer instructions include the read inner loop step size, the write inner loop step size, the read outer loop step size, the write outer loop step size, the inner loop count, and the outer loop count; the inner loop is a loop that determines the read address and write address corresponding to each data transfer in sequence according to the read inner loop step size and the write inner loop step size; the outer loop is a loop that determines the starting read address and the starting write address corresponding to each data transfer in sequence according to the read outer loop step size and the write outer loop step size.

[0023] Each step in this embodiment can be executed by a designated electronic device, which can be a server, a portable terminal, or other forms. Specifically, the execution entity in this embodiment is a data transfer device, which can be a data transfer device integrated within an NPU (Neural Processing Unit) and containing data transfer control circuitry and data paths. An external control unit or NPU scheduling unit provides the data transfer instructions. Subsequent steps are all executed by this data transfer device, and the cooperation of internal modules belongs to the control and data processing process within the device. The data transfer instruction in this embodiment is control information describing a data transfer task and its execution parameters; the data transfer task is a task that, according to the instruction, moves the data to be processed from the location corresponding to the read address to the target storage location after shaping processing. Each data transfer task can contain multiple data transfers. The read-in stage is the processing stage of obtaining input data and forming the currently read data; the on-chip shaping stage is the processing stage of changing the data layout inside the chip; the write-back stage is the processing stage of moving the shaped data to the target storage location. The three stages correspond to the processing relationship of the same data before and after processing, and it is not required that different data must wait for all stages of the previous data to be completed before processing begins. The data transfer instructions in this embodiment describe the type and parameters of the current data transfer task. For example, they may include the source address for reading, the destination address for writing, the data length for reading / writing, the inner and outer loop step sizes for reading / writing, and the number of inner and outer loop iterations for reading / writing. In this embodiment, the starting read address and starting write address are the read and write addresses used for the first data transfer in a certain outer loop round, respectively. The number of inner loop iterations in this embodiment is the number of data transfers performed within each outer loop round, and the number of outer loop iterations in this embodiment is the number of rounds in which a set of inner loop iterations is completed. The reading inner loop step size in this embodiment is the change in read address between two adjacent data transfers within the same inner loop round, and the writing inner loop step size in this embodiment is the change in write address between two adjacent data transfers. Similarly, the reading outer loop step size in this embodiment is the change in the starting read address between two adjacent outer loop rounds, and the writing outer loop step size in this embodiment is the change in the starting write address between two adjacent outer loop rounds. The granularity of data operations in this embodiment can be refined to a single byte.

[0024] S102, during the read-in phase, based on the read inner loop step size, read outer loop step size, inner loop count, and outer loop count, the read address corresponding to each data transfer is determined sequentially, and the read-in processing is performed based on the read address to obtain the currently read-in data.

[0025] In this embodiment, the read address is the address where data is read from storage space during a data transfer. The currently read data in this embodiment is the data obtained in the current data transfer and available for processing by the on-chip shaping stage; its content can be input feature maps, weights, or intermediate activation values. Input feature maps are feature data used by a certain computational layer of a neural network; weights are model parameters involved in the calculation; and intermediate activation values ​​are data generated by previous calculations and used for subsequent calculations. The read processing includes obtaining the corresponding data according to the read address and providing it to subsequent shaping processes. In this embodiment, in one round of the outer loop, reading begins from the starting read address of that round, and then the read address is updated sequentially according to the read inner loop step size. After completing the transfer corresponding to the number of inner loop iterations, the starting read address of the next round is determined according to the read outer loop step size, and reading continues according to the rules of the next round's inner loop. This embodiment can utilize DMA (Direct Memory Access) via a bus bridge to read data from off-chip storage or upper-level cache to obtain the currently read data. The read control in this embodiment can generate read operation control information based on the current data layout and transfer mode. The current data layout refers to the arrangement of the data to be moved in the source storage space, and the moving mode refers to the address change method formed by the inner and outer loop parameters of reading and writing.

[0026] S103, in the on-chip shaping stage, performs shaping processing based on the currently read data to obtain the current shaping data.

[0027] The shaping process in this embodiment involves arranging, organizing dimensions, or transforming the data fragment combination relationships of the currently read data according to the data layout required for subsequent computation or write-back. Data layout refers to the arrangement and organization of data elements or data fragments. This embodiment does not limit the specific method of shaping the currently read data; for example, the data arrangement can be adjusted according to a configured data rearrangement or row / column transformation mode; or the combination relationship of data fragments can be adjusted according to a configured splicing or segmentation mode. During processing, the data required for shaping is obtained from the data already read on-chip, the current shaped data is formed according to the corresponding mode, and the result is handed over to the write-back stage. In this embodiment, the on-chip shaping function can be undertaken by a shaping unit, which is a hardware processing circuit that performs data layout transformation. The shaping unit can be separated from the read control and write control logic, connected using mutually distinct data paths, and its specific functions can be configured according to input / output requirements. After the currently read data is shaped on-chip in this embodiment, it can directly form current shaped data adapted to the subsequent computation array or target storage layout, reducing the need to repeatedly write intermediate data back to off-chip storage and then read it again to complete the same format conversion.

[0028] S104: During the write-back phase, write processing is performed based on the write inner loop step size, write outer loop step size, inner loop count, outer loop count, and the current integer data, and the current integer data is moved to the target storage location.

[0029] In this embodiment, the target storage location is the location corresponding to the target address where the current shaped data is finally written. It can be located in off-chip memory, system cache, or storage space provided by subsequent modules. System cache refers to system-level data temporary storage space, and subsequent modules refer to subsequent processing modules that use the current transfer results.

[0030] An embodiment of the present invention provides a data transfer method, which may include: S101, dividing the data transfer task into a read-in stage, an on-chip shaping stage, and a write-back stage based on data transfer instructions; wherein, the data transfer instructions include a read inner loop step size, a write inner loop step size, a read outer loop step size, a write outer loop step size, an inner loop count, and an outer loop count; the inner loop is a loop that determines the read address and write address corresponding to each data transfer in sequence according to the read inner loop step size and the write inner loop step size; the outer loop is a loop that determines the starting read address corresponding to each data transfer in sequence according to the read outer loop step size and the write outer loop step size. The process involves: S102, in the read phase, determining the read address corresponding to each data transfer based on the read inner loop step size, read outer loop step size, inner loop count, and outer loop count, and performing read processing based on the read address to obtain the currently read data; S103, in the on-chip shaping phase, performing shaping processing based on the currently read data to obtain the currently shaped data; S104, in the write-back phase, performing write processing based on the write inner loop step size, write outer loop step size, inner loop count, outer loop count, and the currently shaped data, and transferring the currently shaped data to the target storage location. This embodiment of the invention obtains the currently read data based on the read loop parameters, converts it into the current shaped data during the on-chip shaping phase, and writes it to the target storage location based on the write loop parameters. In this embodiment, the loop parameters reduce redundant address configurations for multiple transfers, and the on-chip shaping reduces additional format conversions and intermediate data transfers, thereby improving the efficiency of data transfer.

[0031] It should be further explained that, based on any of the above embodiments, the data transfer method may further include: after each data transfer is completed, updating the read address and write address corresponding to the next data transfer according to the read inner loop step size and write inner loop step size, respectively, and performing the next data transfer based on the updated read address and write address, until the inner loop count is reached; after the inner loop count is reached, updating the starting read address and starting write address corresponding to the next outer loop according to the read outer loop step size and write outer loop step size, respectively, and performing the next outer loop data transfer based on the updated starting read address and starting write address, until the outer loop count is reached. It can be understood that configuring the read address, write address, and transferred data length once for one data transfer can be achieved by switching parameters such as read and write addresses, enabling multiple data transfers to be performed with a single configuration. This can be achieved by nesting two loops, combined with... Figure 2 , Figure 3 and Figure 4This will be explained in more detail. Specifically, data transfer instructions may include an end identifier, read start address, write start address, inner loop count, read address inner loop step size (i.e., read inner loop step size), write address inner loop step size (i.e., write inner loop step size), outer loop count, read address outer loop step size (i.e., read outer loop step size), write address outer loop step size (i.e., write outer loop step size), and data length. The end identifier indicates whether this instruction is the last one to be executed. Taking repeated jumps to the write address as an example: [Reference] Figure 2 , Figure 2 This is a schematic diagram of the first inner and outer loops provided in an embodiment of the present invention. Outer loop 1, inner loop 1-1: Take the corresponding length of data from the starting read address (0) and put it into the starting write address (0); Outer loop 1, inner loop 1-2: Take the data from the second segment position (1) after the starting read address and put it into the address of the starting write address and the inner loop step size (3); Outer loop 1, inner loop 1-3: Take the data from the third segment position (2) after the starting read address and put it into the starting write address + the inner loop step size. The address of 2(6); until the end of outer loop 1, when entering outer loop 2, as Figure 3 As shown, Figure 3 This is a schematic diagram of the second inner and outer loop provided in an embodiment of the present invention. The starting read address increments normally (3), and the starting write address is changed to the starting write address of outer loop 1 plus the outer loop step size (1). The inner loop operation is similar to outer loop 1. Outer loop 3 is as follows. Figure 4 As shown, Figure 4 This is a schematic diagram of a third inner and outer loop provided in an embodiment of the present invention; after the outer loop ends, all data transfer is completed. Write address jump is suitable for rearranging continuous data, and read address jump is suitable for rearranging non-contiguous data. More complex operations can be achieved by jumping to both read and write addresses. This embodiment, by controlling the changes in read and write addresses within a loop and the changes in the starting address between loops respectively, can determine the complete read and write address relationship for multiple transfers after a single configuration, avoiding repeated address configuration for each data segment, and can adapt to the conversion between continuous and non-contiguous layouts, improving the efficiency and flexibility of continuous data transfer.

[0032] It should be further explained that, based on any of the above embodiments, the above-mentioned sequential determination of the read address corresponding to each data transfer, and the reading processing based on the read address to obtain the currently read data, may include: reading based on the current read address to obtain data to be aligned; performing alignment processing on the data to be aligned to obtain aligned data; and writing the aligned data into the read-side memory to obtain the currently read data. In this embodiment, the data to be aligned is data read from the source memory space according to the current read address that has not yet completed on-chip storage format adaptation. The source memory space can be off-chip memory or an upper-level cache; the effective length of the retrieved data is determined based on the length of the data transferred this time. In this embodiment, after determining the current read address based on the read-side loop parameters, a read request is issued through DMA, and the corresponding data is obtained through the bus bridge. The alignment processing in this embodiment is an operation that combines the address and transmission boundary relationship to organize the effective data into a format that the on-chip storage can accept; the aligned data is the data to be written into the read-side memory after this operation is completed. In this embodiment, the read-side memory is a storage component that caches the aligned data on-chip and provides data to the shaping processing; specifically, it can be SRAM (Static Random Access Memory). This embodiment, through the connection of reading, alignment, and read-side caching, can organize unaligned or cross-boundary data in the source storage into data that can be shaped, reducing invalid bytes participating in subsequent processing and reducing waiting and additional sorting overhead caused by inconsistencies between the read format and the on-chip processing format.

[0033] It should be further explained that, based on any of the above embodiments, the on-chip shaping stage, which performs shaping processing on the currently read data to obtain the current shaped data, may include: shaping the currently read data based on a configured shaping mode to obtain the current shaped data; wherein, the shaping mode includes at least one of data rearrangement, row and column transformation, splicing, and segmentation. This embodiment does not limit the specific content of the shaping mode. For example, it may include data rearrangement or row and column transformation to change the arrangement relationship of each element; or it may include splicing or segmentation to change the organization relationship of data fragments; it may also include a combination of multiple processing methods. Data rearrangement, row and column transformation, splicing, and segmentation are all completed within the data transport device, and the specific shaping function can be configured according to the target input and output format. This embodiment, by performing different layout transformations according to the configured shaping mode, enables a single data transport to simultaneously complete the data format processing required for subsequent tasks, reducing the need to call other processing steps to perform the same transformation, and improving the flexibility of data format adaptation and transport efficiency.

[0034] It should be further explained that, based on any of the above embodiments, the write-back phase, based on the inner loop step size, outer loop step size, inner loop count, outer loop count, and the current shaped data, performs write processing to move the current shaped data to the target storage location. This can include: writing the current shaped data to the write-side memory based on configured write operation control information to obtain data to be written; performing write alignment processing on the data to be written read from the write-side memory to obtain write-aligned data; and writing the write-aligned data to the target storage location. In this embodiment, the shaped data is written to the write-side memory. The write-side memory is used to cache the data to be written back and plays a rate matching role between the shaping unit and the DMA (Direct Memory Access) write-back path. Through this cache, the shaping unit can continue processing subsequent data blocks without waiting for each DMA write-back to complete, thereby improving on-chip pipeline efficiency. In this embodiment, the write-side memory can be a write-side SRAM. Based on information such as the target address, data length, and valid bytes, the data to be written undergoes bit-width concatenation, boundary padding, write mask generation, and invalid byte masking, converting on-chip regular data into a write-back format acceptable to DMA and the external bus. This embodiment can write the write-aligned data to the target storage location via a bus bridge. The target storage location can be off-chip storage, system cache, or a subsequent module. Because alignment and formatting are completed before write-back, DMA can perform write-back operations in a more continuous and efficient manner, reducing bandwidth waste caused by unaligned writes and small-granularity accesses.

[0035] It should be further explained that, based on any of the above embodiments, after the data transfer task is divided into a read-in stage, an on-chip shaping stage, and a write-back stage based on the data transfer instructions, it may further include: monitoring the execution status corresponding to the read-in stage, the on-chip shaping stage, and the write-back stage, so as to continuously schedule the read-in processing, shaping processing, and write-back processing corresponding to subsequent data based on the execution status and the address changes corresponding to the inner and outer loops, so that the read-in processing, shaping processing, and write-back processing corresponding to different data are executed in parallel pipeline until the current data to be transferred is transferred. The execution status in this embodiment is information indicating the current processing progress and working status of the corresponding stage, which may include a busy state, a stage completion state, or an abnormal state. For the same data, the sequential dependency between read-in, shaping, and write-back is still maintained. In this embodiment, when the read-in stage of a certain data is completed, the data is then shaped; when the data is shaped, the read-side status and the next read address can be combined to schedule the read-in of subsequent data; when the previous data is written back, the shaping of subsequent data can continue. The subsequent addresses on both the read and write sides are determined by the inner and outer loop parameters of the current instruction, avoiding the mismatch between data transferred in different iterations and the incorrect target location. For example, the completion status of a stage and the acceptability status of the next stage can be used together as the advancement condition: data is advanced only when the data in the previous stage is completed and the next stage is acceptable; if the write-side memory cannot receive the new shaping result temporarily, writing to the write-side memory is paused, and it continues after the acceptability status is restored. The original address and data correspondence of already issued read and write requests are maintained, and the same data cannot be advanced to the next set of addresses due to pauses. In this embodiment, the current data to be transferred is completed after the last piece of data in the last round of the outer loop is written back. By scheduling different data according to the execution status and loop address changes, this embodiment can reduce the serial waiting between read, shaping, and write back while maintaining the correspondence between input and output of each transfer, thereby improving the parallel utilization of each processing path and the overall transfer throughput.

[0036] It should be further explained that, based on any of the above embodiments, the data transfer method may further include: monitoring the execution status of the read-in stage, the on-chip shaping stage, and the write-back stage to determine abnormal states; determining the corresponding exception handling method based on the exception type of the abnormal state, and controlling the execution of the corresponding stage based on the exception handling method. In this embodiment, the abnormal state is a working state that does not meet normal address access, data alignment, or transmission requirements during execution; the exception type in this embodiment is a category classified according to the cause of the exception or the object involved, and may include address out-of-bounds, alignment anomaly, SRAM access conflict, and DMA error. Address out-of-bounds means the access location exceeds the allowed range; alignment anomaly means the data alignment fails to meet the current access format requirements; SRAM access conflict means simultaneous access makes incompatible demands on storage resources; DMA error is an error state that occurs during DMA transmission. The exception handling method in this embodiment is a stage execution control method configured for the corresponding exception type. After monitoring each stage and the related DMA, alignment, shaping, and storage working states, the determined abnormal states can be recorded and reported. The specific judgment of anomalies in this embodiment can be as follows: when the starting address of this access or the ending address determined by the effective data length exceeds the currently allowed access range, an address out-of-bounds error is determined; when the effective byte range of the alignment processing output cannot meet the effective length requirement, an alignment error is determined; when the same storage port receives access requests that cannot be executed simultaneously, an SRAM access conflict is determined; when the DMA returns a transmission error response, a DMA error is determined. This embodiment does not limit the specific content of the anomaly handling method. For example, for SRAM access conflicts that can be eliminated by waiting, the access request that caused the conflict can be suspended, and the corresponding stage can continue to be executed after the port becomes available; or for address out-of-bounds errors or DMA transmission errors, the corresponding stage can be stopped from submitting new access requests, the anomaly can be recorded and reported, and the task can be re-initiated or re-configured externally. For alignment anomalies where complete and effective data cannot be obtained, the data can be stopped from entering subsequent stages, and the anomaly can be recorded and reported. In the case of suspension, the read / write address and loop progress of the incomplete data are retained to avoid omissions or repeated progress during recovery; in the case of stopping and waiting for reconfiguration, the failed data is not registered as completed data transfer. Anomaly logs can include the stage at which the anomaly occurred, the anomaly type, and the corresponding read or write address, facilitating the identification of the access location requiring processing. This embodiment, by selecting the appropriate stage for execution control based on the anomaly type, prevents abnormal access from propagating to subsequent reshaping or write-back, and allows recoverable resource conflicts to continue execution, thereby improving the controllability of the data transfer process and reducing the risk of erroneous data continuing to flow due to abnormal states.

[0037] Neural Processing Units (NPUs) have gradually become key modules in System-on-Chips (SoCs) for high-energy-efficiency AI (Artificial Intelligence) computing tasks. Existing NPUs typically accelerate deep neural networks such as convolutional neural networks, Transformers, and recommendation models through structures including matrix multiplication arrays, convolutional computation units, vector processing units, on-chip SRAM, DMA controllers, and on-chip interconnect networks. Compared to CPUs (Central Processing Units) and GPUs (Graphics Processing Units), NPUs have significant advantages in multiply-accumulate operation density, low-bit quantization computation, and on-chip data reuse. However, as model size increases and network structures become more complex, the performance bottleneck of NPUs has gradually shifted from simple computational power to data handling efficiency.

[0038] For a clearer understanding of this invention, please refer to the following details. Figure 5 , Figure 5 This is a schematic diagram of a system architecture for a data transfer method provided in an embodiment of the present invention. Specifically, it may include: a top-level control module sending specific instruction information to a read / write control module; the read / write control module sending data requests to the DMA through a read / write alignment module, and receiving / writing back data. After the read data passes through the alignment module, the read control module performs pre-arrangement processing during the data writing to SRAM according to the shaping mode, facilitating subsequent data retrieval by the shaping unit; after the data passes through the shaping unit, the write control module processes the writing process to SRAM again, facilitating subsequent continuous writing of data back to the storage medium by the write alignment module via the DMA.

[0039] For easier understanding, please refer to Figure 6 , Figure 6 A flowchart illustrating a data transfer method provided in an embodiment of the present invention may include: S0: Top-level control command reception phase: The external control unit or NPU (Neural Processing Unit) scheduling unit issues data transfer instructions to the top-level control module. These instructions describe the type and parameters of the data transfer task, such as the source address for reading, the destination address for writing, the length of the data to be read or written, the inner and outer loop step sizes for reading and writing, and the number of loop iterations. The top-level control module, as the scheduling entry point for this solution, is responsible for translating the high-level instructions into executable hardware control flows for the read and write control modules.

[0040] S1: Top-level control module parsing and task decomposition stage.

[0041] The top-level control module parses the received instructions, breaking down a complete data transfer task into a read phase, an on-chip shaping phase, and a write-back phase. For tasks requiring data to be read from off-chip, the top-level control module generates read-side operation parameters; for tasks requiring write-back, it generates write-side operation parameters; and for tasks requiring on-chip data rearrangement, it further coordinates the working order of the read-side SRAM, shaping unit, and write-side SRAM. The purpose of this phase is to uniformly plan the data flow and control flow, avoiding timing inconsistencies caused by independent read and write controls.

[0042] S2: Read control module startup phase: When a task requires data reading, the top-level control module sends read operation control information to the read control module. Based on the read parameters provided by the top-level control module, the read control module generates the read-side SRAM write address, chip select signal, write enable, data valid signal, and handshake signals with the DMA and read alignment modules. The read control module no longer passively follows the DMA data stream; instead, under the scheduling of the top-level control module, it generates a more precise read-side control cycle according to the current data layout and transport mode (each different inner and outer loop).

[0043] S3: DMA data read and data alignment phase: DMA reads input data (data to be shaped) from off-chip memory or higher-level cache via a bus bridge. The data read can be input feature maps, weights, or other data to be shaped. After the data enters the read alignment module, the read alignment module performs non-aligned address correction, cross-boundary concatenation, valid byte filtering, bit width adaptation, and invalid data masking based on the address offset, valid bytes, data width, and boundary information provided by the read control module. This stage converts irregular or unaligned off-chip data into a regular format suitable for on-chip SRAM storage.

[0044] S4: Read-side SRAM write stage: After being processed by the read alignment module, the data is written to the read-side SRAM. The read-side SRAM is used to cache the aligned data, providing a standardized data access basis for subsequent shaping units. Since the write address and write cycle of the read-side SRAM are generated by the read control module, which is scheduled by the top-level control module, the read process can be clearly connected with the subsequent shaping process, and the data can be pre-arranged according to the needs of the shaping unit.

[0045] S5: Shaping Unit Processing Stage: The shaping unit reads data from the read-side SRAM and performs operations such as data rearrangement, row and column transformation, splicing, or splitting according to the shaping mode configured by the top-level control module. This stage is used to complete data layout transformation within the NPU, adapting the data format to the subsequent computing array (requirements of subsequent tasks) or write-back to storage requirements, avoiding repeated write-back of intermediate data to off-chip storage. The specific functions of the shaping unit can be customized, offering a high degree of flexibility.

[0046] S6: Write control module startup phase: After the shaping unit generates the data to be written, the top-level control module sends write operation control information to the write control module. The write control module generates the chip select, write address, write enable, and data valid signals for the write-side SRAM based on the target data layout, the write-side SRAM address, the write order, and the data validity information. This stage ensures that the data output by the shaping unit can be written to the write-side SRAM in an orderly manner according to the target format.

[0047] S7: Write-side SRAM write phase: The shaped data is written to the write-side SRAM under the control of the write control module. The write-side SRAM is used to buffer data to be written back and plays a rate matching role between the shaping unit and the DMA write-back path. Through this buffer, the shaping unit can continue processing subsequent data blocks without waiting for each DMA write-back to complete, thereby improving on-chip pipeline efficiency.

[0048] S8: Write alignment process stage: Data in the write-side SRAM is sent to the write alignment module. Based on information such as the target address, data length, and valid bytes, the write alignment module performs bit-width concatenation, boundary padding, write mask generation, and invalid byte masking on the data to be written back, converting the on-chip regular data into a write-back format acceptable to DMA and the external bus.

[0049] S9: DMA write-back phase: The DMA receives the data formatted by the write alignment module and writes it back to off-chip memory, system cache, or subsequent modules via the bus bridge. Because alignment and formatting are completed before writing back, the DMA can perform write-back operations in a more continuous and efficient manner, reducing bandwidth waste caused by unaligned writes and fine-grained accesses.

[0050] S10: Top-level control status monitoring phase: The top-level control module continuously monitors the operating status of the DMA, read control module, write control module, read / write alignment module, shaping unit, and SRAM. Upon completion of a phase, the top-level control module initiates the next phase based on the status information. When address out-of-bounds errors, alignment anomalies, SRAM access conflicts, or DMA errors occur, the top-level control module records and reports the abnormal status. This design enables centralized status management throughout the entire material handling process.

[0051] S11: Continuous Task Scheduling Phase If the current operator still has subsequent data that needs to be transferred, the top-level control module will continue to start the next round of read, shape, and write-back process based on the next set of address offsets and task parameters. Through unified scheduling by the top-level control module, the read path, shape path, and write path can form a pipelined collaboration, improving the parallel utilization of DMA, SRAM, and shape units.

[0052] This invention unifies the previously dispersed DMA data transfer, read control, write control, and shaping operations under a single scheduling center. After receiving external instructions, the top-level control module can uniformly configure the DMA, read control, and write control modules, and advance the process according to the status of each module. This achieves centralized scheduling and read-write coordination during the data transfer process, ultimately improving the overall controllability of data transfer within the NPU. Furthermore, this invention, through unified configuration and advancement of DMA, read control, write control, and shaping operations by top-level control, enables a double-loop system to handle address changes during multiple transfers, read-write alignment to handle byte range and transmission format adaptation, on-chip shaping to handle target data layout conversion, and read-write side buffers to connect different processing cycles. Through this collaboration, redundant configuration, off-chip intermediate data transfer, and stage waiting can be reduced, improving data operation flexibility and data transfer efficiency. Moreover, the shaping unit in this embodiment is logically separated from other modules, allowing for customized design based on input / output data requirements and scheduling in conjunction with the read-write control module, further enhancing the flexibility of data operations.

[0053] The data transfer device provided in the embodiments of the present invention will be described below. The data transfer device described below and the data transfer method described above can be referred to each other.

[0054] Please refer to the details. Figure 7 , Figure 7 A schematic diagram of a data transfer device provided in an embodiment of the present invention may include: The stage splitting module 100 is used to split the data transfer task into a read-in stage, an on-chip shaping stage, and a write-back stage based on data transfer instructions. The data transfer instructions include a read inner loop step size, a write inner loop step size, a read outer loop step size, a write outer loop step size, an inner loop count, and an outer loop count. The inner loop is a loop that sequentially determines the read and write addresses corresponding to each data transfer based on the read inner loop step size and the write inner loop step size. The outer loop is a loop that sequentially determines the starting read and starting write addresses corresponding to each data transfer based on the read outer loop step size and the write outer loop step size. The read-in module 200 is used to determine the read address corresponding to each data transfer in the read-in stage based on the read inner loop step size, the read outer loop step size, the inner loop count and the outer loop count, and to perform read-in processing based on the read address to obtain the currently read-in data; The shaping processing module 300 is used to perform shaping processing based on the currently read data during the on-chip shaping stage to obtain the current shaped data; The write module 400 is used to perform write processing based on the write inner loop step size, the write outer loop step size, the number of inner loops and the number of outer loops, and the current integer data during the write-back phase, and to move the current integer data to the target storage location.

[0055] Furthermore, based on any of the above embodiments, the data transfer apparatus may further include: The read / write address update module is used to update the read address and write address corresponding to the next data transfer according to the read inner loop step size and the write inner loop step size after each data transfer is completed, and to perform the next data transfer based on the updated read address and write address, until the inner loop number is reached; The outer loop update module is used to update the starting read address and starting write address corresponding to the next outer loop according to the reading outer loop step size and the writing outer loop step size respectively after the inner loop count is reached, and to perform data transfer for the next outer loop based on the updated starting read address and starting write address, until the outer loop count is reached.

[0056] Furthermore, based on any of the above embodiments, the read-in module 200 may include: The reading unit is used to read data to be aligned based on the current read address. The alignment unit is used to align the data to be aligned to obtain aligned data. A write memory unit is used to write the alignment data into the read-side memory to obtain the currently read data.

[0057] Furthermore, based on any of the above embodiments, the shaping processing module 300 may include: A shaping processing unit is used to perform shaping processing on the currently read data based on a configured shaping pattern to obtain the current shaped data; wherein the shaping pattern includes at least one of data rearrangement, row and column transformation, concatenation, and splitting.

[0058] Furthermore, based on any of the above embodiments, the writing module 400 may include: The data to be written determination unit is used to write the current shaped data into the write-side memory based on the configured write operation control information to obtain the data to be written. A write alignment data determination unit is used to perform write alignment processing on the data to be written read from the write-side memory to obtain write alignment data; Write target storage location unit, used to write the write-aligned data to the target storage location.

[0059] Furthermore, based on any of the above embodiments, the data transfer apparatus may further include: The execution status acquisition module is used to monitor the execution status of the read-in stage, the on-chip shaping stage, and the write-back stage. Based on the execution status and the address changes corresponding to the inner and outer loops, it continuously schedules the read-in processing, shaping processing, and write-back processing corresponding to subsequent data, so that the read-in processing, shaping processing, and write-back processing corresponding to different data are executed in parallel pipeline until the current data to be transferred is transferred.

[0060] Furthermore, based on any of the above embodiments, the data transfer method may further include: An abnormal state determination module is used to monitor the execution status of the read-in stage, the on-chip shaping stage, and the write-back stage, and to determine abnormal states. An exception handling module is used to determine the corresponding exception handling method based on the exception type of the exception state, and to control the execution of the corresponding stage based on the exception handling method.

[0061] It should be noted that the order of the modules and units in the aforementioned data transfer device can be changed without affecting the logic.

[0062] This invention provides a data transfer device, which may include: a stage splitting module 100, used to split a data transfer task into a read-in stage, an on-chip shaping stage, and a write-back stage based on data transfer instructions; wherein, the data transfer instructions include a read inner loop step size, a write inner loop step size, a read outer loop step size, a write outer loop step size, an inner loop count, and an outer loop count; the inner loop is a loop that determines the read address and write address corresponding to each data transfer according to the read inner loop step size and the write inner loop step size; the outer loop is a loop that determines the starting read address and the starting write address corresponding to each data transfer according to the read outer loop step size and the write outer loop step size; a read-in module 200, The present invention utilizes inner and outer loop parameters to determine the read address corresponding to each data transfer during the read-in phase, based on the inner loop step size, the outer loop step size, the inner loop count, and the outer loop count, and performs read-in processing based on the read address to obtain the currently read data; the shaping processing module 300 performs shaping processing based on the currently read data during the on-chip shaping phase to obtain the currently shaped data; the write module 400 performs write processing based on the inner loop step size, the outer loop step size, the inner loop count, the outer loop count, and the currently shaped data during the write-back phase, and transfers the currently shaped data to the target storage location. This embodiment of the invention reduces sequential configuration operations by utilizing inner and outer loop parameters to determine the read and write addresses for multiple transfers, and completes on-chip shaping between read-in and write-back, reducing the overhead of separate data format conversion and connection, and improving the efficiency of data transfer.

[0063] The following describes a data transfer device provided by an embodiment of the present invention. The data transfer device described below and the data transfer method described above can be referred to each other.

[0064] Please refer to Figure 8 , Figure 8 A schematic diagram of a data transfer device provided in an embodiment of the present invention may include: Memory 10 is used to store computer programs; Processor 20 is used to execute computer programs to implement the data transfer method described above.

[0065] The memory 10, processor 20, and communication interface 30 all communicate with each other through the communication bus 40.

[0066] In this embodiment of the invention, the memory 10 is used to store one or more programs. The programs may include program code, which includes computer operation instructions. In this embodiment of the invention, the memory 10 may store programs for implementing the following functions: Based on data movement instructions, the data movement task is divided into a read-in stage, an on-chip shaping stage, and a write-back stage. The data movement instructions include the read inner loop step size, write inner loop step size, read outer loop step size, write outer loop step size, inner loop count, and outer loop count. The inner loop determines the read address and write address corresponding to each data movement according to the read inner loop step size and the write inner loop step size. The outer loop determines the starting read address and starting write address corresponding to each data movement according to the read outer loop step size and the write outer loop step size. During the read-in phase, the read address corresponding to each data transfer is determined sequentially based on the read inner loop step size, read outer loop step size, inner loop count, and outer loop count. The read-in process is then performed based on the read address to obtain the currently read-in data. During the on-chip shaping stage, shaping is performed based on the currently read data to obtain the current shaped data; During the write-back phase, the write process is performed based on the write inner loop step size, write outer loop step size, inner loop count, outer loop count, and the current integer data, and the current integer data is moved to the target storage location.

[0067] In one possible implementation, the memory 10 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function; and the data storage area may store data created during use.

[0068] Furthermore, memory 10 may include read-only memory and random access memory, providing instructions and data to the processor. A portion of the memory may also include NVRAM. The memory stores operating systems and operating instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and handling hardware-based tasks.

[0069] Processor 20 can be a central processing unit (CPU), an application-specific integrated circuit, a digital signal processor, a field-programmable gate array, or other programmable logic device. Processor 20 can be a microprocessor or any conventional processor. Processor 20 can call programs stored in memory 10.

[0070] The communication interface 30 can be an interface for the communication module, used to connect with other devices or systems.

[0071] Of course, it should be noted that, Figure 8 The structure shown does not constitute a limitation on the data transfer device in the embodiments of the present invention. In practical applications, the data transfer device may include more than Figure 8More or fewer components as shown, or combinations of certain components.

[0072] The computer-readable storage medium provided in the embodiments of the present invention is described below. The computer-readable storage medium described below and the data transfer method described above can be referred to each other.

[0073] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the data transfer method described above.

[0074] The computer-readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0075] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0076] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0077] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0078] The above provides a detailed description of a data transfer method, apparatus, device, and computer-readable storage medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A data transfer method, characterized in that, include: The data transfer task is divided into a read-in stage, an on-chip shaping stage, and a write-back stage based on data transfer instructions. The data transfer instructions include the read inner loop step size, write inner loop step size, read outer loop step size, write outer loop step size, inner loop count, and outer loop count. The inner loop determines the read and write addresses corresponding to each data transfer based on the read inner loop step size and the write inner loop step size. The outer loop determines the starting read and starting write addresses corresponding to each data transfer based on the read outer loop step size and the write outer loop step size. In the reading phase, based on the inner loop step size, the outer loop step size, the number of inner loop iterations, and the number of outer loop iterations, the corresponding read address for each data transfer is determined sequentially, and the reading process is performed based on the read address to obtain the currently read data; In the on-chip shaping stage, shaping processing is performed based on the currently read data to obtain the current shaped data; In the write-back phase, the write process is performed based on the write inner loop step size, the write outer loop step size, the inner loop count, the outer loop count, and the current integer data, and the current integer data is moved to the target storage location.

2. The data transfer method according to claim 1, characterized in that, Also includes: After each data transfer is completed, the read address and write address corresponding to the next data transfer are updated according to the read inner loop step size and the write inner loop step size, respectively, and the next data transfer is performed based on the updated read address and write address, until the inner loop number is reached; After the inner loop count is reached, the starting read address and starting write address of the next outer loop are updated according to the reading outer loop step size and the writing outer loop step size, respectively. The data transfer of the next outer loop is then performed based on the updated starting read address and starting write address until the outer loop count is reached.

3. The data transfer method according to claim 1, characterized in that, The read address corresponding to each data transfer is determined sequentially, and the data is read in based on the read address to obtain the currently read data, including: Read the data based on the current read address to obtain the data to be aligned; The data to be aligned is aligned to obtain aligned data; The alignment data is written to the read-side memory to obtain the currently read data.

4. The data transfer method according to claim 1, characterized in that, In the on-chip shaping stage, shaping processing is performed based on the currently read data to obtain current shaped data, including: The currently read data is shaped based on the configured shaping pattern to obtain the current shaped data; wherein the shaping pattern includes at least one of data rearrangement, row and column transformation, concatenation and splitting.

5. The data transfer method according to claim 1, characterized in that, In the write-back phase, based on the inner loop step size, the outer loop step size, the inner loop count, the outer loop count, and the current integer data, a write process is performed to move the current integer data to the target storage location, including: Based on the configured write operation control information, the current shaped data is written to the write-side memory to obtain the data to be written; The data to be written, read from the write-side memory, is subjected to write alignment processing to obtain write-aligned data; Write the write-aligned data to the target storage location.

6. The data transfer method according to any one of claims 1 to 5, characterized in that, After breaking down the data transfer task into a read-in stage, an on-chip shaping stage, and a write-back stage based on data transfer instructions, it also includes: The execution status of the read-in stage, the on-chip shaping stage, and the write-back stage is monitored. Based on the execution status and the address changes corresponding to the inner and outer loops, the read-in processing, shaping processing, and write-back processing corresponding to subsequent data are continuously scheduled, so that the read-in processing, shaping processing, and write-back processing corresponding to different data are executed in parallel pipeline until the current data to be transferred is transferred.

7. The data transfer method according to claim 1, characterized in that, Also includes: The execution status of the read-in stage, the on-chip shaping stage, and the write-back stage is monitored to identify abnormal states; The corresponding exception handling method is determined based on the exception type of the abnormal state, and the execution of the corresponding stage is controlled based on the exception handling method.

8. A data transfer device, characterized in that, include: The phase splitting module is used to split the data transfer task into a read phase, an on-chip shaping phase, and a write-back phase based on data transfer instructions. The data transfer instructions include the read inner loop step size, write inner loop step size, read outer loop step size, write outer loop step size, inner loop count, and outer loop count. The inner loop determines the read and write addresses corresponding to each data transfer based on the read inner loop step size and the write inner loop step size. The outer loop determines the starting read and starting write addresses corresponding to each data transfer based on the read outer loop step size and the write outer loop step size. The read-in module is used to determine the read address corresponding to each data transfer in the read-in stage based on the read inner loop step size, the read outer loop step size, the inner loop count and the outer loop count, and to perform read-in processing based on the read address to obtain the currently read-in data; The shaping module is used to perform shaping processing based on the currently read data during the on-chip shaping stage to obtain the current shaped data; The write module is used to perform write processing based on the write inner loop step size, the write outer loop step size, the number of inner loops and the number of outer loops, and the current integer data during the write-back phase, and to move the current integer data to the target storage location.

9. A data transfer device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the method as claimed in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the data transfer method as described in any one of claims 1 to 7.