Data processing system and method

By using multiple NPUs for parallel execution in the data processing system and configuring independent storage space for each NPU, the problem of insufficient processing power of a single NPU and long time-consuming serial execution of multiple NPUs is solved, achieving more efficient data processing. and task execution.

CN118535296APending Publication Date: 2024-08-23EVERY MOMENT THINKING INTELLIGENT TECH (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311652038.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-05
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

In the existing technology, the data processing capability of a single NPU is limited, and serial execution of multiple NPUs takes a long time, making it difficult to achieve efficient calculations in application scenarios that require high data calculation efficiency.

Method used

Multiple NPUs are used to execute in parallel. Each NPU only accesses its own independent storage space. The CPU divides tasks into subtasks and assigns them to multiple NPUs to avoid competition and congestion problems when multiple NPUs access the same storage space.

Benefits of technology

It improves the speed of data processing and task execution efficiency. Through the design of independent storage space, it avoids competition and congestion between multiple NPUs and achieves faster data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535296A
    Figure CN118535296A
Patent Text Reader

Abstract

The invention discloses a data processing system and method. The system comprises a CPU (Central Processing Unit), a plurality of NPUs (Network Processing Unit), a plurality of SRAMs (Static Random Access Memory) and a plurality of PSRAMs, the plurality of NPUs are respectively connected with the CPU through respective corresponding internal buses AXI; each NPU is provided with an SRAM and a PSRAM, and the SRAM and the PSRAM are connected with the corresponding NPU through respective corresponding internal buses AXI; the CPU is used for integrally dividing a to-be-executed task into a plurality of sub-tasks and distributing the sub-tasks to the plurality of NPUs; the SRAM is used for pre-storing first parameter information allocated to the subtask of the corresponding NPU; the PSRAM is used for storing second parameter information allocated to the sub-task of the corresponding NPU; and each NPU reads the first parameter information based on the driving signal of the CPU, calls the second parameter information to execute the corresponding subtask, and writes the generated third parameter information into the corresponding SRAM.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a data processing system and method. Background Art

[0002] NPU (embedded neural network processor) is an important application of artificial intelligence. Usually, a single NPU or multiple NPUs are used to execute tasks with large amounts of data. However, in the prior art, a single NPU is limited by its own data processing capabilities, and multiple NPUs take a long time to execute in series. If a single NPU or multiple NPUs are used in application scenarios that require high data computing efficiency, it is difficult to efficiently calculate the data, resulting in difficulty in efficiently executing tasks. Summary of the invention

[0003] The present invention aims to solve at least one of the technical problems existing in the prior art.

[0004] To this end, the present invention proposes a data processing system and method, in which multiple NPUs execute in parallel, and each NPU only accesses its corresponding storage space, avoiding competition and congestion problems when multiple NPUs access the same storage space, thereby speeding up data processing and improving task execution speed.

[0005] According to the first aspect embodiment of the present application, there is provided a data processing system, comprising: a CPU, a plurality of NPUs, a plurality of SRAMs and a plurality of PSRAMs; the plurality of NPUs are respectively connected to the CPU via their respective corresponding internal buses AXI; each of the NPUs is configured with one SRAM and one PSRAM, and the SRAM and the PSRAM are both connected to the corresponding NPU via their respective corresponding internal buses AXI; the CPU is used to divide the overall task to be executed into a plurality of subtasks and distribute them to the plurality of NPUs respectively; the SRAM is used to pre-store first parameter information of the subtasks distributed to the corresponding NPUs; the PSRAM is used to store second parameter information of the subtasks distributed to the corresponding NPUs; each of the NPUs reads the first parameter information based on the driving signal of the CPU and calls the second parameter information to execute the corresponding subtask, and writes the generated third parameter information into the corresponding SRAM.

[0006] In the above system, the first parameter information includes the data required to execute the subtask; the second parameter information includes the algorithm model required to execute the subtask; and the third parameter information includes the initialization data, intermediate calculation results and final output results during the execution of the subtask.

[0007] In the above system, the CPU receives the control instruction sent by the RTOS, and selects the NPU in the idle state to work according to the control instruction and the running status of each NPU.

[0008] In the above system, when each of the NPUs switches from a working state to an idle state, the NPU triggers an external interrupt to feed back to the CPU.

[0009] In the above system, the NPU has a built-in status register, and the CPU reads the status registers in each NPU in a polling manner to determine whether the NPU is faulty.

[0010] In the above system, when the SRAM or the PSRAM configured by the NPU fails, the NPU triggers an external interrupt to feed back to the CPU.

[0011] According to a second aspect of the present application, there is provided a data processing method for the data processing system as described above, comprising the following steps:

[0012] The CPU receives the control instruction sent by the RTOS, and selects a plurality of NPUs in an idle state according to the control instruction; each of the NPUs is configured with an SRAM and a PSRAM;

[0013] The CPU divides the task to be executed as a whole into a plurality of subtasks and distributes them to a plurality of selected NPUs respectively; and writes the first parameter information of the subtasks distributed to the NPU into the corresponding SRAM; and writes the second parameter information of the subtasks distributed to the NPU into the corresponding PSRAM;

[0014] The CPU drives one of the selected NPUs to start, and the started NPU reads the first parameter information from the SRAM corresponding to the NPU and calls the second parameter information from the corresponding PSRAM to execute the corresponding subtask, and writes the generated third parameter information into the SRAM corresponding to the NPU;

[0015] After one of the selected NPUs is started, the CPU drives the next selected NPU.

[0016] In the above method, before the CPU receives the control instruction sent by the RTOS and selects multiple NPUs in an idle state according to the control instruction, it also includes: the CPU reads the status register in each of the NPUs in a polling manner to determine whether the NPU is faulty.

[0017] According to a third aspect of the present application, a terminal is provided, including a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor executes the above-mentioned data processing method when running the computer program.

[0018] According to the fourth aspect embodiment of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is executed by a processor, the terminal where the storage medium is located is controlled to execute the above-mentioned data processing method.

[0019] According to the technical solution provided in the present application, at least the following beneficial effects are achieved: each NPU is configured with an SRAM and a PSRAM, so that each NPU has an independent storage space. The CPU divides the task to be executed as a whole into multiple subtasks and distributes them to multiple NPUs respectively. The SRAM corresponding to each NPU is used to store the first parameter information of the subtask distributed to the corresponding NPU, and the PSRAM corresponding to each NPU is used to store the second parameter information of the subtask distributed to the corresponding NPU. The CPU first drives one of the NPUs to start, and the started NPU reads the first parameter information from the corresponding SRAM and calls the second parameter information from the corresponding PSRAM to execute the corresponding subtask, and then writes the third parameter information generated during the execution of the subtask into the corresponding SRAM, which enables each NPU to access only its corresponding storage space, avoiding competition and congestion problems when multiple NPUs access the same storage space. After one of the NPUs is started, the CPU drives the next NPU, so that multiple NPUs can be executed in parallel without interfering with each other, thereby speeding up the processing of data.

[0020] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0022] Figure 1 A structural block diagram of a data processing system provided in an embodiment of the present application;

