Scheduling controller and method for neural network processing unit
The scheduling controller for neural network processing units addresses inefficiencies in task and resource management by employing a multi-level scheduler architecture that adapts to static and dynamic neural network models, enhancing parallel processing and resource utilization.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- MOFFETT TECH CO LTD
- Filing Date
- 2024-11-27
- Publication Date
- 2026-06-04
Smart Images

Figure CN2024134919_04062026_PF_FP_ABST
Abstract
Description
Scheduling Controller and Method for Neural network Processing UnitTECHNICAL FIELD
[0001] The present invention pertains to the field of neural networks (NN) and, more specifically, to a scheduling controller for neural network processing unit.BACKGROUND
[0002] Neural networks (NN) are currently the foundation for many modern artificial intelligence (AI) applications such as image and video recognition, recommender systems, classification, medical image analysis, and natural language processing.SUMMARY
[0003] Various embodiments of the present specification may include processors and systems implementing a scheduling controller for neural network processing unit. A system composed of one or more computers can be configured to perform specific operations or actions by installing software, firmware, hardware, or a combination of these elements. This configuration enables the system to carry out the designated actions. Similarly, computer programs can be designed to perform particular operations by including instructions that, when executed by data processing apparatus, prompt the apparatus to execute these actions.
[0004] In one general aspect, it provides a scheduling controller for neural network processing unit, wherein the neural network processing unit is used for running a neural network model and comprises multiple cores, each core comprises multiple processing elements (PEs) and each PE comprise multiple functional units, comprising: a top level module including a top RISC-V CPU with Vector extension (RVV) and a chip level scheduler (ChLS) , wherein the top level module is configured to make the top RVV perform scheduling for the multiple cores based on scheduling firmware for the top RVV or make the ChLS perform scheduling for the multiple cores based on predefined instruction sequence for the ChLS; a core level module including a core RVV and a core level scheduler (CoLS) , wherein the core level module is configured to make the core RVV perform scheduling for the multiple PEs based on scheduling firmware for the core RVV or make the CoLS perform scheduling for the multiple PEs based on predefined instruction sequence for the CoLS; and a PE level module including a PE RVV and a PE level scheduler (PELS) , wherein the PE level module is configured to make the PE RVV perform scheduling for the multiple functional units based on scheduling firmware for the PE RVV or make the PELS perform scheduling for the multiple functional units based on predefined instruction sequence for the PELS.
[0005] In one general aspect, it provides a scheduling method for neural network processing unit, wherein the neural network processing unit is used for running a neural network model and comprises multiple cores, each core comprises multiple processing elements (PEs) and each PE comprise multiple functional units, comprising: configuring a top level module including a top RISC-V CPU with Vector extension (RVV) and a chip level scheduler (ChLS) , wherein the top level module is configured to make the top RVV perform scheduling for the multiple cores based on scheduling firmware for the top RVV or make the ChLS perform scheduling for the multiple cores based on predefined instruction sequence for the ChLS; configuring a core level module including a core RVV and a core level scheduler (CoLS) , wherein the core level module is configured to make the core RVV perform scheduling for the multiple PEs based on scheduling firmware for the core RVV or make the CoLS perform scheduling for the multiple PEs based on predefined instruction sequence for the CoLS; and configuring a PE level module including a PE RVV and a PE level scheduler (PELS) , wherein the PE level module is configured to make the PE RVV perform scheduling for the multiple functional units based on scheduling firmware for the PE RVV or make the PELS perform scheduling for the multiple functional units based on predefined instruction sequence for the PELS.
[0006] These and other features of the systems, methods, and non-transitory computer-readable media disclosed herein, as well as the methods of operation and functions of the related elements of structure and the combination of parts and economies of manufacture, will become more apparent upon consideration of the following description and the appended claims with reference to the accompanying drawings, all of which form a part of this specification, wherein like reference numerals designate corresponding parts in the various figures. It is to be expressly understood, however, that the drawings are for purposes of illustration and description only and are not intended as a definition of the limits of the invention.BRIEF DESCRIPTION OF THE DRAWINGS
[0007] FIG. 1 illustrates an exemplary system diagram of a neural network processing unit in accordance with various embodiments.
[0008] FIG. 2 illustrates an example Processing Element (PE) in the neural network processing unit in accordance with various embodiments.
[0009] FIG. 3 illustrates an example scheduling controller for neural network processing unit in accordance with various embodiments.
[0010] FIG. 4-1 illustrates an example chip level scheduler (ChLS) in accordance with various embodiments.
[0011] FIG. 4-2 illustrates an example specific states and jump conditions of Finite State Machine (FSM) in the ChLS depicted in FIG. 4-1.
[0012] FIG. 5-1 illustrates an example core level scheduler (CoLS) in accordance with various embodiments.
[0013] FIG. 5-2 illustrates an example specific states and jump conditions of FSM in the CoLS depicted in FIG. 5-1.
[0014] FIG. 6-1 illustrates an example PE level scheduler (PELS) in accordance with various embodiments.
[0015] FIG. 6-2 illustrates an example specific states and jump conditions of FSM in the PELS depicted in FIG. 6-1.
[0016] FIG. 7 illustrates an example pipelining process performed by PELS in accordance with various embodiments.
[0017] FIG. 8 illustrates an example RVV loading process in accordance with various embodiments.
[0018] FIG. 9 illustrates an example RVV scheduling process in accordance with various embodiments.
[0019] FIG. 10 illustrates an example hardware scheduling process in accordance with various embodiments.
[0020] FIG. 11 illustrates an example scheduling method for neural network processing unit in accordance with various embodiments.
[0021] FIG. 12 illustrates an example computer system in which any of the embodiments described herein may be implemented. DETAIL DESCRIPTION OF THE EMBODIMENTS
[0022] Embodiments described herein provide methods, systems, apparatus for implementing a scheduling controller for neural network processing unit, enabling dynamically managing task distribution and resource allocation across the different PEs and cores.
[0023] FIG. 1 illustrates an exemplary system diagram of a neural network (NN) processing unit 100. The neural network processing unit 100 in FIG. 1 may refer to a neural network accelerator or an NPU, e.g., a specialized microprocessor designed to accelerate machine learning and artificial intelligence (AI) tasks. Unlike traditional CPUs (Central Processing Units) and GPUs (Graphics Processing Units) , accelerators or NPUs are optimized specifically for the neural network operations such as convolution computations and vector operations..
[0024] The NN processing unit 100 illustrated in FIG. 1 includes a plurality of Processing Elements (PEs) that are designed to provide maximum parallelism to accelerate neural network operations. These PEs are organized in a 2D mesh network and interconnected via a network of routers (denoted as “R” in FIG. 1) . Additionally, the NN processing unit 100 incorporates double data rate (DDR) memory modules and caches, such as the last-level cache (LLC) , to support efficient data storage and retrieval. The NN processing unit 100 is also equipped with control circuit, including a RVV (Top RVV as depicted in FIG. 1) responsible for vector processing. The NN processing unit 100 in FIG. 1 is merely illustrative, and may comprise more, fewer, or alternative components. The accelerator 100 may be designed as a reconfigurable device such as a field-programmable gate array (FPGA) , or an application-specific integrated circuit (ASIC) .
[0025] In some embodiments, to optimize resource utilization and enhance the parallel processing capabilities of the NN processing unit 100, the PEs within the 2D mesh network may be divided into multiple sections, with each section referred to as a core. As illustrated in FIG. 1, every group of 16 PEs (arranged in a 4x4 grid) constitutes a core, resulting in a total of four cores across the 64 PEs in the NN processing unit 100. Each core is equipped with dedicated DDR memory, LLC, and control circuits, including a RVV, responsible for vector processing, a Core Level Scheduler (CoLS) , which manages the execution and synchronization of multiple PEs, and an Instruction Dispatch Unit (IDU) , which allocates instructions to various execution units within the accelerator. This architecture enables all four cores 110 (i.e., the four PE groups) to operate concurrently, ensuring efficient parallel processing.
[0026] In some embodiments, these cores 110 are further organized into a Network-on-Chip (NoC) for inter-core communication. For instance, in FIG. 1, the four groups of PEs are arranged as a ring NoC, facilitating seamless communication between cores and enhancing overall computational throughput. The ring NoC architecture includes a circular arrangement of cores 110, where data packets travel along a unidirectional or bidirectional ring, passing through each core 110 until they reach their destination. The ring NoC may be used for data communication between DDRs and PCIe or for PEs to read data from DDR belonging to other cores. In addition to the ring NoC, the PEs may be arranged as a 2D mesh NoC, managing the data communication between PEs.
[0027] Furthermore, the ring NoC architecture in FIG. 1 is scalable, allowing additional cores or PEs to be easily added to the ring without significantly increasing the complexity of the network. This flexibility supports the expansion of the NN processing unit to accommodate larger neural network models or additional computational tasks as needed.
[0028] The NN processing unit 100 illustrated in FIG. 1 may interact with an external (host) CPU through a peripheral component interconnect express (PCIe) or an Ethernet (ETH) . The NN processing unit 100 illustrated in FIG. 1 may further include an internal CPU to orchestra the cores with instructions, and a chip level scheduler (ChLS) .
[0029] FIG. 2 illustrates an example Processing Element (PE) 140 in the neural network processing unit. The PE 140 is an example of a PE within core 110 from FIG. 1. The internal components of PE 140 depicted in FIG. 2 are for illustrative purposes, and the actual implementation may include additional, fewer, or alternative components depending on the specific design requirements.
[0030] The PE 140 may include a PE level scheduler (PELS) that manages instruction issuance through an instruction interface, triggering various functional modules. These modules include the DMA (Direct Memory Access) module, which facilitates high-speed data transfer between memory and processing units without burdening the central processing core. The Sparse Processing Unit (SPU) performs tensor multiplication. The Vector Processing Unit (VPU) handles vectorized operations. The Activation Engine (AE) applies activation functions, including ReLU, sigmoid, or softmax, introducing non-linearity into the neural networks. The Transpose Engine (TE) performs tensor transposition, often required in matrix multiplications and other tasks that involve reordering data dimensions. Finally, the Sorting Engine (SE) is responsible for sorting tensor elements, particularly useful in identifying and isolating high-magnitude values for optimization and pruning in sparse computations. These functional modules efficiently access shared memory, allowing seamless data transfer and interaction between them to ensure smooth operation.
[0031] Furthermore, PE 140 incorporates a local RVV (not depicted in FIG. 2) , such as a single-core RVV, which is optimized for executing vectorized instructions for neural network tasks. The RVV is coupled with TCM (Tightly Coupled Memory) , a high-speed, low-latency memory directly connected to the PE. This TCM allows the PE to store critical data and intermediate results for rapid access, minimizing latency and ensuring efficient execution of compute-intensive tasks such as matrix operations, convolutions, and tensor manipulations.
[0032] FIG. 3 illustrates an example scheduling controller 300 for neural network processing unit in accordance with various embodiments. The scheduling controller 300 depicted in FIG. 3 comprises three modules of different levels. Specifically, the scheduling controller 300 comprises a top level module 310 including a top RVV 312 and a chip level scheduler (ChLS) 314, a core level module 320 including a core RVV 322 and a core level scheduler (CoLS) 324, and a PE level module 330 including a PE RVV 332 and a PE level scheduler (PELS) 334. Since the scheduling operations performed by the top RVV 312, the core RVV 322 and the PE RVV 332 are mainly based on software instructions, the top RVV 312, the core RVV 322 and the PE RVV 332 may be called as software-based scheduling units. Further, since the scheduling operations performed by the ChLS 314, the CoLS 324 and the PELS 334 are mainly based on hardware (each of the ChLS 314, the CoLS 324 and the PELS 334 may be implemented as a pre-designed FSM, which will be described in the following text with reference to FIG. 4-2, FIG. 5-2 and FIG. 6-2 respectively) , the ChLS 314, the CoLS 324 and the PELS 334 may be called as hardware-based scheduling units. In some embodiments, the top RVV 312, the core RVV 322 and the PE RVV 332 are configured to communicate with each other through mailbox mechanism. In some embodiments, the top RVV 312 and the ChLS 314 are configured to interact with each other through Interrupt Request (IRQ) mechanism, the core RVV 322 and the CoLS 324 are configured to interact with each other through IRQ mechanism, and the PE RVV 332 and the PELS 334 are configured to interact with each other through IRQ mechanism. As for the control relationship between the software-based scheduling units, the top RVV 312 controls the core RVV 322, and the core RVV 322 controls the PE RVV 332. As for the control relationship between the hardware-based scheduling units, the ChLS 314 controls the CoLS 324, and the CoLS 324 controls the PELS 334. In the top level module 310, the top RVV 312 controls the ChLS 314, in the core level module 320, the core RVV 322 controls the CoLS 324, and in the PE level module 330, the PE RVV 332 controls the PELS 334. The specific control mode used for the neural network processing unit depends on the neural network model running on the neural network processing unit. The software-based scheduling unit is more flexible in scheduling tasks than the hardware-based scheduling unit and more suitable to be used in the scenario in which the neural network model running on the neural network processing unit dynamically changes. However, the software-based scheduling unit has a long latency than that of the hardware-based scheduling unit. As the hardware-based scheduling unit has a relative small latency and suitable to fast and dense control, it is more suitable to the scenario in which the neural network model is static or rarely changes.
[0033] FIG. 4-1 illustrates an example ChLS 314 in accordance with various embodiments. In some embodiments, the scheduling firmware of the top RVV 312 is loaded to Scratch Pad Memory (SPM) 420 once the neural network processing unit 100 is powered on. The top RVV 312 can be configured to perform scheduling for the multiple cores based on scheduling firmware for the top RVV 312. The top RVV 312 can be also configured to instruct top level Direct Memory Access (DMA) 430 to retrieve the predefined instruction sequence for the ChLS 314 from the SPM 420 and send the same to the ChLS 314 so that the ChLS 314 can perform scheduling for the multiple cores based on predefined instruction sequence. The predefined instruction sequence for the ChLS 314 is determined based on the neural network model. In some embodiments, the top RVV 312 has a higher priority than the ChLS 314 in performing scheduling for the multiple cores. In some embodiments, the ChLS 314 is configured to be controlled by the top RVV 312 through top level Control and Status Register (CSR) 410. In some embodiments, the ChLS 314 is configured to control the CoLS through special scheduler interface (which is not shown in FIG. 4-1) .
[0034] The ChLS 314 depicted in FIG. 4-1 may include multiple sub modules, such as FSM, Instruction Buffer. Although the ChLS 314 is shown to include above sub modules, it may include more or less sub modules than those as shown in FIG. 4-1. In some embodiments, the Instruction Buffer is used to store instructions that can be executed by the ChLS 314. The function of the ChLS 314 may be achieved through the FSM which provides a global control of all states including IDLE (which indicates the ChLS 314 can be enabled by the top RVV 312 through the CSR 410) , READY (which indicates the ChLS 314 is already enabled and ready to execute instructions. Once instructions are available, ChLS 314 can execute them immediately) , IF&ID (which indicates the ChLS 314 fetches and decodes instructions) , EXEC (which indicates the ChLS 314 executes the decoded instructions) , and DONE (which indicates the ChLS 314 enters execute end state) .
[0035] FIG. 4-2 shows an example specific states and jump conditions of the FSM in the ChLS 314 depicted in FIG. 4-1, including: (1) IDLE→READY: once enabled, the ChLS 314 jumps to ready state and prepares to execute instructions. (2) READY→IF&ID: the ChLS 314 is in ready state, once an instruction is valid in Instruction Buffer, the ChLS 314 jumps to IF&ID state to perform instruction fetching and instruction decoding process. (3) IF&ID→EXEC: after the instruction decoding process is complete, the ChLS 314 jumps to execute state to execute, for example, specific 32-bit instructions. (4) DONE→IDLE: after the execution of instructions is complete and there is an operation end instruction, the ChLS 314 jumps to idle state. (5) DONE→READY: after the execution of instruction is complete and there is no operation end instruction, and there happens to be an enable request coming into the ChLS 314, the ChLS 314 jumps to ready state. (6) DONE→IF&ID: after the execution of instruction is complete, and there is no operation end instruction and no enable requests coming into the ChLS 314, and there are valid instructions in Instruction Buffer, then the ChLS 314 jumps to IF&ID state and executes the next instruction directly so as to save processing cycle.
[0036] FIG. 5-1 illustrates an example CoLS 324 in accordance with various embodiments. In some embodiments, the firmware of the core RVV 322 is loaded to DDR memory module once the neural network processing unit 100 is powered on. The core RVV 322 can be configured to perform scheduling for the multiple PEs based on scheduling firmware for the core RVV 322. An IDU 520 can retrieve the predefined instruction sequence for the CoLS 324 from the DDR memory module (which is not shown in FIG. 5-1) and sends the same to the instruction buffer of the CoLS 324 so that the CoLS 324 can perform scheduling for the multiple PEs based on predefined instruction sequence for the CoLS 324. The predefined instruction sequence for the CoLS 324 is determined based on the neural network model. In some embodiments, the core RVV 322 has a higher priority than the CoLS 324 in performing scheduling for the multiple PEs. In some embodiments, the CoLS 324 is configured to be controlled by the core RVV 322 through core level CSR 510. In some embodiments, the CoLS 324 is configured to be controlled by the ChLS 322 through special scheduler interface (which is not shown in FIG. 5-1) .. In some embodiments, the CoLS 324 is configured to control the PELS through special scheduler interface (which are not shown in FIG. 5-1) .
[0037] The CoLS 324 depicted in FIG. 5-1 may include multiple sub modules, such as FSM, Instruction Buffer. Although the CoLS 324 is shown to include above sub modules, it may include more or less sub modules than those as shown in FIG. 5-1. In some embodiments, the Instruction Buffer is used to store instructions that can be executed by the CoLS 324. The function of the CoLS 324 may be achieved through the FSM which provides a global control of all states including IDLE (which indicates the CoLS 324 can be enabled by the core RVV 322 through the CSR 510) , READY (which indicates the CoLS 324 is already enabled and ready to execute instructions. Once instructions are available, CoLS 324 can executes them immediately) , Load Self Instruction (which indicates the CoLS 324 initiates a request to IDU 520 to self-load instructions as needed) , IF&ID (which indicates the CoLS 324 fetches and decodes instructions) , EXEC (which indicates the CoLS 324 executes the decoded instructions) , and DONE (which indicates the CoLS 324 enters execute end state) .
[0038] FIG. 5-2 shows an example specific states and jump conditions of the FSM in the CoLS 324 depicted in FIG. 5-1, including: (1) IDLE→READY: once enabled, the CoLS 324 jumps to ready state and prepares to execute instructions. (2) IDLE→Load Self Instruction: the CoLS 324 jumps to Load Self Instruction state once being informed to load its own instructions. (3) READY→Load Self Instruction: the CoLS 324 jumps to Load Self Instruction state once being informed to load its own instructions after being enabled. (4) READY→IF&ID: the CoLS 324 is in ready state, once an instruction is valid in Instruction Buffer, the CoLS 324 jumps to IF&ID state to perform instruction fetching decoding process. (5) Load Self Instruction→READY: the CoLS 324 jumps to ready state when being informed to load its own instructions first and then being enabled. (6) Load Self Instruction→IF&ID: the CoLS 324 jumps to IF&ID state to perform instruction fetching decoding process with previous state being ready or the execution of instructions is complete. (7) IF&ID→EXEC: after instruction decoding process is complete, the CoLS 324 jumps to execute state to execute, for example, specific 32-bit instruction. (8) DONE→IDLE: after the execution of instruction is complete and there is an operation end instruction, the CoLS 324 jumps to idle state. (9) DONE→Load Self Instruction: after the execution of instruction is complete and there is no operation end instruction, and there happens to be a Load Self Instruction request coming into the CoLS 324, the CoLS 324 jumps to Load Self Instruction state. (10) DONE→READY: after the execution of instruction is complete and there is no operation end instruction and no Load Self Instruction request coming into the CoLS 324, and there happens to be an enable request coming into the CoLS 324, the CoLS 324 jumps to ready state. (11) DONE→IF&ID: after the execution of instruction is complete, and there is no operation end instruction and no Load Self Instruction request and no enable request coming into the CoLS 324, and there are valid instructions in Instruction Buffer, then the CoLS 324 jumps to IF&ID state and executes the next instruction directly so as to save processing cycle.
[0039] FIG. 6-1 illustrates an example PELS 334 in accordance with various embodiments. The PELS 334 depicted in FIG. 6-1 may be implemented as a FSM as depicted in FIG. 6-2. In some embodiments, the PELS 334 includes three instruction queues, which are input stage 601, execute stage 603 and output stage 605. The three stages control multiple functional units in the PE, such as SPU 630, VPU 640, AE 650, TE 660, SE 670 and DMA controller (DMA CTRL) 680. The input stage 601 includes input instruction buffer and input scheduler, the execute stage 603 includes execute buffer and the execute scheduler, and the output stage 605 includes output buffer 603 and output scheduler. In some embodiments, the firmware of the PE RVV 332 is loaded to DDR memory module once the neural network processing unit is powered on. The PE RVV 332 can be configured to perform scheduling for the multiple functional units based on scheduling firmware for the PE RVV 332. An IDU 620 can retrieve the predefined instruction sequence for the PELS 334 from the DDR memory module (which is not shown in FIG. 6-1) and sends the same to the PELS 334 so that the PELS 334 can perform scheduling for the multiple functional units based on predefined instruction sequence for the PELS 334. The predefined instruction sequence for the PELS 334 is determined based on the neural network model. In some embodiments, the PE RVV 332 has a higher priority than the PELS 334 in performing scheduling for the multiple functional units. In some embodiments, the PELS 334 is configured to be controlled by the PE RVV 332 through PE level CSR 610. In some embodiments, the PELS 334 is configured to be controlled by the CoLS 324 through special scheduler interface (which is not shown in FIG. 6-1) . In some embodiments, the PELS 334 is configured to control various functional units to perform specific operations.
[0040] FIG. 6-2 shows an example specific states and jump conditions of the FSM in the PELS depicted in FIG. 6-1. For input stage, it includes Step 1: the PELS jumps to IDLE state when being powered on; Step 2: the PE RVV / CoLS issues op enable signal. If input buffer is in unlock state, the PE RVV / CoLS continues to issue new op enable signal without waiting for the entire op to be done; Step 3: the PELS jumps to IF&ID state if detecting op enable signal is high and the input buffer status is in unlock state; Step 4: In IF&ID state, if the instruction is STR instruction, the PELS reads the instruction and maintains in IF&ID state. If the instruction is ENB / LCK / ULCK / CALL instruction, the PELS reads the instruction and jumps to EXEC state. If the instruction is END instruction, the PELS reads the instruction and triggers execute stage enable signal and jumps back to IDLE state; Step 5: in EXEC state, the PELS sets op enable or sets input buffer status. If the next instruction is still ENB / LCK / ULCK / CALL instruction, the PELS maintains in EXEC state; if the instruction is WFI instruction, the PELS jumps to WAIT_DONE state; if the instruction is END instruction, the PELS jumps back to IF&ID state; Step 6: in WAIT_DONE state, the PELS waits for op done signal or buffer unlock signal. After receiving the done / unlock signal, the PELS jumps back to IF&ID state and repeats Step 4.
[0041] For execute stage, it includes Step 1: the PELS jumps to IDLE state when being powered on; Step 2: the PELS jumps to IF&ID state if detecting trigger execute stage enable signal is valid; Step 3: In IF&ID state, if the instruction is STR instruction, the PELS reads the instruction and maintains in IF&ID state. If the instruction is ENB / LCK / ULCK / CALL instruction, the PELS reads the instruction and jumps to EXEC state. If the instruction is END instruction, the PELS reads the instruction and triggers output stage enable signal and jumps back to IDLE state; Step 4: in EXEC state, the PELS sets op enable or sets input buffer status. If the next instruction is still ENB / LCK / ULCK / CALL instruction, the PELS maintains in EXEC state; if the instruction is WFI instruction, the PELS jumps to WAIT_DONE state; if the instruction is END instruction, the PELS jumps back to IF&ID state; Step 5: in WAIT_DONE state, the PELS waits for op done signal or buffer unlock signal. After receiving the done / unlock signal, the PELS jumps back to IF&ID state and repeats Step 3.
[0042] For output stage, it includes Step 1: the PELS jumps to IDLE state when being powered on; Step 2: the PELS jumps to IF&ID state if detecting trigger output stage enable signal is valid; Step 3: In IF&ID state, if the instruction is STR instruction, the PELS reads the instruction and maintains in IF&ID state. If the instruction is ENB / LCK / ULCK / CALL instruction, the PELS reads the instruction and jumps to EXEC state. If the instruction is END instruction, the PELS reads the instruction and sending op done signal to PE RVV / CoLS and jumps back to IDLE state; Step 4: in EXEC state, the PELS sets op enable / sets input buffer status. If the next instruction is still ENB / LCK / ULCK / CALL instruction, the PELS maintains in EXEC state; if the instruction is WFI instruction, the PELS jumps to WAIT_DONE state; if the instruction is END instruction, the PELS jumps back to IF&ID state; Step 5: in WAIT_DONE state, the PELS waits for op done signal or buffer unlock signal. After receiving the done / unlock signal, the PELS jumps back to IF&ID state and repeats Step 3.
[0043] In some embodiments, when the neural network model running on the neural network processing unit is a static neural network model (i.e., the structure and parameters of the neural network model do not change) , the scheduling controller 300 is configured to preferably use the hardware-based scheduling units, i.e., the ChLS, the CoLS and the PELS to perform desired scheduling. Specifically, based on predefined instruction sequences, the ChLS performs scheduling for the multiple cores and controls the CoLS to perform scheduling for the multiple PEs, and the CoLS controls the PELS to perform scheduling for the multiple functional units. In some embodiments, when the neural network model running on the neural network processing unit is a dynamic neural network model (i.e., the structure and parameters of the neural network model dynamically change) , the scheduling controller 300 is configured to preferably use the software-based scheduling units, i.e., the top RVV, the core RVV and the PE RVV to perform desired scheduling. Specifically, based on scheduling firmware, the top RVV performs scheduling for the multiple cores and controls the core RVV to perform scheduling for the multiple PEs, and the core RVV can control the PE RVV to perform scheduling for the multiple functional units. In some embodiments, when the neural network model running on the neural network processing unit is a hybrid neural network model (i.e., a portion of structure and parameters of the neural network model do not change while a portion of structure and parameters of the neural network model dynamically change) , the scheduling controller 300 can use both the hardware-based scheduling units and the software-based scheduling units to cooperate with each other to perform desired scheduling. In some embodiments, the scheduling controller 300 is configured to offload the scheduling relating to the static part of the neural network model (the portion with unchanged structure and parameters) to the hardware-based scheduling units (i.e., the ChLS, the CoLS and the PELS) to make them perform desired scheduling based on predefined instruction sequences, and the scheduling controller 300 is configured to make the software-based scheduling units (i.e., the top RVV, the core RVV and the PE RVV) perform desired scheduling relating to the dynamic part of the neural network model (the portion with dynamically changed structure and parameters) . In some embodiments, when the structure and parameters of the neural network model change, at least one of the top RVV, the core RVV and the PE RVV is configured to control the scheduling performed by the corresponding hardware-based scheduling unit to make the corresponding hardware-based unit perform updated scheduling based on updated instruction sequence therefor, including that the top RVV s configured to control he scheduling performed by the ChLS to make the ChLS perform updated scheduling based on updated instruction sequence therefor, and / or the core RVV s configured to control the scheduling performed by the CoLS to make the CoLS perform updated scheduling based on updated instruction sequence therefor, and / or the PE RVV s configured to control the scheduling performed by the PELS to make the PELS perform updated scheduling based on updated instruction sequence therefor. In the present application, the software-based scheduling unit and the hardware-based scheduling unit cooperating with each other can dynamically adapt to changes in input data and workload patterns, reallocating resources as needed to ensure that the neural network processing unit runs at peak efficiency.
[0044] FIG. 7 illustrates an example pipelining process performed by PELS in accordance with various embodiments. As shown in FIG. 7, there are three inferences (inference 1, inference 2 and inference 3) representing three identical inference operations. Each inference includes input stage, execute stage and output stage. As the internal computing resource in the neural network processing unit is limited, it shall prioritizing ensuring that the execute stage is under full load operation. As shown in FIG. 7, the input data for inference 1 is loaded to input buffer in the input stage of inference 1. After the input data is used in execute stage of inference 1, the input buffer may be released and the input data for next inference, for example, inference 2, may be loaded to the input buffer, as indicated by time T1. Although the input data for inference 2 has been loaded into the input buffer at time T1, the execute stage of inference 2 cannot begin until the execute stage of inference 1 is completed to release compute resource for inference 2, as indicated by time T2. After the input data is used in execute stage of inference 2, the input buffer may be released again and the input data for next inference, for example, inference 3, may be loaded to the input buffer, as indicated by time T3. Since the output buffer will be released until the output stage of inference 1 is completed (as indicated by time T4) , the execution of inference 2 have to wait until the output stage of inference 1 is completed (at this time, the output buffer is released) so that it can load output data to the output buffer. Similar to inference 2, although the input data for inference 3 has been loaded into the input buffer at time T3, the execute stage of inference 3 cannot begin until the execute stage of inference 2 is completed to release compute resource for inference 3, as indicated by time T5. Since the output buffer will be released again until the output stage of inference 2 is completed (as indicated by time T6) , the execution of inference 3 have to wait until the output stage of inference 2 is completed (at this time, the output buffer is released again) so that it can load output data to the output buffer. FIG. 7 also shows input instruction queue, execute instruction queue and output instruction queue performed by PELS, which shows how the input stages, the execute stages and the output stages of inference 1, 2 and 3 are performed in a pipelining manner by corresponding instruction queues. The pipelining process performed by the PELS depicted in FIG. 7 may ensure that the input and output of a later inference is not blocked by those of a previous inference.
[0045] FIG. 8 illustrates an example power-on RVV loading process in accordance with various embodiments. When the neural network processing unit is powered on, the firmware of the top RVV is stored in a ROM area in the neural network processing unit. Then program codes indicating how to configure hardware (such as PCIe, DDR) are loaded from outside flash to the neural network processing unit together with the firmware of the RVVs. At this time, all cores in the neural network processing unit are in reset state. Then, Kernel Mode Driver (KMD) initializes user interface and messages triggering transition to the firmware of the RVVs through mailbox mechanism. After the initialization of the user interface is completed, KMD loads driver loads updated firmware of all RVVs to corresponding storage locations in the neural network processing unit. When the loading of the firmware of all RVVs to corresponding storage locations in the neural network processing unit is complete, the user can issue data and tasks through, for example PCIe, to the neural network processing unit to make the neural network processing unit perform various operations on input data.
[0046] FIG. 9 illustrates an example RVV scheduling process in accordance with various embodiments. FIG. 9 exemplarily illustrates three RVVs (RVV0, RVV1 and RVV2) . When these RVVs are called, all synchronization requests for these RVVs are acquired. After all synchronization requests for these RVVs are acquired, it releases these RVVs at the same time (i.e., these RVVs are synchronized) and notifies each RVV to continue.
[0047] FIG. 10 illustrates an example hardware scheduling process in accordance with various embodiments. FIG. 10 shows how PEs perform specific operation under the control of the ChLS 314, the CoLS 324 and the PELS 334. As shown in FIG. 10, DMA loads data to respective functional units in the PE so that the functional units can perform various specific operations and stores data to corresponding memory after the operations are done. It should be noted that FIG. 10 is just a schematic diagram, which only illustratively shows the parallel operations of the various functional units in the PE.
[0048] FIG. 11 illustrates an example scheduling method 1100 for neural network processing unit in accordance with various embodiments. The method 1100 may include Block 1110: configuring a top level module including a top RISC-V CPU with Vector extension (RVV) and a chip level scheduler (ChLS) , wherein the top level module is configured to make the top RVV perform scheduling for the multiple cores based on scheduling firmware for the top RVV or make the ChLS perform scheduling for the multiple cores based on predefined instruction sequence for the ChLS; Block 1120: configuring a core level module including a core RVV and a core level scheduler (CoLS) , wherein the core level module is configured to make the core RVV perform scheduling for the multiple PEs based on scheduling firmware for the core RVV or make the CoLS perform scheduling for the multiple PEs based on predefined instruction sequence for the CoLS; and Block 1130: configuring a PE level module including a PE RVV and a PE level scheduler (PELS) , wherein the PE level module is configured to make the PE RVV perform scheduling for the multiple functional units based on scheduling firmware for the PE RVV or make the PELS perform scheduling for the multiple functional units based on predefined instruction sequence for the PELS.
[0049] In some embodiments, the predefined instruction sequence for the ChLS, the predefined instruction sequence for the CoLS and the predefined instruction sequence for the PELS are determined based on the neural network model and are loaded to corresponding storage locations in the neural network processing unit.
[0050] In some embodiments, the ChLS is configured to be controlled by the top RVV through top level Control and Status Register (CSR) , the CoLS is configured to be controlled by the core RVV through core level CSR, and the PELS is configured to be controlled by the PE RVV through PE level CSR.
[0051] In some embodiments, the CoLS is configured to be controlled by the ChLS through special scheduler interface, and the PELS is configured to be controlled by the CoLS through special scheduler interface.
[0052] In some embodiments, when the neural network model is a static neural network model of which the structure and parameters do not change, the top level module is configured to make the ChLS perform scheduling for the multiple cores based on predefined instruction sequence for the ChLS, the core level module is configured to make the CoLS controlled by the ChLS to perform scheduling for the multiple PEs based on predefined instruction sequence for the CoLS, and the PE level module is configured to make the PELS controlled by the CoLS to perform scheduling for the multiple functional units based on predefined instruction sequence for the PELS.
[0053] In some embodiments, when the neural network model is a dynamic neural network model of which the structure and parameters dynamically change, the top level module is configured to make the top RVV perform scheduling for the multiple cores based on scheduling firmware for the top RVV, the core level module is configured to make the core RVV controlled by the top RVV to perform scheduling for the multiple PEs based on scheduling firmware for the core RVV, and the PE level module is configured to make the PE RVV controlled by the core RVV to perform scheduling for the multiple functional units based on scheduling firmware for the PE RVV.
[0054] In some embodiments, when the neural network model is a hybrid neural network model of which a portion of structure and parameters do not change and a portion of structure and parameters dynamically change, the top level module is configured to make the top RVV control the current scheduling performed by the ChLS to make the ChLS perform scheduling for the multiple cores based on updated predefined instruction sequence for the ChLS when the structure and parameters changes, and / or the core level module is configured to make the core RVV control the current scheduling performed by the CoLS to make the CoLS perform scheduling for the multiple cores based on updated predefined instruction sequence for the CoLS when the structure and parameters change, and / or the PE level module is configured to make the PE RVV control the current scheduling performed by the PELS to perform scheduling for the multiple functional units based on updated predefined instruction sequence for the PELS when the structure and parameters change.
[0055] In some embodiments, each of the ChLS, the Cols and the PELS can be implemented as a Finite State Machine (FSM) .
[0056] Although FIG. 11 shows example blocks of method 1100, in some implementations, method 1100 may include additional steps, fewer steps, different steps, or differently arranged steps than those depicted in FIG. 1100. Additionally, or alternatively, two or more of the steps of method 1100 may be performed in parallel.
[0057] FIG. 12 illustrates an example computing device in which any of the embodiments described herein may be implemented. The computing device may be used to implement one or more components of the systems and the methods shown in FIGs. 1-11. The computing device 1200 may comprise a bus 1202 or other communication mechanisms for communicating information and one or more hardware processors 1204 coupled with bus 1202 for processing information. Hardware processor (s) 1204 may be, for example, one or more general-purpose microprocessors.
[0058] The computing device 1200 may also include a main memory 1207, such as random-access memory (RAM) , cache and / or other dynamic storage devices, coupled to bus 1202 for storing information and instructions to be executed by processor (s) 1204. Main memory 1207 also may be used for storing temporary variables or other intermediate information during execution of instructions to be executed by processor (s) 1204. Such instructions, when stored in storage media accessible to processor (s) 1204, may render computing device 1200 into a special-purpose machine that is customized to perform the operations specified in the instructions. Main memory 1207 may include non-volatile media and / or volatile media. Non-volatile media may include, for example, optical or magnetic disks. Volatile media may include dynamic memory. Common forms of media may include, for example, a floppy disk, a flexible disk, hard disk, solid-state drive, magnetic tape, or any other magnetic data storage medium, a CD-ROM, any other optical data storage medium, any physical medium with patterns of holes, a RAM, a DRAM, a PROM, and EPROM, a FLASH-EPROM, NVRAM, any other memory chip or cartridge, or networked versions of the same.
[0059] The computing device 1200 may implement the techniques described herein using customized hard-wired logic, one or more ASICs or FPGAs, firmware and / or program logic which in combination with the computing device may cause or program computing device 1200 to be a special-purpose machine. According to one embodiment, the techniques herein are performed by computing device 1200 in response to processor (s) 1204 executing one or more sequences of one or more instructions contained in main memory 1207. Such instructions may be read into main memory 1207 from another storage medium, such as storage device 1209. Execution of the sequences of instructions contained in main memory 1207 may cause processor (s) 1204 to perform the process steps described herein. For example, the processes / methods disclosed herein may be implemented by computer program instructions stored in main memory 1207. When these instructions are executed by processor (s) 1204, they may perform the steps as shown in corresponding figures and described above. In alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions.
[0060] The computing device 1200 also includes a communication interface 1210 coupled to bus 1202. Communication interface 1210 may provide a two-way data communication coupling to one or more network links that are connected to one or more networks. As another example, communication interface 1210 may be a local area network (LAN) card to provide a data communication connection to a compatible LAN (or WAN component to communicate with a WAN) . Wireless links may also be implemented.
[0061] The performance of certain of the operations may be distributed among the processors, not only residing within a single machine, but deployed across a number of machines. In some example embodiments, the processors or processor-implemented engines may be located in a single geographic location (e.g., within a home environment, an office environment, or a server farm) . In other example embodiments, the processors or processor-implemented engines may be distributed across a number of geographic locations.
[0062] Each of the processes, methods, and algorithms described in the preceding sections may be embodied in, and fully or partially automated by, code modules executed by one or more computer systems or computer processors comprising computer hardware. The processes and algorithms may be implemented partially or wholly in application-specific circuit.
[0063] When the functions disclosed herein are implemented in the form of software functional units and sold or used as independent products, they can be stored in a processor executable non-volatile computer-readable storage medium. Particular technical solutions disclosed herein (in whole or in part) or aspects that contributes to current technologies may be embodied in the form of a software product. The software product may be stored in a storage medium, comprising a number of instructions to cause a computing device (which may be a personal computer, a server, a network device, and the like) to execute all or some steps of the methods of the embodiments of the present application. The storage medium may comprise a flash drive, a portable hard drive, ROM, RAM, a magnetic disk, an optical disc, another medium operable to store program code, or any combination thereof.
[0064] Particular embodiments further provide a system comprising a processor and a non-transitory computer-readable storage medium storing instructions executable by the processor to cause the system to perform operations corresponding to steps in any method of the embodiments disclosed above. Particular embodiments further provide a non-transitory computer-readable storage medium configured with instructions executable by one or more processors to cause the one or more processors to perform operations corresponding to steps in any method of the embodiments disclosed above.
[0065] Embodiments disclosed herein may be implemented through a cloud platform, a server or a server group (hereinafter collectively the “service system” ) that interacts with a client. The client may be a terminal device, or a client registered by a user at a platform, wherein the terminal device may be a mobile terminal, a personal computer (PC) , and any device that may be installed with a platform application program.
[0066] The various features and processes described above may be used independently of one another or may be combined in various ways. All possible combinations and sub-combinations are intended to fall within the scope of this disclosure. In addition, certain method or process blocks may be omitted in some implementations. The methods and processes described herein are also not limited to any particular sequence, and the blocks or states relating thereto can be performed in other sequences that are appropriate. For example, described blocks or states may be performed in an order other than that specifically disclosed, or multiple blocks or states may be combined in a single block or state. The example blocks or states may be performed in serial, in parallel, or in some other manner. Blocks or states may be added to or removed from the disclosed example embodiments. The exemplary systems and components described herein may be configured differently than described. For example, elements may be added to, removed from, or rearranged compared to the disclosed example embodiments.
[0067] The various operations of exemplary methods described herein may be performed, at least partially, by an algorithm. The algorithm may be comprised in program codes or instructions stored in a memory (e.g., a non-transitory computer-readable storage medium described above) . Such algorithm may comprise a machine learning algorithm. In some embodiments, a machine learning algorithm may not explicitly program computers to perform a function but can learn from training samples to make a prediction model that performs the function.
[0068] The various operations of exemplary methods described herein may be performed, at least partially, by one or more processors that are temporarily configured (e.g., by software) or permanently configured to perform the relevant operations. Whether temporarily or permanently configured, such processors may constitute processor-implemented engines that operate to perform one or more operations or functions described herein.
[0069] Similarly, the methods described herein may be at least partially processor-implemented, with a particular processor or processors being an example of hardware. For example, at least some of the operations of a method may be performed by one or more processors or processor-implemented engines. Moreover, the one or more processors may also operate to support performance of the relevant operations in a “cloud computing” environment or as a “software as a service” (SaaS) . For example, at least some of the operations may be performed by a group of computers (as examples of machines including processors) , with these operations being accessible via a network (e.g., the Internet) and via one or more appropriate interfaces (e.g., an Application Program Interface (API) ) .
[0070] The performance of certain of the operations may be distributed among the processors, not only residing within a single machine, but deployed across a number of machines. In some example embodiments, the processors or processor-implemented engines may be located in a single geographic location (e.g., within a home environment, an office environment, or a server farm) . In other example embodiments, the processors or processor-implemented engines may be distributed across a number of geographic locations.
[0071] Throughout this specification, plural instances may implement components, operations, or structures described as a single instance. Although individual operations of one or more methods are illustrated and described as separate operations, one or more of the individual operations may be performed concurrently, and nothing requires that the operations be performed in the order illustrated. Structures and functionality presented as separate components in example configurations may be implemented as a combined structure or component. Similarly, structures and functionality presented as a single component may be implemented as separate components. These and other variations, modifications, additions, and improvements fall within the scope of the subject matter herein.
[0072] As used herein, “or” is inclusive and not exclusive, unless expressly indicated otherwise or indicated otherwise by context. Therefore, herein, “A, B, or C” means “A, B, A and B, A and C, B and C, or A, B, and C, ” unless expressly indicated otherwise or indicated otherwise by context. Moreover, “and” is both joint and several, unless expressly indicated otherwise or indicated otherwise by context. Therefore, herein, “A and B” means “A and B, jointly or severally, ” unless expressly indicated otherwise or indicated otherwise by context. Moreover, plural instances may be provided for resources, operations, or structures described herein as a single instance. Additionally, boundaries between various resources, operations, engines, and data stores are somewhat arbitrary, and particular operations are illustrated in a context of specific illustrative configurations. Other allocations of functionality are envisioned and may fall within a scope of various embodiments of the present disclosure. In general, structures and functionality presented as separate resources in the example configurations may be implemented as a combined structure or resource. Similarly, structures and functionality presented as a single resource may be implemented as separate resources. These and other variations, modifications, additions, and improvements fall within a scope of embodiments of the present disclosure as represented by the appended claims. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.
[0073] The term “include” or “comprise” is used to indicate the existence of the subsequently declared features, but it does not exclude the addition of other features. Conditional language, such as, among others, “can, ” “could, ” “might, ” or “may, ” unless specifically stated otherwise, or otherwise understood within the context as used, is generally intended to convey that certain embodiments include, while other embodiments do not include, certain features, elements and / or steps. Thus, such conditional language is not generally intended to imply that features, elements and / or steps are in any way required for one or more embodiments or that one or more embodiments necessarily include logic for deciding, with or without user input or prompting, whether these features, elements and / or steps are included or are to be performed in any particular embodiment.
[0074] Although an overview of the subject matter has been described with reference to specific example embodiments, various modifications and changes may be made to these embodiments without departing from the broader scope of embodiments of the present disclosure. Such embodiments of the subject matter may be referred to herein, individually, or collectively, by the term “invention” merely for convenience and without intending to voluntarily limit the scope of this application to any single disclosure or concept if more than one is, in fact, disclosed.
[0075] The embodiments illustrated herein are described in sufficient detail to enable those skilled in the art to practice the teachings disclosed. Other embodiments may be used and derived therefrom, such that structural and logical substitutions and changes may be made without departing from the scope of this disclosure. The Detailed Description, therefore, is not to be taken in a limiting sense, and the scope of various embodiments is defined only by the appended claims, along with the full range of equivalents to which such claims are entitled.
Claims
1.A scheduling controller for neural network processing unit, wherein the neural network processing unit is used for running a neural network model and comprises multiple cores, each core comprises multiple processing elements (PEs) and each PE comprise multiple functional units, comprising:a top level module including a top RISC-V CPU with Vector extension (RVV) and a chip level scheduler (ChLS) , wherein the top level module is configured to make the top RVV perform scheduling for the multiple cores based on scheduling firmware for the top RVV or make the ChLS perform scheduling for the multiple cores based on predefined instruction sequence for the ChLS;a core level module including a core RVV and a core level scheduler (CoLS) , wherein the core level module is configured to make the core RVV perform scheduling for the multiple PEs based on scheduling firmware for the core RVV or make the CoLS perform scheduling for the multiple PEs based on predefined instruction sequence for the CoLS; anda PE level module including a PE RVV and a PE level scheduler (PELS) , wherein the PE level module is configured to make the PE RVV perform scheduling for the multiple functional units based on scheduling firmware for the PE RVV or make the PELS perform scheduling for the multiple functional units based on predefined instruction sequence for the PELS.2.The scheduling controller of claim 1, wherein the predefined instruction sequence for the ChLS, the predefined instruction sequence for the CoLS and the predefined instruction sequence for the PELS are determined based on the neural network model and are loaded to corresponding storage locations in the neural network processing unit.3.The scheduling controller of claim 1, wherein the ChLS is configured to be controlled by the top RVV through top level Control and Status Register (CSR) , the CoLS is configured to be controlled by the core RVV through core level CSR, and the PELS is configured to be controlled by the PE RVV through PE level CSR.4.The scheduling controller of claim 1, wherein the CoLS is configured to be controlled by the ChLS through special scheduler interface, and the PELS is configured to be controlled by the CoLS through special scheduler interface.5.The scheduling controller of claim 1, wherein when the neural network model is a static neural network model of which the structure and parameters do not change, the top level module is configured to make the ChLS perform scheduling for the multiple cores based on predefined instruction sequence for the ChLS, the core level module is configured to make the CoLS controlled by the ChLS to perform scheduling for the multiple PEs based on predefined instruction sequence for the CoLS, and the PE level module is configured to make the PELS controlled by the CoLS to perform scheduling for the multiple functional units based on predefined instruction sequence for the PELS.6.The scheduling controller of claim 1, wherein when the neural network model is a dynamic neural network model of which the structure and parameters dynamically change, the top level module is configured to make the top RVV perform scheduling for the multiple cores based on scheduling firmware for the top RVV, the core level module is configured to make the core RVV controlled by the top RVV to perform scheduling for the multiple PEs based on scheduling firmware for the core RVV, and the PE level module is configured to make the PE RVV controlled by the core RVV to perform scheduling for the multiple functional units based on scheduling firmware for the PE RVV.7.The scheduling controller of claim 1, wherein when the neural network model is a hybrid neural network model of which a portion of structure and parameters do not change and a portion of structure and parameters dynamically change, the top level module is configured to make the top RVV control the current scheduling performed by the ChLS to make the ChLS perform scheduling for the multiple cores based on updated predefined instruction sequence for the ChLS when the structure and parameters changes, and / or the core level module is configured to make the core RVV control the current scheduling performed by the CoLS to make the CoLS perform scheduling for the multiple cores based on updated predefined instruction sequence for the CoLS when the structure and parameters change, and / or the PE level module is configured to make the PE RVV control the current scheduling performed by the PELS to perform scheduling for the multiple functional units based on updated predefined instruction sequence for the PELS when the structure and parameters change.8.The scheduling controller of claim 1, wherein each of the ChLS, the Cols and the PELS can be implemented as a Finite State Machine (FSM) .9.A scheduling method for neural network processing unit, wherein the neural network processing unit is used for running a neural network model and comprises multiple cores, each core comprises multiple processing elements (PEs) and each PE comprise multiple functional units, comprising:configuring a top level module including a top RISC-V CPU with Vector extension (RVV) and a chip level scheduler (ChLS) , wherein the top level module is configured to make the top RVV perform scheduling for the multiple cores based on scheduling firmware for the top RVV or make the ChLS perform scheduling for the multiple cores based on predefined instruction sequence for the ChLS;configuring a core level module including a core RVV and a core level scheduler (CoLS) , wherein the core level module is configured to make the core RVV perform scheduling for the multiple PEs based on scheduling firmware for the core RVV or make the CoLS perform scheduling for the multiple PEs based on predefined instruction sequence for the CoLS; andconfiguring a PE level module including a PE RVV and a PE level scheduler (PELS) , wherein the PE level module is configured to make the PE RVV perform scheduling for the multiple functional units based on scheduling firmware for the PE RVV or make the PELS perform scheduling for the multiple functional units based on predefined instruction sequence for the PELS.10.The scheduling method of claim 9, wherein the predefined instruction sequence for the ChLS, the predefined instruction sequence for the CoLS and the predefined instruction sequence for the PELS are determined based on the neural network model and are loaded to corresponding storage locations in the neural network processing unit.11.The scheduling method of claim 9, wherein the ChLS is configured to be controlled by the top RVV through top level Control and Status Register (CSR) , the CoLS is configured to be controlled by the core RVV through core level CSR, and the PELS is configured to be controlled by the PE RVV through PE level CSR.12.The scheduling method of claim 9, wherein the CoLS is configured to be controlled by the ChLS through special scheduler interface, and the PELS is configured to be controlled by the CoLS through special scheduler interface.13.The scheduling method of claim 9, wherein when the neural network model is a static neural network model of which the structure and parameters do not change, the top level module is configured to make the ChLS perform scheduling for the multiple cores based on predefined instruction sequence for the ChLS, the core level module is configured to make the CoLS controlled by the ChLS to perform scheduling for the multiple PEs based on predefined instruction sequence for the CoLS, and the PE level module is configured to make the PELS controlled by the CoLS to perform scheduling for the multiple functional units based on predefined instruction sequence for the PELS.14.The scheduling method of claim 9, wherein when the neural network model is a dynamic neural network model of which the structure and parameters dynamically change, the top level module is configured to make the top RVV perform scheduling for the multiple cores based on scheduling firmware for the top RVV, the core level module is configured to make the core RVV controlled by the top RVV to perform scheduling for the multiple PEs based on scheduling firmware for the core RVV, and the PE level module is configured to make the PE RVV controlled by the core RVV to perform scheduling for the multiple functional units based on scheduling firmware for the PE RVV.15.The scheduling method of claim 9, wherein when the neural network model is a hybrid neural network model of which a portion of structure and parameters do not change and a portion of structure and parameters dynamically change, the top level module is configured to make the top RVV control the current scheduling performed by the ChLS to make the ChLS perform scheduling for the multiple cores based on updated predefined instruction sequence for the ChLS when the structure and parameters changes, and / or the core level module is configured to make the core RVV control the current scheduling performed by the CoLS to make the CoLS perform scheduling for the multiple cores based on updated predefined instruction sequence for the CoLS when the structure and parameters change, and / or the PE level module is configured to make the PE RVV control the current scheduling performed by the PELS to perform scheduling for the multiple functional units based on updated predefined instruction sequence for the PELS when the structure and parameters change.16.The scheduling method of claim 9, wherein each of the ChLS, the Cols and the PELS can be implemented as a Finite State Machine (FSM) .