Neural network processor and control method
Through a heterogeneous symbiotic fusion computing architecture and a dynamic scheduling controller, efficient fusion of matrix and non-matrix operations is achieved, accelerating sparse computing, solving the problems of low efficiency and high power consumption of existing neural network processors in hybrid operator operation scenarios, adapting to dynamic tensor shapes, and improving hardware utilization and computing power utilization.
Patent Information
- Application Number
- CN202611121218.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-27
- Publication Date
- 2026-11-27
AI Technical Summary
Existing neural network processors suffer from problems such as low computing power utilization, high power consumption of invalid data transfer, difficulty in adapting to dynamic tensor shapes, and high compiler implementation difficulty in hybrid operator operation scenarios. They perform particularly poorly when running lightweight models and large models alternately.
It adopts a heterogeneous symbiotic fusion computing architecture, which includes matrix operation cores and non-matrix operation cores. Combined with a dynamic scheduling controller, on-chip storage system, sparse data adaptation unit and pass-through module, it realizes the fusion acceleration of matrix and non-matrix operations and supports dynamic tensor and sparse computing.
It improves the computational efficiency of all neural network operators, reduces chip power consumption, adapts to the full-scenario artificial intelligence computing needs, improves hardware utilization in dynamic scenarios, and reduces data transfer and pipeline blockage.
Smart Images

