Data processing device, instruction synchronization method, electronic device and storage medium

By introducing synchronization cache blocks and synchronization indication signals into data processing equipment, instruction timing synchronization between multiple hardware computing units is achieved, which solves the problem of low instruction synchronization efficiency in the existing technology and improves operator performance and computing efficiency.

CN118296084BActive Publication Date: 2024-09-20北京壁仞科技开发有限公司 +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410711364.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-09-20
Estimated Expiration
2044-06-04

AI Technical Summary

Technical Problem

It is difficult to achieve high efficiency in instruction synchronization between multiple hardware computing units of existing data processing equipment, resulting in the inability to trigger the multicast feature, which reduces operator performance, and the limited number of hardware synchronization units limits operator development and computing efficiency.

Method used

By introducing synchronization cache blocks into data processing equipment, instruction synchronization operations are simulated, synchronization cache blocks and synchronization indication signals are used to send synchronization signals between different hardware computing units, the number of synchronization units is expanded, more synchronization signals are provided, and instruction timing is realized. synchronous.

Benefits of technology

It improves multicast features and computing efficiency, reduces data loading delays and performance overhead, reduces restrictions on operator development, and enables the ultimate performance of hardware.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118296084B
    Figure CN118296084B
Patent Text Reader

Abstract

The present disclosure provides a data processing device, an instruction synchronization method, an electronic device, and a non-transitory computer-readable storage medium. The data processing device may include: N hardware computing units, the N hardware computing units have corresponding synchronization cache blocks, the synchronization cache blocks are used to cache synchronization indication signals, each hardware computing unit is configured to execute each instruction in sequence according to an instruction sequence, and each hardware computing unit is also configured to: in response to the execution of the previous instruction of the target instruction, before executing the target instruction, send a first signal to the synchronization cache block, wherein the target instruction is an instruction that the N hardware computing units need to execute synchronously; in response to the synchronization indication signal indicating that the N hardware computing units have executed the previous instruction of the target instruction, execute the target instruction. The data processing device simulates instruction synchronization operations through synchronization cache blocks, expands the number of synchronization units, and reduces restrictions on operator development.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular, to a data processing device, an instruction synchronization method, an electronic device and a storage medium. Background Art

[0002] In some data processing devices, multiple hardware computing units can be used to perform computing tasks in parallel. For example, one hardware computing unit can perform a part of a computing task, or each hardware computing unit can perform computing tasks on different input data in parallel. Since each hardware computing unit performs computing tasks in parallel, the instruction sequences of each hardware computing unit are usually roughly the same. In the process of executing computing tasks, instruction timing synchronization is often required. For example, each hardware computing unit needs to execute synchronously or execute a certain instruction within a very short window period to ensure the coordination between the hardware computing units and the order of operation. Summary of the invention

[0003] At least one embodiment of the present disclosure provides a data processing device, comprising N hardware computing units, N being a positive integer greater than 1, the N hardware computing units having corresponding synchronization cache blocks, the synchronization cache blocks being used to cache synchronization indication signals, each hardware computing unit being configured to execute each instruction in sequence according to an instruction sequence, and each hardware computing unit being further configured to: in response to completing the execution of a preceding instruction of a target instruction, before executing the target instruction, send a first signal to the synchronization cache block, wherein the target instruction is an instruction that the N hardware computing units need to execute synchronously; in response to the synchronization indication signal indicating that the N hardware computing units have completed the execution of the preceding instruction of the target instruction, execute the target instruction, wherein the synchronization indication signal is determined based on the first signal sent by the N hardware computing units to the synchronization cache block.

[0004] For example, in the data processing device provided by at least one embodiment of the present disclosure, the first signal is an atomic addition operation signal, the synchronization indication signal is determined by performing an accumulation operation on the received first signal, and the hardware computing unit executes in response to the synchronization indication signal indicating that the N hardware computing units have completed executing the previous instruction of the target instruction. When executing the target instruction, it includes performing the following operations: cyclically reading the synchronization indication signal, and executing the target instruction in response to the value of the synchronization indication signal being equal to a preset value; resetting the synchronization indication signal.

[0005] For example, in the data processing device provided by at least one embodiment of the present disclosure, the preset value includes a first value or an initial value, wherein the first value is the sum of the accumulated value of the N first signals sent by the N hardware computing units and the initial value; resetting the synchronization indication signal includes: resetting the synchronization indication signal to the initial value.

[0006] For example, in the data processing device provided by at least one embodiment of the present disclosure, the synchronization indication signal is an atomic variable, the atomic addition operation signal includes accumulating 1 to the atomic variable, and the first value is the sum of the initial value and N.

[0007] For example, in a data processing device provided in at least one embodiment of the present disclosure, the target instruction includes a data loading instruction, and the data loading instruction is used to load the same block of target data from the memory, and the multicast feature is triggered when the N hardware computing units execute the data loading instruction simultaneously.

[0008] For example, in the data processing device provided by at least one embodiment of the present disclosure, after the N hardware computing units all execute the target instruction, one of the N hardware computing units loads the target data from the memory into the one hardware computing unit, and broadcasts the target data to the remaining N-1 hardware computing units.

[0009] For example, in a data processing device provided by at least one embodiment of the present disclosure, the target instruction includes a logic operation instruction and an operation instruction, the logic operation instruction is used to perform arithmetic and logic operations in a cache, the operation instruction is the next instruction executed after the logic operation instruction in the instruction sequence, the number of synchronization cache blocks corresponding to the N hardware computing units is 2, including a first synchronization cache block and a second synchronization cache block, the synchronization indication signal includes a first synchronization indication signal and a second synchronization indication signal, the first synchronization cache block is used to cache the first synchronization indication signal, the second synchronization cache block is used to cache the second synchronization indication signal, the first synchronization indication signal is used to indicate whether the N hardware computing units have all executed the previous instruction of the logic operation instruction, and the second synchronization indication signal is used to indicate whether the N hardware computing units have all executed the logic operation instruction.

[0010] For example, in the data processing device provided by at least one embodiment of the present disclosure, in response to the target instruction being the logic operation instruction, the hardware computing unit executes an instruction in response to completing the execution of a previous instruction of the target instruction, and before executing the target instruction, sends a first signal to the synchronization cache block, including the following operations: in response to completing the execution of a previous instruction of the logic operation instruction according to the instruction sequence, before executing the logic operation instruction, sends the first signal to the first synchronization cache block; the hardware computing unit executes an instruction in response to the synchronization indication signal indicating that the N hardware computing units have completed the execution of the previous instruction of the target instruction, and when executing the target instruction, includes the following operations: cyclically reading the first synchronization indication signal, and executing the logic operation instruction in response to the value of the first synchronization indication signal being equal to a preset value, wherein the first synchronization indication signal is determined based on the first signal sent by the N hardware computing units to the first synchronization cache block; resetting the first synchronization indication signal.

