Data processing system, data synchronization method, electronic device and storage medium
By introducing synchronization cache blocks and synchronization indication signals into the data processing system, the number of synchronization units is expanded, the problem of limited data synchronization between hardware computing units is solved, efficient data synchronization and complex operator fusion are achieved, and processing is improved. performance.
Patent Information
- Application Number
- CN202410711411.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-04
AI Technical Summary
In existing data processing systems, data synchronization operations between hardware computing units are limited by the number of hardware synchronization units, resulting in limited operator fusion strategies and inability to achieve the ultimate performance of the hardware, especially in complex data dependencies. Operator fusion or optimization.
By introducing synchronization cache blocks in the data processing system, data synchronization operations are simulated, the number of synchronization units is expanded, synchronization indication signals are used to send synchronization signals between different hardware computing units, virtual synchronization units are added, and more synchronization signals are provided to support complex data dependencies.
It achieves efficient data synchronization between different hardware computing units, reduces restrictions on operator development, supports operator fusion or optimization of complex data dependencies, and avoids the performance problems caused by high-level synchronization units used for low-level synchronization. loss, improving processing performance.
Smart Images

Figure CN118277490B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular, to a data processing system, a data synchronization method, an electronic device, and a storage medium. Background Art
[0002] In some data processing systems, multiple hardware computing units can be used to perform computing tasks in parallel. For example, one hardware computing unit can perform part of a computing task, or each hardware computing unit can perform computing tasks on different input data in parallel. For example, in the process of executing a computing task, for a certain data processing operation, the source operands as input parameters may come from different hardware computing units. At this time, it is necessary to perform a data synchronization operation and wait for the source operands to be ready before executing the next operation. For example, the data synchronization operation requires that when the hardware computing unit currently executing the data processing operation reads the source operand from the memory, it must ensure that the hardware computing unit providing the source operand has written the corresponding data into the memory. Summary of the invention
[0003] At least one embodiment of the present disclosure provides a data processing system, comprising N hardware computing units, wherein the N hardware computing units include a first hardware computing unit, N being a positive integer greater than 1, the first hardware computing unit having a corresponding synchronization cache block for caching a synchronization indication signal, the first hardware computing unit being configured to: in response to a need to obtain target data to perform a data processing operation, read the synchronization indication signal from the synchronization cache block, wherein the target data includes first data in N-1 hardware computing units other than the first hardware computing unit among the N hardware computing units, and in response to the synchronization indication signal indicating that the first data in the N-1 hardware computing units is ready, read the target data from the N-1 hardware computing unit to the first hardware computing unit, wherein the synchronization indication signal is determined based on first signals sent to the synchronization cache block by the N-1 hardware computing units when their respective first data are ready.
[0004] For example, in the data processing system provided by at least one embodiment of the present disclosure, the synchronization indication signal is determined by performing an accumulation operation on the received first signal, and the first hardware computing unit executes in response to the synchronization indication signal indicating that the first data in the N-1 hardware computing units is ready, and when the target data is read from the N-1 hardware computing unit to the first hardware computing unit, the following operations are performed: cyclically reading the synchronization indication signal, and in response to the value of the synchronization indication signal being equal to a preset value, reading the target data from the N-1 hardware computing unit to the first hardware computing unit, wherein the preset value is the sum of the accumulated value of the N-1 first signals respectively sent by the N-1 hardware computing units and an initial value; resetting the synchronization indication signal to the initial value.
[0005] For example, in the data processing system provided by at least one embodiment of the present disclosure, the first signal is an atomic addition operation signal, the synchronization indication signal is an atomic variable, the atomic addition operation signal includes adding 1 to the atomic variable, and the preset value is the sum of the initial value and N-1.
[0006] For example, in the data processing system provided by at least one embodiment of the present disclosure, the synchronization indication signal includes N-1 synchronization signals corresponding one to one to the N-1 hardware computing units, and the first hardware computing unit executes in response to the synchronization indication signal indicating that the first data in the N-1 hardware computing units is ready. When reading the target data from the N-1 hardware computing units to the first hardware computing unit, it includes performing the following operations: cyclically reading the N-1 synchronization signals, updating to the first signal in response to any synchronization signal, and performing a read operation until the target data is read from the N-1 hardware computing units, wherein the read operation includes reading the first data in the corresponding hardware computing unit from the hardware computing unit corresponding to any synchronization signal, and resetting any synchronization signal.
[0007] For example, in a data processing system provided by at least one embodiment of the present disclosure, the first signal is used to write a first value to the synchronization signal, and in response to any one of the synchronization signals being updated to the first signal, a read operation is performed, including: in response to the numerical value of any one of the synchronization signals being updated to the first value, the read operation is performed; resetting any one of the synchronization signals includes: updating any one of the synchronization signals from the first value to an initial value, wherein the initial value is different from the first value.
[0008] For example, in the data processing system provided by at least one embodiment of the present disclosure, there is a data dependency relationship between the N hardware computing units, and the data dependency relationship includes that the target data used by the first hardware computing unit when performing the data processing operation comes from the N-1 hardware computing units.
[0009] For example, in a data processing system provided by at least one embodiment of the present disclosure, the data processing system is used to perform calculations of a neural network, and the neural network has a corresponding execution sequence, wherein the neural network includes multiple fusion layers, and the execution sequence characterizes the data dependencies and execution order between the multiple fusion layers in the neural network; the data dependencies between the N hardware computing units are determined based on the data dependencies between the fusion layers in the execution sequence.
[0010] For example, in the data processing system provided by at least one embodiment of the present disclosure, each of the N-1 hardware computing units is configured to: in response to the first data of the hardware computing unit being stored in the corresponding storage component, send the first signal to the synchronization cache block, and then continue to execute other instruction operations.
[0011] For example, in the data processing system provided by at least one embodiment of the present disclosure, the N hardware computing units correspond to different synchronization cache blocks respectively.
[0012] For example, in the data processing system provided by at least one embodiment of the present disclosure, the N hardware computing units share the synchronization cache block.
[0013] For example, in the data processing system provided by at least one embodiment of the present disclosure, the type of the hardware computing unit includes thread hardware, execution unit, computing unit or programmable multiprocessor.
[0014] For example, in a data processing system provided in at least one embodiment of the present disclosure, the data processing system includes at least one data processor, and the N hardware computing units belong to the same data processor.
[0015] For example, in a data processing system provided in at least one embodiment of the present disclosure, the data processing system includes multiple data processors, and the N hardware computing units do not all belong to the same data processor.
[0016] For example, in a data processing system provided in at least one embodiment of the present disclosure, the data processing system includes at least one server node, each server node includes at least one data processor, and the N hardware computing units are distributed in the same server node or different server nodes.
[0017] For example, in a data processing system provided by at least one embodiment of the present disclosure, the synchronization cache block is located in a memory area accessible to the N hardware computing units in the data processing system.
[0018] For example, in the data processing system provided by at least one embodiment of the present disclosure, in response to the types of the N hardware computing units being execution units or thread hardware and belonging to the same data processor, the synchronization cache block is located in the shared memory of the same data processor; in response to the types of the N hardware computing units being computing units or programmable multiprocessors and belonging to the same data processor, the synchronization cache block is located in the global memory of the same data processor; in response to the N hardware computing units not all belonging to the same data processor, the synchronization cache block is located in the memory of the central processing unit, wherein the central processing unit is configured to manage all data processors where the N hardware computing units are located.
[0019] At least one embodiment of the present disclosure provides a data synchronization method for a data processing system including N hardware computing units, wherein the N hardware computing units include a first hardware computing unit, and N is a positive integer greater than 1. The data synchronization method comprises: in response to a need to obtain target data to perform a data processing operation, reading a synchronization indication signal from a synchronization cache block corresponding to the first hardware computing unit, wherein the target data includes first data in N-1 hardware computing units other than the first hardware computing unit among the N hardware computing units; in response to the synchronization indication signal indicating that the first data in the N-1 hardware computing unit is ready, reading the target data from the N-1 hardware computing unit to the first hardware computing unit, wherein the synchronization indication signal is determined by first signals sent to the synchronization cache block by the N-1 hardware computing units when their respective first data are ready.
[0020] For example, in the data synchronization method provided in at least one embodiment of the present disclosure, the synchronization indication signal is determined by performing an accumulation operation on the received first signal, and in response to the synchronization indication signal indicating that the first data in the N-1 hardware computing units is ready, when the target data is read from the N-1 hardware computing unit to the first hardware computing unit, it includes: cyclically reading the synchronization indication signal, and in response to the value of the synchronization indication signal being equal to a preset value, reading the target data from the N-1 hardware computing unit to the first hardware computing unit, wherein the preset value is the sum of the accumulated value of the N-1 first signals sent by the N-1 hardware computing unit and an initial value; resetting the synchronization indication signal to the initial value.
[0021] For example, in the data synchronization method provided in at least one embodiment of the present disclosure, the synchronization indication signal includes N-1 synchronization signals corresponding one to the N-1 hardware computing units, and in response to the synchronization indication signal indicating that the first data in the N-1 hardware computing units is ready, the target data is read from the N-1 hardware computing units to the first hardware computing units, including: cyclically reading the N-1 synchronization signals, updating to the first signal in response to any one of the synchronization signals, performing a read operation until the target data is read from the N-1 hardware computing units, wherein the read operation includes reading the first data in the corresponding hardware computing unit from the hardware computing unit corresponding to any one of the synchronization signals, and resetting any one of the synchronization signals.
[0022] At least one embodiment of the present disclosure provides an electronic device, comprising: a processor; and a memory, wherein the memory stores a computer-readable code, and when the computer-readable code is executed by the processor, the data synchronization method as described in any embodiment of the present disclosure is executed.
[0023] At least one embodiment of the present disclosure provides a non-transitory computer-readable storage medium having instructions stored thereon, wherein the instructions, when executed by a processor, implement the data synchronization method as described in any embodiment of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0025] Figure 1 A schematic structural diagram of a general purpose graphics processing unit (GPGPU) is shown;
[0026] Figure 2 A schematic block diagram of a data processing system provided by at least one embodiment of the present disclosure is shown;
[0027] Figure 3A A schematic diagram of a directed acyclic graph of a neural network is shown;
[0028] Figure 3B Shown according to Figure 3A The implementation process of the directed acyclic graph shown in the figure is to fuse operators to obtain the computational graph;
[0029] Figure 3C Shown according to Figure 3B The execution sequence obtained by serializing the computation graph shown;
[0030] Figure 4A A schematic process diagram of one-way data synchronization provided for at least one embodiment of the present disclosure;
[0031] Figure 4B A schematic process diagram of bidirectional data synchronization provided for at least one embodiment of the present disclosure;
[0032] Figure 5 A schematic flow chart of a data synchronization method provided by at least one embodiment of the present disclosure;
[0033] Figure 6 A schematic block diagram of an electronic device provided for at least one embodiment of the present disclosure;
[0034] Figure 7 A schematic diagram of a non-transitory computer-readable storage medium provided for at least one embodiment of the present disclosure. DETAILED DESCRIPTION
[0035] The technical solutions in the embodiments of the present disclosure will be described clearly and completely below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0036] In addition, as shown in the present disclosure and claims, unless the context clearly indicates an exception, the words "a", "an", "a kind" and / or "the" do not specifically refer to the singular, but may also include the plural. The words "first", "second" and similar words used in the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, words such as "include" or "comprise" mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Words such as "connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect.
[0037] Flowcharts are used in this disclosure to illustrate the steps of the method according to the embodiments of the present disclosure. It should be understood that the preceding or succeeding steps are not necessarily performed precisely in order. On the contrary, various steps may be processed in reverse order or simultaneously. At the same time, other operations may also be added to these processes. It is understood that the professional terms and nouns involved in this article have meanings known to those skilled in the art.
[0038] Figure 1A schematic structural diagram of a general-purpose graphics processing unit (GPGPU) is shown.
[0039] like Figure 1 As shown, the general-purpose graphics processor is actually an array of programmable multiprocessors. For example, the programmable multiprocessor can be a streaming processor cluster (SPC), for example, including Figure 1 The stream processor clusters 1, ..., and stream processor cluster M are shown, where M is a positive integer greater than 1. In a general-purpose graphics processor, one stream processor cluster processes one computing task, or multiple stream processor clusters process one computing task. Multiple stream processor clusters share data through a global cache or a global memory.
[0040] like Figure 1 As shown, taking stream processor cluster 1 as an example, one stream processor cluster includes multiple computing units, such as Figure 1 In the figure, there are computing units 1, 2, ..., N, where N is a positive integer. Each computing unit (CU) is used to perform arithmetic and logical operations, such as accumulation, reduction, conventional addition, subtraction, multiplication, and division. A computing unit includes multiple cores (also called computing cores or computing cores), each of which includes an arithmetic logic unit (ALU), a floating-point computing unit, etc. The computing core is used to perform specific computing tasks. In addition, the computing unit also includes registers (e.g. Figure 1 The register file in the computing unit and the shared memory are used to hierarchically store source data and destination data related to computing tasks. The shared memory in a computing unit is used to share data between the cores of the computing unit.
[0041] In parallel computing, computing tasks are generally performed by multiple threads. These threads are divided into multiple thread blocks before being executed in a general-purpose graphics processor (or parallel computing processor), and then distributed through the thread block distribution module ( Figure 1 The CPU (not shown) distributes multiple thread blocks to each computing unit. All threads in a thread block must be assigned to the same computing unit for execution. At the same time, the thread block is split into minimum execution thread bundles (or simply thread bundles, warps), each of which contains a fixed number (or less than this fixed number) of threads, for example, 32 threads. Thread bundles run on execution units (EUs), and threads run on thread hardware, for example, 1 thread bundle runs on 1 execution unit, and 1 thread runs on 1 thread hardware. Multiple thread blocks can be executed in the same computing unit, or in different computing units.
[0042] In each compute unit, the warp scheduling / dispatching module ( Figure 1 The thread warps are scheduled and allocated (not shown) so that multiple computing cores of the computing unit can run the thread warps. Depending on the number of computing cores in the computing unit, multiple thread warps in a thread block can be executed simultaneously or in time-sharing. Multiple threads in each thread warp will execute the same instruction. The memory execution instruction will be emitted to the shared memory in the computing unit or further emitted to the intermediate level cache or global cache or global memory for read and write operations, etc.
[0043] Artificial Neural Networks (ANN), also known as neural networks for short, is an algorithmic mathematical model that imitates the behavioral characteristics of animal neural networks and performs distributed parallel information processing. This network relies on the complexity of the system to adjust the interconnected relationships between a large number of internal nodes to achieve the purpose of processing information. Regardless of the type of artificial neural network, their common characteristics are large-scale parallel processing, distributed storage, elastic topology, high redundancy and nonlinear operations, and have capabilities in terms of computing speed, associative ability, adaptability, fault tolerance and self-organization. These characteristics and capabilities constitute the technical basis for artificial neural networks to simulate intelligent activities and have been used in various technical fields. For example, artificial neural networks can be used in data compression, image processing, video coding, signal processing and other aspects.
[0044] Operators in neural networks usually refer to the basic mathematical operations or operations used in the neural network layers. These operators are used to build the various layers and components of the neural network to achieve data transmission, conversion and calculation. They are the basic building blocks of neural networks and define the structure and operation flow of the model, including input, output and intermediate calculations. In the model, the connection relationship between operators forms a directed graph that reflects the calculation order of different operations in the neural network. By combining these operators, complex and powerful neural network models can be constructed to handle various complex tasks and data.
[0045] In order to improve the computational efficiency of neural networks, multiple adjacent operators that meet certain conditions or rules in the neural network are usually fused to form a fused operator. Generally, a fused operator or a single operator that cannot be fused can be called a fused operator, also called a fusion layer. The computation process of a neural network is performed layer-by-layer in units of fusion layers. Usually, the output of the previous layer (or the previous layers) is used as the input of the next layer (or the next layers), so there is data dependency between fusion layers. In the computation process of a neural network, data synchronization is required to ensure the execution order between fusion layers with data dependencies, that is, when the current fusion layer reads input data from the memory, it must be ensured that the corresponding fusion layer has written the corresponding data into the memory. Therefore, in order to ensure that the processor (such as an artificial intelligence chip) that performs neural network calculations can perform calculations according to the desired timing, it is necessary to insert data synchronization operations where data dependencies exist, and wait for the data to be prepared before executing the next operation.
[0046] Artificial intelligence chips can be implemented in the form of graphics processing units (GPUs), general-purpose graphics processing units (GPGPUs), tensor processing units (TPUs), data processing units (DPUs), etc. However, no matter what processor architecture is used, there are usually multiple levels of hardware computing units, such as Figure 1 The related content described above, the types of hardware computing units may include thread hardware, execution units, computing units, stream processor clusters, etc. For example, as mentioned above, one streaming processor cluster may include multiple computing units, one computing unit may include multiple execution units, and one execution unit may include multiple thread hardware.
[0047] The data transmission between the fusion layers that perform calculations in the same processor is generally synchronized through a hardware synchronization unit set in the processor. The hardware synchronization unit is provided with a preset number of data synchronization signals for execution units at different levels. For example, 10 data synchronization signals are provided for synchronization between computing units, and 10 data synchronization signals are provided for synchronization between streaming processor clusters. Data synchronization signals can only be used for synchronization at the same level or at a lower level. For example, when synchronization of computing units is required, data synchronization signals for synchronization between computing units are required, and data synchronization signals for synchronization between execution units or threads cannot be used. Although data synchronization signals for synchronization between streaming processor clusters can be used, this will result in a decrease in performance because the synchronization of computing units at this time is achieved by relying on synchronization between streaming processor clusters.
[0048] Since synchronization operations rely on the hardware synchronization unit provided by the hardware, when there are fewer hardware synchronization units, it will greatly restrict operator development. Since the number of synchronization signals provided by the hardware synchronization unit is limited, the operator fusion strategy is limited by the number of synchronization signals. For some complex data dependencies, it is limited by the number of hardware synchronization signals and cannot be performed. It can only reduce the complexity of operators, but cannot perform arbitrary depth of operator fusion or optimization, making it difficult to exert the ultimate performance of the hardware.
[0049] The structure of the graphics processor is relatively simple, with a large number of computing units and a very long pipeline, which is particularly suitable for processing large amounts of data of the same type. However, the graphics processor cannot work alone and must be controlled and scheduled by the central processing unit (CPU) to work. For example, when the central processing unit needs to process a large amount of data of the same type, the graphics processor can be called for parallel computing.
[0050] When the GPU performs parallel computing, the CPU can split the data into many blocks, each of which is handed over to a stream in the GPU for processing. Or it can be understood that the CPU splits the computing task into multiple subtasks, each of which is processed by a stream in the GPU. Each stream includes one or more of the following three steps: 1) Transferring the data belonging to the stream from the GPU memory to the GPU memory; 2) The GPU performs calculations and saves the results in the GPU memory; 3) Copying the calculation result data of the stream from the GPU memory to the CPU memory.
[0051] When the structure of the neural network is more complex, in order to improve the computing efficiency, the fusion layer can be split into multiple parts and distributed to run on multiple GPUs. At this time, when synchronizing data, it is necessary to run the corresponding interface function (API) on the CPU side for synchronization. This synchronization operation will cause the GPU to suspend operation and wait for the CPU to actively activate (kernal launch) the execution flow, thus introducing multiple activation overheads on the CPU side.
[0052] At least one embodiment of the present disclosure provides a data processing system, a data synchronization method, an electronic device, and a non-transitory computer-readable storage medium. The data processing system may include: N hardware computing units, the N hardware computing units include a first hardware computing unit, N is a positive integer greater than 1, the first hardware computing unit has a corresponding synchronization cache block for caching a synchronization indication signal, and the first hardware computing unit is configured to: in response to the need to obtain target data to perform a data processing operation, read the synchronization indication signal from the synchronization cache block, wherein the target data includes the first data in the remaining N-1 hardware computing units except the first hardware computing unit in the N hardware computing units, and in response to the synchronization indication signal indicating that the first data in the N-1 hardware computing units is ready, read the target data from the N-1 hardware computing unit to the first hardware computing unit, wherein the synchronization indication signal is determined according to the first signal sent to the synchronization cache block by the N-1 hardware computing units when the respective first data is ready.
[0053] In the data processing system provided by at least one embodiment of the present disclosure, a synchronization cache block is used to simulate a data synchronization operation, so that a synchronization signal is sent between different hardware computing units using the synchronization cache block and a synchronization indication signal, the number of synchronization units is expanded, and the restrictions on operator development are reduced. In theory, the number of synchronization cache blocks can be infinite, so a large number of virtual synchronization units can be added, and a large number of synchronization signals can be provided for data synchronization.
[0054] Figure 2 A schematic block diagram of a data processing system provided by at least one embodiment of the present disclosure is shown.
[0055] like Figure 2 As shown, the data processing system 100 includes N hardware computing units, such as Figure 2 The first hardware computing unit 101 and N-1 hardware computing units 102, N is a positive integer greater than 1.
[0056] For example, the first hardware computing unit 101 may be any one of the N hardware computing units. For example, the first hardware computing unit may be a hardware computing unit that currently needs to perform data synchronization. Of course, for other hardware computing units, when data synchronization is required, they may also be used as the first hardware computing unit to perform similar processing. That is, in the present disclosure, the execution process of the data synchronization operation is explained by taking the first hardware computing unit as an example.
[0057] For example, there is a data dependency relationship between N hardware computing units, and the data dependency relationship includes that the target data used by the first hardware computing unit when performing a data processing operation comes from N-1 hardware computing units. That is, when the first hardware computing unit performs a data processing operation, it needs to wait until the target data has been stored in the corresponding storage component by the N-1 hardware computing units before reading the target data to perform the data processing operation.
[0058] It should be noted that the data processing system may further include more hardware computing units, and the N hardware computing units are some hardware computing units in the data processing system that require data synchronization, or have data dependencies.
[0059] For example, the data processing system 100 may include one data processor or multiple data processors. For example, the data processor may be a central processing unit, a graphics processor, a general-purpose graphics processor, a tensor processor, a neural network processor, etc. The present disclosure does not specifically limit the type of data processor.
[0060] For example, when the data processing system 100 includes multiple data processors, the types of the data processors may be any combination as described above, and the present disclosure does not impose any specific limitation on this.
[0061] For example, in one example, the data processing system 100 may include a central processing unit and multiple graphics processors, where the central processing unit serves as a host side and is configured to control and schedule multiple graphics processors serving as device sides to perform computing tasks.
[0062] For example, the data processing system 100 may be a distributed system, for example, including a plurality of server nodes, the server nodes being connected to each other using a network protocol and communicating with other server nodes. For example, each server node may include one or more data processors.
[0063] For example, as mentioned above, a data processor may include multiple levels of hardware computing units, and the types of hardware computing units may include thread hardware, execution units, computing units, programmable multiprocessors, etc. For example, when the processor is a graphics processor or a general-purpose graphics processor, the programmable multiprocessor may be a streaming processor cluster. For the relationship between thread hardware, execution units, computing units, and streaming processor clusters, please refer to the above Figure 1 The relevant description will not be repeated here.
[0064] For example, the types of the N hardware computing units may be the same, or in other words, the levels of the N hardware computing units may be the same, for example, they are all computing units. For example, the types of the N hardware computing units may be different, for example, the N hardware computing units may belong to different levels, for example, some are computing units, and some are stream processor clusters, etc. The present disclosure does not impose specific restrictions on this. In the present disclosure, data synchronization is not limited to the same level, and data synchronization can also be performed between high-level and low-level hardware computing units.
[0065] For example, data synchronization between N hardware computing units may occur within a data processor or between multiple data processors.
[0066] For example, the data processing system 100 includes one or more data processors, and the N hardware computing units all belong to the same data processor.
[0067] For example, the data processing system 100 includes multiple data processors, and the N hardware computing units do not all belong to the same data processor. For example, the N hardware computing units belong to different data processors, such as some hardware computing units in one data processor and other hardware computing units in another data processor.
[0068] For example, the data processing system 100 includes at least one server node, each server node includes at least one data processor, and N hardware computing units are distributed in the same server node or different server nodes. For example, data synchronization between the N hardware computing units can occur within a server node or between multiple server nodes.
[0069] For example, Figure 2 As shown, the first hardware computing unit 101 has a corresponding synchronization cache block 103, and the synchronization cache block 103 is used to cache the synchronization indication signal.
[0070] For example, the synchronization cache block is located in a memory area accessible to N hardware computing units in the data processing system 100. For example, a piece of memory space is allocated from the memory area as the synchronization cache block. Therefore, the number of the synchronization cache blocks can be large, theoretically infinite, and the number of synchronization units can be greatly expanded as virtual synchronization units, reducing the restrictions on operator development.
[0071] For example, in response to the N hardware computing units being of execution unit or thread hardware type and belonging to the same data processor, the synchronization cache block is located in the shared memory of the data processor.
[0072] For example, when the hardware compute unit is an execution unit or thread hardware, such as Figure 1As shown in the figure, they can all access the shared memory in the computing unit, so a memory area can be allocated from the shared memory as a synchronization cache block. Since the shared memory has a faster access speed, it can improve data synchronization efficiency compared to using other memory areas (such as global memory).
[0073] For example, when the hardware computing unit is a computing unit or a programmable multiprocessor, if the N hardware computing units that need to perform data synchronization are all located in the same data processor, such as the same graphics processor or a general-purpose graphics processor, such as Figure 1 As shown, they can all access the global memory in the data processor, so a memory area can be allocated from the global memory as a synchronization cache block.
[0074] For example, if the N hardware computing units that need to perform data synchronization are not all located in the same data processor, such as in different data processors, then the synchronization cache block is located in the memory of the central processing unit. For example, the central processing unit is configured to manage all data processors where the N hardware computing units are located.
[0075] For example, in one example, some hardware computing units are located in one graphics processor, and other hardware computing units are located in another graphics processor, or some hardware computing units are located in one server node, and other hardware computing units are located in another server node, etc. For example, the data processors where these hardware computing units are located are managed by a central processor, such as being controlled and scheduled by the central processor to use these data processors to perform computing tasks. Therefore, these data processors can all access the memory area of the central processor, such as allocating a memory area from the memory of the central processor as a synchronization cache block.
[0076] Different from the established hardware connection relationship of the hardware synchronization unit itself, the use of synchronization cache blocks for data synchronization operations is not limited to synchronization between the same levels. The synchronization between different levels is exactly the same as the synchronization between the same levels, reducing the performance loss caused by using high-level synchronization units for low-level synchronization. In addition, data synchronization operations between different processors or even different servers can be directly executed using virtual synchronization units (synchronization cache blocks), avoiding multiple activation overheads on the central processing unit side and improving processing performance.
[0077] For example, in some embodiments, a synchronization cache block may be allocated to each hardware computing unit, for example, N hardware computing units correspond to different synchronization cache blocks respectively. In this case, each hardware computing unit uses its own synchronization cache block to perform data synchronization operations.
[0078] For example, in some other embodiments, N computing units may share one synchronization cache block, that is, N hardware computing units may use the same synchronization cache block to perform data synchronization operations.
[0079] For example, synchronization cache blocks may be allocated to hardware computing units before executing a task. This allocation method may be fixed or may be adjusted according to different computing tasks.
[0080] For example, in one example, different synchronization cache blocks can be allocated in advance for different hardware computing units, for example, each hardware computing unit can be allocated a synchronization cache block. In the process of executing a computing task, if the hardware computing unit needs to perform a data synchronization operation, the allocated synchronization cache block is used, and if the data synchronization operation is not required, the corresponding synchronization cache block is idle. The capacity of the synchronization cache block is not too large, and this method can simplify the allocation process.
[0081] For example, in another example, synchronization cache blocks can be allocated according to the data dependency between the hardware computing units in the computing task. For example, if there is a data dependency between some hardware computing units and data synchronization operations need to be performed, synchronization cache blocks are allocated to these hardware computing units. This makes it possible to use memory resources more reasonably and reduce memory resource waste.
[0082] For example, the first hardware computing unit can be configured to: in response to the need to obtain target data to perform a data processing operation, read a synchronization indication signal from a synchronization cache block, wherein the target data includes the first data in the remaining N-1 hardware computing units among the N hardware computing units except the first hardware computing unit, and in response to the synchronization indication signal indicating that the first data in the N-1 hardware computing units is ready, read the target data from the N-1 hardware computing unit to the first hardware computing unit, wherein the synchronization indication signal is determined based on the first signals sent to the synchronization cache block by the N-1 hardware computing units respectively when their respective first data are ready.
[0083] For example, when the first hardware computing unit needs to obtain target data from N-1 hardware computing units, subsequent steps including reading synchronization indication signals are executed to obtain target data. For example, when the first hardware computing unit 101 needs to obtain target data to perform a data processing operation, for example, when the first hardware computing unit 101 executes an instruction to use the target data to perform a data processing operation, steps including reading synchronization indication signals are performed to obtain target data before executing the instruction, and then the target data is used to perform the data processing operation; or, when the first hardware computing unit 101 executes an instruction to obtain target data, steps including reading synchronization indication signals are performed to obtain target data, and then the target data is used to perform the data processing operation. For example, the synchronization indication signal indicates that the first data in the N-1 hardware computing units are ready, indicating that the first data in the N-1 hardware computing units have been stored in the corresponding storage components, and the first hardware computing unit can read its respective first data from the storage components in the N-1 hardware computing units.
[0084] For example, each of the N-1 hardware computing units is configured to: in response to the first data of the hardware computing unit being stored in the corresponding storage component, send a first signal to the synchronization cache block, and then continue to execute other instruction operations.
[0085] For example, for the hardware computing unit 102, after its first data is stored in the corresponding storage component, a first signal is sent to the synchronization cache block 103 corresponding to the first hardware computing unit 101, and then other instruction operations can be continued.
[0086] It should be noted that the first data refers to data that the first hardware computing unit 101 needs to read from another hardware computing unit 102 , and the first data in different hardware computing units 102 are not restricted to be the same.
[0087] When the first hardware computing unit 101 executes the instruction corresponding to the data processing operation, it cyclically reads the synchronization indication signal in the synchronization cache block. When the synchronization indication signal meets the preset conditions, it means that the first data of the N-1 hardware computing units 102 have been stored in the corresponding storage components and can be used for reading. At this time, the first hardware computing unit 101 reads the target data from the N-1 hardware computing units 102 to the first hardware computing unit.
[0088] The synchronization indication signal can be implemented in two ways.
[0089] For example, in some embodiments, the synchronization indication signal is determined by performing an accumulation operation on the received first signal.
[0090] For example, in this embodiment, the first signal is an atomic addition operation signal, such as an atomic add signal, and the synchronization indication signal is an atomic variable. When the atomic addition operation signal is executed, it is necessary to wait for the addition operation to be completed before executing other operations. Therefore, using the atomic addition operation signal for accumulation will not cause accumulation errors when multiple hardware computing units 102 send the first signal at the same time.
[0091] Of course, the first signal may also take other signal forms that can perform protocol operations, and the present disclosure does not impose specific limitations on this.
[0092] For example, when the first hardware computing unit executes in response to a synchronization indication signal indicating that the first data in N-1 hardware computing units is ready, and reads the target data from the N-1 hardware computing unit to the first hardware computing unit, the following operations are included: cyclically reading the synchronization indication signal, and in response to the value of the synchronization indication signal being equal to a preset value, reading the target data from the N-1 hardware computing unit to the first hardware computing unit, wherein the preset value is the sum of the accumulated value of the N-1 first signals sent by the N-1 hardware computing unit and the initial value; resetting the synchronization indication signal to the initial value.
[0093] For example, in a specific example, the atomic addition operation signal includes accumulating 1 to the atomic variable, and the preset value is the sum of the initial value and N-1.
[0094] For example, the initial value may be set to 0.
[0095] For example, the synchronization indication signal is an initial value a in the initial state. After the first data of the N-1 hardware computing units 102 is prepared, for example, written into the corresponding storage component, the first signal is sent to the synchronization cache block 103. After the synchronization cache block 103 receives a first signal, the synchronization indication signal is accumulated by b until the N-1 first signals sent by the N-1 hardware computing units 102 are received. The value of the synchronization indication signal becomes a+(N-1) ×b, where a and b can be integers or floating point numbers.
[0096] For example, when the first hardware computing unit 101 needs to obtain target data to perform a data processing operation, for example, when executing an instruction to perform a data processing operation using target data, before executing the instruction, the synchronization indication signal is read from the synchronization cache block 103 to determine whether the value of the synchronization indication signal is a+(N-1)×b. If the value of the synchronization indication signal is not a+(N-1)×b, the process continues to wait. When the value of the synchronization indication signal is a+(N-1)×b, it indicates that the N-1 hardware computing units 102 have prepared their respective first data. At this time, the target data (N-1 first data) is read from the N-1 hardware computing units 102 to the first hardware computing unit 103.
[0097] Afterwards, the first hardware computing unit 101 resets the synchronization indication signal to the initial value a to perform the next round of data synchronization.
[0098] Therefore, the behavior of the hardware synchronization unit is simulated from the software to synchronize data between different hardware computing units, so that a large number of synchronization signals can be added. The operator fusion strategy will not be limited by the number of synchronization signals, and it supports complex data dependencies in the fusion strategy. It can perform operator fusion or optimization of any depth and can bring into play the ultimate performance of the hardware.
[0099] For example, in some other embodiments, the synchronization indication signal includes N-1 synchronization signals corresponding one to one to N-1 hardware computing units.
[0100] For example, when the first hardware computing unit executes in response to a synchronization indication signal indicating that the first data in N-1 hardware computing units is ready, and reads the target data from the N-1 hardware computing units to the first hardware computing unit, the following operations are included: cyclically reading N-1 synchronization signals, updating to the first signal in response to any synchronization signal, and performing a read operation until the target data is read from the N-1 hardware computing units, wherein the read operation includes reading the first data in the corresponding hardware computing unit from any synchronization signal, and resetting any synchronization signal.
[0101] For example, the first signal is used to write a first value to the synchronization signal, and in response to any synchronization signal being updated to the first signal, a read operation is performed, including: in response to the value of any synchronization signal being updated to the first value, a read operation is performed; and any synchronization signal is reset, including: updating any synchronization signal from the first value to the initial value, wherein the initial value and the first value are different.
[0102] For example, the synchronization indication signal includes synchronization signal 1, synchronization signal 2, ..., synchronization signal N-1, which correspond to N-1 hardware computing units 102 respectively. In the initial state, the N-1 synchronization signals are initialized to an initial value c, where c is an integer or a floating point number. After the first data of the N-1 hardware computing units 102 is prepared, for example, written to the corresponding storage component, the first signal is sent to the synchronization cache block 103. For example, when the first data of the hardware computing unit 102_1 is prepared, the first signal is sent to the synchronization cache block 103, and the corresponding synchronization signal 1 is set to the first value d. For example, when the first data of the hardware computing unit 102_2 is prepared, the first signal is sent to the synchronization cache block 103, and the corresponding synchronization signal 2 is set to the first value d. For example, c and d can be integers or floating point numbers, but c is not equal to d.
[0103] For example, when the first hardware computing unit 101 needs to obtain target data to perform a data processing operation, such as when executing an instruction to perform a data processing operation using the target data, before executing the instruction, it reads a synchronization indication signal from the synchronization cache block 103, that is, reads N-1 synchronization signals.
[0104] For example, taking the synchronization signal 1 as an example, if the value of the synchronization signal 1 is updated from the initial value c to the first value d, a read operation is performed, that is, the first data is read from the hardware computing unit 102_1, and the synchronization signal 1 is reset to the initial value c.
[0105] The above operation is also performed for the remaining synchronization signals until N-1 synchronization signals have all updated the first value d, and the target data has been read from N-1 hardware computing units 102, thus completing one data synchronization.
[0106] Therefore, the behavior of the hardware synchronization unit is simulated from the software to synchronize data between different hardware computing units, so that a large number of synchronization signals can be added. The operator fusion strategy will not be limited by the number of synchronization signals, and it supports complex data dependencies in the fusion strategy. It can perform operator fusion or optimization of any depth and can bring into play the ultimate performance of the hardware.
[0107] For example, the data processing system according to the embodiment of the present disclosure can be applied to neural network computing, such as for performing reasoning tasks or training tasks of a neural network. For example, the synchronization cache blocks in the data processing system and the corresponding use process can be used to implement data synchronization between fusion layers in a neural network.
[0108] For example, a neural network has a corresponding execution sequence, the neural network includes multiple fusion layers, and the execution sequence represents the data dependency relationship and execution order between the multiple fusion layers in the neural network. The data dependency relationship between the N hardware computing units is determined based on the data dependency relationship between the fusion layers in the execution sequence.
[0109] For example, the neural network can be a multi-branch network or a single-branch network. In a single-branch network (i.e., the entire neural network has only one branch), the output of the previous layer is always the input of the next layer, and the data dependency is single and the pattern is fixed. In a multi-branch network, the input of a certain layer comes from the output of multiple layers, or the output of a certain layer is used as input to multiple layers, and there is no fixed branching pattern. Different networks will also have different multi-branch structures. For any neural network structure, the data processing system provided by at least one embodiment of the present disclosure can be used to synchronize data between fusion layers.
[0110] A neural network can be viewed as a directed acyclic graph (DAG) consisting of many computing nodes, each of which corresponds to an operator. Specifically, Figure 3AA schematic diagram of a directed acyclic graph of a neural network is shown. Figure 3A As shown, a directed acyclic graph consisting of 13 computing nodes is shown, that is, the corresponding neural network includes 13 operators. In addition, the nodes are connected by lines, which represent the data dependency and data flow between the computing nodes. For example, the output data of node 1 flows to node 2, and the output data of node 2 flows to node 3 and node 6, and so on. It can be determined that node 1 has a data dependency relationship with node 2, and node 2 has a data dependency relationship with node 6 and node 3. It can be understood that Figure 3A The network structure shown in the figure is only illustrative, and the embodiments of the present disclosure do not impose any specific limitation on the structure of the neural network.
[0111] Next, according to Figure 3A The directed acyclic graph shown can be subjected to operator fusion to obtain a fused computational graph. Figure 3B Shown according to Figure 3A The directed acyclic graph shown in the figure is used to perform operator fusion to obtain the implementation process of the computational graph.
[0112] In related technologies, for the calculation of neural networks, in order to more efficiently execute the calculation process of operators in the network, operators can be fused according to some rules and patterns, that is, multiple operators can be fused into a fusion layer, such as Figure 3B As shown, operators 1 and 2 can be fused into a fusion layer A. Similarly, operators 3, 4, and 5 can be fused into a fusion layer C. Operators 6, 7, 8, and 9 can be fused into a fusion layer B, and so on. In addition, Figure 3B The computation graph in also includes a single operator that is not fused with other operators, for example, operator D and operator E, which can be directly used as fusion layer D and fusion layer E. According to the above operator fusion rules, a computation graph consisting of fusion layers and connections between fusion layers can be obtained. It can be understood that the embodiments of the present disclosure do not limit the specific rules for performing operator fusion, and can be performed in a conventional manner in the relevant technology.
[0113] Figure 3C Shown according to Figure 3B According to the embodiment of the present disclosure, serialization refers to converting a non-linear graph into a linear execution sequence with a time order according to the data dependency relationship on the above-mentioned computation graph and the traversal rules of the graph, and retaining the data dependency relationship on the graph, while ensuring that all data dependencies are unidirectional on the time axis, that is, having the following Figure 3C The execution sequence is based on the fusion layer, and each fusion layer in the execution sequence starts calculation in a timely and orderly manner.
[0114] For example, refer to Figure 3C In the execution sequence shown, for the fusion layer E, the target data used for executing the data processing operation comes from the fusion layer C and the fusion layer B. For example, the target data includes the output data of the fusion layer C and the output data of the fusion layer B, that is, the first data may refer to the output data of the fusion layer C or the output data of the fusion layer B. For example, for the fusion layer E, the hardware computing unit executing the fusion layer E may be used as the first hardware computing unit, and the hardware computing units executing the fusion layer C and the fusion layer B may be used as the other N-1 hardware computing units.
[0115] As an implementation method, the above-mentioned computational graph can be generated based on a directed acyclic graph of a neural network. It is understandable that other methods can also be used to obtain a linear computational graph according to the embodiments of the present disclosure, as long as the computational graph can characterize the data dependency and execution order between multiple fusion layers in the neural network, without limitation here.
[0116] For example, in one example, the preset value is N-1, the initial value is 0, and the first signal is an atomic addition operation signal for adding 1 to the synchronization indication signal. The following takes this parameter configuration as an example to illustrate the process of data synchronization operation.
[0117] Figure 4A A schematic process diagram of one-way data synchronization provided for at least one embodiment of the present disclosure.
[0118] For example, in Figure 4A In the example, there are two hardware computing units that need to perform data synchronization, namely, hardware computing unit 1 and hardware computing unit 2. For example, hardware computing unit 2 needs to use the output data of hardware computing unit 1 to perform data processing operations.
[0119] For example, each hardware computing unit has a corresponding synchronization cache block, for example, hardware computing unit 1 corresponds to synchronization cache block 103_1, and hardware computing unit 2 corresponds to synchronization cache block 103_2. Of course, hardware computing unit 1 and hardware computing unit 2 can also share one synchronization cache block, which will not be repeated here.
[0120] For example, after the target data is prepared, the hardware computing unit 1 sends a first signal to the synchronization cache block 103_2, for example, the first signal may be an atomic addition operation signal, or the first signal may be a signal for writing a first value. Afterwards, the hardware computing unit 1 continues to execute subsequent other instructions.
[0121] For example, hardware computing unit 2 can serve as the first hardware computing unit. When it is necessary to obtain target data, for example, before executing an instruction to perform a data processing operation using the target data, it cyclically reads the synchronization indication signal from the synchronization cache block 103_2. When the synchronization indication signal meets the preset conditions, it reads the target data from hardware computing unit 1 to hardware computing unit 2, and resets the synchronization indication signal to the initial value 0, thereby completing a data synchronization operation.
[0122] Here, the preset condition may refer to the aforementioned content. For example, when the first signal is an atomic addition operation signal, the synchronization indication signal satisfies the preset condition that the value of the synchronization indication signal is equal to N-1; for example, when the first signal is a signal that writes a first value, the synchronization indication signal satisfies the preset condition that the value of the synchronization signal corresponding to the hardware computing unit 1 is updated to the first value.
[0123] Figure 4B A schematic process diagram of bidirectional data synchronization provided for at least one embodiment of the present disclosure.
[0124] For example, in Figure 4B In the embodiment, there are two hardware computing units that are synchronized, namely, hardware computing unit 1 and hardware computing unit 2. For example, hardware computing unit 1 and hardware computing unit 2 have a bidirectional data dependency relationship with each other, that is, hardware computing unit 1 needs to use the output data of hardware computing unit 2 to perform data processing operations, and hardware computing unit 2 also needs to use the output data of hardware computing unit 1 to perform data processing operations.
[0125] For example, when the target data of the hardware computing unit 1 is prepared, a first signal is sent to the synchronization cache block 103_2, and then the hardware computing unit 1 can continue to execute other instruction operations. For example, the hardware computing unit 2 can be used as the first hardware computing unit, which cyclically reads the synchronization indication signal from the synchronization cache block 103_2 when it needs to obtain the target data, for example, before executing the instruction to use the target data for data processing operations, and when the synchronization indication signal meets the preset conditions, reads the target data from the hardware computing unit 1 to the hardware computing unit 2, and resets the synchronization indication signal in the synchronization cache block 103_2 to the initial value 0, completing a data synchronization operation.
[0126] For example, when the target data of the hardware computing unit 2 is prepared, a first signal is sent to the synchronization cache block 103_1, and then the hardware computing unit 2 can continue to execute other instruction operations. For example, the hardware computing unit 1 can be used as the first hardware computing unit, which cyclically reads the synchronization indication signal from the synchronization cache block 103_1 when it needs to obtain the target data, for example, before executing the instruction to use the target data for data processing operations, and when the synchronization indication signal meets the preset conditions, reads the target data from the hardware computing unit 2 to the hardware computing unit 1, and resets the synchronization indication signal in the synchronization cache block 103_1 to the initial value 0, completing a data synchronization operation.
[0127] In at least one embodiment of the present disclosure, a virtual synchronization cache block is provided to replace the hardware synchronization unit, and the synchronization behavior of the hardware synchronization unit is simulated in software, so that a large number of virtual synchronization units can be added, a large number of synchronization signals can be added, and the operator fusion strategy will not be limited by the number of synchronization signals, and the complex data dependency in the fusion strategy can be supported. Operator fusion or optimization of any depth can be performed, reducing the restrictions on operator development, and can bring into play the ultimate performance of hardware. In addition, the synchronization behavior of the hardware synchronization unit is simulated in software, and the hardware connection relationship established by the hardware synchronization unit itself is not limited. The data synchronization operation is not limited to the synchronization between the same level, and the synchronization between different levels is exactly the same as the synchronization between the same level, which reduces the performance loss caused by using high-level synchronization units for low-level synchronization, and can even be extended to data synchronization operations between different processors or even different server nodes. Moreover, for data synchronization operations between different processors or even different server nodes, virtual synchronization units (synchronization cache blocks) can be directly used to execute, avoiding multiple activation overheads on the central processor side and improving processing performance.
[0128] At least one embodiment of the present disclosure further provides a data synchronization method for a data processing system including N hardware computing units.
[0129] For example, the N hardware computing units include a first hardware computing unit, and N is a positive integer greater than 1.
[0130] For the relevant description of the data processing system and the N hardware computing units, please refer to the relevant content of the aforementioned data processing system, and the repeated parts will be omitted.
[0131] Figure 5 The following is a schematic flow chart of a data synchronization method provided by at least one embodiment of the present disclosure. Figure 5 As shown, the data synchronization method provided by at least one embodiment of the present disclosure includes at least steps S10 and S20.
[0132] In step S10, in response to the need to obtain target data to perform a data processing operation, a synchronization indication signal is read from a synchronization cache block corresponding to the first hardware computing unit.
[0133] For example, the target data includes first data in the remaining N-1 hardware computing units except the first hardware computing unit among the N hardware computing units.
[0134] In step S20 , in response to the synchronization indication signal indicating that the first data in the N−1 hardware computing units is ready, the target data is read from the N−1 hardware computing units to the first hardware computing unit.
[0135] For example, the synchronization indication signal is determined by first signals that N-1 hardware computing units respectively send to the synchronization cache block when their respective first data preparation is completed.
[0136] For example, in some embodiments, the synchronization indication signal is determined by performing an accumulation operation on the received first signal. For example, the first signal is an atomic addition operation signal, such as an atomic add signal, and the synchronization indication signal is an atomic variable.
[0137] For example, step S20 may include: cyclically reading the synchronization indication signal, and in response to the value of the synchronization indication signal being equal to a preset value, reading the target data from N-1 hardware computing units to the first hardware computing unit, wherein the preset value is the sum of the accumulated value of the N-1 first signals sent by the N-1 hardware computing units and the initial value; resetting the synchronization indication signal to the initial value.
[0138] For example, the atomic addition operation signal includes accumulating 1 to the atomic variable, and the preset value is the sum of the initial value and N-1. For example, the initial value can be set to 0.
[0139] For the specific process of the data synchronization operation in this embodiment, please refer to the relevant description in the aforementioned data processing system, and the repeated parts will not be repeated here.
[0140] For example, in some other embodiments, the synchronization indication signal includes N-1 synchronization signals corresponding one to one to N-1 hardware computing units.
[0141] For example, step S20 may include: cyclically reading N-1 synchronization signals, updating any synchronization signal to the first signal in response to the target data being read from N-1 hardware computing units, wherein the read operation includes reading the first data in the corresponding hardware computing unit from the hardware computing unit corresponding to any synchronization signal, and resetting any synchronization signal.
[0142] For example, the first signal is used to write a first value to the synchronization signal, and in response to any synchronization signal being updated to the first signal, a read operation is performed, including: in response to the value of any synchronization signal being updated to the first value, a read operation is performed; and any synchronization signal is reset, including: updating any synchronization signal from the first value to the initial value, wherein the initial value and the first value are different.
[0143] For the specific process of the data synchronization operation in this embodiment, please refer to the relevant description in the aforementioned data processing system, and the repeated parts will not be repeated here.
[0144] For example, there is a data dependency relationship between N hardware computing units. For example, the data dependency relationship includes that target data used when the first hardware computing unit performs a data processing operation comes from N-1 hardware computing units.
[0145] For example, a data processing system is used to perform calculations for a neural network.
[0146] For example, the N hardware computing units correspond to different synchronization cache blocks respectively. For example, the N hardware computing units share the same synchronization cache block.
[0147] For example, types of hardware compute units include thread hardware, execution units, compute units, or programmable multiprocessors.
[0148] For example, the N hardware computing units may belong to the same data processor or may not all belong to the same data processor, or even the N hardware computing units may belong to different server nodes.
[0149] For example, the synchronization cache block is located in a memory area that can be accessed by N hardware computing units in the data processing system.
[0150] For more details about the N hardware computing units and the synchronous cache blocks, please refer to the relevant description of the aforementioned data processing system, and the repeated parts will not be repeated here.
[0151] In the data synchronization method provided by at least one embodiment of the present disclosure, a virtual synchronization cache block is provided to replace the hardware synchronization unit, and the synchronization behavior of the hardware synchronization unit is simulated in software, so that a large number of virtual synchronization units can be added, a large number of synchronization signals can be added, and the operator fusion strategy will not be limited by the number of synchronization signals, and the complex data dependency relationship in the fusion strategy can be supported. Operator fusion or optimization of any depth can be performed, reducing the restrictions on operator development, and can bring into play the ultimate performance of hardware. In addition, the synchronization behavior of the hardware synchronization unit is simulated in software, and the hardware connection relationship established by the hardware synchronization unit itself is not limited. The data synchronization operation is not limited to the synchronization between the same level, and the synchronization between different levels is exactly the same as the synchronization between the same level, which reduces the performance loss caused by using a high-level synchronization unit for low-level synchronization, and can even be extended to data synchronization operations between different processors or even different server nodes. Moreover, for data synchronization operations between different processors or even different server nodes, virtual synchronization units (synchronization cache blocks) can be directly used to execute, avoiding multiple activation overheads on the central processor side and improving processing performance.
[0152] Regarding the specific implementation process involved in the data synchronization method according to the embodiment of the present disclosure, reference can be made to the above combined Figure 2-4B The data processing system described according to some embodiments of the present disclosure will not be described again herein.
[0153] At least one embodiment of the present disclosure further provides an electronic device. Figure 6 A schematic block diagram of an electronic device provided for at least one embodiment of the present disclosure.
[0154] For example, Figure 6 As shown, the electronic device includes a processor 201, a communication interface 202, a memory 203 and a communication bus 204. The processor 201, the communication interface 202, and the memory 203 communicate with each other through the communication bus 204. The processor 201, the communication interface 202, the memory 203 and other components can also communicate through a network connection. The present disclosure does not limit the type and function of the network. It should be noted that Figure 6 The components of the electronic device shown are merely exemplary and non-limiting. The electronic device may also have other components according to actual application requirements.
[0155] For example, the memory 203 is used to store computer-readable instructions non-transiently. When the processor 201 is used to execute the computer-readable instructions, the data synchronization method described in any of the above embodiments is implemented. The specific implementation of each step of the data synchronization method and the related explanation content can be referred to the embodiment of the above data synchronization method, which will not be repeated here.
[0156] For example, other implementations of the data synchronization method implemented by the processor 201 executing computer-readable instructions stored in the memory 203 are the same as the implementations mentioned in the aforementioned method embodiment section, and will not be repeated here. The processor 201 can perform various actions and processes according to the program stored in the memory 203. Specifically, the processor 201 can be an integrated circuit with signal processing capabilities. A general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. For example, the processor here can refer to any data processor capable of data processing, such as one or more data processors in the aforementioned data processing system.
[0157] For example, the communication bus 204 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industrial Standard Architecture (EISA) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0158] For example, the communication interface 202 is used to implement communication between the electronic device and other devices.
[0159] For example, the processor 201 can control other components in the electronic device to perform the desired functions. The processor 201 can be a device with data processing capabilities and / or program execution capabilities, such as a central processing unit (CPU), a network processor (NP), a tensor processing unit (TPU), or a graphics processing unit (GPU); it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The central processing unit (CPU) can be an X86 or ARM architecture, etc.
[0160] For example, the memory 203 may include any combination of one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disk read-only memory (CD-ROM), USB memory, flash memory, etc. One or more computer-readable instructions may be stored on the computer-readable storage medium, and the processor 201 may execute the computer-readable instructions to implement various functions of the electronic device. Various applications and various data may also be stored in the storage medium.
[0161] For example, for a detailed description of the process of performing data synchronization on an electronic device, reference may be made to the relevant description in the embodiment of the data synchronization method, and repeated parts will not be repeated.
[0162] certainly, Figure 6 The architecture shown is only exemplary and can be omitted according to actual needs when implementing different devices. Figure 6 One or more components of an electronic device are shown.
[0163] Figure 7 A schematic diagram of a non-transitory computer-readable storage medium provided for at least one embodiment of the present disclosure. Figure 7 As shown, the storage medium 300 may be a non-transitory computer-readable storage medium, and one or more computer-readable instructions 301 may be non-transitory stored on the storage medium 300. For example, when the computer-readable instructions 301 are executed by a processor, one or more steps in the data synchronization method described above may be executed.
[0164] For example, the storage medium 300 may be applied to the above-mentioned electronic device. For example, the storage medium 300 may include a memory in the electronic device.
[0165] For example, the storage medium may include a memory card of a smart phone, a storage component of a tablet computer, a hard disk of a personal computer, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), flash memory, or any combination of the above storage media, or other applicable storage media.
[0166] For example, the description of the storage medium 300 may refer to the description of the memory in the embodiment of the electronic device, and the repeated parts will not be repeated.
[0167] Those skilled in the art will appreciate that the contents disclosed in this disclosure may be subject to various variations and improvements. For example, the various devices or components described above may be implemented by hardware, or by software, firmware, or a combination of some or all of the three.
[0168] In addition, although the present disclosure makes various references to certain units in the system according to embodiments of the present disclosure, any number of different units can be used and run on the client and / or server. The units are only illustrative, and different aspects of the system and method can use different units.
[0169] Flowcharts are used in this disclosure to illustrate the steps of the method according to the embodiments of the present disclosure. It should be understood that the preceding or following steps are not necessarily performed precisely in order. On the contrary, various steps may be processed in reverse order or simultaneously. At the same time, other operations may also be added to these processes.
[0170] Those skilled in the art will appreciate that all or part of the steps in the above method can be completed by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk. Optionally, all or part of the steps in the above embodiment can also be implemented using one or more integrated circuits. Accordingly, each module / unit in the above embodiment can be implemented in the form of hardware or in the form of a software functional module. The present disclosure is not limited to any particular form of combination of hardware and software.
[0171] Unless otherwise defined, all terms used herein have the same meaning as commonly understood by those of ordinary skill in the art to which the present disclosure belongs. It should also be understood that terms such as those defined in common dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant technology, and should not be interpreted in an idealized or highly formal sense, unless explicitly defined as such herein.
[0172] The above is an explanation of the present disclosure and should not be considered as a limitation thereof. Although several exemplary embodiments of the present disclosure are described, it will be readily understood by those skilled in the art that many modifications may be made to the exemplary embodiments without departing from the novel teachings and advantages of the present disclosure. Therefore, all such modifications are intended to be included within the scope of the present disclosure as defined in the claims. It should be understood that the above is an explanation of the present disclosure and should not be considered to be limited to the specific embodiments disclosed, and modifications to the disclosed embodiments and other embodiments are intended to be included within the scope of the appended claims. The present disclosure is defined by the claims and their equivalents.
Claims
1. A data processing system, comprising N hardware computing units, wherein the N hardware computing units include a first hardware computing unit, and there is a data dependency relationship between the N hardware computing units, where N is a positive integer greater than 1. The first hardware computing unit has a corresponding synchronization cache block for caching the synchronization indication signal. The first hardware computing unit is configured as: In response to the need to obtain target data to perform a data processing operation, reading the synchronization indication signal from the synchronization cache block, in, The target data includes first data in the remaining N-1 hardware computing units of the N hardware computing units except the first hardware computing unit, and In response to the synchronization indication signal indicating that the first data in the N-1 hardware computing units is ready, reading the target data from the N-1 hardware computing unit to the first hardware computing unit, wherein the synchronization indication signal is determined according to the first signal sent by the N-1 hardware computing units to the synchronization cache block when the first data of each of the N-1 hardware computing units is ready, The synchronization indication signal is determined according to the first signal, including: the synchronization indication signal is determined by performing an accumulation operation on the received first signal, or the synchronization indication signal includes N-1 synchronization signals corresponding to the N-1 hardware computing units one by one.
2. The data processing system according to claim 1, in, In response to the synchronization indication signal, the first signal is received and determined by performing an accumulation operation, When the first hardware computing unit executes, in response to the synchronization indication signal indicating that the first data in the N-1 hardware computing units is ready, reading the target data from the N-1 hardware computing unit to the first hardware computing unit, the following steps are performed: cyclically reading the synchronization indication signal, and in response to the value of the synchronization indication signal being equal to a preset value, reading the target data from the N-1 hardware computing units to the first hardware computing unit, wherein the preset value is the sum of the accumulated value of the N-1 first signals respectively sent by the N-1 hardware computing units and an initial value; The synchronization indication signal is reset to the initial value.
3. The data processing system according to claim 2, in, The first signal is an atomic addition operation signal, and the synchronization indication signal is an atomic variable. The atomic addition operation signal includes accumulating 1 to the atomic variable, The preset value is the sum of the initial value and N-1.
4. The data processing system according to claim 1, in, In response to the synchronization indication signal including N-1 synchronization signals corresponding to the N-1 hardware computing units one by one, When the first hardware computing unit executes, in response to the synchronization indication signal indicating that the first data in the N-1 hardware computing units is ready, reading the target data from the N-1 hardware computing unit to the first hardware computing unit, the following steps are performed: cyclically reading the N-1 synchronization signals, updating any one of the synchronization signals to the first signal in response to executing a reading operation until the target data is read from the N-1 hardware computing units, The reading operation includes reading the first data in the corresponding hardware computing unit from the hardware computing unit corresponding to any one of the synchronization signals, and resetting any one of the synchronization signals.
5. The data processing system according to claim 4, in, The first signal is used to write a first value to the synchronization signal, In response to any one of the synchronization signals being updated to the first signal, performing a read operation comprises: in response to the value of any one of the synchronization signals being updated to the first value, performing the read operation; Resetting any one of the synchronization signals includes: updating any one of the synchronization signals from the first value to an initial value, wherein the initial value is different from the first value.
6. The data processing system according to claim 1, in, The data dependency relationship includes that the target data used by the first hardware computing unit when executing the data processing operation comes from the N-1 hardware computing units.
7. The data processing system according to claim 6, in, The data processing system is used to perform calculations of a neural network, The neural network has a corresponding execution sequence, wherein the neural network includes a plurality of fusion layers, and the execution sequence represents a data dependency relationship and an execution order between the plurality of fusion layers in the neural network; The data dependency relationship between the N hardware computing units is determined based on the data dependency relationship between the fusion layers in the execution sequence.
8. The data processing system according to any one of claims 1 to 7, in, Each of the N-1 hardware computing units is configured as follows: In response to the first data of the hardware computing unit being stored in the corresponding storage component, the first signal is sent to the synchronization cache block, and then other instruction operations are continued to be executed.
9. The data processing system according to any one of claims 1 to 7, in, The N hardware computing units correspond to different synchronization cache blocks respectively.
10. The data processing system according to any one of claims 1 to 7, in, The N hardware computing units share the synchronization cache block.
11. The data processing system according to any one of claims 1 to 7, in, The types of hardware computing units include thread hardware, execution units, computation units or programmable multiprocessors.
12. The data processing system according to any one of claims 1 to 7, in, The data processing system includes at least one data processor, and the N hardware computing units belong to the same data processor.
13. The data processing system according to any one of claims 1 to 7, in, The data processing system includes multiple data processors, and the N hardware computing units do not all belong to the same data processor.
14. The data processing system according to any one of claims 1 to 7, in, The data processing system includes at least one server node, each server node includes at least one data processor, The N hardware computing units are distributed in the same server node or different server nodes.
15. The data processing system according to any one of claims 1 to 7, in, The synchronization cache block is located in a memory area accessible to the N hardware computing units in the data processing system.
16. The data processing system according to claim 15, in, In response to the N hardware computing units being of execution unit or thread hardware and belonging to the same data processor, the synchronization cache block is located in the shared memory of the same data processor, In response to the N hardware computing units being of a type of computing unit or a programmable multiprocessor and belonging to one data processor, the synchronization cache block is located in the global memory of the one data processor, In response to the N hardware computing units not all belonging to the same data processor, the synchronization cache block is located in the memory of the central processing unit, wherein the central processing unit is configured to manage all the data processors where the N hardware computing units are located.
17. A data synchronization method for a data processing system comprising N hardware computing units, in, The N hardware computing units include a first hardware computing unit, N is a positive integer greater than 1, The data synchronization method comprises: In response to the need to obtain target data to perform a data processing operation, a synchronization indication signal is read from a synchronization cache block corresponding to the first hardware computing unit, wherein the target data includes first data in the remaining N-1 hardware computing units of the N hardware computing units except the first hardware computing unit, In response to the synchronization indication signal indicating that the first data in the N-1 hardware computing units is ready, reading the target data from the N-1 hardware computing unit to the first hardware computing unit, wherein the synchronization indication signal is determined by the first signal sent by the N-1 hardware computing units to the synchronization cache block when the first data of each of the N-1 hardware computing units is ready, The synchronization indication signal is determined according to the first signal, including: the synchronization indication signal is determined by performing an accumulation operation on the received first signal, or the synchronization indication signal includes N-1 synchronization signals corresponding to the N-1 hardware computing units one by one.
18. The data synchronization method according to claim 17, in, In response to the synchronization indication signal, the first signal is received and determined by performing an accumulation operation, In response to the synchronization indication signal indicating that the first data in the N-1 hardware computing units is ready, reading the target data from the N-1 hardware computing unit to the first hardware computing unit includes: cyclically reading the synchronization indication signal, and in response to the value of the synchronization indication signal being equal to a preset value, reading the target data from the N-1 hardware computing units to the first hardware computing unit, wherein the preset value is the sum of the accumulated value of the N-1 first signals sent by the N-1 hardware computing units and an initial value; The synchronization indication signal is reset to the initial value.
19. The data synchronization method according to claim 17, in, In response to the synchronization indication signal including N-1 synchronization signals corresponding to the N-1 hardware computing units one by one, In response to the synchronization indication signal indicating that the first data in the N-1 hardware computing units is ready, reading the target data from the N-1 hardware computing unit to the first hardware computing unit includes: cyclically reading the N-1 synchronization signals, updating any one of the synchronization signals to the first signal in response to executing a reading operation until the target data is read from the N-1 hardware computing units, The reading operation includes reading first data in the corresponding hardware computing unit from the hardware computing unit corresponding to any one of the synchronization signals, and resetting any one of the synchronization signals.
20. An electronic device, include: processor; and A memory, wherein the memory stores a computer-readable code, and when the computer-readable code is executed by the processor, the data synchronization method according to any one of claims 17 to 19 is executed.
21. A non-transitory computer-readable storage medium having stored thereon instructions, It is characterized in that When the instructions are executed by a processor, the data synchronization method according to any one of claims 17 to 19 is implemented.
Citation Information
Patent Citations
Caching management unit and caching management method
CN101430663A
Calculation synchronization method, synchronization management device and calculation unit
CN113869484A
Task synchronization method, processor, device, storage medium and program product
CN116627614A
Synchronous control method, device and equipment
CN117573210A
Data processor, data processing method, electronic equipment and storage medium
CN118035618A