Figure CN123180240A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence hardware acceleration technology, and in particular to a neural network processor and control method. It can efficiently perform intensive linear matrix operations such as matrix multiplication, convolution, and transpose, as well as non-matrix operations such as vector operations, scalar operations, activation functions, normalization, and pooling. Background Technology
[0002] In recent years, deep neural networks, represented by Transformer and CNN, have made groundbreaking progress in computer vision, natural language processing, and speech recognition, and have been deployed on a large scale commercially. To meet the growing demand for computing power, the industry has developed a variety of dedicated hardware acceleration architectures. Among them, the Systolic Array has become the mainstream implementation scheme for matrix multiplication and addition operations due to its excellent data reuse capability and highly parallel multiply-accumulate processing capability.
[0003] However, with the continuous evolution of neural network model structures, especially the increasingly prominent trend of alternating hybrid operators in large language models and lightweight models, neural network processors using traditional architectures generally suffer from low computational efficiency and excessively high power consumption for invalid data transfer in hybrid operator operation scenarios. This severely restricts the general computing performance and scenario adaptability of AI chips. Existing neural network processors based on systolic arrays mainly have the following technical defects: First, non-matrix operations are inefficient. Non-matrix operations such as Softmax, LayerNorm, pooling, and activation functions like ReLU, GeLU, and Sigmoid cannot run efficiently on systolic arrays directly. Existing solutions typically rely on external CPUs or general-purpose arithmetic logic units (ALUs) to assist in these operations, causing the results to be repeatedly transferred between matrix operation cores and non-matrix operation cores. This results in frequent data transfers and pipeline pauses, significantly increasing overall inference latency.
[0004] Secondly, it is difficult to adapt to dynamic tensor shapes. Dynamic scenarios such as variable-length sequence input, sparse attention mechanisms, and conditional branches will generate tensors with uncertain runtime shapes, which will disrupt the inherent regular data flow pattern of the systolic array, resulting in a large number of processing units (PEs) being idle and a significant decrease in hardware utilization.
[0005] Third, sparse computing suffers from wasted power consumption. Zero-value elements in the weighted or active data still enter the systolic array pipeline and participate in the complete multiply-accumulate operation, generating a large amount of unnecessary power consumption. Existing solutions lack effective zero-value detection and skipping mechanisms, thus failing to accelerate sparse computing.
[0006] Fourth, compiler implementation is difficult. Existing solutions require complex offline compilation mapping operations to pre-split the neural network computation graph into matrix operation and non-matrix operation parts and complete the coordinated scheduling, which cannot adapt to dynamic changes during the inference process; when the model structure or input shape changes, the entire compilation process must be re-executed, resulting in poor deployment flexibility.
[0007] A review of existing patents and publicly available technical literature reveals significant shortcomings in current technologies. For instance, patents such as CN115461712A primarily focus on hardware optimization for matrix convolution operations, improving matrix array structures, or optimizing static data scheduling schemes. There are few comprehensive designs addressing the collaborative acceleration of mixed matrix and non-matrix operations. Furthermore, while some heterogeneous chips integrate multiple computing units, they often employ dual-core fixed parallel or time-sharing serial operating modes, failing to dynamically allocate computing resources based on operator characteristics. In scenarios involving fragmented, operator-intensive lightweight models or alternating operator operations in large models, these chips generally suffer from low computing power utilization, redundant data transfer, high power consumption, and large inference latency, making it difficult to meet the demands of full-scenario artificial intelligence computing.
[0008] To address the numerous shortcomings of the existing technologies, this invention proposes a neural network processor and its control method that integrates matrix operations and non-matrix operations. This solution retains the high throughput advantage of systolic arrays while flexibly and efficiently performing various non-matrix operator operations, and natively supports sparse computing acceleration.
[0009] It should be noted that heterogeneous dual-core computing architecture, dynamic scheduling, and data passthrough represent macro-level design directions in the field of neural network processors. The scattered disclosure of these individual features does not constitute a revelation of the complete technical solution of this invention. This invention is not a simple superposition of the aforementioned macro-level features, but rather constructs a complete integrated computing hardware system through the dedicated internal structure design and inter-module collaborative linkage mechanism of five major hardware units (computation core array, dynamic scheduling controller, on-chip storage system, sparse data adaptation unit, and passthrough module). Each hardware unit contains specific functional components distinct from existing technologies, including a tensor shape prediction unit, a three-level adaptive sparse coding logic, a fine-grained independent reconfigurable channel, and a quantization power consumption closed-loop control unit. The units achieve unified coordination of data flow, control flow, and timing flow through the dynamic scheduling controller, simultaneously generating optimization effects in multiple dimensions such as dynamic tensor adaptation, sparse acceleration, power consumption control, and hybrid operator execution. Its overall technical effect exceeds the sum of the expected effects of any single feature, constituting a substantial technical contribution of this invention. Summary of the Invention
[0010] The purpose of this invention is to overcome the shortcomings of existing neural network processors, such as the separation of matrix operations and non-matrix operations in hardware, fixed scheduling methods, large hardware switching overhead, low computing power utilization, redundant data transfer, and easy pipeline blockage, and to provide a neural network processor that integrates matrix operations and non-matrix operations and its control method.
[0011] This invention employs a heterogeneous symbiotic integrated computing architecture, constructing an integrated hardware system composed of a first type of computing core (matrix operation core) and a second type of computing core (non-matrix operation core), abandoning the traditional design mode of independently deployed and time-division multiplexing computing units. By configuring a dynamic scheduling controller, it analyzes the operation type and data dependencies of neural network operators in real time, adaptively adapting to three types of working scenarios: pure matrix-intensive operations, pure non-matrix scattered operations, and matrix-non-matrix mixed operations. Simultaneously, it supports dynamic tensor and sparse computing modes, avoiding idle processing units and ineffective power consumption. This invention can comprehensively improve the computational efficiency and computing power utilization of all neural network operators, reduce chip power consumption, and meet the needs of artificial intelligence computing and inference in all scenarios.
[0012] The present invention adopts the following technical solution: On the one hand, the present invention provides a neural network processor, which mainly consists of a computing core array, a dynamic scheduling controller, an on-chip storage system, a sparse data adaptation unit, a pass-through module, etc. The modules work together to achieve the fusion acceleration of matrix and non-matrix operations.
[0013] 1. Computing core array The core computing hardware of this invention adopts a nested symbiotic architecture, which includes a first type of computing core and a second type of computing core. The two types of cores share the instruction bus and on-chip cache resources and can run independently in parallel without hardware switching overhead.
[0014] The first type of computational core consists of a large-scale array of two-dimensional basic processing units, responsible for performing intensive linear matrix operations such as convolution, fully connected layers, matrix multiplication, tensor concatenation, and tensor transformation. Each basic processing unit integrates a multiplication subunit, an addition subunit, a local register link, a data bypass switch, and a mode configuration register. The data bypass switch can bypass the multiplication subunit when an operand is detected to be zero or a preset invalid value, directly transmitting the input data to the adjacent basic processing unit, reducing unnecessary power consumption. The mode configuration register supports dynamic switching between normal pulse mode and vector-matrix multiplication broadcast mode for the basic processing unit.
[0015] The second type of computing core comprises multiple independent, reconfigurable computing channels, each configured with an independent mode register, independent data buffer, and independent pass-through input interface. Each channel integrates activation operation subunits, normalization operation subunits, pooling operation subunits, and element-wise arithmetic operation subunits. The current working subunit is selected by the independent mode configuration register, and the hardware latency for a single mode switch does not exceed two clock cycles. The mode register is locked during task execution, prohibiting mid-process switching to ensure operational stability. Each channel supports dynamic adaptation to INT8, FP16, and FP32 multi-precision operations, allowing switching of operation precision according to operator requirements. The channel supports two operating modes: independent operation mode (reading vector data from the on-chip buffer to perform SIMD operations) and cooperative pipelined mode (receiving tensors from the first type of computing core via the pass-through interface, bypassing the on-chip buffer to complete pipelined parallel operations). The second type of computing core as a whole supports non-linear activation operations such as ReLU, Sigmoid, and Softmax, batch normalization / layer normalization operations, max / average pooling operations, threshold judgment, logical operations, and various non-matrix operations such as element-wise arithmetic operations.
[0016] This module supports two working modes: 1) Standalone mode: Reads continuous vector data from the on-chip memory system and executes Single Instruction Multiple Data (SIMD) instructions; 2) Collaborative mode: The intermediate results output by the first type of computing core do not need to be written to the on-chip storage system. Instead, they are directly transmitted to the second type of computing core via a dedicated collaborative channel. The second type of computing core performs parallel operations in a pipelined manner, achieving zero-latency hardware bypass.
[0017] 2. Dynamic scheduling controller This module is the processor's global control core, used to parse the operator types and data dependencies in the instruction stream in real time, distribute matrix operation tasks to the first type of operation core and non-matrix operation tasks to the second type of operation core, and uniformly manage the data flow synchronization and data bypass transmission between modules.
[0018] The module integrates an operator type identification unit, a dependency resolution unit, a tensor shape prediction unit, an arbitration allocation unit, a pipeline synchronization unit, and a power consumption closed-loop control unit.
[0019] Operator type identification unit: Extracts type labels corresponding to operators from the instruction stream to be executed. The type labels include at least dense linear operation categories and nonlinear non-matrix operation categories. It also extracts feature information such as data dimension and operation density to determine the current operation scenario.
[0020] Dependency resolution unit: Constructs the data flow graph between the currently executed operators, maintains the register and buffer status table, and detects data conflict issues such as write-after-read and read-after-write.
[0021] Tensor Shape Prediction Unit: It has a built-in historical tensor shape cache stack (which can store the tensor dimension, sequence length, and sparsity characteristics of the most recent 32 batches of inference data). It implements a time-series statistical prediction mechanism through hardware logic. Based on the shape distribution pattern of historical batch data, it predicts the dimension range, sequence length, and dynamic change trend of the next batch of input tensors. Based on the prediction results, it completes the block mapping configuration of the PE array, the space pre-allocation of the on-chip L3 cache, and the data prefetching 16 clock cycles in advance, eliminating hardware configuration latency in dynamic tensor scenarios and increasing the hardware utilization rate in dynamic scenarios from the traditional 50% to over 85%.
[0022] Arbitration allocation unit: Based on the current occupancy rate of each computing core and the length of the pending queue, it allocates computing resources to each operator according to preset priority strategies such as fair polling and shortest remaining time priority, and dynamically configures the working mode, parallel computing power and scheduling priority of the two types of computing cores.
[0023] Pipeline synchronization unit: unifies the working cycle of the two types of computing cores, calibrates timing deviations, and achieves zero-delay data bypass through hardware semaphores or event counters, ensuring accurate matching of associated operator data and preventing pipeline blockage.
[0024] Power consumption closed-loop control unit: Equipped with a dual-threshold quantization control mechanism, it sets precise load thresholds and voltage frequency levels, and performs closed-loop feedback control based on real-time computing load, operator type, and tensor scale, solving the problems of traditional power consumption control being coarse and lacking quantization support.
[0025] 3. On-chip storage system A three-tiered shared cache architecture is adopted, including an in-situ cache layer, a shared cache layer, and a global cache layer. Data conflicts are avoided through hierarchical scheduling, maximizing on-chip data reuse. Each cache layer supports dynamic spatial fragmentation configuration, which can adjust the fragment size in advance based on the prediction results of the tensor shape prediction unit to adapt to the dynamic tensor data storage requirements.
[0026] In-situ cache layer: Independently bound to the first type of computing core and the second type of computing core respectively, used to temporarily store the intermediate results of each core's operation. It supports in-situ overwriting and reuse of data without the need to migrate data. The preferred capacity of the single-core in-situ cache is 128KB, and the read / write latency is ≤1 clock cycle.
[0027] Shared cache layer: Shared by both types of computing cores, used to store model weights, bias parameters and general feature data, with a preferred capacity of 512KB, supporting high-speed parallel reading by both cores.
[0028] Global cache layer: Used for data exchange with off-chip memory, to complete batch data preloading and final calculation result write-back, with a preferred capacity of 2MB, supporting bursty batch data transfer.
[0029] This module can simultaneously adapt to the regularly segmented data of pulsating arrays and the continuous / step-by-step access data of vector / scalar modules, and has data format conversion capabilities. The dynamic scheduling controller dynamically determines which of the above-mentioned cache layers to store the data based on the frequency and scope of data usage.
[0030] 4. Sparse Data Adaptation Unit Located on the data path between the on-chip storage system and the first type of computing core, this unit is uniformly configured by the dynamic scheduling controller. Compared to the traditional single CSR sparse coding scheme, this invention adds a three-level sparse adaptive adaptation mechanism, covering different sparse scenarios and overcoming the limitations of existing technologies. This unit can detect data elements in weighted data and feature activation data that have values of zero or less than a preset threshold. It supports encoding and storing the data elements in at least one of the following formats: compressed sparse row format, compressed sparse column format, or bit-mask format. It actively blocks zero-value data from entering the computing pipeline, achieving sparse computing acceleration and power consumption optimization. The first type of computing core skips the encoded and marked data elements when performing operations.
[0031] This unit incorporates hardware logic for sparsity detection, enabling real-time statistics on the percentage of zero values in the input data. When the sparsity is ≤30%, lightweight bitmask encoding is used to reduce encoding overhead; when 30% < sparsity ≤70%, Compressed Sparse Row (CSR) encoding is used; and when the sparsity is >70%, Compressed Sparse Column (CSC) encoding is used, achieving optimal adaptation for different sparsity scenarios. It also supports threshold sparsity filtering, allowing users to customize the zero-value determination threshold. This uniformly encodes and masks data with tiny weights less than the preset threshold, further reducing invalid computations.
[0032] The first type of computing core can precisely skip all invalid data elements marked with codes during operation, without participating in multiplication and addition operations. In actual tests, it can reduce power consumption by approximately 38% in scenarios with 40% sparsity, and further reduce power consumption in scenarios with 70% high sparsity. It can reach 55%, and the sparse optimization effect is significantly better than the traditional solution.
[0033] 5. Straight-through transmission module It features a built-in dedicated data pass-through path and data sorting unit across computing cores. The pass-through path has a bit width of 512 bits, with a one-way transmission latency of ≤1 clock cycle. This pass-through path is bidirectional: intermediate feature data output from the first type of computing core can bypass the global cache layer and external memory, and be directly transmitted to the second type of computing core for post-processing, achieving seamless pipeline connection; simultaneously, it supports the reverse transmission of output data from the second type of computing core to the first type of computing core, meeting the application requirements of residual connections, feature concatenation, or iterative loop calculations in neural network models. The bidirectional pass-through mechanism can completely eliminate the cross-core data transport overhead in matrix-non-matrix operator alternation scenarios, reducing data transport power consumption by more than 60%.
[0034] On the other hand, this invention also provides a control method for the aforementioned neural network processor, which is a closed-loop adaptive iterative process. It features dynamic shape prediction, refined sparsity adaptation, quantized power consumption control, fine-grained resource scheduling, and parallel fusion computation. It can adapt to all types of neural network computation scenarios, solving the problems of wasted computing power, pipeline blockage, and poor dynamic adaptation in traditional fixed scheduling processes. The single instruction computation process is as follows: S1: Instruction Flow Parsing and Operator Feature Recognition The neural network operation instruction stream is analyzed segment by segment to extract the type information, data dimension, and operation density features of each operator, and to determine whether the current operation scenario is a matrix operation, a non-matrix operation, or a mixed operation scenario.
[0035] S2: Data Dependency and Resource Conflict Pre-detection Based on the characteristics of the operators, a data flow graph between the operators to be executed is constructed. Data dependencies and hardware resource conflicts between matrix operators and non-matrix operators are detected. It is determined whether there is a pipeline dependency situation where intermediate results are generated by the first type of operator and there is a data dependency between the intermediate results and the subsequent second type of operator, and the detection results are output.
[0036] S3: Dynamic resource adaptive allocation Based on the computing scenario, data dependencies, and resource conflict detection results, the computing resources, working modes, and scheduling priorities of the first type of computing core (matrix computing core) and the second type of computing core (non-matrix computing core) are dynamically configured.
[0037] S4: Task Distribution and Branch Execution 1) If there are no resource conflicts and no pipeline dependencies, the computation tasks are distributed to the first type of computation core and the second type of computation core for independent parallel execution according to the operator type; 2) If the pipeline dependency situation exists, the computing collaboration mode is activated and the direct path is opened, so that the intermediate results do not need to be transferred through external memory or shared cache, and are directly sent to the second type of computing core for computing, so as to achieve seamless pipeline connection. 3) If the weight data or activation data to be calculated contains more than a preset proportion of zero-value elements, the sparse operation mode is activated simultaneously. In the first type of operation core, the invalid operation corresponding to the zero-value element is skipped, and only the valid operation is performed on the non-zero data elements. After the operation is completed, the address of the operation result is remapped to restore the correct order position, thus accelerating the sparse computation.
[0038] S5: Production Line Synchronous Calibration Unify the operating rhythm of the first type of computing core and the second type of computing core, calibrate the timing matching relationship of associated operators, achieve zero-latency data synchronization through hardware semaphores or event counters, eliminate computing time difference, and prevent pipeline blockage.
[0039] S6: Dynamic power consumption control The computing power utilization of each computing module is monitored in real time. When the utilization of any type of computing core is detected to be lower than a preset first threshold, the power supply voltage of the core is reduced to a preset low voltage level and idle hardware units are shut down. When the utilization is detected to be higher than a preset second threshold, the operating frequency of the core is increased to a preset high frequency level. The first threshold is less than the second threshold. The adjustment of power supply voltage and operating frequency are performed in the time interval between the completion of the currently executing computing task and the start of the next computing task. The adjustment parameters are driven by the real-time computing status feedback from steps S1 to S4, forming a closed-loop control.
[0040] After a single set of instructions is completed, return to step S1 and execute the subsequent instruction stream in a loop until the entire neural network model has been completed.
[0041] Compared with existing technologies, this invention has the following outstanding technical advantages: 1. Innovative architecture with significant differentiation: Based on heterogeneous dual cores, it adds four original mechanisms: hardware-level tensor shape prediction, three-level sparse adaptive adaptation, fine-grained channel reconstruction, and quantized power consumption closed-loop control. It breaks through the technical limitations of existing public architectures and solves the problems of weak dynamic adaptation, single sparse optimization, and coarse power consumption control in traditional solutions, demonstrating clear creativity.
[0042] 2. Significantly improved computing power efficiency: Non-matrix operations do not require external CPU or general-purpose ALU, and the bidirectional pass-through path eliminates cross-core data transfer overhead; coupled with a hierarchical sparse skip mechanism and PE unit data bypass design, the overall computing power consumption is reduced and the energy efficiency ratio is improved.
[0043] 3. Extremely strong dynamic adaptability: The tensor shape prediction unit enables dynamic prediction and pre-configuration at runtime without recompiling the computation graph. It can adapt to complex scenarios such as variable-length sequences, dynamic tensors, and sparse fluctuations, thus improving hardware utilization in dynamic scenarios.
[0044] 4. Improved hardware details and strong practicality: The hardware implementation details of the second type of computing core are supplemented, such as fine-grained channel reconstruction, single-channel timing constraints, cache quantization parameters, and transmission latency. The traditional general architecture description is abandoned, and the hardware's feasibility and mass production capability are greatly improved.
[0045] 5. Sufficient quantization support: All power consumption control, performance optimization, and sparse acceleration effects are equipped with quantization thresholds, parameter indicators, and measured effect data, solving the problems of traditional technical solutions lacking quantization support and having ambiguous effects. The technical advantages are intuitive and clear.
[0046] 6. Low scheduling and deployment costs: It adopts a hardware-level dynamic prediction scheduling mechanism, which eliminates the need for complex offline compilation and static strategy configuration, greatly reducing the difficulty of compiler development, shortening the AI model deployment cycle, and adapting to various dynamic inference scenarios. Attached Figure Description
[0047] Figure 1 This is a block diagram of the overall structure of the neural network processor of the present invention.
[0048] Figure 2 This is a flowchart illustrating the internal structure and zero-value bypass of a single basic processing unit.
[0049] Figure 3 This is a diagram illustrating the structure and workflow of the dynamic scheduling controller.
[0050] Figure 4 This is a schematic diagram of the collaborative mode for the second type of computing core.
[0051] Figure 5 This is a schematic diagram of the closed-loop process for power consumption regulation. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments and the accompanying drawings. It should be understood that these descriptions are merely exemplary and not intended to limit the scope of the invention. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concept of the invention.
[0053] The accompanying drawings illustrate a layer structure according to an embodiment of the present invention. These drawings are not to scale, and some details have been enlarged for clarity, and some details may have been omitted. The shapes of the various regions and layers shown in the drawings, as well as their relative sizes and positional relationships, are merely exemplary and may deviate from reality due to manufacturing tolerances or technical limitations. Furthermore, those skilled in the art can design regions / layers with different shapes, sizes, and relative positions as needed.
[0054] Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0055] In the description of this invention, it should be noted that the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0056] Furthermore, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0057] Example 1: Overall Architecture of Neural Network Processor like Figure 1 As shown in the figure, an embodiment of the present invention provides a neural network processor, including a computing core array 100, a dynamic scheduling controller 200, an on-chip storage system 300, a sparse data adaptation unit 400, and a pass-through module 500.
[0058] The computing core array 100 includes a first type of computing core 110 and a second type of computing core 120. The first type of computing core 110 is a 64×64 two-dimensional basic processing unit array, supporting block dynamic activation, and is used to perform intensive linear operations such as convolution and matrix multiplication. The second type of computing core 120 is a multi-channel independent fine-grained reconfigurable array, preferably containing 8 reconfigurable computing channels. Each channel is configured with an independent mode register, an independent data buffer, and an independent pass-through input interface. Each channel can independently and dynamically switch between activation function operation mode, normalization operation mode, pooling operation mode, and element-wise arithmetic operation mode. The single-channel switching delay is ≤2 clock cycles. The mode register is locked during task execution to prevent mid-process switching and ensure operational stability. Each channel supports dynamic adaptation for INT8, FP16, and FP32 multi-precision operations. The switching is triggered in real time by the dynamic scheduling controller 200 according to the currently allocated operator type. The reconfigurable computing channel maintains the current mode during the processing of the current computing task and switches to the target mode corresponding to the next computing task after completing the current computing task and before the start of the next computing task.
[0059] The dynamic scheduling controller 200 is coupled to the computing core array 100, the on-chip storage system 300, the sparse data adaptation unit 400 and the pass-through module 500, respectively. It has a built-in tensor shape prediction unit and a power consumption closed-loop control unit, which are used to parse the instruction stream in real time, predict tensor characteristics, dynamically schedule tasks, quantize and control power consumption and control the direction of data flow.
[0060] The on-chip storage system 300 includes an in-situ cache layer 310, a shared cache layer 320, and a global cache layer 330. The in-situ cache layer 310 is independently bound to the first type of computing core 110 and the second type of computing core 120, with a single core capacity of 128KB; the shared cache layer 320 has a capacity of 512KB and is shared by both cores; the global cache layer 330 has a capacity of 2MB and is used for data exchange with the off-chip memory 340. Each cache layer supports dynamic block pre-configuration.
[0061] The sparse data adaptation unit 400 is located on the data path between the on-chip storage system 300 and the first type of computing core 110. It supports three levels of sparse adaptive coding: bitmask, CSR, and CSC, and is uniformly configured by the dynamic scheduling controller 200.
[0062] The pass-through module 500 has a built-in 512-bit wide cross-core dedicated bidirectional pass-through path 510 and a data sorting unit 520, with a unidirectional transmission delay of ≤1 clock cycle.
[0063] Basic processing unit structure like Figure 2 As shown, each basic processing unit 1100 in the first type of arithmetic core includes a multiplication subunit 1110, an addition subunit 1120, a local register 1130, and a data bypass switch 1140. The data bypass switch 1140 is coupled to the input and output terminals of the multiplication subunit 1110, respectively.
[0064] When the data bypass switch 1140 detects that the current operand is zero or a preset invalid value, it directly transmits the input data to the adjacent basic processing unit without going through the multiplication subunit 1110 or the addition subunit 1120. For example, in convolution operations, when there is a column with zero weights in the weight matrix, the data bypass switch 1140 identifies the zero value and skips the corresponding multiplication-addition operation, directly bypassing the previous stage data to the adjacent PE, effectively reducing dynamic power consumption.
[0065] Each basic processing unit 1100 also includes a mode configuration register 1150, used to configure the PE to operate in normal pulse mode or vector-matrix product broadcast mode. In broadcast mode, PEs in the same row receive the same input vector elements, and each column is multiplied by different weight columns to achieve efficient calculation of vector-matrix product.
[0066] Dynamic scheduling controller like Figure 3 As shown, the dynamic scheduling controller 200 includes an operator type identification unit 210, a dependency parsing unit 220, an arbitration allocation unit 230, a pipeline synchronization unit 240, a tensor shape prediction unit 250, and a power consumption closed-loop control unit 260.
[0067] The operator type identification unit 210 receives the instruction stream to be executed from the instruction bus and extracts the type label, data dimension, and operation density information of each operator. The type label includes at least the categories of dense linear operations (such as CONV, FC, MATMUL) and nonlinear non-matrix operations (such as ReLU, SOFTMAX, LAYERNORM, POOL).
[0068] The dependency resolution unit 220 constructs a data flow graph between the currently executed operators and maintains register and buffer state tables to detect data conflicts such as read-after-write (RAW) and read-after-write (WAR). For example, when it is detected that the output tensor of the convolution operator currently being executed by the first type of operation core is exactly the input tensor of the ReLU activation operator that the second type of operation core is about to execute, the dependency resolution unit 220 marks that a pipelined dependency exists.
[0069] Arbitration allocation unit 230 allocates computing resources using a dynamic weight priority strategy based on the current occupancy rate of each computing core and the length of the pending queue, combined with the tensor prediction results, taking into account both task real-time performance and resource utilization.
[0070] The pipeline synchronization unit 240 uses hardware semaphores or event counters to unify the working rhythm of the two types of computing cores, ensuring that the time sequence of dependent operator pairs is accurately matched.
[0071] The tensor shape prediction unit 250 uses 32 batches of historical data cache stacks to statistically analyze the distribution patterns of tensor shape, sequence length, and sparsity, predicts the characteristics of the next batch of operations, and completes PE array block partitioning, cache block pre-configuration, and data pre-fetching 16 clock cycles in advance, solving the problems of hardware configuration lag and PE idleness in dynamic tensor scenarios.
[0072] The power consumption closed-loop control unit 260 monitors the core load in real time and dynamically adjusts the voltage frequency based on the 30% and 80% dual quantization thresholds. It completes parameter adjustments during task intervals to form a real-time feedback closed-loop control.
[0073] Collaborative work mode like Figure 4 As shown, when the dynamic scheduling controller 200 determines that there is a pipeline dependency between the matrix operation currently being executed by the first type of computing core 110 and the vector operation to be executed by the second type of computing core 120, it initiates the cooperative mode.
[0074] Taking the "matrix multiplication + Softmax" operator pair in the Transformer model as an example: After the first type of computation core 110 completes the Q×KT matrix multiplication, it obtains the attention score matrix, which serves as the input data for the subsequent Softmax operator. In cooperative mode, the attention score matrix output by the first type of computation core 110 is not written to the global cache layer 330 of the on-chip storage system or external memory 340, but is directly transmitted to the input of the second type of computation core 120 via the pass-through path 510 in the pass-through module 500. The second type of computation core 120 immediately begins Softmax operation upon receiving the data, without waiting for data loading instructions or memory read cycles.
[0075] During this process, the pipeline synchronization unit 240 records the completion time of the output of the first type of computing core 110 through an event counter and sends a synchronization signal to the second type of computing core 120 to ensure that the second type of computing core 120 is ready when the data arrives, achieving zero-latency hardware bypass. Compared with the existing solution that requires writing the matrix operation result into memory first and then reading it from memory by the CPU or ALU, this embodiment reduces the number of data transfers from at least two (write to memory + read from memory) to zero, reduces data transfer power consumption by more than 60%, and significantly reduces access latency.
[0076] Meanwhile, the direct path supports reverse transmission: after the second type of operation core 120 completes the normalization operation, its result can be transmitted back to the first type of operation core 110 through the direct path 510 for residual connection or feature splicing of subsequent convolutional layers, thus meeting the operation requirements of the Add&Norm module in the Transformer decoder.
[0077] Sparse computing acceleration In a specific application scenario, the weight data to be calculated contains approximately 40% zero-value elements, which falls under the category of medium-sparse scenarios. After the dynamic scheduling controller 200 detects the current data sparsity, it triggers the sparse data adaptation unit 400 to enable CSR encoding mode, which records only the values of non-zero elements, column indices, and row start positions, while masking all zero-value elements.
[0078] When the first type of computing core 110 performs matrix multiplication and addition operations, the PE unit automatically skips the operations corresponding to the zero values of the encoded markers and only completes the valid multiplication and addition operations for non-zero data. After the operation is completed, the hardware address remapping unit automatically restores the tensor dimensions and position order and outputs the complete operation result. In this scenario, invalid operations are reduced by 40%, power consumption is reduced by 38%, and inference speed is increased by 32%.
[0079] In scenarios with a high sparsity rate of 75%, the system automatically switches to CSC encoding mode to specifically adapt to column sparsity characteristics, reducing ineffective power consumption by up to 55% and significantly improving acceleration compared to traditional single sparsity solutions.
[0080] In addition to zero-value-based sparse coding, this invention also supports an amplitude threshold filtering mechanism. When the sparsity detection hardware logic identifies a large number of parameters in the weight data with amplitudes below a preset threshold, the sparse data adaptation unit 400 marks these weak weights as invalid elements and skips the computation, just like zero values. This mechanism can further filter out low-contribution parameters, and is particularly suitable for quantized lightweight models. Without significantly affecting inference accuracy, it reduces invalid computation by an additional 5%-10%, further optimizing power consumption and inference speed.
[0081] Example 2: Control Method Flow Reference Figure 5 The control method of the neural network processor of this invention is a closed-loop adaptive iterative process, and the operation process of a single set of instructions is as follows: Step S1: The operator type identification unit 210 of the dynamic scheduling controller 200 parses the neural network operation instruction stream segment by segment and extracts features such as operator type, data dimension, and operation density; the tensor shape prediction unit 250 retrieves historical 32 batches of inference data, predicts the current tensor shape and sparsity features, and completes PE array block partitioning, cache block pre-configuration and data pre-fetching in advance.
[0082] Step S2: The dependency parsing unit 220 combines operator features and prediction parameters to detect data dependencies and hardware resource conflicts between matrix operators and non-matrix operators, determine whether there is a pipeline dependency, and output the detection results.
[0083] Step S3: Arbitration allocation unit 230 dynamically configures the computing resources, working mode and scheduling priority of the two types of computing cores based on the computing scenario, data dependency relationship and resource conflict detection results.
[0084] Step S4: Task distribution and branch execution: Dual-core independent parallel operation when there are no conflicts or dependencies; when there are pipelining dependencies, the pass-through collaborative mode is enabled; when sparse data is detected, the three-level sparse coding mode is adaptively matched to complete sparse accelerated operation and address remapping.
[0085] Step S5: The pipeline synchronization unit 240 unifies the working cycle of the two types of computing cores, calibrates the timing matching relationship, eliminates computing time difference, and avoids pipeline blockage.
[0086] Step S6: The power consumption closed-loop control unit 260 monitors the core load in real time and dynamically adjusts the voltage frequency based on the 30% and 80% dual quantization thresholds. It completes parameter adjustment during task intervals to form a real-time feedback closed-loop control.
[0087] After a single set of instructions is completed, return to step S1 and repeat the process until all model calculations are completed.
[0088] Example 3: Quantization Power Consumption Closed-Loop Control In this embodiment, the first load threshold is preset to 30%, the second load threshold is preset to 80%, and the voltage and frequency levels are quantified as follows: standard operating voltage 1.2V, standard operating frequency 1GHz; low load level voltage 0.84V (0.7 times the nominal voltage), high load level frequency 1.2GHz (1.2 times the nominal frequency).
[0089] Real-time monitoring of two types of computing core utilization: When the core utilization is consistently below 30%, it is determined to be a low-load state. During the interval between the completion of the current task, the power supply voltage is reduced to a low voltage level, and idle PE units and redundant cache paths are shut down to reduce static and dynamic power consumption. When the core utilization is consistently above 80%, it is determined to be a high-load saturation state. Before the next task starts, the operating frequency is increased to release peak computing power and avoid computing power bottlenecks.
[0090] All voltage and frequency adjustments are performed without computational interruption or pipeline stall. Based on closed-loop feedback control of real-time computational load, operator type, and tensor scale, the overall energy efficiency ratio is improved in hybrid operator scenarios compared to traditional fixed power consumption strategies, achieving a dynamic optimal balance between performance and power consumption.
[0091] Example 4: Dynamic Tensor Adaptive Fit In large language model variable-length sequence inference scenarios, the sequence length dynamically fluctuates between 128 and 1024, and the tensor shape changes in real time. Traditional processors need to pre-compile multiple scheduling strategies for different sequence lengths, which is complex to deploy and results in low hardware utilization.
[0092] This invention uses a tensor shape prediction unit to predict the length range of the current batch sequence in real time based on the historical sequence length distribution pattern. It can pre-configure the adaptive configuration of PE array block size, cache data block, and pipeline depth without recompiling the computation graph and dynamically switch scheduling strategies at runtime.
[0093] Industrial applicability The neural network processor and its control method proposed in this invention can be widely applied to the design and manufacturing of artificial intelligence acceleration chips, and are suitable for various scenarios such as large-scale model inference in the cloud, real-time computing in edge intelligent devices, and lightweight AI in terminals. This invention can be implemented through standard CMOS processes, is compatible with existing chip design flows, has a clearly defined innovative architecture, refined hardware details, and outstanding quantization results, possessing extremely high industrialization value and market competitiveness.
[0094] The above description of the embodiments is only for the purpose of helping to understand the method and core idea of this application; at the same time, for those skilled in the art, there will be changes in the specific implementation and application scope based on the idea of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
[0095] Certain terms are used in the specification and claims to refer to specific components. Those skilled in the art will understand that hardware manufacturers may use different names to refer to the same component. This specification and claims do not distinguish components based on differences in name, but rather on differences in function. The terms "comprising" and "including" used throughout the specification and claims are open-ended and should be interpreted as "comprising / including but not limited to". "Approximately" means that within an acceptable margin of error, those skilled in the art can solve the technical problem and substantially achieve the technical effect within a certain margin of error. The following descriptions in the specification are preferred embodiments for carrying out this application; however, these descriptions are for the purpose of illustrating the general principles of this application and are not intended to limit the scope of this application. The scope of protection of this application shall be determined by the appended claims.
[0096] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a product or system comprising a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a product or system. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the product or system that includes said element.
[0097] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0098] The foregoing description illustrates and describes several preferred embodiments of this application. However, as previously stated, it should be understood that this application is not limited to the forms disclosed herein and should not be construed as excluding other embodiments. It can be used in various other combinations, modifications, and environments, and can be altered within the scope of the application concept described herein through the foregoing teachings or techniques or knowledge in related fields. Any modifications and variations made by those skilled in the art that do not depart from the spirit and scope of this application should be within the protection scope of the appended claims.
Claims
1. A neural network processor, characterized in that, include: The array of computing cores includes a first type of computing core and a second type of computing core. The first type of computing core is used to perform intensive linear operations, such as matrix multiplication, while the second type of computing core is used to perform nonlinear, non-matrix operations in units of vectors or scalars. A dynamic scheduling controller, coupled to the computing core array, is used to parse the current sequence of operators to be executed in real time, dynamically allocate each operator to the first type of computing core or the second type of computing core for execution according to the operation type and data dependency of each operator, and control the data flow direction between the two computing cores; An on-chip storage system, coupled to the computing core array and the dynamic scheduling controller, is used to provide data caching and data sharing for the first type of computing core and the second type of computing core; When there is an intermediate result generated by the first type of operator in the continuous operators to be executed, and there is a data dependency between the intermediate result and the subsequent second type of operator, the dynamic scheduling controller controls the output data of the first type of operation core to bypass at least a part of the on-chip storage system and directly transmit it to the input end of the second type of operation core.
2. The neural network processor as described in claim 1, characterized in that, The dynamic scheduling controller has a built-in operator type identification unit, a dependency resolution unit, and an arbitration allocation unit. The operator type identification unit is used to extract the type label corresponding to each operator from the instruction stream to be executed. The type label includes at least the category of intensive linear operation and the category of nonlinear non-matrix operation. The dependency resolution unit is used to construct a data flow graph between the currently executed operators and to detect write-after-read conflicts and read-after-write conflicts. The arbitration allocation unit is used to allocate execution resources to each operator according to a preset priority strategy based on the current occupancy rate and the length of the pending queue of the first type of computing core and the second type of computing core.
3. The neural network processor as described in claim 1, characterized in that, The first type of computing core consists of multiple basic processing units interconnected in the form of a two-dimensional grid; Each of the basic processing units includes a multiplication subunit, an addition subunit, a local register, and a data bypass switch. The data bypass switch is configured to directly transmit the input data to the adjacent basic processing unit when the operand it receives is zero or a preset invalid value, without passing through the multiplication subunit or the addition subunit.
4. The neural network processor as described in claim 1, characterized in that, The second type of computing core includes multiple independent reconfigurable computing channels. Each reconfigurable computing channel is configured with an independent mode register, an independent data buffer, and an independent pass-through input interface. Each reconfigurable computing channel integrates multiple computing sub-units, and the current working sub-unit is selected by the corresponding mode register. Each channel supports dynamic adaptation for multi-precision computing. The switching is triggered in real time by the dynamic scheduling controller according to the type of the currently allocated operator, and the reconfigurable computing channel maintains the current mode unchanged during the processing of the current computing task, and switches to the target computing mode corresponding to the next computing task after the current computing task is completed and before the next computing task begins.
5. The neural network processor as described in claim 1, characterized in that, The on-chip storage system includes an in-situ cache layer, a shared cache layer, and a global cache layer; The in-situ cache layer is independently bound to the first type of computing core and the second type of computing core, respectively, for temporarily storing the intermediate calculation results of each core and supporting in-situ overwriting and reuse of data; The shared cache layer is shared by the first type of computing core and the second type of computing core, and is used to store model weights and general feature data; The global cache layer is used for data exchange with off-chip memory; The dynamic scheduling controller dynamically determines whether to allocate data to the in-situ cache layer, the shared cache layer, or the global cache layer based on the frequency and scope of data usage. The dynamic scheduling controller also has a built-in tensor shape prediction unit. The tensor shape prediction unit stores multiple batches of historical tensor size data, predicts the dimension of the next batch of tensors based on the historical shape distribution, and completes the PE array mapping configuration and on-chip cache block pre-allocation in advance. Each cache layer of the on-chip storage system supports dynamic spatial fragmentation configuration, and the fragmentation size can be adjusted in advance according to the prediction result of the tensor shape prediction unit to adapt to the dynamic tensor data storage requirements.
6. The neural network processor as described in claim 1, characterized in that, The path by which the output data of the first type of computing core bypasses at least a portion of the on-chip storage system and is directly transmitted to the input of the second type of computing core is a bidirectional pass-through path. The bidirectional direct path also supports the reverse transmission of output data from the second type of computing core to the first type of computing core, in order to meet the needs of residual connection, feature splicing or iterative loop calculation in the neural network model.
7. The neural network processor as described in claim 1, characterized in that, It also includes a sparse data adaptation unit, which is disposed on the data path between the on-chip storage system and the first type of computing core; The sparse data adaptation unit has built-in sparse rate detection hardware logic, and adaptively switches between three encoding formats—bitmask format, compressed sparse row format, or compressed sparse column format—based on the proportion of zero values in the data. It also supports filtering out data with small weights based on a preset amplitude threshold, uniformly marking them as invalid elements and skipping the calculation; The first type of computing core skips the encoded and marked data elements when performing operations.
8. A control method for a neural network processor as described in any one of claims 1-7, characterized in that, The neural network processor includes a first type of computational core and a second type of computational core. The first type of computational core is used to perform intensive linear operations, such as matrix multiplication, and the second type of computational core is used to perform nonlinear, non-matrix operations in units of vectors or scalars. The method includes the following steps: S1: Real-time parsing of the neural network operator stream to be executed, extracting the type information of each operator and the data dependencies between operators; S2: Based on the type information, assign dense linear operators to the first type of operation core, and assign nonlinear or non-matrix operators to the second type of operation core; S3: Based on the data dependency relationship, determine whether there is a pipeline dependency situation where the intermediate result is generated by the first type of operator and there is a data dependency relationship between the intermediate result and the subsequent second type of operator; S4: If the pipeline dependency situation exists, the direct data path between the first type of computing core and the second type of computing core is activated, so that the intermediate result does not need to be transferred through external memory or shared cache, and is directly sent to the second type of computing core for processing; S5: During the execution of the operation, the load status of each operation core is monitored in real time, and the allocation strategy of subsequent operators and the hardware operating voltage or operating frequency are dynamically adjusted accordingly.
9. The control method for a neural network processor as described in claim 8, characterized in that, The sparsity determination step is included after step S2: If the weight data or activation data to be calculated contains more than a preset proportion of zero-value elements, then the sparse operation mode is activated. In the sparse operation mode, the first type of operation core skips invalid operations corresponding to the zero-value elements when performing multiplication and addition operations, and only performs valid operations on non-zero data elements; After the operation is completed, the address of the operation result is remapped to restore the correct output that is consistent with the original tensor position order.
10. The control method for a neural network processor as described in claim 8, characterized in that, The dynamic adjustment of hardware operating voltage or operating frequency in step S5 specifically includes: When the utilization rate of the first type of computing core or the second type of computing core is detected to be lower than a preset first threshold, the power supply voltage of the core is reduced to a preset low voltage level. When the utilization rate of the first type of computing core or the second type of computing core is detected to be higher than a preset second threshold, the operating frequency of the core is increased to a preset high frequency level. The first threshold is less than the second threshold, the first threshold is 30%, and the second threshold is 80%; the power supply voltage is reduced to 0.7 times the nominal voltage under low load, and the operating frequency is increased to 1.2 times the nominal frequency under high load; The adjustment of the power supply voltage and the adjustment of the operating frequency are both performed during the time interval between the completion of the currently executing calculation task and the start of the next calculation task. The adjustment parameters are driven by the real-time calculation status feedback of steps S1 to S4, forming a closed-loop control.
Citation Information
Patent Citations
Scalable array architecture for in-memory computing
CN115461712A