[0023] Figure 2 A workflow diagram of a data processing system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0025] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above-mentioned drawings are used to distinguish similar objects, rather than to describe a specific order or sequence. The meaning of "several" is one or more, the meaning of "many" is more than two, greater than, less than, exceed, etc. are understood to exclude the number itself, and above, below, within, etc. are understood to include the number itself.

[0026] like Figure 1 As shown, the first aspect embodiment of the present application provides a data processing system, including a CPU (Central Processing Unit), multiple NPUs (Neural Processing Unit neural network processors), multiple SRAMs (Static Random-Access Memory static random access memory) and multiple PSRAMs (Pseudo static random access memory pseudo static random access memory).

[0027] Among them, multiple NPUs are connected to the CPU through their corresponding internal buses AXI on the system on chip SOC (System on Chip). Each NPU is configured with an SRAM and a PSRAM, so that each NPU has an independent storage space. In this way, when multiple NPUs work at the same time, each NPU only accesses its corresponding storage space, which can avoid competition and congestion problems when multiple NPUs access the same storage space. Both SRAM and PSRAM are connected to the corresponding NPU through their corresponding internal buses AXI.

[0028] like Figure 2As shown, in some specific embodiments of the present application, the CPU divides the task to be executed as a whole into multiple subtasks and distributes them to multiple NPUs respectively. The SRAM corresponding to each NPU is used to store the first parameter information of the subtask distributed to the corresponding NPU, and the PSRAM corresponding to each NPU is used to store the second parameter information of the subtask distributed to the corresponding NPU. Each NPU to which the subtask is distributed is started based on the driving signal of the CPU. The started NPU reads the first parameter information from the corresponding SRAM and calls the second parameter information from the corresponding PSRAM to execute the corresponding subtask, and then writes the third parameter information generated during the execution of the subtask into the corresponding SRAM. After each subtask is executed by the corresponding NPU, the CPU directly reads the final output result of the corresponding subtask from the third parameter information written in each SRAM for integration processing, and the result after integration processing is used as the final result of the task to be executed.