[0011] For example, in a data processing device provided by at least one embodiment of the present disclosure, in response to the target instruction being the operation instruction, the hardware computing unit executes an instruction in response to the execution of a previous instruction of the target instruction, and before executing the target instruction, sends a first signal to the synchronization cache block, including the following operations: in response to the execution of the logic operation instruction, sends the first signal to the second synchronization cache block before executing the operation instruction; the hardware computing unit executes an instruction in response to the synchronization indication signal indicating that the N hardware computing units have all executed the previous instruction of the target instruction, and when executing the target instruction, includes the following operations: cyclically reads the second synchronization indication signal, and executes the operation instruction in response to the value of the second synchronization indication signal being equal to a preset value, wherein the second synchronization indication signal is determined based on the first signal sent by the N hardware computing units to the second synchronization cache block; and resets the second synchronization indication signal.

[0012] For example, in the data processing device provided by at least one embodiment of the present disclosure, the arithmetic logic operation includes reduction or accumulation.

[0013] For example, in the data processing device 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 the data processing device 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.

[0015] For example, in the data processing device 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, the synchronization cache block is located in the shared memory of the data processing device, and in response to the types of the N hardware computing units being computing units or programmable multiprocessors, the synchronization cache block is located in the global memory of the data processing device.

[0016] At least one embodiment of the present disclosure provides an instruction synchronization method for a data processing device including N hardware computing units, where N is a positive integer greater than 1, and the instruction synchronization method comprises: in response to each hardware computing unit executing the previous instruction of a target instruction according to an instruction sequence, before executing the target instruction, sending a first signal to the synchronization cache block, wherein the target instruction is an instruction that the N hardware computing units need to execute synchronously; in response to the synchronization indication signal indicating that the N hardware computing units have executed the previous instruction of the target instruction, the N hardware computing units execute the target instruction synchronously, wherein the synchronization indication signal is determined based on the first signal sent by the N hardware computing units to the synchronization cache block.

[0017] For example, in the instruction synchronization method provided by at least one embodiment of the present disclosure, the first signal is an atomic addition operation signal, 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 N hardware computing units have all executed the previous instruction of the target instruction, the target instruction is executed, including: cyclically reading the synchronization indication signal, and in response to the value of the synchronization indication signal being equal to a preset value, executing the target instruction; resetting the synchronization indication signal.

[0018] For example, in the instruction synchronization method provided in at least one embodiment of the present disclosure, the preset value includes a first value or an initial value, the first value is the sum of the accumulated value of the N first signals sent by the N hardware computing units and the initial value; resetting the synchronization indication signal includes: resetting the synchronization indication signal to the initial value.

[0019] For example, in the instruction synchronization method provided in at least one embodiment of the present disclosure, the target instruction includes a data loading instruction, and the data loading instruction is used to load the same block of target data from the memory. The multicast feature is triggered when the N hardware computing units execute the data loading instruction simultaneously. After making the N hardware computing units execute the target instruction synchronously, the instruction synchronization method also includes: making one of the N hardware computing units load the target data from the memory into the one hardware computing unit, and broadcasting the target data to the remaining N-1 hardware computing units.

[0020] For example, in the instruction synchronization method provided in at least one embodiment of the present disclosure, the target instruction includes a logic operation instruction and an operation instruction, the logic operation instruction is used to perform arithmetic and logic operations in the cache, and the operation instruction is the next instruction executed after the logic operation instruction in the instruction sequence. The instruction synchronization method includes: performing a first instruction synchronization before each hardware computing unit executes the logic operation instruction according to the instruction sequence, and performing a second instruction synchronization before each hardware computing unit executes the operation instruction according to the instruction sequence.

[0021] 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 instruction synchronization method as described in any embodiment of the present disclosure is executed.

[0022] 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 instruction synchronization method as described in any embodiment of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] 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.

[0024] Figure 1 A schematic structural diagram of a general purpose graphics processing unit (GPGPU) is shown;

[0025] Figure 2 A schematic block diagram of a data processing device provided by at least one embodiment of the present disclosure is shown;

[0026] Figure 3 A schematic diagram of an instruction synchronization process provided by at least one embodiment of the present disclosure;

[0027] Figure 4 A schematic diagram of a process of instruction synchronization provided by an embodiment of the present disclosure;

[0028] Figure 5 A schematic diagram of a process of instruction synchronization provided by another embodiment of the present disclosure;

[0029] Figure 6 A schematic flow chart of an instruction synchronization method provided by at least one embodiment of the present disclosure;

[0030] Figure 7A schematic block diagram of an electronic device provided for at least one embodiment of the present disclosure;

[0031] Figure 8 A schematic diagram of a non-transitory computer-readable storage medium provided for at least one embodiment of the present disclosure. DETAILED DESCRIPTION

[0032] 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.

[0033] 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.

[0034] 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.

[0035] Figure 1 A schematic structural diagram of a general-purpose graphics processing unit (GPGPU) is shown.

[0036] 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 1The 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.

[0037] 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.

[0038] 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.

