Data processing method and system, chip, and terminal
Through the hardware synchronization lock management unit and distributed synchronization lock, the timing relationship between the direct memory access unit and the vector processing unit is controlled, which solves the waiting problem of the scalar processing unit and improves the data processing efficiency of the processor.
Patent Information
- Application Number
- PCT/CN2024/076589
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-30
- Filing Date
- 2024-02-07
- Publication Date
- 2024-10-03
AI Technical Summary
In the existing technology, the scalar processing unit needs to wait for the direct memory access unit to complete the task execution before sending the task to the vector processing unit, resulting in low utilization of the scalar processing unit and low processor data processing efficiency.
Through the hardware synchronization lock management unit, the same synchronization lock identifier is used between the scalar processing unit and the vector processing unit. After receiving the task instruction, the direct memory access unit determines the working status and task type of the synchronization lock, executes the data processing task, and After the task is completed, the task type value of the hardware synchronization lock is updated so that the vector processing unit can execute the task in time.
It improves the processing efficiency of the scalar processing unit, realizes the timing relationship control between the direct memory access unit and the vector processing unit, and improves the overall efficiency of the processor in processing data.
Smart Images

Figure CN2024076589_03102024_PF_FP_ABST
Abstract
Description
Data processing method, system, chip and terminal
[0001] Related applications
[0002] This application claims priority to Chinese patent application number 2023103614485, filed on March 30, 2023, entitled “Data processing method, system, chip and terminal,” the entire text of which is hereby incorporated by reference. Technical Field
[0003] The embodiments of the present application relate to the field of computer technology, and in particular to a data processing method, system, chip, and terminal. Background Art
[0004] With the development of computer technology, the amount of data that processors need to process is increasing. When a processor processes data, the processor's DMA (Direct Memory Access) unit usually moves data stored in the processor's external memory to the processor's internal storage unit. The processor's VPU (Vector Processing Unit) then processes the data stored in the internal storage unit. Therefore, how to control the timing relationship between the direct memory access unit moving data and the vector processing unit processing data is the key to improving the processor's processing efficiency.
[0005] In related technologies, the Scalar Process Unit (SPU), a processor responsible for scalar computation and program flow control, typically determines the timing for the Direct Memory Access (DMA) unit to move data and the timing for the Vector Processing Unit (VPU) to process data, based on software written by the developer. The SPU then sends tasks to the DMA and VPU at the corresponding times, thus enabling software-controlled timing between the DMA and VPUs.
[0006] However, in related art, the scalar processing unit must wait for the direct memory access unit to complete its task before sending it to the vector processing unit. During this waiting period, the scalar processing unit is idle and cannot process other tasks. As a result, the utilization rate of the scalar processing unit is low, resulting in inefficient data processing by the processor.
[0007] Summary of the Invention
[0008] The embodiments of the present application provide a data processing method, system, chip, and terminal that can improve the efficiency of a processor in processing data. The technical solution is as follows:
[0009] In one aspect, a data processing method is provided, which is performed by a data processing system, wherein the data processing system includes a direct memory access unit, a vector processing unit, a scalar processing unit, and a hardware synchronization lock management unit, and the method includes:
[0010] The scalar processing unit sends a first task instruction to the direct memory access unit and sends a second task instruction to the vector processing unit;
[0011] The direct memory access unit determines, based on the first task instruction sent by the scalar processing unit, a first distributed synchronization lock indicated by a first synchronization lock identifier included in the first task instruction, wherein the first distributed synchronization lock is used to determine whether to execute a first data processing task included in the first task instruction;
[0012] The direct memory access unit executes the first data processing task included in the first task instruction and sends a task completion instruction to the hardware synchronization lock management unit when the working state value of the first distributed synchronization lock is a preset value representing an idle state and the task type value of the first distributed synchronization lock meets the execution condition of the first data processing task;
[0013] The hardware synchronization lock management unit updates the task type value of the first hardware synchronization lock indicated by the first synchronization lock identifier in the hardware synchronization lock sequence based on the task completion instruction; and
[0014] When the task type value of the first hardware synchronization lock is updated, the vector processing unit executes the second data processing task included in the second task instruction sent by the scalar processing unit.
[0015] In another aspect, a data processing system is provided, the data processing system including a direct memory access unit, a vector processing unit, a scalar processing unit, and a hardware synchronization lock management unit;
[0016] The scalar processing unit is used to send a first task instruction to the direct memory access unit and send a second task instruction to the vector processing unit;
[0017] The direct memory access unit is configured to determine, based on a first task instruction sent by the scalar processing unit, a first distributed synchronization lock indicated by a first synchronization lock identifier included in the first task instruction in the direct memory access unit, wherein the first distributed synchronization lock is used to determine whether to execute a first data processing task included in the first task instruction;
[0018] The direct memory access unit is further configured to, when the working state value of the first distributed synchronization lock is a preset value representing an idle state and the task type value of the first distributed synchronization lock meets the execution condition of the first data processing task, execute the first data processing task included in the first task instruction and send a task completion instruction to the hardware synchronization lock management unit;
[0019] The hardware synchronization lock management unit is used to update the task type value of the first hardware synchronization lock indicated by the first synchronization lock identifier in the hardware synchronization lock sequence based on the task completion instruction;
[0020] The vector processing unit is configured to execute a second data processing task included in a second task instruction sent by the scalar processing unit when the task type value of the first hardware synchronization lock is updated.
[0021] In another aspect, a chip is provided, comprising a data processing system.
[0022] On the other hand, a terminal is provided, comprising a processor and a memory, wherein the memory stores a data processing method, and the processor is configured to implement the data processing method as described in the above aspects through a data processing system.
[0023] The details of one or more embodiments of the present application are set forth in the accompanying drawings and the description below. Other features and advantages of the present application will become apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the conventional technology, the following briefly introduces the drawings required for use in the embodiments or the conventional technology descriptions. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without any creative work.
[0025] FIG1 is a schematic diagram of the structure of a data processing system provided in an embodiment of the present application;
[0026] FIG2 is a flow chart of a data processing method provided in an embodiment of the present application;
[0027] FIG3 is an interactive flow chart of a data processing method provided in an embodiment of the present application;
[0028] FIG4 is a schematic diagram of a judgment logic provided in an embodiment of the present application;
[0029] FIG5 is a flow chart of a data processing method provided by an embodiment of the present application;
[0030] FIG6 is a schematic diagram of a distributed synchronization lock provided in an embodiment of the present application;
[0031] FIG7 is a schematic diagram of a first hardware synchronization lock provided in an embodiment of the present application;
[0032] FIG8 is a flowchart of another data processing provided by an embodiment of the present application;
[0033] FIG9 is a schematic structural diagram of a terminal provided in an embodiment of the present application. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0035] In this application, the terms "first", "second", etc. are used to distinguish identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on the quantity and execution order.
[0036] In the present application, the term "at least one" means one or more, and the term "plurality" means two or more.
[0037] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the first task instruction and the second task instruction involved in this application were obtained with full authorization.
[0038] For ease of understanding, the terms involved in this application are explained below.
[0039] Artificial Intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0040] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, as well as machine learning / deep learning, autonomous driving, and smart transportation.
[0041] FIG1 is a structural diagram of a data processing system provided in an embodiment of the present application. Referring to FIG1 , the data processing system 10 includes a scalar processing unit 101 , a direct memory access 102 , a vector processing unit 103 , and a hardware synchronization lock management unit 104 .
[0042] Optionally, the data processing system 10 can be configured in any type of processor such as an AI (Artificial Intelligence) processor, a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), and a DSP (Digital Signal Processor). The data processing system 10 can also be configured in an AI (Artificial Intelligence) chip, a SOC (System On Chip), a PCB (Printed Circuit Board) carrying the chip, or a terminal. The terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, an intelligent voice interaction device, a smart home appliance, a car terminal, and other types of devices, which are not limited in the embodiments of the present application.
[0043] The scalar processing unit 101 is configured to send a first task instruction to the direct memory access 102 and a second task instruction to the vector processing unit 103. The first task instruction and the second task instruction include the same synchronization lock flag. Accordingly, the direct memory access 102 and the vector processing unit 103 determine the task to be executed and the time to execute the task based on the received task instructions.
[0044] For example, the direct memory access 102 determines the first distributed synchronization lock in the direct memory access 102 based on the first synchronization lock identifier in the first task instruction sent by the scalar processing unit 101. Furthermore, the direct memory access 102 determines whether to currently execute the first data processing task in the first task instruction based on the working state value of the first distributed synchronization lock and the task type value of the first distributed synchronization lock.
[0045] After completing a task, the direct memory access 102 can also send a task completion instruction to the hardware synclock management unit 104. Accordingly, upon receiving the task completion instruction, the hardware synclock management unit 104 updates the task type value of the first hardware synclock in the hardware synclock sequence. The vector processing unit 103 can execute the second data processing task in the second task instruction if the task type value of the first hardware synclock is updated.
[0046] Those skilled in the art will appreciate that the number of the above-mentioned terminals may be more or less. For example, the above-mentioned terminal may be only one, or the above-mentioned terminals may be dozens or hundreds, or a larger number. The embodiments of the present application do not limit the number of terminals and device types.
[0047] In some embodiments, a data processing method is provided, which is performed by a data processing system, the data processing system including a direct memory access unit, a vector processing unit, a scalar processing unit, and a hardware synchronization lock management unit. The method includes: the scalar processing unit sending a first task instruction to the direct memory access unit and sending a second task instruction to the vector processing unit, wherein the first task instruction includes a first data processing task and a first synchronization lock identifier indicating a first distributed synchronization lock, and the second task instruction includes a second data processing task; the direct memory access unit identifies a working state value of the first distributed synchronization lock based on the first synchronization lock identifier from the first task instruction; when the working state value of the first distributed synchronization lock is a preset value representing an idle state and the task type value of the first distributed synchronization lock meets the execution condition of the first data processing task, the direct content access unit executes the first data processing task and sends a task completion instruction to the hardware synchronization lock management unit after the first data processing task is completed; the hardware synchronization lock management unit updates the task type value of the first hardware synchronization lock indicated by the first synchronization lock identifier in the hardware synchronization lock sequence based on the task completion instruction; and when the task type value of the first hardware synchronization lock is updated, the vector processing unit executes the second data processing task.
[0048] FIG2 is a flow chart of a data processing method provided in an embodiment of the present application. The method is applied to a data processing system, which includes a direct memory access unit (DMA), a vector processing unit (VPU), a scalar processing unit (SPU), and a hardware synchronization lock management unit. Referring to FIG2 , the method includes:
[0049] 201. A scalar processing unit sends a first task instruction to a direct memory access unit, and sends a second task instruction to a vector processing unit.
[0050] In the embodiments of the present application, the data processing system can be configured in any type of processor, such as an AI processor, a central processing unit, a graphics processing unit, and a digital signal processor. The data processing system can also be configured in an AI chip, a system-on-chip, a PCB carrying a chip, or a terminal, and the embodiments of the present application are not limited to this.
[0051] The direct memory access unit in the data processing system is capable of moving data between an external memory and a memory within the data system. The embodiment of the present application is described by taking the example of a direct memory access unit moving data to be processed in an external memory to the inside of a data processing system. The vector processing unit is capable of processing the data to be processed moved to the inside of the data processing system by the direct memory access unit. The scalar processing unit is used to send task instructions to the direct memory access unit and the vector processing unit respectively. Accordingly, the direct memory access unit and the vector processing unit can determine information such as the task to be executed, the task type of the task, and the execution conditions of the task through the received task instructions.
[0052] Because the direct memory access unit and the vector processing unit need to perform many tasks, and there is a timing dependency between the tasks performed by the direct memory access unit and the tasks performed by the vector processing unit. For example, the vector processing unit performs a task of processing data, which requires the execution result of the task of moving data performed by the direct memory access unit. Therefore, it is necessary to control the timing relationship between the tasks performed by the direct memory access unit and the vector processing unit to ensure the efficiency of data processing by the data processing system. In an embodiment of the present application, the timing relationship between the tasks performed by the direct memory access unit and the vector processing unit is controlled by a hardware synchronization lock. Accordingly, the task instructions sent by the scalar processing unit to the direct memory access unit and the vector processing unit include the same synchronization lock identifier, that is, the first task instruction and the second task instruction include the same synchronization lock identifier. The synchronization lock identifier can indicate any idle hardware synchronization lock in the hardware synchronization lock sequence. By specifying the same hardware synchronization lock for the direct memory access unit and the vector processing unit, the timing relationship between the tasks performed by the direct memory access unit and the vector processing unit can be controlled by the hardware synchronization lock.
[0053] For example, the aforementioned timing relationship can be controlled by the hardware synchronization lock. Before the direct memory access unit executes the task of moving data, the task type value of the corresponding hardware synchronization lock is set to 0. After the direct memory access unit completes the task, the hardware synchronization lock management unit updates the task type value of the hardware synchronization lock to 1. The vector processing unit can determine whether the direct memory access unit has completed the task based on the task type value of the hardware synchronization lock. When the task type value of the hardware synchronization lock is updated to 1, the vector processing unit determines that the direct memory access unit has completed the task, and the vector processing unit can then execute the task of processing the target data.
[0054] 202. The direct memory access unit determines, based on the first task instruction sent by the scalar processing unit, a first distributed synchronization lock indicated by a first synchronization lock identifier included in the first task instruction.
[0055] In an embodiment of the present application, the direct memory access unit includes multiple distributed synchronization locks corresponding to the hardware synchronization lock sequence. After the direct memory access unit receives the first task instruction sent by the scalar processing unit, the direct memory access unit determines the first distributed synchronization lock corresponding to the first synchronization lock identifier from the multiple distributed synchronization locks in the direct memory access unit based on the first synchronization lock identifier included in the first task instruction. Since the distributed synchronization lock and the corresponding hardware synchronization lock in the hardware synchronization lock sequence are consistent, the direct memory access unit can directly determine whether to execute the first data processing task based on the relevant information of the first distributed synchronization lock.
[0056] 203. When the working state value of the first distributed synchronization lock is a preset value representing an idle state and the task type value of the first distributed synchronization lock meets the execution condition of the first data processing task, the direct memory access unit executes the first data processing task included in the first task instruction, and sends a task completion instruction to the hardware synchronization lock management unit after the first data processing task is completed.
[0057] In an embodiment of the present application, the direct memory access unit determines whether the first data processing task is currently being executed based on the current working state value of the first distributed synchronization lock and the task type value of the first distributed synchronization lock. The working state value of the first distributed synchronization lock includes an idle state and a non-idle state. The idle state indicates that the previous task corresponding to the distributed synchronization lock has been completed, and the direct memory access unit is currently able to execute the first data processing task. The non-idle state indicates that the previous task corresponding to the distributed synchronization lock is being executed, and the direct memory access unit is currently unable to execute the first data processing task.
[0058] Through the task type value of the first distributed synchronization lock, it is possible to determine whether the execution conditions of the first data processing task are currently met. The execution condition is used to control the relationship between the task type value of the first distributed synchronization lock and the execution of the first data processing task. By configuring the execution condition for the task, it is possible to control the timing of the direct memory access unit executing the task through the distributed synchronization lock. Therefore, when the working state value of the first distributed synchronization lock is a preset value representing the idle state, and the task type value of the first distributed synchronization lock meets the execution conditions of the first data processing task, it indicates that the first data processing task can be executed at present. The direct memory access unit moves the data to be processed from the external memory to the inside of the data processing system by executing the first data processing task. After the direct memory access unit completes the data movement, the direct memory access unit sends a task completion instruction to the hardware synchronization lock management unit. The task completion instruction is used to notify the hardware synchronization lock management unit that the current first data processing task has been completed.
[0059] 204. The hardware synchronization lock management unit updates the task type value of the first hardware synchronization lock indicated by the first synchronization lock identifier in the hardware synchronization lock sequence based on the task completion instruction.
[0060] In an embodiment of the present application, a hardware sync lock management unit is configured to manage multiple hardware sync locks in a hardware sync lock sequence. Upon receiving a task completion instruction, the hardware sync lock management unit determines, in the hardware sync lock sequence, a first hardware sync lock corresponding to the first sync lock identifier. The hardware sync lock management unit updates a task type value for the first hardware sync lock.
[0061] 205. When the task type value of the first hardware synchronization lock is updated, the vector processing unit executes the second data processing task included in the second task instruction sent by the scalar processing unit.
[0062] In an embodiment of the present application, the vector processing unit can determine whether to execute a data processing task based on the updated task type value of the first hardware synchronization lock. When the task type value of the first hardware synchronization lock is updated, the vector processing unit determines that the first data processing task has been completed. If the execution conditions of the second data processing task are currently met, the vector processing unit executes the second data processing task. The second data processing task is the vector processing unit processing the data to be processed that the direct memory access unit has moved to the data processing system.
[0063] An embodiment of the present application provides a data processing method performed by a data processing system. A scalar processing unit can send task instructions to a direct memory access unit and a vector processing unit separately. This eliminates the need for the scalar processing unit to wait for the direct memory access unit to complete its task before sending the task to the vector processing unit, thereby improving the processing efficiency of the scalar processing unit. Accordingly, the direct memory access unit can determine a first distributed synchronizer in the direct memory access unit based on a first synchronizer identifier in a first task instruction sent by the scalar processing unit. Furthermore, the direct memory access unit can determine whether a first data processing task is currently being executed based on the working state value of the first distributed synchronizer and the task type value of the first distributed synchronizer. This eliminates the need for the scalar processing unit to determine when the direct memory access unit will execute the first data processing task, thereby achieving decoupling from the scalar processing unit. After the direct memory access unit completes its task, the direct memory access unit sends a task completion instruction to a hardware synchronizer management unit. Based on the task completion instruction, the hardware synchronizer management unit can update the task type value of the first hardware synchronizer in the hardware synchronizer sequence. In response to the update of the task type value of the first hardware synchronizer, the vector processing unit promptly executes the second data processing task, thereby improving the processor's data processing efficiency.
[0064] FIG3 is an interactive flow chart of a data processing method provided in an embodiment of the present application. The method is applied to a data processing system, which includes a direct memory access unit (DMA), a vector processing unit (VPU), a scalar processing unit (SPU), and a hardware synchronization lock management unit. Referring to FIG3 , the method includes:
[0065] 301. A hardware synchronization lock management unit determines at least one idle hardware synchronization lock and an identifier of each hardware synchronization lock in a hardware synchronization lock sequence.
[0066] In the embodiments of the present application, the data processing system can be configured in any type of processor, such as an AI processor, a central processing unit, a graphics processing unit, and a digital signal processor. The data processing system can also be configured in an AI chip, a system-on-chip, a PCB carrying a chip, or a terminal, and the embodiments of the present application are not limited to this.
[0067] In response to a data processing task being received by the data processing system, the data processing system invokes the hardware sync lock management unit to determine an idle hardware sync lock in a hardware sync lock sequence to assist in executing the data processing task. The at least one idle hardware sync lock is used to control the timing relationship between the direct memory access unit and the vector processing unit in executing the data processing task.
[0068] 302. The hardware synchronization lock management unit sends an identifier of any hardware synchronization lock as a first synchronization lock identifier to the scalar processing unit.
[0069] In an embodiment of the present application, after receiving a data processing task, the data processing system needs to call the direct memory access unit and the vector processing unit to execute the data processing task. For example, the data processing task is to process target data stored in an external memory. In the process of executing the above-mentioned data processing task, the direct memory access unit is required to first move the target data stored in the external memory to the inside of the data processing system, and then the vector processing unit processes the target data inside the data processing system. Therefore, the data management system needs to send the corresponding tasks to the direct memory access unit and the vector processing unit, and control the timing relationship between the execution of the tasks by the direct memory access unit and the vector processing unit through an idle hardware synchronization lock.
[0070] In some embodiments, the hardware sync lock management unit can send any idle hardware sync lock to the scalar processing unit. Accordingly, the hardware sync lock management unit first determines at least one idle hardware sync lock from the hardware sync lock sequence. Then, after determining at least one idle hardware sync lock, the hardware sync lock management unit sends the identifier of any idle hardware sync lock as the first sync lock identifier to the scalar processing unit. The first sync lock identifier is used to indicate the hardware sync lock in the hardware sync lock sequence used to control the above-mentioned timing relationship. The scalar processing unit is used to send task instructions to the direct memory access unit and the vector processing unit. By sending the first sync lock identifier to the scalar processing unit, the scalar processing unit can send the same first sync lock identifier as part of the task instruction to the direct memory access unit and the vector processing unit during the process of sending the task instruction to the direct memory access unit and the vector processing unit. This ensures the timing relationship between the direct memory access unit and the vector processing unit in executing the data processing task.
[0071] In some embodiments, the hardware sync lock management unit can determine an idle hardware sync lock by using a leading zero detection method. Accordingly, the hardware sync lock management unit detects the hardware sync lock sequence starting from the low bit and uses the identifier of the first detected idle hardware sync lock as the first sync lock identifier.
[0072] 303. In response to the scalar processing unit receiving the first synchronization lock identifier, the scalar processing unit generates a first task instruction and a second task instruction.
[0073] In an embodiment of the present application, after the scalar processing unit receives the first synchronization lock identifier, the scalar processing unit can generate a first task instruction to be sent to the direct memory access unit and a second task instruction to be sent to the vector processing unit. In the process of generating the first task instruction, the scalar processing unit puts the first synchronization lock identifier and the first data processing task that the direct memory access unit needs to execute into the first task instruction. In the process of generating the second task instruction, the scalar processing unit puts the second synchronization lock identifier and the second data processing task that the vector processing unit needs to execute into the second task instruction. Among them, the first data processing task is to move the target data stored in the external memory to the inside of the data processing system. The second data processing task is to process the target data inside the data processing system. By sending the first synchronization lock identifier and the first data processing task as the first task instruction to the direct memory access unit, and sending the first synchronization lock identifier and the second data processing task as the second task instruction to the vector processing unit, the direct memory access unit and the vector processing unit can determine the corresponding hardware synchronization lock according to the first synchronization lock identifier in the task instruction. Furthermore, the direct memory access unit and the vector processing unit can determine the timing of executing corresponding data processing tasks according to the hardware synchronization lock, thereby controlling the timing of the direct memory access unit and the vector processing unit executing tasks through the hardware synchronization lock, thereby improving the efficiency of data processing in the data processing system.
[0074] 304. The scalar processing unit sends a first task instruction to the direct memory access unit, and sends a second task instruction to the vector processing unit.
[0075] In an embodiment of the present application, the scalar processing unit sends a first task instruction to the direct memory access unit and sends a second task instruction to the vector processing unit.
[0076] Optionally, the scalar processing unit may simultaneously send the first task instruction and the second task instruction to the direct memory access unit and the vector processing unit, respectively. The scalar processing unit may also first send the first task instruction to the direct memory access unit and then send the second task instruction to the vector processing unit. The scalar processing unit may also first send the second task instruction to the vector processing unit and then send the first task instruction to the direct memory access unit. The embodiment of the present application does not limit the timing of sending the first task instruction and the second task instruction.
[0077] 305. The direct memory access unit determines, based on the first task instruction sent by the scalar processing unit, a first distributed synchronization lock indicated by a first synchronization lock identifier included in the first task instruction.
[0078] In an embodiment of the present application, a direct memory access unit receives a first task instruction sent by a scalar processing unit. The direct memory access unit determines a first synchronization lock identifier included in the first task instruction. The direct memory access unit includes multiple distributed synchronization locks corresponding to a hardware synchronization lock sequence. Based on the first synchronization lock identifier, the direct memory access unit can determine a first distributed synchronization lock corresponding to the first synchronization lock identifier from among multiple distributed synchronization locks in the direct memory access unit. Moreover, the distributed synchronization lock and the corresponding hardware synchronization lock in the hardware synchronization lock sequence remain consistent in most clock cycles. Therefore, the direct memory access unit can directly determine whether to execute the first data processing task included in the first task instruction based on the working status value and value of the first distributed synchronization lock.
[0079] In some embodiments, the working state value of the first distributed synchronization lock includes an idle state and a non-idle state. The idle state indicates that the previous task corresponding to the distributed synchronization lock has been completed, and the direct memory access unit can currently execute the first data processing task. The non-idle state indicates that the previous task corresponding to the distributed synchronization lock is being executed, and the direct memory access unit cannot currently execute the first data processing task. Through the task type value of the first distributed synchronization lock, it can be determined whether the execution condition of the first data processing task is currently met. The execution condition is used to control the relationship between the task type value of the first distributed synchronization lock and the execution of the first data processing task. By configuring the execution condition for the task, it is possible to control the timing of the execution of the task by the direct memory access unit through the distributed synchronization lock.
[0080] In some embodiments, the direct memory access unit determines the working state value and value of the first distributed synchronization lock using two multiplexers. For the first multiplexer in the direct memory access unit, the first multiplexer determines the first distributed synchronization lock and the working state value of the first distributed synchronization lock corresponding to the first synchronization lock identifier in a first synchronization lock sequence based on the first synchronization lock identifier included in the first task instruction. The first synchronization lock sequence is used to indicate the working state values of multiple distributed synchronization locks in the direct memory access unit. The states include an idle state and a non-idle state. For the second multiplexer in the direct memory access unit, the second multiplexer determines the task type value of the first distributed synchronization lock in a second synchronization lock sequence based on the first synchronization lock identifier. The second synchronization lock sequence is used to indicate the task type values of multiple distributed synchronization locks in the direct memory access unit. The direct memory access unit determines the execution condition of the first data processing task based on the task type of the first data processing task included in the first task instruction. The execution condition indicates the conditions that the task type value of the first distributed synchronization lock must meet. Task types include read task types and write task types. The two multiplexers in the direct memory access unit can quickly determine the first distributed synchronization lock, the working state value of the first distributed synchronization lock, and the task type value of the first distributed synchronization lock from the two synchronization lock sequences, thereby improving the efficiency of the direct memory access unit in executing the first data processing task.
[0081] In some embodiments, the task type of the first data processing task is a read task type. The direct memory access unit uses the task type value of the first distributed synchronization lock as a first value as an execution condition. Among them, the first data processing task of the read task type is a direct memory access unit that reads the target data to be processed stored in the external memory and moves the target data to the internal memory. By using the task type of the data processing task and using different values of the first distributed synchronization lock as execution conditions, different execution conditions can be determined for tasks of different task types, thereby realizing the execution timing between control tasks.
[0082] In some embodiments, the direct memory access unit can determine whether the execution condition of the first data processing task is currently met based on the operating state value of the first distributed synchronization lock, the task type value of the first distributed synchronization lock, and the task type of the first data processing task, using the schematic diagram of the execution condition judgment logic shown in FIG4 . As shown in FIG4 , the execution condition judgment logic includes an AND logic gate 401, an AND logic gate 402, and a multiplexer 403. The negation symbol 404 is used to indicate that the input of the synchronization lock's operating state value (busy) or the synchronization lock's task type value (sync) is negated before being input into the AND logic gate. It should be noted that the negation symbol 401 in FIG4 is merely an illustrative example. The direct memory access unit can determine whether to negate the synchronization lock's operating state value or the synchronization lock's task type value based on actual needs. This allows the multiplexer to determine whether the data processing task can currently be executed based on the output of the AND logic gate. Therefore, the multiplexer can determine whether the execution condition of the data processing task is currently met based on the output of the AND logic gate and the task type (sync_set_value) and output a judgment result (issue_en). The value "busy" can be either 0 or 1. A busy value of 0 indicates that the sync lock is not idle, while a busy value of 1 indicates that the sync lock is idle. The value of sync_set_value can also be either 0 or 1. A value of 1 indicates that the task type is a read task, while a value of 0 indicates that the task type is a write task.
[0083] For example, for a data processing task of the read task type (sync_set_value is 1), according to the above execution logic, if the working state value of the synchronization lock is a preset value representing the idle state (busy is 1) and the task type value (sync) of the synchronization lock is 0, the data processing task can currently be executed. Therefore, the direct memory access unit can invert the task type value of the synchronization lock input to the AND logic gate 401, and the sync input to the AND logic gate 401 is 1. The direct memory access unit does not invert the working state value of the synchronization lock in the AND logic gate 401, and the busy input to the AND logic gate 401 is 1. Both inputs of the AND logic gate 401 are 1, and the output of the AND logic gate 401 is 1. Accordingly, since busy is currently 1 and sync is 0, the direct memory access unit can invert both, or neither, in the AND logic gate 402, or only invert busy and not sync. In all three of the above cases, the output of the AND logic gate 402 is 0. Therefore, the multiplexer 403 can determine that the above data processing task can be executed currently based on the output value of the AND logic gate 401 being 1 and the output value of the AND logic gate 402 being 0, and the above judgment logic of the direct memory access unit is consistent with the execution logic of the data processing task.
[0084] In some embodiments, the direct memory access unit can determine the execution condition of the first data processing task based on the task type indicated by sync_set_value, that is, determine the sync when the execution condition is met. For example, when the sync_set_value of the first data processing task is 1, it indicates that the first data processing task is a read task. The direct memory access unit uses sync to be 0 as the execution condition, that is, the first value is 0. Therefore, the execution condition of the first data processing task is met only when busy is 1 and sync is 0. Correspondingly, when busy is 1 and sync is 0, the multiplexer 403 outputs the judgment result that the execution condition is currently met. When busy and sync are other values, the multiplexer 403 outputs the judgment result that the execution condition is not currently met.
[0085] 306. When the working state value of the first distributed synchronization lock is a preset value representing an idle state and the task type value of the first distributed synchronization lock meets the execution condition of the first data processing task, the direct memory access unit executes the first data processing task included in the first task instruction and sends a task completion instruction to the hardware synchronization lock management unit.
[0086] In an embodiment of the present application, when the direct memory access unit determines that the working state value of the first distributed synchronization lock is a preset value representing an idle state, and the task type value of the first distributed synchronization lock meets the execution condition of the first data processing task, it indicates that the first data processing task can be executed at present. The direct memory access unit executes the first data processing task and moves the target data to be processed from the external memory to the inside of the data processing system. After the direct memory access unit completes the data movement, the direct memory access unit sends a task completion instruction to the hardware synchronization lock management unit. The task completion instruction is used to notify the hardware synchronization lock management unit that the current first data processing task has been completed.
[0087] In some embodiments, while the direct memory access unit is executing the first data processing task, the direct memory access unit initiates a req_interface instruction to request access to the external memory to move target data from the external memory. When the access request is sent and processed by the external memory, it indicates that the direct memory access unit has completed the move of the target data. The direct memory access unit then sends a task completion instruction to the hardware genlock management unit.
[0088] 307. The hardware synchronization lock management unit determines a first hardware synchronization lock in the hardware synchronization lock sequence based on the first synchronization lock identifier in the task completion instruction.
[0089] In an embodiment of the present application, a hardware sync lock management unit receives a task completion instruction sent by a direct memory access unit. The hardware sync lock management unit determines a first sync lock identifier included in the task completion instruction. The hardware sync lock management unit determines a first hardware sync lock corresponding to the first sync lock identifier in a hardware sync lock sequence. The first hardware sync lock and the first distributed sync lock in the direct memory access unit module both correspond to the first sync lock identifier.
[0090] 308. The hardware synchronization lock management unit updates the task type value of the first hardware synchronization lock after the second number of clock cycles.
[0091] In an embodiment of the present application, the hardware synchronization lock management unit and the direct memory access unit are located at different positions in the data processing system, and the positions are distributed relatively far apart. Therefore, it is necessary to delay the update of the task type value of the first hardware synchronization lock by a delayed beater to meet the timing requirements of the hardware synchronization lock management unit and the direct memory access unit. The number of delayed clock cycles is associated with the number of delayed beaters. The hardware synchronization lock management unit can update the task type value of the first hardware synchronization lock after the second number of clock cycles through a second number of delayed beaters. Among them, the second number can be a preset value, such as 2, 3 or 5, which is not limited in the embodiment of the present application. By updating the task type value of the first hardware synchronization lock after the direct memory access unit completes the first data processing task, it is possible to represent the execution status of the task executed by the direct memory access unit through the task type value of the first hardware synchronization lock, and control the timing of the task executed by the direct memory access unit through the task type value of the first hardware synchronization lock.
[0092] In some embodiments, the hardware synchronization lock management unit can determine the updated value of the first hardware synchronization lock according to the type of the first data processing task. In the case where the task type of the first data processing task is a read task type, the hardware synchronization lock management unit updates the task type value of the first hardware synchronization lock from the first value to the second value after a second number of clock cycles. For example, after three clock cycles, the hardware synchronization lock management unit updates the task type value of the first hardware synchronization lock from 0 to 1. By updating the first hardware synchronization lock to different values according to the task type of the data processing task, it can be determined whether the execution conditions of tasks of different task types are met according to the task type value of the first hardware synchronization lock. This realizes the control of the execution timing of tasks according to the hardware synchronization lock.
[0093] For example, the hardware synchronization lock management unit can determine the first data processing task and the updated value of the first hardware synchronization lock through sync_set_value. When sync_set_value is 1, the task type of the first data processing task is a read task, and the updated value of the first hardware synchronization lock is 1. When sync_set_value is 0, the task type of the first data processing task is a write task, and the updated value of the first hardware synchronization lock is 0.
[0094] To more clearly illustrate the process by which the direct memory access unit executes the first data processing task, the process is described below in conjunction with the data processing flowchart shown in FIG5 . As shown in FIG5 , in response to the data processing system receiving the data processing task, the hardware synclock management unit determines at least one idle hardware synclock and an identifier for each hardware synclock in the hardware synclock sequence. The hardware synclock management unit then sends the identifier of any hardware synclock as a first synclock identifier to the scalar processing unit. Upon receiving the first synclock identifier, the scalar processing unit sends the first synclock identifier and the first data processing task as a first task instruction to the direct memory access unit. Based on the received first task instruction, the direct memory access unit determines, via two multiplexers (muxes), the first distributed synclock corresponding to the first synclock identifier and the working state value (busy) of the first distributed synclock in the first synclock sequence, and determines the task type value (sync) of the first distributed synclock in the second synclock sequence. The direct memory access unit then determines whether to execute the first data processing task based on the working state value of the first distributed synclock, the task type value of the first distributed synclock, and the task type of the first data processing task. For example, the first data processing task can only be executed when the task type of the first data processing task is a read task, the working state value of the first synchronization lock is a preset value representing the idle state, that is, busy is 1, and the task type value of the first synchronization lock is 0. When the judgment result indicates that the first data processing task can be executed, the direct memory access unit executes the first data processing task. The direct memory access unit accesses the external memory and moves the target data to be processed in the external memory to the inside of the data processing system. After the direct memory access unit completes the data movement, the direct memory access unit sends a task completion instruction to the hardware synchronization lock management unit. The hardware synchronization lock management unit determines the first hardware synchronization lock in the hardware synchronization lock sequence based on the first synchronization lock identifier in the task completion instruction. The hardware synchronization lock management unit uses three delay beaters to update the task type value of the first hardware synchronization lock from 0 to 1 after three clock cycles. Then, through three delay beaters, after three clock cycles, the task type value of the first distributed synchronization lock corresponding to the first synchronization lock identifier in the second synchronization lock sequence is updated from 0 to 1.
[0095] 309. The vector processing unit determines, based on the second task instruction sent by the scalar processing unit, a second distributed synchronization lock indicated by the first synchronization lock identifier included in the second task instruction.
[0096] In an embodiment of the present application, a vector processing unit receives a second task instruction sent by a scalar processing unit. The vector processing unit determines a first sync lock identifier included in the second task instruction. Similar to a direct memory access unit, the vector processing unit also includes multiple distributed sync locks corresponding to a hardware sync lock sequence. Based on the first sync lock identifier, the vector processing unit can determine a second distributed sync lock corresponding to the first sync lock identifier from among the multiple distributed sync locks in the vector processing unit. Furthermore, the second distributed sync lock in the vector processing unit, the first distributed sync lock in the direct memory access unit, and the first hardware sync lock remain consistent for most clock cycles. Therefore, the vector processing unit can directly determine whether to execute the first data processing task included in the second task instruction based on the working state value and task type value of the second distributed sync lock. Therefore, the vector processing unit does not need to determine the working state value and value of the first hardware sync lock in the external hardware sync lock sequence, thereby achieving decoupling from the external hardware sync lock sequence.
[0097] 310. When the working state value of the second distributed synchronization lock is a preset value representing an idle state and the task type value of the second distributed synchronization lock meets the execution condition of the second data processing task, the vector processing unit executes the second data processing task and sends a task completion instruction to the hardware synchronization lock management unit after the second data processing task is completed.
[0098] In an embodiment of the present application, when the vector processing unit determines that the working state value of the second distributed synchronization lock is a preset value representing an idle state, and the task type value of the second distributed synchronization lock meets the execution conditions of the second data processing task, it indicates that the second data processing task can currently be executed. The vector processing unit executes the second data processing task and processes the target data within the data processing system. After the vector processing unit completes processing the target data, the vector processing unit sends a task completion instruction to the hardware synchronization lock management unit. The task completion instruction is used to notify the hardware synchronization lock management unit that the current first data processing task has been completed.
[0099] In some embodiments, while the vector processing unit is executing the second data processing task, the vector processing unit initiates a req_interface instruction to request access to the internal storage unit of the data processing system to process target data. Once the access request is sent and processed by the internal storage unit, the vector processing unit completes processing of the target data. The vector processing unit then sends a task completion instruction to the hardware genlock management unit.
[0100] 311. When the task type value of the second distributed synchronization lock is updated, the vector processing unit updates the working state value of the second distributed synchronization lock to a preset value representing the idle state. The task type value of the second distributed synchronization lock is updated to the task type value of the first hardware synchronization lock a first number of clock cycles after the task type value of the first hardware synchronization lock is updated.
[0101] In an embodiment of the present application, similar to the direct memory access unit, the vector processing unit sends a task completion instruction to the hardware synchronization lock management unit after completing the second data processing task. Accordingly, after receiving the task completion instruction, the hardware synchronization lock management unit delays the task type value of the first hardware synchronization lock by delaying a number of clock cycles through the delay beater. When the task type value of the first hardware synchronization lock is updated, the task type value of the second distributed synchronization lock is updated to the task type value of the first hardware synchronization lock after the first number of clock cycles through the first number of delay beaters. Among them, the first number can be a preset value, such as 2, 3 or 5, which is not limited in the embodiment of the present application. When the task type value of the second distributed synchronization lock is updated, the vector processing unit updates the working state value of the second distributed synchronization lock to represent the idle state to indicate that the current vector processing unit has completed the second data processing task. Furthermore, the vector processing unit can determine whether to execute the next task based on the new state of the second synchronization lock.
[0102] In some embodiments, similar to the direct memory access unit, the vector processing unit includes a third synchronization lock sequence and a fourth synchronization lock sequence. The third synchronization lock sequence is used to indicate the working state values of multiple distributed synchronization locks in the vector processing unit. The fourth synchronization lock sequence is used to indicate the task type values of multiple distributed synchronization locks in the vector processing unit. Therefore, when the task type value of the first hardware synchronization lock is updated, after a first number of clock cycles, the task type value of the second distributed synchronization lock in the fourth synchronization lock sequence is updated to the task type value of the first hardware synchronization lock. When the task type value of the second distributed synchronization lock is updated, the vector processing unit updates the working state value of the second distributed synchronization lock in the third synchronization lock sequence to indicate an idle state.
[0103] As can be seen, after the vector processing unit completes a task, it first delays updating the task type value of the first hardware synchronizer, and then delays updating the task type value of the second distributed synchronizer. Therefore, there is a delay between the vector processing unit completing the task and the updating of the task type value of the second distributed synchronizer. By updating the working state value of the second distributed synchronizer to a preset value representing an idle state only after the task type value of the second distributed synchronizer is updated, task execution conflicts can be avoided when two consecutive data processing tasks both correspond to the second distributed synchronizer. For example, without a third synchronizer sequence, after completing the first data processing task, the vector processing unit updates the task type value of the first hardware synchronizer from 1 to 0. The task type value of the second distributed synchronizer is updated later than the task type value of the first hardware synchronizer. At this time, the task type value of the second distributed synchronizer remains 1 and has not yet been updated to 0. If the vector processing unit determines that it can execute the second data processing task based on the current task type value of the second distributed synchronizer, it will begin executing the second data processing task, which will result in a task conflict. By introducing the working status value of the distributed synchronization lock and using the working status value of the distributed synchronization lock as one of the judgment conditions for determining whether the task can be executed, the above-mentioned task conflict problem can be avoided. As shown in Figure 6, the task type value of the first hardware synchronization lock is updated from 1 to 0, but the task type value of the second distributed synchronization lock in the fourth synchronization lock sequence has not yet been updated to 0. The working status value of the second distributed synchronization lock in the third synchronization lock sequence is a non-idle state, that is, busy is 0. When the task type value of the second distributed synchronization lock is updated from 1 to 0, the working status value of the second distributed synchronization lock is updated to represent the idle state, that is, busy is updated from 0 to 1.
[0104] In which, during the process of the direct memory access unit executing the first data processing task and the vector processing unit executing the second data processing task, the task type value of the first hardware synchronization lock is updated as shown in Figure 7. When the direct memory access unit determines that the task type value of the first distributed synchronization lock is 0 and the working state value of the first distributed synchronization lock is a preset value representing the idle state, the direct memory access unit executes the first data processing task. After the direct memory access unit completes the first data processing task, it instructs the hardware synchronization lock management unit to update the task type value of the first hardware synchronization lock to 1. When the vector processing unit determines that the task type value of the second distributed synchronization lock is 1 and the working state value of the second distributed synchronization lock is a preset value representing the idle state, the vector processing unit executes the second data processing task. After the vector processing unit completes the second data processing task, it instructs the hardware synchronization lock management unit to update the task type value of the first hardware synchronization lock to 0.
[0105] To more clearly illustrate the process by which the direct memory access unit and the vector processing unit execute data processing tasks in the data processing system, the above process is described below in conjunction with the data processing flow chart shown in FIG8 . As shown in FIG8 , the process by which the direct memory access unit executes the first data processing task is similar to the flow chart shown in FIG5 , and is not further described here. In response to the data processing system receiving the data processing task, the hardware synclock management unit determines at least one idle hardware synclock and an identifier for each hardware synclock in the hardware synclock sequence. The hardware synclock management unit then sends the identifier of any hardware synclock as the first synclock identifier to the scalar processing unit. Upon receiving the first synclock identifier, the scalar processing unit sends the first synclock identifier and the second data processing task as a second task instruction to the vector processing unit. Based on the received second task instruction, the vector processing unit, through two multiplexers (muxes), determines the working state value (busy) of the second distributed synclock corresponding to the second synclock identifier and the second distributed synclock in the third synclock sequence, and determines the task type value (sync) of the second distributed synclock in the fourth synclock sequence. The vector processing unit then determines whether to execute the second data processing task based on the working state value of the second distributed synchronization lock, the task type value of the second distributed synchronization lock, and the type of the second data processing task. For example, the second data processing task can only be executed if the task type of the second data processing task is a write task, the working state value of the second synchronization lock is a preset value representing an idle state (i.e., busy is 1), and the task type value of the second synchronization lock is 1. If the judgment result indicates that the second data processing task can be executed, the vector processing unit executes the second data processing task. The vector processing unit processes the target data within the data processing system. After the vector processing unit completes processing the target data, it sends a task completion instruction to the hardware synchronization lock management unit. The hardware synchronization lock management unit determines the first hardware synchronization lock in the hardware synchronization lock sequence based on the first synchronization lock identifier in the task completion instruction. The hardware synchronization lock management unit uses three delay ticks to update the task type value of the first hardware synchronization lock from 1 to 0 after three clock cycles. Furthermore, using three delay ticks, after three clock cycles, it updates the task type value of the second distributed synchronization lock corresponding to the first synchronization lock identifier in the second synchronization lock sequence from 1 to 0. The hardware sync lock management unit can also merge task completion instructions sent by the direct memory access unit and the vector processing unit, and update the task type value of the corresponding hardware sync lock in the hardware sync lock sequence based on the merged multiple task completion instructions. In some embodiments, the hardware sync lock management unit can also receive task completion instructions sent by units other than the direct memory access unit and the vector processing unit.Accordingly, the hardware sync lock management unit merges task completion instructions from different units and updates the task type value of the corresponding hardware sync lock in the hardware sync lock sequence, which can improve the efficiency of updating the task type value of the hardware sync lock.
[0106] It should be noted that the above steps 301-311 are described using the example of a direct memory access unit performing a read task. Specifically, the direct memory access unit reads the target data to be processed from the external memory and moves the target data into the data processing system. In some embodiments, the read task can also be performed by the vector processing unit. Accordingly, the vector processing unit reads the target data to be processed within the data processing system and processes the target data. The direct memory access unit then writes the processed target data into the external memory.
[0107] In some embodiments, the process of the vector processing unit executing a read task includes: the scalar processing unit sends a third task instruction to the vector processing unit, and sends a fourth task instruction to the direct memory access unit, the third task instruction includes a third data processing task and a third distributed synchronization lock indicated by the second synchronization lock identifier, and the fourth task instruction includes a fourth data processing task; the vector processing unit executes the third data processing task when the working state value of the third distributed synchronization lock is a preset value representing an idle state and the task type value of the third distributed synchronization lock meets the execution condition of the third data processing task, and sends a task completion instruction to the hardware synchronization lock management unit after the third data processing task is completed; the hardware synchronization lock management unit updates the task type value of the second hardware synchronization lock indicated by the second synchronization lock identifier in the hardware synchronization lock sequence based on the task completion instruction; the direct memory access unit executes the fourth data processing task when the task type value of the second hardware synchronization lock is updated.
[0108] The following describes the process of the vector processing unit executing the read task through steps (1) to (5).
[0109] (1) The scalar processing unit sends a third task instruction to the vector processing unit, and sends a fourth task instruction to the direct memory access unit.
[0110] After receiving the data processing task, the data processing system needs to call the direct memory access unit and the vector processing unit to execute the data processing task. The data processing system calls the hardware sync lock management unit to determine at least one idle hardware sync lock and the identifier of each hardware sync lock in the hardware sync lock sequence. The hardware sync lock management unit sends the identifier of any hardware sync lock as the second sync lock identifier to the scalar processing unit. After the scalar processing unit receives the first sync lock identifier, the scalar processing unit uses the second sync lock identifier and the third data processing task to be executed by the vector processing unit as the third task instruction. The scalar processing unit uses the second sync lock identifier and the fourth data processing task to be executed by the direct memory access unit as the second task instruction. The scalar processing unit sends the third task instruction to the vector processing unit and the fourth task instruction to the direct memory access unit.
[0111] (2) The vector processing unit determines, based on the third task instruction sent by the scalar processing unit, a third distributed synchronization lock indicated by the second synchronization lock identifier included in the third task instruction in the vector processing unit, where the third distributed synchronization lock is used to determine whether to execute the third data processing task included in the third task instruction.
[0112] (3) When the working state value of the third distributed synchronization lock is a preset value representing an idle state and the task type value of the third distributed synchronization lock meets the execution condition of the third data processing task, the vector processing unit executes the third data processing task included in the third task instruction to process the target data within the data system. After completing the third data processing task, the vector processing unit sends a task completion instruction to the hardware synchronization lock management unit.
[0113] The task type of the third data processing task is a read task type. The vector processing unit sets the task type value of the third distributed synchronization lock to a first value as an execution condition for the third data processing task. For example, the vector processing unit sets the task type value of the third distributed synchronization lock to 0 as an execution condition for the third data processing task. By using the task type of the data processing task and using different values of the third distributed synchronization lock as the execution condition, different execution conditions can be determined for tasks of different task types, thereby controlling the execution timing between tasks.
[0114] (4) The hardware synchronization lock management unit updates the task type value of the second hardware synchronization lock indicated by the second synchronization lock identifier in the hardware synchronization lock sequence based on the task completion instruction.
[0115] Among them, the task type of the third data processing task is a read task type. The hardware synchronization lock management unit determines the second hardware synchronization lock in the hardware synchronization lock sequence based on the second synchronization lock identifier in the task completion instruction. After a third number of clock cycles, the hardware synchronization lock management unit updates the task type value of the second hardware synchronization lock from the first value to the second value. For example, after three clock cycles, the hardware synchronization lock management unit updates the task type value of the second hardware synchronization lock from 0 to 1. By updating the second hardware synchronization lock to a different value according to the task type of the data processing task, it is possible to determine whether the execution conditions of tasks of different task types are met according to the task type value of the second hardware synchronization lock. This realizes the control of the execution timing of tasks according to the hardware synchronization lock.
[0116] (5) When the task type value of the second hardware synchronization lock is updated, the direct memory access unit executes the fourth data processing task included in the fourth task instruction sent by the scalar processing unit and writes the target data processed by the vector processing unit into the external memory.
[0117] An embodiment of the present application provides a data processing method performed by a data processing system. A scalar processing unit can send task instructions to a direct memory access unit and a vector processing unit separately. This eliminates the need for the scalar processing unit to wait for the direct memory access unit to complete its task before sending the task to the vector processing unit, thereby improving the processing efficiency of the scalar processing unit. Accordingly, the direct memory access unit can determine a first distributed synchronizer in the direct memory access unit based on a first synchronizer identifier in a first task instruction sent by the scalar processing unit. Furthermore, the direct memory access unit can determine whether a first data processing task is currently being executed based on the working state value of the first distributed synchronizer and the task type value of the first distributed synchronizer. This eliminates the need for the scalar processing unit to determine when the direct memory access unit will execute the first data processing task, thereby achieving decoupling from the scalar processing unit. After the direct memory access unit completes its task, the direct memory access unit sends a task completion instruction to a hardware synchronizer management unit. Based on the task completion instruction, the hardware synchronizer management unit can update the task type value of the first hardware synchronizer in the hardware synchronizer sequence. In response to the update of the task type value of the first hardware synchronizer, the vector processing unit promptly executes the second data processing task, thereby improving the processor's data processing efficiency.
[0118] The embodiment of the present application further provides a data processing system. Referring to FIG8 , the data processing system includes: a scalar processing unit 801 , a direct memory access unit 802 , a hardware genlock management unit 803 , and a vector processing unit 804 .
[0119] The scalar processing unit 801 is configured to send a first task instruction to the direct memory access unit 802 and a second task instruction to the vector processing unit 804;
[0120] a direct memory access unit 802 configured to determine, based on the first task instruction sent by the scalar processing unit 801, a first distributed synchronization lock indicated by a first synchronization lock identifier included in the first task instruction, wherein the first distributed synchronization lock is used to determine whether to execute a first data processing task included in the first task instruction;
[0121] The direct memory access unit 802 is further configured to execute the first data processing task included in the first task instruction and send a task completion instruction to the hardware synchronization lock management unit 803 when the working state value of the first distributed synchronization lock is a preset value representing an idle state and the task type value of the first distributed synchronization lock meets the execution condition of the first data processing task;
[0122] The hardware synchronization lock management unit 803 is configured to update the task type value of the first hardware synchronization lock indicated by the first synchronization lock identifier in the hardware synchronization lock sequence 8031 based on the task completion instruction;
[0123] The vector processing unit 804 is configured to execute the second data processing task included in the second task instruction sent by the scalar processing unit 801 when the task type value of the first hardware synchronization lock is updated.
[0124] In some embodiments, the vector processing unit 804 is used to determine, in the vector processing unit 804, a second distributed synchronization lock indicated by a first synchronization lock identifier included in the second task instruction based on the second task instruction sent by the scalar processing unit 801, and the second distributed synchronization lock is used to determine whether to execute the second data processing task included in the second task instruction; when the task type value of the second distributed synchronization lock is updated, the working state value of the second distributed synchronization lock is updated to a preset value representing an idle state, and the task type value of the second distributed synchronization lock is updated to the task type value of the first hardware synchronization lock after the task type value of the first hardware synchronization lock is updated for a first number of clock cycles; when the working state value of the second distributed synchronization lock is a preset value representing an idle state, and the task type value of the second distributed synchronization lock meets the execution condition of the second data processing task, the second data processing task included in the second task instruction is executed.
[0125] In some embodiments, the hardware synchronization lock management unit 803 includes a hardware synchronization lock sequence 8031; the hardware synchronization lock management unit 803 is used to determine at least one idle hardware synchronization lock and the identifier of each hardware synchronization lock in the hardware synchronization lock sequence 8031; the identifier of any hardware synchronization lock is sent as a first synchronization lock identifier to the scalar processing unit 801; the scalar processing unit 801 is used to generate a first task instruction and a second task instruction in response to receiving the first synchronization lock identifier.
[0126] In some embodiments, the direct memory access unit 802 includes a first multiplexer 8021, a second multiplexer 8022, a first synchronization lock sequence 8023, and a second synchronization lock sequence 8024; the first multiplexer 8021 is used to determine the working state value of the first distributed synchronization lock and the first distributed synchronization lock in the first synchronization lock sequence 8023 based on the first synchronization lock identifier included in the first task instruction, and the first synchronization lock sequence 8023 is used to indicate the working state value of multiple distributed synchronization locks in the direct memory access unit 802, and the state includes an idle state and a non-idle state. The idle state is used to indicate that the direct memory access unit 802 is currently capable of executing the first data processing Task, the non-idle state is used to indicate that the direct memory access unit 802 is currently executing the data processing task corresponding to the first distributed synchronization lock; the second multiplexer 8022 is used to determine the task type value of the first distributed synchronization lock in the second synchronization lock sequence 8024 based on the first synchronization lock identifier, and the second synchronization lock sequence 8024 is used to indicate the task type values of multiple distributed synchronization locks in the direct memory access unit 802; the direct memory access unit 802 is also used to determine the execution condition of the first data processing task based on the task type of the first data processing task included in the first task instruction, and the execution condition is used to indicate the conditions that the task type value of the first distributed synchronization lock must meet.
[0127] In some embodiments, the task type of the first data processing task is a read task type, and the direct memory access unit 802 is configured to set the task type value of the first distributed synchronization lock to a first value as an execution condition.
[0128] In some embodiments, the hardware sync lock management unit 803 is configured to determine the first hardware sync lock in the hardware sync lock sequence 8031 based on the first sync lock identifier in the task completion instruction; and update the task type value of the first hardware sync lock after a second number of clock cycles.
[0129] In some embodiments, the hardware sync lock management unit 803 is configured to update the task type value of the first hardware sync lock from the first value to the second value after a second number of clock cycles.
[0130] In some embodiments, the scalar processing unit 801 is configured to send a third task instruction to the vector processing unit 803 and to send a fourth task instruction to the direct memory access unit 802; the vector processing unit 804 is configured to determine, in the vector processing unit 804, based on the third task instruction sent by the scalar processing unit 801, a third distributed synchronization lock indicated by a second synchronization lock identifier included in the third task instruction, the third distributed synchronization lock being used to determine whether to execute a third data processing task included in the third task instruction; the vector processing unit 804 is further configured to execute the third data processing task included in the third task instruction and send a task completion instruction to the hardware synchronization lock management unit 803 when a working state value of the third distributed synchronization lock is a preset value representing an idle state and a task type value of the third distributed synchronization lock meets an execution condition of the third data processing task; the hardware synchronization lock management unit 803 is configured to update the task type value of the second hardware synchronization lock indicated by the second synchronization lock identifier in the hardware synchronization lock sequence based on the task completion instruction; and the direct memory access unit 802 is configured to execute the fourth data processing task included in the fourth task instruction sent by the scalar processing unit 801 when the task type value of the second hardware synchronization lock is updated.
[0131] In some embodiments, the task type of the third data processing task is a read task type, and the vector processing unit 804 is configured to set the task type value of the third distributed synchronization lock to the first value as the execution condition of the third data processing task.
[0132] In some embodiments, the task type of the third data processing task is a read task type, and the hardware synchronization lock management unit 803 is used to determine the second hardware synchronization lock in the hardware synchronization lock sequence 8031 based on the second synchronization lock identifier in the task completion instruction; after a third number of clock cycles, the task type value of the second hardware synchronization lock is updated from the first value to the second value.
[0133] It should be noted that the data processing system provided in the above embodiment is merely an example of the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the terminal can be divided into different functional modules to complete all or part of the functions described above. In addition, the data processing system and data processing method provided in the above embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0134] An embodiment of the present application further provides a terminal, which includes a processor and a memory, wherein the memory stores a data processing method, and the processor is used to implement the data processing method provided in the above embodiment through a data processing system.
[0135] FIG9 is a schematic structural diagram of a terminal provided in an embodiment of the present application.
[0136] The terminal 900 includes a processor 901 and a memory 902 .
[0137] The processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 901 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), or PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 901 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0138] The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 902 is used to store at least one computer program, which is used to be used by the processor 901 to implement the data processing method provided in the method embodiment of the present application.
[0139] Those skilled in the art will appreciate that the structure shown in FIG9 does not limit the terminal 900 and may include more or fewer components than shown, or combine certain components, or adopt a different component arrangement.
[0140] An embodiment of the present application further provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to implement the data processing method provided in the above embodiment.
[0141] An embodiment of the present application further provides a computer program product, including a computer program, which is loaded and executed by a processor to implement the data processing method provided in the above embodiment.
[0142] Those skilled in the art will understand that all or part of the steps for implementing the above embodiments may be accomplished by hardware, or may be accomplished by instructing the relevant hardware through a program, and the above program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0143] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0144] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A data processing method, executed by a data processing system, wherein the data processing system comprises a direct memory access unit, a vector processing unit, a scalar processing unit and a hardware synchronization lock management unit, wherein the method include: The scalar processing unit sends a first task instruction to the direct memory access unit, and sends a second task instruction to the vector processing unit, wherein the first task instruction includes a first data processing task and a first synchronization lock identifier indicating a first distributed synchronization lock, and the second task instruction includes a second data processing task; The direct memory access unit identifies the working state value of the first distributed synchronization lock based on the first synchronization lock identifier from the first task instruction; When the working state value of the first distributed synchronization lock is a preset value representing an idle state, and the task type value of the first distributed synchronization lock meets the execution condition of the first data processing task, the direct content access unit executes the first data processing task, and sends a task completion instruction to the hardware synchronization lock management unit after the first data processing task is completed; The hardware synchronization lock management unit updates the task type value of the first hardware synchronization lock indicated by the first synchronization lock identifier in the hardware synchronization lock sequence based on the task completion instruction; and The vector processing unit executes the second data processing task when the task type value of the first hardware synchronization lock is updated.
2. The method according to claim 1, wherein the vector processing unit executes the second data processing task when the task type value of the first hardware synchronization lock is updated, include: The vector processing unit determines, based on the second task instruction, a second distributed synchronization lock indicated by a first synchronization lock identifier included in the second task instruction in the vector processing unit; The vector processing unit updates the working state value of the second distributed synchronization lock to a preset value representing an idle state when the task type value of the second distributed synchronization lock is updated, and the task type value of the second distributed synchronization lock is updated to the task type value of the first hardware synchronization lock after a first number of clock cycles when the task type value of the first hardware synchronization lock is updated; The vector processing unit executes the second data processing task included in the second task instruction when the working state value of the second distributed synchronization lock is a preset value representing an idle state and the task type value of the second distributed synchronization lock meets the execution condition of the second data processing task.
3. The method according to claim 1 or 2, further comprising: include: The hardware synchronization lock management unit determines at least one idle hardware synchronization lock and an identifier of each hardware synchronization lock in the hardware synchronization lock sequence; The hardware synchronization lock management unit sends the identifier of any hardware synchronization lock as the first synchronization lock identifier to the scalar processing unit; In response to the scalar processing unit receiving the first synchronization lock indicator, the scalar processing unit generates the first task instruction and the second task instruction.
4. The method according to any one of claims 1 to 3, further comprising: include: The first multiplexer in the direct memory access unit determines the working state values of the first distributed synchronization lock and the first distributed synchronization lock in a first synchronization lock sequence based on the first synchronization lock identifier included in the first task instruction, the first synchronization lock sequence is used to indicate the working state values of multiple distributed synchronization locks in the direct memory access unit, the states include an idle state and a non-idle state, the idle state is used to indicate that the direct memory access unit is currently able to execute the first data processing task, and the non-idle state is used to indicate that the direct memory access unit is currently executing the data processing task corresponding to the first distributed synchronization lock; A second multiplexer in the direct memory access unit determines a task type value of the first distributed synchronization lock in a second synchronization lock sequence based on the first synchronization lock identifier, wherein the second synchronization lock sequence is used to indicate task type values of multiple distributed synchronization locks in the direct memory access unit; The direct memory access unit determines an execution condition of the first data processing task based on a task type of the first data processing task included in the first task instruction, wherein the execution condition is used to indicate the execution condition of the first distributed synchronization lock. The conditions that the task type value must meet.
5. The method according to any one of claims 1 to 4, wherein the task type of the first data processing task is a read task type, and the direct memory access unit determines the execution condition of the first data processing task based on the task type of the first data processing task included in the first task instruction, include: The direct memory access unit uses the task type value of the first distributed synchronization lock as a first value as the execution condition.
6. The method according to any one of claims 1 to 5, wherein the hardware synchronization lock management unit updates the task type value of the first hardware synchronization lock indicated by the first synchronization lock identifier in the hardware synchronization lock sequence based on the task completion instruction, include: The hardware synchronization lock management unit determines the first hardware synchronization lock in the hardware synchronization lock sequence based on the first synchronization lock identifier in the task completion instruction; The hardware synchronization lock management unit updates the task type value of the first hardware synchronization lock after a second number of clock cycles.
7. The method according to any one of claims 1 to 6, wherein the task type of the first data processing task is a read task type, and the hardware synchronization lock management unit updates the task type value of the first hardware synchronization lock after a second number of clock cycles, include: The hardware synchronization lock management unit updates the task type value of the first hardware synchronization lock from the first value to the second value after the second number of clock cycles.
8. The method according to any one of claims 1 to 7, further comprising: include: The scalar processing unit sends a third task instruction to the vector processing unit, and sends a fourth task instruction to the direct memory access unit, wherein the third task instruction includes a third data processing task and a third distributed synchronization lock indicated by a second synchronization lock identifier, and the fourth task instruction includes a fourth data processing task; The vector processing unit executes the third data processing task when the working state value of the third distributed synchronization lock is a preset value representing an idle state and the task type value of the third distributed synchronization lock meets the execution condition of the third data processing task, and sends a task completion instruction to the hardware synchronization lock management unit after the third data processing task is completed; The hardware synchronization lock management unit updates the task type value of the second hardware synchronization lock indicated by the second synchronization lock identifier in the hardware synchronization lock sequence based on the task completion instruction; The direct memory access unit executes the fourth data processing task when the task type value of the second hardware synchronization lock is updated.
9. The method according to any one of claims 1 to 8, wherein the task type of the third data processing task is a read task type, and the method further include: The vector processing unit uses the task type value of the third distributed synchronization lock as a first value as an execution condition of the third data processing task.
10. The method according to any one of claims 1 to 8, wherein the task type of the third data processing task is a read task type, and the hardware synchronization lock management unit updates the task type value of the second hardware synchronization lock indicated by the second synchronization lock identifier in the hardware synchronization lock sequence based on the task completion instruction, include: The hardware synchronization lock management unit determines the second hardware synchronization lock in the hardware synchronization lock sequence based on the second synchronization lock identifier in the task completion instruction; The hardware synchronization lock management unit updates the task type value of the second hardware synchronization lock from the first value to the second value after a third number of clock cycles.
11. A data processing system, comprising a direct memory access unit, a vector processing unit, a scalar processing unit and a hardware synchronization lock management unit; The scalar processing unit is used to send a first task instruction to the direct memory access unit and send a second task instruction to the vector processing unit, in, The first task instruction includes a first data processing task and a first synchronization lock identifier indicating a first distributed synchronization lock, and the second task instruction includes a second data processing task; The direct memory access unit is used to identify the working state value of the first distributed synchronization lock based on the first synchronization lock identifier from the first task instruction The direct memory access unit is further configured to, when the working state value of the first distributed synchronization lock is a preset value representing an idle state and the task type value of the first distributed synchronization lock meets the execution condition of the first data processing task, the direct content access unit executes the first data processing task, and sends a task completion instruction to the hardware synchronization lock management unit after the first data processing task is completed; The hardware synchronization lock management unit is used for updating the task type value of the first hardware synchronization lock indicated by the first synchronization lock identifier in the hardware synchronization lock sequence based on the task completion instruction; and The vector processing unit is used to execute the second data processing task when the task type value of the first hardware synchronization lock is updated.
12. The system according to claim 11, wherein the vector processing unit is configured to: determine, based on the second task instruction, in the vector processing unit a second distributed synchronization lock indicated by a first synchronization lock identifier included in the second task instruction ; When the task type value of the second distributed synchronization lock is updated, the working state value of the second distributed synchronization lock is updated to a preset value representing an idle state, and the task type value of the second distributed synchronization lock is updated to the task type value of the first hardware synchronization lock after a first number of clock cycles after the task type value of the first hardware synchronization lock is updated; When the working state value of the second distributed synchronization lock is a preset value representing the idle state, and the task type value of the second distributed synchronization lock meets the execution condition of the second data processing task, the second data processing task included in the second task instruction is executed.
13. The system according to claim 11 or 12, wherein the hardware synchronization lock unit comprises the hardware synchronization lock sequence; The hardware synchronization lock management unit is used to determine at least one idle hardware synchronization lock and an identifier of each hardware synchronization lock in the hardware synchronization lock sequence; The hardware synchronization lock management unit is further used to send the identifier of any hardware synchronization lock as the first synchronization lock identifier to the scalar processing unit; The scalar processing unit is used to generate the first task instruction and the second task instruction in response to receiving the first synchronization lock identifier.
14. The system according to any one of claims 11 to 13, wherein the direct memory access unit comprises a first multiplexer, a second multiplexer, a first synchronization lock sequence, and a second synchronization lock sequence; The first multiplexer is used to determine the working state values of the first distributed synchronization lock and the first distributed synchronization lock in the first synchronization lock sequence based on the first synchronization lock identifier included in the first task instruction, the first synchronization lock sequence is used to indicate the working state values of multiple distributed synchronization locks in the direct memory access unit, and the states include an idle state and a non-idle state, the idle state is used to indicate that the direct memory access unit is currently able to execute the first data processing task, and the non-idle state is used to indicate that the direct memory access unit is currently executing the data processing task corresponding to the first distributed synchronization lock; The second multiplexer is used to determine the task type value of the first distributed synchronization lock in a second synchronization lock sequence based on the first synchronization lock identifier, and the second synchronization lock sequence is used to indicate the task type values of multiple distributed synchronization locks in the direct memory access unit; The direct memory access unit is used to determine an execution condition of the first data processing task based on a task type of the first data processing task included in the first task instruction, and the execution condition is used to indicate a condition that the task type value of the first distributed synchronization lock must satisfy.
15. The system according to any one of claims 11 to 14, wherein the task type of the first data processing task is a read task type; The direct memory access unit is used to set the task type value of the first distributed synchronization lock to a first value as the execution condition.
16. The system according to any one of claims 11 to 15, wherein the hardware synchronization lock unit comprises the hardware synchronization lock sequence; The hardware synchronization lock management unit is used to: determine the first hardware synchronization lock in the hardware synchronization lock sequence based on the first synchronization lock identifier in the task completion instruction; and update the task type value of the first hardware synchronization lock after a second number of clock cycles.
17. The system according to any one of claims 11 to 16, wherein the task type of the first data processing task is a read task type; The hardware synchronization lock management unit is used to update the task type value of the first hardware synchronization lock from a first value to a second value after the second number of clock cycles.
18. The system according to any one of claims 11 to 17, wherein the vector processing unit comprises a third distributed synchronization lock; The scalar processing unit is used to send a third task instruction to the vector processing unit, and send a fourth task instruction to the direct memory access unit, the third task instruction includes a third data processing task and a third distributed synchronization lock indicated by a second synchronization lock identifier, and the fourth task instruction includes a fourth data processing task; The vector processing unit is used for executing the third data processing task when the working state value of the third distributed synchronization lock is a preset value representing an idle state and the task type value of the third distributed synchronization lock meets the execution condition of the third data processing task, and sending a task completion instruction to the hardware synchronization lock management unit after the third data processing task is completed; The hardware synchronization lock management unit is used for updating the task type value of the second hardware synchronization lock indicated by the second synchronization lock identifier in the hardware synchronization lock sequence based on the task completion instruction; The direct memory access unit is used to execute the fourth data processing task when the task type value of the second hardware synchronization lock is updated.
19. A chip comprising the data processing system according to any one of claims 11 to 18.
20. A terminal, comprising a processor and a memory, wherein the memory stores the data processing method according to any one of claims 1 to 10, and the processor is used to implement the data processing method through a data processing system.
Citation Information
Patent Citations
Method and device for managing resources on basis of programmable hardware
CN108536526A
Distributed lock calling method and device, electronic equipment and storage medium
CN112799791A
Task scheduling method and device, computer equipment and computer readable storage medium
CN113986534A
Thread execution method and device, electronic equipment and storage medium
CN114691376A
Data processing method and system, chip and terminal
CN116955244A