[0029] In some specific embodiments of the present application, the task to be executed may be, for example, high-resolution image processing. The CPU converts the high-resolution image into many sub-images through transformation, and distributes each transformed sub-image into a sub-task to each NPU. The first parameter information includes the sub-image data required to execute the sub-task; the second parameter information includes the algorithm model required to execute the sub-task; the third parameter information includes the initialization data, intermediate calculation results and final output results during the execution of the sub-task. The NPU reads the sub-image data in the corresponding SRAM and calls the appropriate algorithm model in the corresponding PSRAM, executes the corresponding sub-task, and writes the initialization data, intermediate calculation results and final output results generated during the execution of the task into the corresponding SRAM. After each NPU completes the corresponding sub-task, the CPU reads the final output result from each SRAM for integration processing. It should be noted that each PSRAM can pre-store multiple different algorithm models for a variety of different task types, and the algorithm models stored in each PSRAM can be the same or different.

[0030] In some specific embodiments of the present application, the CPU receives a control instruction issued by the RTOS (Real Time Operating System) to drive one of the NPUs to start. It should be noted that after the NPU is started, it will no longer occupy the CPU resources, thereby releasing the CPU resources to drive the next NPU. Although multiple NPUs are started one by one, they can run and process corresponding subtasks at the same time, in parallel, without interfering with each other. When each NPU completes the corresponding subtask, the NPU switches from the working state to the idle state, and the NPU triggers an external interrupt to feed back to the CPU.

[0031] In some specific embodiments of the present application, after the CPU receives the control instruction sent by the RTOS, it selects the NPU in the idle state to work according to the task type of the control instruction and the running status of the NPU.

[0032] In some specific embodiments of the present application, the NPU has a built-in status register. Before the CPU receives the control instructions issued by the RTOS, the CPU reads the status register inside the NPU by polling to determine whether the NPU has a fault. The status register is usually provided with a flag indicating the working status of the NPU, such as whether an error occurs, whether it is operating normally, etc. If the NPU fails, the flag indicating the error in the status register will be set, and the CPU will stop the operation of the NPU. In other embodiments, data transmission and verification methods can also be used, such as the CPU sending data to the NPU and verifying the accuracy of the data fed back by the NPU, to determine whether the NPU has a fault.

[0033] It should be noted that each NPU is equipped with a corresponding error handling mechanism. When an NPU fails, the error handling mechanism will handle related issues, record the error status, and generate an interrupt to inform the CPU to proceed to the next step.

[0034] In some specific embodiments of the present application, when the NPU fails when reading or writing the corresponding SRAM, for example, the data read from the SRAM does not match the expectations, or the original data in the SRAM is not updated after the processed data is written, the NPU triggers an external interrupt to feedback to the CPU, and the CPU rewrites the to-be-processed data in the failed SRAM into the SRAM corresponding to the new NPU in the idle state for reprocessing.

[0035] In some specific embodiments of the present application, when the NPU fails when calling the algorithm model in the corresponding PSRAM, such as the algorithm model call fails or an error occurs, the NPU triggers an external interrupt to feedback to the CPU, and the CPU calls the PSRAM corresponding to the new NPU in the idle state for processing.

[0036] In some specific embodiments of the present application, when a SRAM or PSRAM corresponding to a certain NPU fails, the NPU triggers an external interrupt to feed back to the CPU, and the CPU selects a new NPU in an idle state and its corresponding SRAM and PSRAM to work.

[0037] The above data processing system can be implemented through an integrated circuit or a chip, which is not specifically limited in this application.

[0038] A second aspect of the present application provides a data processing method, which is applied to the above-mentioned data processing system. The data processing method comprises the following steps:

[0039] The CPU receives control instructions from the RTOS and selects multiple NPUs in idle state according to the control instructions; each NPU is configured with an SRAM and a PSRAM;

[0040] The CPU divides the task to be executed into a plurality of subtasks and distributes them to a plurality of selected NPUs respectively; writes the first parameter information of the subtasks distributed to the NPU into the corresponding SRAM; and writes the second parameter information of the subtasks distributed to the NPU into the corresponding PSRAM;

[0041] The CPU drives one of the selected NPUs to start, and the started NPU reads the first parameter information from the SRAM corresponding to the NPU and calls the second parameter information from the corresponding PSRAM to execute the corresponding subtask, and writes the generated third parameter information into the SRAM corresponding to the NPU;