[0039] In each compute unit, the warp scheduling / dispatching module ( Figure 1The 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.

[0040] AI chips can be implemented in the form of graphics processing units (GPUs), general-purpose graphics processing units, tensor processing units (TPUs), data processing units (DPUs), etc. AI chips can be used to implement AI models, such as artificial neural networks.

[0041] Operators in AI models usually refer to the basic mathematical operations or operations used in the network layer of the model. These operators are used to build the various layers and components of the AI ​​model to achieve data transmission, conversion and calculation. They are the basic building blocks of the AI ​​model, defining 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, which reflects the calculation order of different operations in the AI ​​model. By combining these operators, complex and powerful AI models can be built to handle various complex tasks and data.

[0042] To improve the operator performance of artificial intelligence models, artificial intelligence chips usually have broadcast and multicast features. When all threads in the same warp read the same data in the group shared memory (GSM), if each thread executes an instruction to read the data, it is necessary to perform multiple read operations from the memory, increasing the instruction execution delay and reducing the operator performance. At this time, the multicast feature can be triggered by making each thread execute the data loading instruction synchronously. For example, the data loading operation for the same block of data only needs to load the data once from the shared memory and then broadcast the data to all threads to improve the performance of the operator. Since programmable multiprocessors are independent of each other, in order to enable the multicast feature, it is necessary to perform timing synchronization on multiple programmable multiprocessors when multiple programmable multiprocessors read the same block of data.

[0043] The cache of the artificial intelligence chip (such as the global cache) can provide computing functions to perform some arithmetic logic unit (ALU). For example, arithmetic logic operations can include various arithmetic operations, logical operations, etc., such as addition, subtraction, multiplication, division, bit operations, comparison, accumulation, reduction, etc. For example, for reduction or accumulation calculations, it is necessary to perform accumulation operations on the calculation results, such as using the in-memory calculation function of the cache to accumulate the calculation results in the cache. Due to the limited space of the cache, if the data A to be accumulated is not in the cache, the data A will be moved from the memory to the cache, and then the calculation result B will be accumulated on A. This algorithm requires that data A can remain in the cache until all batches of calculation results are accumulated. Otherwise, it is necessary to frequently move data A from the memory to the cache, affecting the performance of the operator. However, these calculation results may come from different programmable multiprocessors. If some programmable multiprocessors have completed calculation and accumulation, they will continue to perform other operations, which may occupy cache space and squeeze data A out of the cache. At this time, data A needs to be moved from the memory to the cache, affecting the performance of other programmable multiprocessors that have not yet completed the accumulation operation. Therefore, in this case, timing synchronization is usually required between multiple programmable multiprocessors.

[0044] Instruction timing synchronization is generally achieved through a hardware synchronization unit set in the processor. The hardware synchronization unit is provided with a preset number of instruction synchronization signals for execution units at different levels. For example, 10 instruction synchronization signals are provided for synchronization between computing units, and 10 instruction synchronization signals are provided for synchronization between programmable multiprocessors. Instruction 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, instruction synchronization signals for synchronization between computing units are required, and instruction synchronization signals for synchronization between execution units or thread hardware cannot be used. Although instruction synchronization signals for synchronization between programmable multiprocessors 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 programmable multiprocessors.

[0045] Since synchronization operations rely on the hardware synchronization unit provided by the hardware natively, when there are fewer hardware synchronization units, it will greatly restrict operator development. Due to the limited number of synchronization signals provided by the hardware synchronization unit, some instruction synchronization scenarios cannot be supported, such as the inability to enable the multicast feature, which requires multiple data loading operations, reducing operator efficiency, or frequent data transfer from memory to cache, resulting in reduced computing efficiency, etc., making it difficult to maximize the performance of the hardware.

[0046] At least one embodiment of the present disclosure provides a data processing device, an instruction synchronization method, an electronic device, and a non-transitory computer-readable storage medium. The data processing device may include: N hardware computing units, N is a positive integer greater than 1, the N hardware computing units have corresponding synchronization cache blocks, the synchronization cache blocks are used to cache synchronization indication signals, each hardware computing unit is configured to execute each instruction in sequence according to the instruction sequence, and each hardware computing unit is further configured to: in response to the execution of the previous instruction of the target instruction, before executing the target instruction, send a first signal to the synchronization cache block, wherein the target instruction is an instruction that the N hardware computing units need to execute synchronously; in response to the synchronization indication signal indicating that the N hardware computing units have all executed the previous instruction of the target instruction, execute the target instruction, wherein the synchronization indication signal is determined according to the first signal sent by the N hardware computing units to the synchronization cache block.

[0047] In the data processing device provided by at least one embodiment of the present disclosure, instruction synchronization operation is simulated by synchronization cache blocks, so that synchronization signals are sent between different hardware computing units using synchronization cache blocks and synchronization indication signals, the number of synchronization units is expanded, and 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 instruction synchronization.

[0048] Figure 2 A schematic block diagram of a data processing device provided by at least one embodiment of the present disclosure is shown.

[0049] like Figure 2 As shown, the data processing device 100 includes N hardware computing units 101, where N is a positive integer greater than 1.

[0050] For example, N hardware computing units need to synchronize instructions. For example, for a certain target instruction, N hardware computing units need to execute synchronously, where synchronization includes N hardware computing units executing the target instruction at the same time, or N hardware computing units executing the target instruction within a very short window period, that is, the interval between N hardware computing units executing the target instruction that needs to be executed synchronously is very short.

[0051] It should be noted that the data processing device may further include more hardware computing units, and the N hardware computing units are the hardware computing units that need to perform instruction synchronization among the hardware computing units included in the data processing device.

[0052] The data processing device may be a central processing unit, a graphics processing unit, a general-purpose graphics processing unit, a tensor processor, a neural network processor, etc. The present disclosure does not specifically limit the type of data processing device.

[0053] For example, the data processing device may be a computer or an integrated circuit chip, etc. The present disclosure does not specifically limit the hardware structure and hardware form of the data processing device.

[0054] For example, a data processing device may include multiple levels of hardware computing units. For example, taking the data processing device as a graphics processor or a general-purpose graphics processor as an example, 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 aforementioned Figure 1 The relevant description will not be repeated here.

[0055] Data processing devices of other structures or types may have different types of hardware computing units, and the present disclosure does not impose any specific limitation on this.

[0056] 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 streaming processor clusters, etc. The present disclosure does not impose specific restrictions on this. In the present disclosure, there is no restriction on instruction synchronization only at the same level, and instruction synchronization can also be performed between high-level and low-level hardware computing units.

[0057] For example, Figure 2 As shown, N hardware computing units 101 have corresponding synchronization cache blocks 102, and the synchronization cache blocks are used to cache synchronization indication signals.

[0058] For example, N hardware computing units 101 share the same synchronization cache block 102 , that is, the N hardware computing units all use the same synchronization cache block to perform instruction synchronization operations.

[0059] For example, the synchronization cache block is located in a memory area accessible to N hardware computing units in the data processing device 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 as a virtual synchronization unit, the number of synchronization units can be greatly expanded, reducing the restrictions on operator development.

[0060] For example, in response to the type of the N hardware computing units being execution units or thread hardware, the synchronization cache block is located in a shared memory of the data processing device.

[0061] 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 the instruction synchronization efficiency compared to using other memory areas (such as global memory).

[0062] For example, when the hardware computing unit is a computing unit or a programmable multiprocessor (e.g., a streaming processor cluster), Figure 1 As shown, they can all access the global memory in the data processing device, so a memory area can be allocated from the global memory as a synchronization cache block.

[0063] Different from the hardware connection relationship that has been established by the hardware synchronization unit itself, the use of synchronization cache blocks for instruction 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.

[0064] 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.

[0065] For example, synchronization cache blocks may be allocated to hardware computing units that need to perform instruction synchronization in computing tasks. For example, different numbers of synchronization cache blocks may be allocated to these hardware computing units according to different instructions to be synchronized. For example, referring to the content described below, for a data loading instruction that is expected to trigger a multicast feature, one synchronization cache block may be allocated to the hardware computing unit that needs to perform the instruction synchronization. For a logic operation instruction that performs arithmetic and logic operations in the cache, two synchronization cache blocks may be allocated to the hardware computing unit that needs to perform the instruction synchronization.

[0066] For example, each hardware computing unit is configured to execute each instruction in sequence according to the instruction sequence.

[0067] For example, for any hardware computing unit, a series of instructions are executed in order according to its instruction sequence to guide the hardware computing unit to perform a specific operation or task. For example, the instruction sequence usually includes operations such as loading data, processing data, storing data, and controlling program flow. The instruction sequence includes multiple instructions, each of which tells the hardware computing unit to perform a specific action, such as addition, subtraction, comparison, jump, etc. When the computer executes a program, it executes these instructions one by one in the order of the instruction sequence until the program ends or encounters a specific interrupt or exception. The instruction sequence can be written directly by the programmer, or it can be written in a high-level programming language and converted into machine language instructions by a compiler.

[0068] For example, the N hardware computing units may have the same instruction sequence or different instruction sequences. For example, when the N hardware computing units are configured to perform the same computing task and each hardware computing unit is configured to perform a portion of the computing task, the N hardware computing units may have the same instruction sequence.

[0069] For example, each hardware computing unit can be configured to: in response to executing the previous instruction of the target instruction, before executing the target instruction, send a first signal to the synchronization cache block, wherein the target instruction is an instruction that N hardware computing units need to execute synchronously; in response to the synchronization indication signal indicating that the N hardware computing units have all executed the previous instruction of the target instruction, execute the target instruction, wherein the synchronization indication signal is determined based on the first signal sent to the synchronization cache block by the N hardware computing units.

[0070] For example, the target instruction is an instruction that N hardware computing units need to execute synchronously. For the N hardware computing units, the target instruction can be the same instruction, such as the same instruction that the N hardware computing units need to execute synchronously, or the target instruction can be different instructions for different hardware computing units, such as different instructions that the N hardware computing units need to execute synchronously. The present disclosure does not impose specific limitations on this.

[0071] For example, after a hardware computing unit has executed the previous instruction of a target instruction, it is about to execute a target instruction that requires instruction timing synchronization. Before executing the target instruction, the hardware computing unit first sends a first signal to the synchronization cache block, then waits and cyclically reads the synchronization indication signal, and executes the target instruction after the synchronization indication signal indicates that N hardware computing units have executed the previous instruction of the target instruction. In this way, it can be ensured that N hardware computing units execute the target instruction at the same time or almost at the same time (within a very short window period), realizing instruction timing synchronization of the target instruction.

[0072] For example, the synchronization indication signal indicates that N hardware computing units are about to execute the target instruction, that is, N hardware computing units have completed executing the instruction preceding the target instruction and can start executing the target instruction.

[0073] 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. 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 send the first signal at the same time.

[0074] Of course, the first signal may also be in other signal forms capable of performing accumulation operations, and the present disclosure does not impose any specific limitation on this.

[0075] The operations performed by each hardware computing unit are basically the same, so the specific operations of any hardware computing unit performing instruction synchronization are described in detail below.

[0076] For example, when the hardware computing unit executes in response to a synchronization indication signal indicating that N hardware computing units have completed executing the previous instruction of the target instruction, the following operations are included: cyclically reading the synchronization indication signal, and executing the target instruction in response to the value of the synchronization indication signal being equal to a preset value; resetting the synchronization indication signal.

[0077] For example, the preset value includes a first value or an initial value, wherein the first value is the sum of the accumulated value of N first signals sent by N hardware computing units and the initial value; resetting the synchronization indication signal includes: resetting the synchronization indication signal to the initial value.

[0078] For example, in a specific example, the atomic addition operation signal includes accumulating 1 to the synchronization indication signal whose data format is an atomic variable, and the first value is the sum of the initial value and N.

[0079] For example, the initial value may be set to 0.

[0080] For example, the synchronization indication signal is an atomic variable, which is an initial value a in the initial state. When any hardware computing unit executes the previous instruction of the target instruction and before executing the target instruction, it sends a first signal to the synchronization cache block 102. After the synchronization cache block 102 receives a first signal, the synchronization indication signal accumulates b until the first signals sent by N hardware computing units 101 are received. The value of the synchronization indication signal is updated to a+N×b, where a and b can be integers or floating-point numbers.

[0081] For example, each hardware computing unit keeps reading the synchronization indication signal in a loop to determine whether the value of the synchronization indication signal is a+N×b. If the value of the synchronization indication signal is not a+N×b, it continues to wait. When the value of the synchronization indication signal is a+N×b, it indicates that the N hardware computing units 101 have all executed the previous instruction of the target instruction and are about to execute the target instruction. At this time, each hardware computing unit can execute the target instruction.

[0082] Afterwards, the hardware computing unit 101 resets the synchronization indication signal to the initial value a to perform the next round of instruction synchronization.

[0083] Therefore, the behavior of the hardware synchronization unit is simulated from the software to synchronize instructions between different hardware computing units, thereby increasing a large number of synchronization signals and providing a large number of synchronization signals for instruction synchronization scenarios, thereby being able to bring into play the ultimate performance of the hardware.

[0084] Figure 3 A schematic diagram of an instruction synchronization process provided by at least one embodiment of the present disclosure.

[0085] like Figure 3 As shown, for any hardware computing unit, each instruction is executed in sequence according to the instruction sequence. After the previous instruction of the target instruction is executed, the following is executed: Figure 3 The instructions in the dashed box are synchronous operations.

[0086] Specifically, Figure 3 As shown, after executing the previous instruction of the target instruction and before executing the target instruction, a first signal, such as an atomic add signal, is first sent to the synchronization cache block to make the synchronization indication signal perform an accumulation operation. After that, the synchronization indication signal in the synchronization cache block is read cyclically.

[0087] When the value of the synchronization indication signal is equal to a preset value, such as a first value or an initial value, it indicates that the N hardware computing units have all run to the point before executing the target instruction (the N hardware computing units have all executed the instruction before the target instruction). At this time, the target instruction is executed to achieve instruction timing synchronization between the N hardware computing units. In addition, the synchronization indication signal is reset to the initial value to complete a round of instruction synchronization operation. After that, subsequent instructions can be executed according to the instruction sequence.

[0088] For example, in some embodiments, when the hardware computing unit reads that the value of the synchronization indication signal is a first value, the target instruction can be executed and the synchronization indication signal can be reset to an initial value. When the hardware computing unit reads that the value of the synchronization indication signal is an initial value, only the target instruction can be executed without resetting the synchronization indication signal to the initial value again.

[0089] Two scenarios of performing instruction timing synchronization using a data processing device provided by at least one embodiment of the present disclosure are described in detail below.

[0090] For example, in some embodiments, the target instruction includes a data loading instruction (Load instruction), and the data loading instruction is used to load the same block of target data from the memory. For example, when N hardware computing units execute the data loading instruction at the same time, the multicast feature can be triggered.

[0091] For example, after all N hardware computing units execute the target instruction, one of the N hardware computing units loads the target data from the memory into a hardware computing unit, and broadcasts the target data to the remaining N-1 hardware computing units.

[0092] That is to say, after triggering the multicast feature, in essence, only the data loading instruction of one hardware computing unit is actually executed, and the target data is read from the memory. Other hardware computing units obtain the target data by broadcasting the target data through the hardware computing unit, so that only one data loading is performed, reducing the delay overhead and performance overhead caused by data loading, and improving the operator performance.

[0093] Figure 4 A schematic diagram of the instruction synchronization process provided by an embodiment of the present disclosure.

[0094] like Figure 4 As shown, the N hardware computing units that need to perform instruction synchronization include hardware computing unit 1, hardware computing unit 2, . . . , hardware computing unit N.

[0095] For each hardware computing unit, each instruction is executed in sequence according to the instruction sequence. Figure 4 As shown, the time at which N hardware computing units finish executing the previous instruction (instruction 1) of the data loading instruction (target instruction) is different. If each hardware computing unit directly starts to execute the data loading instruction without performing instruction synchronization, the multicast feature cannot be enabled.

[0096] For example, referring to the process described above, for each hardware computing unit, after executing instruction 1, before executing the data loading instruction, a first signal is sent to the synchronization cache block, for example, the first signal is an atomic addition operation signal of accumulation 1, so as to perform an accumulation operation on the synchronization indication signal. Afterwards, the synchronization indication signal is read cyclically, and when the value of the synchronization indication signal is N or 0 (for example, the initial value is 0), the data loading instruction is executed.

[0097] Therefore, each hardware computing unit can start executing the data loading instruction after N hardware computing units have executed instruction 1, so that the data loading instruction can be started at the same time or almost at the same time, thereby enabling multicast characteristics and improving operator performance.

[0098] For example, in some other embodiments, the target instruction includes a logic operation instruction and an operation instruction. For example, the logic operation instruction can be used as the target instruction, and an instruction synchronization is performed according to the instruction synchronization process provided in the above embodiment. For example, the operation instruction can be used as the target instruction, and an instruction synchronization is performed according to the instruction synchronization process provided in the above embodiment.

[0099] The logic operation instruction is used to perform an arithmetic logic operation in the cache, for example, the arithmetic logic operation may include reduction or accumulation. For example, the logic operation instruction executed by N hardware computing units is used to perform the same arithmetic logic operation, such as providing addends for accumulation operations, etc. For example, the logic operation instruction may be a reduction instruction or an accumulation instruction performed in the global cache.

[0100] The operation instruction is the next instruction executed immediately after the logic operation instruction in the instruction sequence. For different hardware computing units, the operation instruction can be the same instruction or different instructions.

[0101] When executing a logical operation instruction, in order to avoid the logical operation result (for example, the accumulation result) being flushed out of the cache to the memory due to other operations performed by some hardware computing units after the accumulation, and multiple data loading from the memory occurs, an instruction synchronization is set before executing the logical operation instruction, and another instruction synchronization is performed after executing the logical operation instruction and before executing the operation instruction. In this way, no other operations will occur during the execution of the logical operation instruction, thereby avoiding flushing the logical operation result out of the cache to the memory, avoiding data loading from the memory, reducing the delay and performance loss caused by data reading, and improving operator performance.

[0102] For example, in this embodiment, two synchronization cache blocks are provided for two instruction synchronizations respectively, and the two synchronization cache blocks cache different synchronization indication signals respectively.

[0103] For example, the number of synchronization cache blocks corresponding to the N hardware computing units is 2, including a first synchronization cache block and a second synchronization cache block, and the synchronization indication signal includes a first synchronization indication signal and a second synchronization indication signal.

[0104] For example, the first synchronization cache block is used to cache the first synchronization indication signal, and the second synchronization cache block is used to cache the second synchronization indication signal.

[0105] For example, the first synchronization indication signal is used to indicate whether the N hardware computing units have all executed the previous instruction of the logic operation instruction. For example, the second synchronization indication signal is used to indicate whether the N hardware computing units have all executed the logic operation instruction.

[0106] For example, when a logic operation instruction is used as a target instruction, the hardware computing unit executes in response to the previous instruction of the target instruction being executed, and before executing the target instruction, sends a first signal to the synchronization cache block, including the following operations: in response to the previous instruction of the logic operation instruction being executed according to the instruction sequence, before executing the logic operation instruction, sends a first signal to the first synchronization cache block; the hardware computing unit executes in response to the synchronization indication signal indicating that N hardware computing units have completed the previous instruction of the logic operation instruction, when executing the target instruction, including the following operations: cyclically read the first synchronization indication signal, and in response to the value of the first synchronization indication signal being equal to a preset value, execute the logic operation instruction, wherein the first synchronization indication signal is determined based on the first signal sent to the first synchronization cache block by the N hardware computing units; and reset the first synchronization indication signal.

[0107] For example, when an operation instruction is used as a target instruction, the hardware computing unit executes an instruction in response to the execution of the previous instruction of the target instruction, and before executing the target instruction, sends a first signal to the synchronization cache block, including the following operations: in response to the execution of the logic operation instruction, before executing the operation instruction, sends a first signal to the second synchronization cache block; the hardware computing unit executes an instruction in response to the synchronization indication signal indicating that N hardware computing units have completed the execution of the previous instruction of the logic operation instruction, and when executing the target instruction, includes the following operations: cyclically read the second synchronization indication signal, and in response to the value of the second synchronization indication signal being equal to a preset value, execute the operation instruction, wherein the second synchronization indication signal is determined based on the first signal sent by the N hardware computing units to the second synchronization cache block; and reset the second synchronization indication signal.

[0108] Figure 5 A schematic diagram of the instruction synchronization process provided by another embodiment of the present disclosure.

[0109] like Figure 5 As shown, the N hardware computing units that need to perform instruction synchronization include hardware computing unit 1, hardware computing unit 2, . . . , hardware computing unit N.

[0110] For each hardware computing unit, each instruction is executed in sequence according to the instruction sequence. Figure 5 As shown, the time taken by N hardware computing units to complete the execution of the logic operation instructions is different. If each hardware computing unit directly starts to execute the operation instruction without performing instruction synchronization, the logic operation result may be flushed out of the cache, resulting in multiple data loading operations from the memory.

[0111] like Figure 5 As shown, in this embodiment, instruction synchronization is performed twice. First, instruction timing synchronization is performed before each hardware computing unit executes a logic operation instruction, and then instruction timing synchronization is performed again before each computing unit executes an operation instruction, so that no other operations exist during the execution of the logic operation instruction, and the operation result will not be flushed out of the cache, thereby reducing the delay caused by multiple data loading operations from the memory and improving the operator performance.

[0112] For example, in the first instruction synchronization, the first synchronization cache block and the first synchronization indication signal are used to synchronize the instruction timing. Referring to the process described above, for each hardware computing unit, after executing instruction 1, before executing the logic operation instruction, a first signal is sent to the first synchronization cache block, for example, the first signal is an atomic addition operation signal of accumulation 1, so as to perform an accumulation operation on the first synchronization indication signal. Afterwards, the first synchronization indication signal is read cyclically, and when the value of the first synchronization indication signal is N or 0 (for example, the initial value is 0), the logic operation instruction is executed.

[0113] For example, in the second instruction synchronization, the second synchronization cache block and the second synchronization indication signal are used to synchronize the instruction timing. Referring to the process described above, for each hardware computing unit, after executing the logic operation instruction, before executing the operation instruction, a first signal is sent to the second synchronization cache block, for example, the first signal is an atomic addition operation signal that accumulates 1, so as to perform an accumulation operation on the second synchronization indication signal. Afterwards, the second synchronization indication signal is read cyclically, and when the value of the second synchronization indication signal is N or 0 (for example, the initial value is 0), the operation instruction is executed.

[0114] Of course, depending on the scenario, a third synchronization cache block and a third synchronization indication signal may also be provided. The process of performing instruction timing synchronization with more cache blocks and synchronization indication signals is similar to the foregoing content and will not be repeated here.

[0115] 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, and a large number of synchronization signals can be added to the instruction synchronization scenario, which can bring into play the ultimate performance of the 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 instruction synchronization operation is not limited to 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.

[0116] At least one embodiment of the present disclosure further provides an instruction synchronization method for a data processing device including N hardware computing units.

[0117] For the relevant description about the data processing device and the N hardware computing units, please refer to the relevant content of the aforementioned data processing device, and the repeated parts will not be repeated.

[0118] Figure 6 A schematic flow chart of an instruction synchronization method provided by at least one embodiment of the present disclosure. Figure 6 As shown, the instruction synchronization method provided by at least one embodiment of the present disclosure includes at least steps S10 and S20.

[0119] In step S10, for each hardware computing unit, in response to the hardware computing unit executing the previous instruction of the target instruction according to the instruction sequence, before executing the target instruction, the hardware computing unit sends a first signal to the synchronization cache block.

[0120] For example, the target instruction is an instruction that N hardware computing units need to execute synchronously. For the content of the target instruction, reference can be made to the relevant introduction of the aforementioned data processing device, and the repeated parts will not be repeated.

[0121] In step S20, in response to the synchronization indication signal indicating that the N hardware computing units have all completed executing the previous instruction of the target instruction, the N hardware computing units synchronously execute the target instruction.

[0122] For example, the synchronization indication signal is determined according to the first signal sent by the N hardware computing units to the synchronization cache block.

[0123] 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.

[0124] 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, executing the target instruction; and resetting the synchronization indication signal.

[0125] For example, the preset value includes a first value or an initial value, and the first value is the sum of the accumulated value of N first signals sent by N hardware computing units and the initial value. For example, resetting the synchronization indication signal includes: resetting the synchronization indication signal to the initial value.

[0126] For the specific process of the instruction synchronization operation in this embodiment, reference may be made to the related description in the aforementioned data processing device, and the repeated parts will not be repeated here.

[0127] For example, the target instruction includes a data loading instruction, and the data loading instruction is used to load the same block of target data from the memory, that is, the data loading instructions executed by N hardware computing units are for loading the same block of target data from the memory. When the N hardware computing units execute the data loading instructions at the same time, the multicast feature is triggered.

[0128] For example, after enabling N hardware computing units to synchronously execute the target instruction, the instruction synchronization method further includes: enabling one of the N hardware computing units to load the target data from the memory into the one hardware computing unit, and broadcasting the target data to the remaining N-1 hardware computing units.

[0129] Before executing the data loading instruction, an instruction synchronization is performed according to the instruction synchronization method described in at least one embodiment of the present disclosure to trigger the multicast feature. After the multicast feature is triggered, only the data loading instruction of one hardware computing unit is actually executed, and the target data is read from the memory, and other hardware computing units obtain the target data by broadcasting the target data through the hardware computing unit, so that only one data loading is performed, reducing the delay overhead and performance overhead caused by data loading, and improving the operator performance.

[0130] For the specific instruction synchronization process when the target instruction is a data loading instruction, reference may be made to the relevant description in the aforementioned data processing device, and the repeated parts will not be repeated here.

[0131] For example, the target instruction includes a logic operation instruction and an operation instruction. For example, the logic operation instruction is used to perform an arithmetic logic operation in the cache, and the arithmetic logic operation may include reduction or accumulation. For example, the operation instruction is the next instruction executed immediately after the logic operation instruction in the instruction sequence.

[0132] In this scenario, two instruction synchronizations are required. For example, the first instruction synchronization is performed before each hardware computing unit executes the logic operation instruction according to the instruction sequence, and the second instruction synchronization is performed before each hardware computing unit executes the operation instruction according to the instruction sequence.

[0133] For example, in this embodiment, two synchronization cache blocks are provided for two instruction synchronizations respectively, and the two synchronization cache blocks cache different synchronization indication signals respectively.

[0134] For example, the number of synchronization cache blocks corresponding to the N hardware computing units is 2, including a first synchronization cache block and a second synchronization cache block, and the synchronization indication signal includes a first synchronization indication signal and a second synchronization indication signal.

[0135] For example, the first synchronization cache block is used to cache the first synchronization indication signal, and the second synchronization cache block is used to cache the second synchronization indication signal.

[0136] For example, the first synchronization indication signal is used to indicate whether the N hardware computing units have all executed the previous instruction of the logic operation instruction. For example, the second synchronization indication signal is used to indicate whether the N hardware computing units have all executed the logic operation instruction.

[0137] For example, when a logic operation instruction is used as a target instruction, S10 may include: in response to the execution of the previous instruction of the logic operation instruction according to the instruction sequence, before executing the logic operation instruction, sending a first signal to the first synchronization cache block. Step S20 may include: cyclically reading the first synchronization indication signal, and in response to the value of the first synchronization indication signal being equal to a preset value, executing the logic operation instruction, wherein the first synchronization indication signal is determined according to the first signal sent to the first synchronization cache block by N hardware computing units; resetting the first synchronization indication signal.

[0138] For example, when the operation instruction is used as the target instruction, step S10 may include: in response to the completion of the execution of the logic operation instruction, before executing the operation instruction, sending a first signal to the second synchronization cache block. Step S20 may include: cyclically reading the second synchronization indication signal, and in response to the value of the second synchronization indication signal being equal to a preset value, executing the operation instruction, wherein the second synchronization indication signal is determined according to the first signal sent to the second synchronization cache block by the N hardware computing units; resetting the second synchronization indication signal.

[0139] For the specific instruction synchronization process when the target instruction is a logic operation instruction and an operation instruction, reference may be made to the relevant description in the aforementioned data processing device, and the repeated parts will not be repeated here.

[0140] When executing a logical operation instruction, in order to avoid the logical operation result (for example, the accumulation result) being flushed out of the cache to the memory due to other operations performed by some hardware computing units after the accumulation, and multiple data loading from the memory occurs, an instruction synchronization is set before executing the logical operation instruction, and another instruction synchronization is performed after executing the logical operation instruction and before executing the operation instruction. In this way, no other operations will occur during the execution of the logical operation instruction, thereby avoiding flushing the logical operation result out of the cache to the memory, avoiding data loading from the memory, reducing the delay and performance loss caused by data reading, and improving operator performance.

[0141] For example, N hardware computing units share the same synchronization cache block.

[0142] For example, types of hardware compute units include thread hardware, execution units, compute units, or programmable multiprocessors.

[0143] 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 device.

[0144] 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 device, and the repeated parts will be omitted.

[0145] 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 sufficient support is provided for instruction timing synchronization. The instruction timing synchronization will not be limited by the number of synchronization signals, and the restrictions on operator development are reduced, so that the ultimate performance of the hardware can be brought into play. 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 instruction 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.

[0146] Regarding the specific implementation process involved in the instruction synchronization method according to the embodiment of the present disclosure, reference can be made to the above combined Figure 2-Figure 5 The data processing device described according to some embodiments of the present disclosure will not be described again herein.

[0147] At least one embodiment of the present disclosure further provides an electronic device. Figure 7 A schematic block diagram of an electronic device provided for at least one embodiment of the present disclosure.

[0148] For example, Figure 7 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 7 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.

[0149] 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 instruction synchronization method described in any of the above embodiments is implemented. The specific implementation of each step of the instruction synchronization method and the related explanation content can be referred to the embodiment of the above instruction synchronization method, which will not be repeated here.

[0150] For example, other implementations of the instruction synchronization method implemented by the processor 201 executing the 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 processor capable of data processing, such as the aforementioned data processing device.

[0151] 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.

[0152] For example, the communication interface 202 is used to implement communication between the electronic device and other devices.

[0153] 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.

[0154] 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.

[0155] For example, for a detailed description of the process of an electronic device executing the instruction synchronization method, reference may be made to the relevant description in the embodiment of the instruction synchronization method, and repeated parts will not be repeated.

[0156] certainly, Figure 7 The architecture shown is only exemplary and can be omitted according to actual needs when implementing different devices. Figure 7 One or more components of an electronic device are shown.

[0157] Figure 8 A schematic diagram of a non-transitory computer-readable storage medium provided for at least one embodiment of the present disclosure.

[0158] For example, Figure 8 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 instruction synchronization method described above may be executed.

[0159] 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.

[0160] 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.

[0161] 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.

[0162] Those skilled in the art will appreciate that the contents disclosed in this disclosure may be subject to various modifications 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.

[0163] 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.

[0164] 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.

[0165] 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.

[0166] 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.

[0167] 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 device comprising N hardware computing units, where N is a positive integer greater than 1. The N hardware computing units have corresponding synchronization cache blocks, the synchronization cache blocks are used to cache synchronization indication signals, and the synchronization cache blocks are located in a memory area accessible to the N hardware computing units. Each hardware computing unit is configured to execute each instruction in sequence. Each hardware compute unit is also configured as: In response to the execution of a previous instruction of the target instruction, before executing the target instruction, a first signal is sent to the synchronization cache block, wherein: The target instruction is an instruction that the N hardware computing units need to execute synchronously; The synchronization indication signal is cyclically read from the synchronization cache block, and in response to the synchronization indication signal indicating that the N hardware computing units have all executed the previous instruction of the target instruction, the target instruction is executed, wherein the synchronization indication signal is determined based on the first signal sent to the synchronization cache block by the N hardware computing units, the first signal is an addition operation signal, and the synchronization indication signal is determined by performing an accumulation operation on the received first signal.

2. The data processing device according to claim 1, wherein: The first signal is an atomic addition operation signal, and the hardware computing unit executes the target instruction in response to the synchronization indication signal indicating that the N hardware computing units have completed executing the previous instruction of the target instruction, and when executing the target instruction, the following operations are performed: In response to the value of the synchronization indication signal being equal to a preset value, executing the target instruction; Reset the synchronization indication signal.

3. The data processing device according to claim 2, wherein: The preset value includes a first value or an initial value, wherein the first value is the sum of the accumulated value of the N first signals sent by the N hardware computing units and the initial value; Resetting the synchronization indication signal includes: resetting the synchronization indication signal to the initial value.

4. The data processing device according to claim 3, wherein: The synchronization indication signal is an atomic variable, and the atomic addition operation signal includes accumulating 1 to the atomic variable. The first value is the sum of the initial value and N.

5. The data processing device according to any one of claims 1 to 4, wherein: The target instruction includes a data loading instruction, and the data loading instruction is used to load the same block of target data from the memory, The multicast feature is triggered when the N hardware computing units simultaneously execute the data loading instruction.

6. The data processing device according to claim 5, wherein: After the N hardware computing units all execute the target instruction, one of the N hardware computing units loads the target data from the memory to the one hardware computing unit, and broadcasts the target data to the remaining N-1 hardware computing units.

7. The data processing device according to any one of claims 1 to 4, wherein: The target instruction includes a logic operation instruction and an operation instruction, wherein the logic operation instruction is used to perform arithmetic and logic operations in the cache, and the operation instruction is the next instruction executed after the logic operation instruction in the instruction sequence, The number of synchronization cache blocks corresponding to the N hardware computing units is 2, including a first synchronization cache block and a second synchronization cache block. The synchronization indication signal includes a first synchronization indication signal and a second synchronization indication signal, The first synchronization cache block is used to cache the first synchronization indication signal, and the second synchronization cache block is used to cache the second synchronization indication signal. The first synchronization indication signal is used to indicate whether the N hardware computing units have all executed the previous instruction of the logic operation instruction. The second synchronization indication signal is used to indicate whether the N hardware computing units have all executed the logic operation instruction.

8. The data processing device according to claim 7, wherein: In response to the target instruction being the logic operation instruction, The hardware computing unit executes the first signal to the synchronization cache block in response to the execution of the previous instruction of the target instruction and before executing the target instruction, including the following operations: In response to the completion of executing a previous instruction of the logic operation instruction according to the instruction sequence, before executing the logic operation instruction, sending the first signal to the first synchronization cache block; The hardware computing unit executes the instruction preceding the target instruction in response to the synchronization indication signal indicating that the N hardware computing units have all completed executing the target instruction, and when executing the target instruction, includes performing the following operations: cyclically reading the first synchronization indication signal, and executing the logic operation instruction in response to a value of the first synchronization indication signal being equal to a preset value, wherein the first synchronization indication signal is determined according to the first signal sent by the N hardware computing units to the first synchronization cache block; Reset the first synchronization indication signal.

9. The data processing device according to claim 7, wherein: In response to the target instruction being the operation instruction, The hardware computing unit executes the first signal to the synchronization cache block in response to the execution of the previous instruction of the target instruction and before executing the target instruction, including the following operations: In response to executing the logic operation instruction, before executing the operation instruction, sending the first signal to the second synchronization cache block; The hardware computing unit executes the instruction preceding the target instruction in response to the synchronization indication signal indicating that the N hardware computing units have all completed executing the target instruction, and when executing the target instruction, includes performing the following operations: cyclically reading the second synchronization indication signal, and executing the operation instruction in response to a value of the second synchronization indication signal being equal to a preset value, wherein the second synchronization indication signal is determined according to the first signal sent by the N hardware computing units to the second synchronization cache block; Reset the second synchronization indication signal.

10. The data processing device according to claim 7, wherein: The arithmetic logic operation includes reduction or accumulation.

11. The data processing device according to any one of claims 1 to 4, wherein: The types of hardware computing units include thread hardware, execution units, computation units or programmable multiprocessors.

12. The data processing device according to claim 1, wherein: In response to the type of the N hardware computing units being execution units or thread hardware, the synchronization cache block is located in a shared memory of the data processing device, In response to the type of the N hardware computing units being a computing unit or a programmable multiprocessor, the synchronization cache block is located in a global memory of the data processing device.

13. An instruction synchronization method for a data processing device comprising N hardware computing units, where N is a positive integer greater than 1, the instruction synchronization method comprising: For each hardware computing unit, in response to the hardware computing unit executing the previous instruction of the target instruction according to the instruction sequence, before executing the target instruction, the hardware computing unit sends a first signal to a synchronization cache block in the data processing device, wherein the synchronization cache block is used to cache a synchronization indication signal, the synchronization cache block is located in a memory area accessible to the N hardware computing units, and the target instruction is an instruction that the N hardware computing units need to execute synchronously; The hardware computing unit cyclically reads the synchronization indication signal from the synchronization cache block, and in response to the synchronization indication signal indicating that the N hardware computing units have all executed the previous instruction of the target instruction, the N hardware computing units synchronously execute the target instruction, wherein the synchronization indication signal is determined based on the first signal sent by the N hardware computing units to the synchronization cache block, the first signal is an addition operation signal, and the synchronization indication signal is determined by performing an accumulation operation on the received first signal.

14. The instruction synchronization method according to claim 13, wherein: The first signal is an atomic addition operation signal, and in response to the synchronization indication signal indicating that the N hardware computing units have all executed the previous instruction of the target instruction, the N hardware computing units synchronously execute the target instruction, including: For each hardware computing unit, in response to the value of the synchronization indication signal being equal to a preset value, the hardware computing unit executes the target instruction; Reset the synchronization indication signal.

15. The instruction synchronization method according to claim 14, wherein: The preset value includes a first value or an initial value, where the first value is the sum of the accumulated value of the N first signals sent by the N hardware computing units and the initial value; Resetting the synchronization indication signal includes: resetting the synchronization indication signal to the initial value.

16. The instruction synchronization method according to any one of claims 13 to 15, wherein: The target instruction includes a data loading instruction, and the data loading instruction is used to load the same block of target data from the memory, and the multicast feature is triggered when the N hardware computing units execute the data loading instruction at the same time, After causing the N hardware computing units to synchronously execute the target instruction, the instruction synchronization method further includes: One of the N hardware computing units is enabled to load the target data from the memory into the one hardware computing unit, and broadcast the target data to the remaining N-1 hardware computing units.

17. The instruction synchronization method according to any one of claims 13 to 15, wherein: The target instruction includes a logic operation instruction and an operation instruction, wherein the logic operation instruction is used to perform arithmetic and logic operations in the cache, and the operation instruction is the next instruction executed after the logic operation instruction in the instruction sequence, The instruction synchronization method includes: performing a first instruction synchronization before each hardware computing unit executes the logic operation instruction according to the instruction sequence, and performing a second instruction synchronization before each hardware computing unit executes the operation instruction according to the instruction sequence.

18. An electronic device, comprising: processor; and A memory, wherein the memory stores a computer-readable code, and when the computer-readable code is executed by the processor, the instruction synchronization method according to any one of claims 13 to 17 is executed.

19. A non-transitory computer-readable storage medium having stored thereon instructions, wherein: When the instruction is executed by the processor, the instruction synchronization method according to any one of claims 13 to 17 is implemented.

Citation Information

Patent Citations

  • Secondary offload device and method in graphics processor

    CN112214443A

  • Calculation synchronization method, synchronization management device and calculation unit

    CN113869484A

  • Data processor, data processing method, electronic equipment and storage medium

    CN118012788A

  • Workgroup synchronization and processing

    US20210373975A1