[0042] After one of the selected NPUs is started, the CPU drives the next selected NPU.

[0043] In some specific embodiments of the present application, before the CPU receives the control instruction issued by the RTOS and selects multiple NPUs in idle state according to the control instruction, it also includes: the CPU reads the status register in each NPU by polling to determine whether the NPU is faulty.

[0044] The third aspect of the present application also provides a terminal, including a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor executes the above-mentioned data processing method when running the computer program.

[0045] Specifically, the processor may be a CPU, a general-purpose processor, a DSP, an ASIC, an FPGA or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0046] Specifically, the processor is connected to the memory via a bus, and the bus may include a path for transmitting information. The bus may be a PCI bus or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.

[0047] The memory can be a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, or an EEPROM, CD-ROM or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.

[0048] Optionally, the memory is used to store the code of the computer program for executing the solution of the present application, and the execution is controlled by the processor. The processor is used to execute the application program code stored in the memory to implement the actions of the above-mentioned data processing system.

[0049] The fourth aspect embodiment of the present application also provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is executed by the processor, the terminal where the storage medium is located is controlled to execute the above-mentioned data processing method.

[0050] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0051] The above is a specific description of the preferred implementation of the present application, but the present application is not limited to the above implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions without violating the spirit of the present application. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present application.

Claims

1. A data processing system, comprising: CPU, multiple NPUs, multiple SRAMs, and multiple PSRAMs; The plurality of NPUs are connected to the CPU through their respective corresponding internal buses AXI; each NPU is configured with one SRAM and one PSRAM, and the SRAM and the PSRAM are connected to the corresponding NPU through their respective corresponding internal buses AXI; the CPU is used to divide the task to be executed as a whole into a plurality of subtasks and distribute them to the plurality of NPUs respectively; the SRAM is used to pre-store the first parameter information of the subtasks distributed to the corresponding NPU; The PSRAM is used to store the second parameter information assigned to the subtask corresponding to the NPU; each NPU reads the first parameter information based on the driving signal of the CPU and calls the second parameter information to execute the corresponding subtask, and writes the generated third parameter information into the corresponding SRAM.

2. The system according to claim 1, characterized in that The first parameter information includes the data required to execute the subtask; the second parameter information includes the algorithm model required to execute the subtask; and the third parameter information includes the initialization data, intermediate calculation results and final output results during the execution of the subtask.

3. The system according to claim 1, characterized in that The CPU receives the control instruction sent by the RTOS, and selects the NPU in the idle state to work according to the control instruction and the running status of each NPU.

4. The system according to claim 1, characterized in that When each of the NPUs switches from a working state to an idle state, the NPU triggers an external interrupt to feed back to the CPU.

5. The system according to claim 1, characterized in that The NPU has a built-in status register, and the CPU reads the status registers in each NPU in a polling manner to determine whether the NPU is faulty.

6. The system according to claim 1, characterized in that When the SRAM or the PSRAM configured by the NPU fails, the NPU triggers an external interrupt to feed back to the CPU.

7. A data processing method for a data processing system according to any one of claims 1 to 6, characterized in that: The following steps are involved: The CPU receives the control instruction sent by the RTOS, and selects a plurality of NPUs in an idle state according to the control instruction; each of the NPUs is configured with an SRAM and a PSRAM; The CPU divides the task to be executed as a whole into a plurality of subtasks and distributes them to the plurality of selected NPUs respectively; and writes the first parameter information of the subtasks distributed to the NPUs into the corresponding SRAMs; and writing the second parameter information of the subtask distributed to the NPU into the corresponding PSRAM; The CPU drives one of the selected NPUs to start, and the started NPU reads the first parameter information from the SRAM corresponding to the NPU and calls the second parameter information from the corresponding PSRAM to execute the corresponding subtask, and writes the generated third parameter information into the SRAM corresponding to the NPU; After one of the selected NPUs is started, the CPU drives the next selected NPU.

8. The data processing method according to claim 7, characterized in that: Before the CPU receives the control instruction sent by the RTOS and selects a plurality of NPUs in an idle state according to the control instruction, the method further includes: The CPU reads the status registers in each of the NPUs in a polling manner to determine whether the NPU is faulty.

9. A terminal comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor runs the computer program, the data processing method according to any one of claims 7 to 8 is performed.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed by a processor, the terminal where the storage medium is located is controlled to execute the data processing method described in any one of claims 7 to 8.