Dot product accelerator, dot product data processing method, and processor chip

By designing a dot product accelerator microarchitecture with reconfigurable multiplier arrays and adder trees, the adaptation problem of mixed-precision neural networks in existing technologies is solved, achieving efficient and accurate dot product operations, suitable for mixed-precision requirements in the cloud, edge, and end-user environments.

CN123137616APending Publication Date: 2026-11-20上海为旌科技有限公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611618469.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-20
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Existing dot product accelerators cannot flexibly adapt to diverse models when processing mixed-precision neural networks, resulting in low hardware utilization and rounding errors introduced by low-precision floating-point operations, which leads to a decrease in model accuracy.

Method used

Design a microarchitecture for a dot product accelerator that supports multiple precision format switching through a reconfigurable multiplier array and an adder tree, and uses early accumulation and single rounding to ensure computational accuracy and efficiency.

Benefits of technology

It achieves a balance between computing power, area, and accuracy, with high hardware utilization, avoids the accumulation of rounding errors, adapts to various accuracy requirements, and reduces chip customization costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123137616A_ABST
    Figure CN123137616A_ABST
Patent Text Reader

Abstract

The application provides a dot product accelerator, a dot product data processing method and a processor chip, the accelerator comprising: a multiplier array, which can be switched between a floating point mode and a fixed point mode; an addition tree; a floating point processing channel, which is used for decoding a plurality of floating point operands to obtain the order code and the mantissa of each operand, the mantissa is input into the multiplier array in the floating point mode to multiply to obtain a plurality of mantissa products, the plurality of mantissa products are aligned to the same exponent and then accumulated into a partial sum by the addition tree, the partial sum is accumulated with a historical accumulation value in an accumulation register, the accumulation register saves an unrounded intermediate result during the accumulation process, and after the completion of the accumulation, single normalization and single rounding are performed on the intermediate result and the intermediate result is output; and the floating point processing channel is bypassed in the fixed point mode. The application multiplexes the same set of multiplier array and addition tree to realize fixed point and floating point multi-precision calculation, avoids the error accumulation of step-by-step rounding during the accumulation process, and is suitable for mixed precision dot product operation of a neural network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of dot product accelerator technology, and more particularly to a dot product accelerator, a dot product data processing method, and a processor chip. Background Technology

[0002] The dot product is a fundamental mathematical operation: multiplying two sets of numbers position by position and then summing all the products together to get a total. For example, the dot product of vectors [a1,a2,a3] and [b1,b2,b3] is a1×b1 + a2×b2 + a3×b3.

[0003] With the rapid increase in the scale of neural networks, the number of dot product operations in convolutional and fully connected layers of modern models has reached billions or even trillions. The core operation of dot product is multiplication-accumulation, where the hardware implementation of multipliers is costly and power-consuming, and the data path latency of the adder tree directly determines the processor's clock speed. Therefore, the throughput and energy efficiency of dot product operations have become a decisive bottleneck for the performance of the entire AI chip. The original design intention of dot product accelerators is to improve the multiplication acceleration rate. Specifically, it uses a customized hardware architecture to arrange a large number of multipliers and adders in parallel, forming a dedicated data path of "multiplication array + addition tree", striving to complete as many multiplication-accumulation operations as possible per clock cycle. However, current neural networks are rapidly developing towards mixed precision: different network layers or different operators in the same layer may use different data formats such as INT8, FP8, FP16, and BF16. This presents a dilemma for dot product accelerator design: if designed only for a single precision, it cannot flexibly adapt to diverse models and has low hardware utilization; if multiple independent computation paths are used to deal with different precisions, it will incur huge area and power consumption costs; more importantly, once low-precision floating-point operations are directly accumulated, rounding errors will be introduced and the errors will continue to amplify with the number of accumulations, resulting in unacceptable precision of the final result and seriously reducing the accuracy of the model.

[0004] Therefore, there is an urgent need for a dot product accelerator microarchitecture that can perform high-speed computation in low-precision form and reliable accumulation in high-precision form on a unified reconfigurable multiplication array, achieving the optimal balance between computing power, area and accuracy. Summary of the Invention

[0005] The purpose of this invention is to provide a dot product accelerator, a dot product data processing method, and a processor chip, which is a dot product accelerator microarchitecture capable of high-speed calculation in low-precision form and reliable accumulation in high-precision format, thereby achieving a balance between computing power, area, and accuracy.

[0006] The technical solution provided by this invention is as follows: In a first aspect, this application provides a dot product accelerator, comprising: A multiplier array comprising multiple multiplier units, the multiplier array switching between floating-point mode and fixed-point mode in response to a control signal: each of the multiplier units can be combined into at least one wide-bit-width multiplier in the floating-point mode, and split into multiple low-bit-width multipliers in the fixed-point mode. The addition tree, connected to the output of the multiplier array, switches between single-channel wide data accumulation mode and multi-channel narrow data parallel accumulation mode in response to the control signal. A floating-point processing path, connected to the multiplier array and the adder tree, is used to decode multiple floating-point operands to obtain the exponent and mantissa of each operand. The mantissas of each operand are fed into the multiplier array in floating-point mode for multiplication to obtain multiple mantissa products. These multiple mantissa products are aligned to the same exponent and then accumulated by the adder tree to form a partial sum. This partial sum is then added to the historical accumulated value stored in an accumulation register. The accumulation register stores intermediate results that have not been rounded during the accumulation process. The floating-point processing path is also used to perform a single normalization and a single rounding on the intermediate results in the accumulation register after all accumulations are completed, and then output the result. In the fixed-point mode, the floating-point processing path is bypassed, and the fixed-point operands are multiplied and accumulated by the multiplier array and the adder tree in the fixed-point mode.

[0007] In some implementations, the floating-point processing path includes a decoding module, an alignment shift module, an accumulation module, and a normalization rounding module; The decoding module is used to decode multiple input floating-point operands respectively, and extract the sign bit, exponent and mantissa of each floating-point operand; The alignment shift module is connected to the decoding module and the multiplier array respectively. It is used to determine the right shift amount of each mantissa product based on the difference between the other exponents and the reference exponent, using the maximum value among the exponents of the multiple floating-point operands as the reference exponent, and to perform a right shift on the corresponding mantissa product according to the right shift amount. The addition tree is used to accumulate the multiple mantissa multiplications after right shifting of the order into the partial sum; The accumulation module is used to accumulate the portion and the historical accumulated value in the accumulation register; The normalization rounding module is connected to the accumulator register and is used to perform leading zero detection and exponent adjustment on the intermediate results in the accumulator register after all accumulations are completed, and to perform a single rounding to output the calculation result with the target precision.

[0008] In some implementations, the multiplier array is combined into a wide bit-width multiplier in the floating-point mode to perform mantissa multiplication of four sets of floating-point operands in parallel within one clock cycle, resulting in four mantissa products.

[0009] In some implementations, when the alignment shift module performs a right shift by the specified right shift amount, it pads the least significant bit side of the mantissa product with zeros to preserve low-precision bits.

[0010] In some implementations, the accumulation module aligns the historical accumulated value with the partial sum before accumulation; when the accumulation result overflows, the accumulation module shifts the accumulation result one bit to the right and increments the exponent by one; the bit width of the accumulation register is greater than the mantissa bit width of the input floating-point operand, and the intermediate result stored in the accumulation register is an unnormalized intermediate result.

[0011] In some implementations, the accelerator employs a five-stage pipeline, which consists of: an operand decoding stage corresponding to the decoding module, a mantissa multiplication stage corresponding to the multiplier array, a right shift and product addition stage corresponding to the alignment shift module and the addition tree, an accumulation stage corresponding to the accumulation module, and a normalization and rounding stage corresponding to the normalization and rounding module.

[0012] In some implementations, the multiplier array and the adder tree switch the supported precision formats via the control signal, including at least two of INT4, INT8, FP8, BF16, and FP16.

[0013] In some implementations, in the fixed-point mode, the bypassed processing in the floating-point processing path includes: decoding the input data, shifting the order, and rounding to normalization; the fixed-point operands directly enter the multiplier array and the adder tree to complete multiplication and accumulation; the multiple low-width multipliers obtained by splitting the multiplier array process the multiplication operations of multiple fixed-point operands in parallel within a single cycle, and the adder tree accumulates the multiple products in parallel.

[0014] Secondly, this application provides a dot product data processing method, which applies the dot product accelerator described in the first aspect, including: Receive input data and precision mode indication; When the precision mode is indicated as floating-point mode, the floating-point processing path decodes multiple floating-point operands to obtain the exponent and mantissa of each operand; the multiplier array is controlled to be combined into at least one wide-bit-width multiplier to perform multiplication on the mantissa of each floating-point operand, resulting in multiple mantissa products; after aligning the multiple mantissa products to the same exponent, the addition tree accumulates them into a partial sum in a single-channel wide data accumulation mode; the partial sum is accumulated with the historical accumulated value stored in the accumulation register, which stores intermediate results that have not been rounded during the accumulation process; after all accumulations are completed, the intermediate results in the accumulation register are subjected to single normalization and single rounding and then output; When the precision mode is indicated as fixed-point mode, the floating-point processing path is bypassed, and the multiplier array is split into multiple low-width multipliers. The addition tree then performs parallel multiplication and accumulation of multiple fixed-point operands in a multi-path narrow data parallel accumulation mode.

[0015] Thirdly, this application provides a processor chip including the dot product accelerator described in the first aspect.

[0016] The dot product accelerator, dot product data processing method, and processor chip provided by this invention have at least the following technical effects: (1) Based on the hardware of the traditional fixed-point MAC array, this solution only adds lightweight logic such as decoding, alignment shifting and normalization rounding. The core multiplier array and adder tree are fully reused, and there is no need to independently equip the large-area FP32 multiplier. While giving the fixed-point array full floating-point acceleration capability, it only introduces an area increment of about 25%, and the computing power density per unit area is much higher than that of the discrete architecture. (2) Thanks to the “early accumulation and single rounding” process design, the entire point accumulation process of this scheme always retains the full precision tail number, and only performs normalization and rounding once in the final output. From the perspective of operation mechanism, it eliminates the error accumulation caused by multiple intermediate roundings, so that the final calculation accuracy is comparable to the direct use of FP32 operation when inputting low precision formats such as FP16, BF16, FP8. (3) This scheme dynamically splits the multiplier array and the adder tree by controlling the signal. The throughput of FP16 / BF16 can be completely equivalent to that of INT16, and the throughput of FP8 can be completely equivalent to that of INT8. The computing power potential of low-precision floating-point format is completely released without changing the memory bandwidth configuration. (4) The same data path of this solution can be seamlessly switched to support multiple precisions such as INT4, INT8, FP8, BF16, and FP16 through reconfigurable control. One piece of hardware can cover the mixed precision requirements of multiple deployment scenarios such as cloud training, edge inference, and low power consumption on the edge, which greatly reduces the chip customization cost. Attached Figure Description

[0017] The preferred embodiments will now be described in a clear and easy-to-understand manner, with reference to the accompanying drawings, to further explain the above-mentioned characteristics, technical features, advantages, and implementation methods of this solution.

[0018] Figure 1 This is a schematic diagram of a traditional floating-point multi-path dot product accelerator. Figure 2 This is a schematic diagram of a traditional fixed-point multi-path dot product accelerator. Figure 3 This is a schematic diagram of the hardware structure of a dot product accelerator according to an embodiment of the present invention; Figure 4 This is a schematic diagram comparing the computing power of various numerical precision formats according to an embodiment of the present invention. Detailed Implementation

[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the specific implementation methods of the present invention will be described below with reference to the accompanying drawings. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings and other implementation methods can be obtained based on these drawings without any creative effort.

[0020] To keep the drawings concise, only the parts relevant to the invention are shown schematically in each figure, and they do not represent the actual structure of the product. Furthermore, for ease of understanding, in some figures, only one of components with the same structure or function is shown schematically, or only one is labeled. In this document, "one" can mean not only "only one" but also "more than one".

[0021] The dot product is a core operation in convolutional and fully connected layers of neural networks. The operation involves multiplying two sets of operands positionally and then summing all the multiplications. With the rapid increase in the size of neural networks, the number of dot product operations in modern models has reached billions or even trillions. The throughput and energy efficiency of dot product operations have become a decisive bottleneck in the performance of artificial intelligence chips.

[0022] Existing dot product accelerators are mainly divided into two categories. For example... Figure 1 The traditional floating-point multi-path dot product accelerator shown uses independent floating-point multipliers and adders to build the dot product path: taking the processing of four-path dot product (DOT4) as an example, it requires four FP32 multipliers and four FP32 adders. This type of architecture has the following drawbacks: First, the FP32 multipliers have high hardware overhead and high latency, significantly increasing area costs and restricting timing convergence; second, the tree structure introduces multiple intermediate roundings during the step-by-step multiplication and addition process, and the rounding error gradually accumulates, affecting the overall accuracy of general matrix multiplication and other operations; third, this type of architecture is difficult to efficiently accommodate low-precision data formats. When the input is in formats such as INT8, INT4, FP8, BF16, FP16, etc., an additional data conversion unit is required, and the computational power gain that should be brought by the low-precision format cannot be truly released.

[0023] like Figure 2The traditional fixed-point multi-path dot product accelerator shown uses a fine-grained, configurable partial product generation and hierarchical accumulation structure to dynamically split a high-bit-width multiplier into multiple low-bit-width multipliers. Combined with a reconfigurable adder tree, it achieves parallel computation of multiple low-precision dot products or combines them into high-precision dot products within a single cycle, resulting in high computational throughput and energy efficiency per unit area. However, this type of architecture inherently cannot support floating-point computation and struggles to meet the ever-increasing demands of large-scale model inference and training.

[0024] Neural networks are rapidly evolving towards mixed-precision computing, with different network layers or different operators within the same layer potentially using different data formats such as INT8, FP8, FP16, and BF16. Designing for only single-precision computing fails to flexibly adapt to diverse models, resulting in low hardware utilization. Conversely, using multiple independent computational pathways to handle different precisions incurs significant area and power consumption costs. More importantly, the direct accumulation of low-precision floating-point operations introduces rounding errors, which amplify with each accumulation, leading to unacceptable precision in the final result and severely reducing model accuracy.

[0025] Therefore, a dot product accelerator is needed that can perform high-speed computation in low-precision form on a unified reconfigurable multiplication array while reliably accumulating in high-precision format, achieving an optimal balance between computational power, area, and accuracy. This proposal suggests a novel microarchitecture for a dot product accelerator. This architecture is compatible with fixed-point multiplication and accumulation operations and employs an innovative design to directly execute DOT4 operations with fused floating-point precision, i.e., completing the multiplication and accumulation of four sets of operands in a single operation; the result is then further accumulated into a higher-precision FP32 format. In typical applications such as neural networks, this fundamentally avoids the precision loss caused by long sequence accumulations; simultaneously, with only a small increase in area overhead, computational resources such as multipliers and accumulators are efficiently reused, greatly improving computational efficiency. The following is a detailed description of this proposal with reference to the accompanying figures: In one embodiment, this application provides a dot product accelerator, comprising: A multiplier array, comprising multiple multiplier units, switches between floating-point and fixed-point modes in response to a control signal: each multiplier unit can be combined into at least one wide-bit-width multiplier in floating-point mode, and split into multiple low-bit-width multipliers in fixed-point mode. The adder tree, connected to the output of the multiplier array, switches between single-channel wide data accumulation mode and multi-channel narrow data parallel accumulation mode in response to a control signal. The floating-point processing path, connected to the multiplier array and the adder tree, is used to decode multiple floating-point operands to obtain the exponent and mantissa of each operand. The mantissa of each operand is fed into the multiplier array in floating-point mode for multiplication to obtain multiple mantissa products. The multiple mantissa products are aligned to the same exponent and then accumulated by the adder tree to obtain a partial sum. The partial sum is then added to the historical accumulated value stored in the accumulation register. The accumulation register stores intermediate results that have not been rounded during the accumulation process. The floating-point processing path is also used to perform a single normalization and a single rounding on the intermediate results in the accumulation register after all accumulations are completed and then output them. In fixed-point mode, the floating-point processing path is bypassed, and fixed-point operands are multiplied and accumulated via a multiplier array and an adder tree in fixed-point mode.

[0026] The core architecture of this application includes a reconfigurable multiplier array and adder tree, a floating-point processing path, and a multiplexing mechanism that bypasses the floating-point processing path in fixed-point mode. For example... Figure 3 As shown, the dot product accelerator in this embodiment includes a multiplier array, an adder tree, a floating-point processing path, and an accumulation register. The working process in floating-point mode and fixed-point mode will be described below.

[0027] In floating-point mode, the floating-point processing path decodes multiple input floating-point operands (e.g., operands in FP16, BF16, and FP8 formats) to obtain the exponent and mantissa of each operand. The multiplier array switches to floating-point mode in response to the control signal, and each multiplication unit is combined into at least one wide-bit-width multiplier to perform multiplication on the mantissa of each floating-point operand, resulting in multiple mantissa products. The floating-point processing path aligns the multiple mantissa products to the same exponent, and the addition tree in single-channel wide data accumulation mode accumulates the aligned mantissa products into a partial sum. Subsequently, the partial sum is accumulated with the historical accumulated value stored in the accumulation register. The key is that the accumulator register stores the intermediate results without rounding during the accumulation process. This means the intermediate results are neither normalized nor rounded to any floating-point format, thus maintaining the highest precision numerical representation during the cyclic accumulation. Only after all accumulations are complete does the floating-point processing path perform a single normalization and rounding on the intermediate results in the accumulator register, outputting the calculation result with the target precision (e.g., FP32 format). This "early accumulation of dot products, delayed single rounding" approach, mechanistically avoids the accumulation of successive rounding errors.

[0028] In fixed-point mode, the floating-point processing path is bypassed. Fixed-point operands (e.g., INT8 and INT4 format operands) are directly fed into the multiplier array and adder tree in fixed-point mode without decoding, alignment shifting, or normalization rounding. Each multiplication unit of the multiplier array is split into multiple low-width multipliers, processing multiple fixed-point multiplications in parallel within a single cycle. The adder tree switches to a multi-channel narrow-data parallel accumulation mode, accumulating multiple products in parallel to complete the fixed-point multiplication accumulation. Thus, the same set of multiplier array and adder tree hardware time-sharing handles both fixed-point multiprecision and floating-point multiprecision calculations, requiring only a small amount of additional floating-point dedicated logic, resulting in minimal area overhead.

[0029] At the hardware reuse level, this solution directly reuses the existing fine-grained multipliers and adder trees in traditional MAC arrays, eliminating the need for a separate, large-area FP32 multiplier. During fixed-point computation, a bypass floating-point module is used to split the multiplier into multiple low-bit-width multipliers that operate in parallel; during floating-point computation, the multipliers are dynamically combined to perform mantissa multiplication. Through time-sharing multiplexing and functional reconfiguration, a single set of computing resources simultaneously supports both fixed-point multi-precision and floating-point multi-precision processing capabilities, adding only a small number of floating-point decoding, alignment, and normalization rounding modules, resulting in a minimal increase in hardware area.

[0030] At the floating-point precision protection level, a fusion architecture of "early accumulation of dot products and delayed single rounding" is adopted. After multiple sets of floating-point operands are decoded and multiplied by their mantissas, they are not immediately rounded to intermediate floating-point numbers. Instead, they are first aligned to the maximum exponent, and the multiple products are added in an addition tree, then accumulated with the historical results in the accumulation register. After all accumulation loops are completed, normalization and rounding are performed only once, and the final FP32 result is output. This method of "preserving the full-precision mantissa during the process and rounding only at the end" avoids the accumulation of rounding errors at each level from a mechanism perspective, ensuring that the calculation precision equivalent to FP32 can still be achieved when inputting low-precision formats such as FP16, BF16, and FP8.

[0031] At the level of bandwidth and computing power equivalence, thanks to hardware reuse and low-precision parallel splitting mechanism, the computing power of this invention is completely equivalent to that of fixed-point format of the same width when inputting low-precision floating-point numbers: the throughput of FP16 / BF16 is equivalent to INT16, and the throughput of FP8 is equivalent to INT8, thereby maximizing the utilization of memory bandwidth and not losing computing efficiency due to data format switching.

[0032] In one embodiment, based on the foregoing embodiments, the floating-point processing path includes a decoding module, an alignment shift module, an accumulation module, and a normalization rounding module; The decoding module decodes multiple input floating-point operands (such as FP16, BF16, FP8, etc.) separately, extracting the sign bit, exponent, and mantissa fields of each operand. The decoded exponent is sent to the exponent shifting module, and the mantissa is sent to the multiplier array to perform mantissa multiplication. Taking DOT4 operation as an example, this module calculates the product of four sets of mantissas simultaneously in one cycle, producing four partial products. The multiplier array of this module can be dynamically reconfigured according to control signals: combined into a wide-bit-width multiplier in floating-point mode; and split into multiple narrow-bit-width multipliers in fixed-point mode to process multiple INT8 or INT4 operations in parallel.

[0033] The exponent shifting module is connected to both the decoding module and the multiplier array. It uses the maximum value among the exponents of multiple floating-point operands as the base exponent, determines the right shift amount for each mantissa product based on the differences between the remaining exponents and the base exponent, and performs a right shift on the corresponding mantissa products according to the shift amount. This aligns all mantissa products to the same exponent scale, preparing for accumulation in the addition tree. It should be noted that the right shift operation here pre-fills the LSB with 0s to preserve low-precision bits and avoid prematurely discarding information.

[0034] Addition trees are used to accumulate multiple mantissa multiplications after right shifting of order into a partial sum, that is, to complete the addition of multipliers within the same set of dot products. Addition trees also support reconfiguration: processing fixed-point products after order shifting in floating-point mode; and directly accumulating the multiplications of multiple fixed-point paths in fixed-point mode.

[0035] The accumulation module is used to accumulate partial sums with historical accumulated values ​​in the accumulation register, achieving cyclic accumulation of the current dot product with historical results. It's important to note that before accumulation, the historical accumulated values ​​and the current dot product must be right-shifted to the right. After accumulation, if overflow occurs, the result needs to be right-shifted by 1 bit, and the corresponding exponent is incremented by 1. This step is the core embodiment of the "early accumulation" concept: at this stage, the accumulation register still stores unnormalized full-precision intermediate results, not yet rounded to FP32, thus maintaining the maximum precision numerical representation during cyclic accumulation.

[0036] The normalization rounding module is connected to the accumulator register. After all accumulations are completed, it performs leading zero detection and exponent adjustment (i.e., normalization) on the intermediate results in the accumulator register, and performs a single rounding to output the calculation result with the target precision. Since the entire point accumulation process only performs rounding once here, it eliminates the error accumulation caused by multiple intermediate roundings in the traditional architecture.

[0037] In one embodiment, based on the foregoing embodiments, the multiplier array is combined into a wide bit-width multiplier in floating-point mode to perform the mantissa multiplication of four sets of floating-point operands in parallel within one clock cycle, resulting in four mantissa products.

[0038] In this embodiment, the multiplier array is combined into a wide-bit-width multiplier in floating-point mode to perform mantissa multiplication of four sets of floating-point operands in parallel within one clock cycle: that is, to complete the DOT4 operation in a single cycle, processing eight operands (four for each of the two operands in the four multiplications), and generating four mantissa products. These four mantissa products are then partially summed by an adder tree after alignment shifting, achieving internal multiplication and addition of a set of four-way dot products within a single cycle. The DOT4 structure matches the basic granularity of general matrix multiplication in modern neural networks, allowing for grouped dot product calculations without increasing the number of clock cycles.

[0039] In one embodiment, based on the foregoing embodiment, when the order shift module performs a right shift by the right shift amount, zeros are padded on the least significant bit side of the mantissa product to preserve low-precision bits.

[0040] In this embodiment, when the order shift module performs a right shift on the mantissa product by the right shift amount, it pads the least significant bit (LSB) of the mantissa product with zeros, thereby preserving the low-precision bits freed up by the right shift and avoiding premature discarding of low-precision information during the alignment process. Compared with the traditional implementation that directly discards or truncates the low-precision bits during a right shift, padding the LSB with zeros allows the low-precision information covered by the right shift amount to still participate in the calculation during the accumulation stage, further ensuring the numerical reliability of full-precision accumulation.

[0041] In one embodiment, based on the foregoing embodiment, the accumulation module aligns the historical accumulated value with the partial sum before accumulation; when the accumulation result overflows, the accumulation module shifts the accumulation result one bit to the right and increments the exponent by one; the bit width of the accumulation register is greater than the mantissa bit width of the input floating-point operand, and the intermediate result stored in the accumulation register is an unnormalized intermediate result.

[0042] In this embodiment, before accumulation, the accumulation module first aligns the historical accumulated value with the partial sum output by the addition tree, ensuring they are aligned to the same exponent before adding them. If the accumulation result overflows, the accumulated result is shifted right by one bit, and the corresponding exponent is incremented by one to maintain the valid range of the numerical representation. The bit width of the accumulation register is greater than the mantissa bit width of the input floating-point operand to accommodate the low-precision bits retained by the right shift and the bit width increase during the accumulation process, ensuring that the intermediate result stored in the accumulation register is an unnormalized, unrounded, full-precision intermediate result. During the cyclic accumulation process, the partial sum of the dot product in each round is added to the accumulation register in the above manner until all accumulation loops are completed, and there is never any rounding operation in the accumulation register.

[0043] In one embodiment, based on the foregoing embodiments, the accelerator employs a five-stage pipeline, which consists of: an operand decoding stage corresponding to the decoding module, a mantissa multiplication stage corresponding to the multiplier array, a right shift and product addition stage corresponding to the alignment shift module and the addition tree, an accumulation stage corresponding to the accumulation module, and a normalization and rounding stage corresponding to the normalization and rounding module.

[0044] Taking the BF16 data format as an example, the dot product accelerator in this embodiment adopts a five-stage pipeline, dividing the floating-point calculation process into five pipeline stages: The first stage is the operand decoding stage, corresponding to the decoding module, which decodes multiple floating-point operands separately, extracting the sign bit, exponent, and mantissa. The second stage is the mantissa multiplication stage, corresponding to the multiplier array in floating-point mode, which performs parallel multiplication of each group of mantissas. The third stage is the right shift and product addition stage, corresponding to the shift module and the addition tree, which shifts the mantissa products to the right with the maximum exponent as the base exponent, and the addition tree adds the aligned mantissa products into a partial sum. That is, the first three stages complete the internal multiplication and addition of a set of dot products. The fourth stage is the accumulation stage, corresponding to the accumulation module, which adds the partial sum of the current dot product to the historical accumulated value in the accumulation register. The fifth stage is the normalization and rounding stage, corresponding to the normalization and rounding module, which performs a one-time format conversion and single rounding on the full-precision intermediate result in the accumulation register in an extra cycle after all accumulation loops are completed, and outputs the final result. The five-stage pipeline enables clock-level parallelism of each processing stage, ensuring high throughput under high-frequency design.

[0045] In one embodiment, based on the foregoing embodiments, the multiplier array and adder tree switch the supported precision formats via control signals, including at least two of INT4, INT8, FP8, BF16, and FP16.

[0046] In this embodiment, both the multiplier array and the adder tree are equipped with configurable control logic. The control signals can come from the precision indicator bit in the instruction or the mode configuration register. By configuring the control signals, the multiplier array can switch between "combining into high-width multipliers" and "splitting into multiple low-width multipliers", and the adder tree can switch between "single-channel wide data accumulation" and "multi-channel narrow data parallel accumulation", thereby enabling the same data path to flexibly support at least two of the multiple precision formats such as INT4, INT8, FP8, BF16, and FP16.

[0047] Thanks to hardware reuse and low-precision parallel partitioning mechanisms, this embodiment achieves complete computational efficiency equivalent to fixed-point formats of the same width when inputting low-precision floating-point numbers: the throughput of FP16 / BF16 is equivalent to INT16, and the throughput of FP8 is equivalent to INT8. Figure 4 As shown (attached) Figure 4In the graph, the horizontal axis represents various numerical precision formats, such as BF16, FP16, INT16, FP8, and INT8; the vertical axis represents the computing power ratio, for example, the computing power of BF16 / FP16 / INT16 is a baseline value of 1, and the computing power of FP8 / INT8 is 4. This means that without changing the memory bandwidth configuration, floating-point operations can achieve the same computational throughput as fixed-point operations, without losing computational efficiency due to data format switching, thus maximizing memory bandwidth utilization.

[0048] In one embodiment, based on the foregoing embodiments, in fixed-point mode, the bypassed processing in the floating-point processing path includes: decoding the input data, shifting the order, and normalizing rounding; the fixed-point operands directly enter the multiplier array and the adder tree to complete multiplication and accumulation; multiple low-width multipliers obtained by splitting the multiplier array process the multiplication operations of multiple fixed-point operands in parallel within a single cycle, and the adder tree accumulates the multiple products in parallel.

[0049] In this embodiment, as Figure 3 As shown in the bypass path (the path indicated by the dashed line), in fixed-point mode, the bypassed processing in the floating-point processing path specifically includes: decoding the input data, alignment shifting, and normalization rounding; fixed-point operands skip the above steps and directly enter the multiplier array and adder tree to complete multiplication and accumulation. At this time, multiple low-width multipliers obtained by splitting the multiplier array process the multiplication operations of multiple fixed-point operands in parallel within a single cycle. For example, the high-width multiplier is split into multiple INT8-bit or INT4-bit multipliers to process multiple fixed-point operands in parallel; the adder tree is correspondingly switched to a multi-path narrow data parallel accumulation mode to accumulate multiple products in parallel. The fixed-point path fully reuses the multiplier array and adder tree hardware of the floating-point path. Only the floating-point dedicated decoding, alignment shifting, and normalization rounding logic are idle in fixed-point mode, which is also the direct reason for the small area overhead of this invention.

[0050] This invention builds floating-point fused dot product capabilities on the basis of traditional fixed-point MAC arrays with minimal area overhead: the core multiplier array and adder tree are fully reused in both fixed-point and floating-point modes, requiring only lightweight logic additions such as decoding, alignment shifting, and normalization rounding. The measured area increase is approximately 25%, and the computing power density per unit area is significantly higher than... Figure 1 The discrete floating-point architecture shown features an "early accumulation, single rounding" process that makes the final calculation accuracy of low-precision floating-point inputs (FP16, BF16, FP8) comparable to FP32 operations, eliminating the accumulation of errors from successive rounding. The floating-point throughput is equivalent to that of fixed-point inputs of the same width (FP16 / BF16 is equivalent to INT16, FP8 is equivalent to INT8), with zero memory bandwidth waste. A single reconfigurable data path covers multiple precisions from INT4 to FP16, and a single piece of hardware can meet the mixed precision requirements of the cloud, edge, and end-device.

[0051] In one embodiment, this application provides a dot product data processing method, which applies the dot product accelerator of the foregoing embodiments, including: S100, Receive input data and precision mode indication; S200: When the precision mode is indicated as floating-point mode, the floating-point processing path decodes multiple floating-point operands to obtain the exponent and mantissa of each operand; it controls the multiplier array to combine into at least one wide-bit-width multiplier, performs multiplication on the mantissa of each floating-point operand, and obtains multiple mantissa products; after aligning the multiple mantissa products to the same exponent, the addition tree accumulates them into a partial sum in single-channel wide data accumulation mode; the partial sum is accumulated with the historical accumulated value stored in the accumulation register, and the accumulation register stores the intermediate results that have not been rounded during the accumulation process; after all accumulations are completed, the intermediate results in the accumulation register are subjected to single normalization and single rounding and then output. S300 When the precision mode is indicated as fixed-point mode, the floating-point processing path is bypassed, and the control multiplier array is split into multiple low-width multipliers. The addition tree performs parallel multiplication and accumulation of multiple fixed-point operands in a multi-path narrow data parallel accumulation mode.

[0052] In the above method, the four stages of the floating-point process—decoding, mantissa multiplication, right shift and multiplier addition, and accumulation—progress in the first four stages of the five-stage pipeline. Normalization and rounding are performed once as the fifth stage after all accumulations are completed.

[0053] In one embodiment, this application provides a processor chip including the dot product accelerator of the foregoing embodiment.

[0054] The processor chip provided in this embodiment integrates one or more dot product accelerators from the above embodiments as multiply-accumulate operation units. The chip also includes conventional structures such as an instruction scheduling unit, on-chip storage, and data transfer interfaces. The processor chip can be deployed on cloud training servers, edge inference devices, and low-power terminals: When performing general matrix multiplication operations in neural networks, the instruction scheduling unit generates control signals according to the precision format of the operation, configuring each dot product accelerator to work in floating-point mode or fixed-point mode; when performing mixed-precision inference or training, operators with different precision formats can be time-multiplexed by the same on-chip dot product accelerator array, without the need for separate operation paths according to precision.

[0055] It should be noted that the above embodiments can be freely combined as needed. The above description is only a preferred embodiment of the present invention. It should be pointed out that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A dot product accelerator, characterized in that, include: A multiplier array comprising multiple multiplier units, the multiplier array switching between floating-point mode and fixed-point mode in response to a control signal: each of the multiplier units can be combined into at least one wide-bit-width multiplier in the floating-point mode, and split into multiple low-bit-width multipliers in the fixed-point mode. The addition tree, connected to the output of the multiplier array, switches between single-channel wide data accumulation mode and multi-channel narrow data parallel accumulation mode in response to the control signal. A floating-point processing path, connected to the multiplier array and the adder tree, is used to decode multiple floating-point operands to obtain the exponent and mantissa of each operand. The mantissas of each operand are fed into the multiplier array in floating-point mode for multiplication to obtain multiple mantissa products. These multiple mantissa products are aligned to the same exponent and then accumulated by the adder tree to form a partial sum. This partial sum is then added to the historical accumulated value stored in an accumulation register. The accumulation register stores intermediate results that have not been rounded during the accumulation process. The floating-point processing path is also used to perform a single normalization and a single rounding on the intermediate results in the accumulation register after all accumulations are completed, and then output the result. In the fixed-point mode, the floating-point processing path is bypassed, and the fixed-point operands are multiplied and accumulated by the multiplier array and the adder tree in the fixed-point mode.

2. The dot product accelerator according to claim 1, characterized in that, The floating-point processing path includes a decoding module, an alignment shift module, an accumulation module, and a normalization rounding module; The decoding module is used to decode multiple input floating-point operands respectively, and extract the sign bit, exponent and mantissa of each floating-point operand; The alignment shift module is connected to the decoding module and the multiplier array respectively. It is used to determine the right shift amount of each mantissa product based on the difference between the other exponents and the reference exponent, using the maximum value among the exponents of the multiple floating-point operands as the reference exponent, and to perform a right shift on the corresponding mantissa product according to the right shift amount. The addition tree is used to accumulate the multiple mantissa multiplications after right shifting of the order into the partial sum; The accumulation module is used to accumulate the portion and the historical accumulated value in the accumulation register; The normalization rounding module is connected to the accumulator register and is used to perform leading zero detection and exponent adjustment on the intermediate results in the accumulator register after all accumulations are completed, and to perform a single rounding to output the calculation result with the target precision.

3. The dot product accelerator according to claim 2, characterized in that, The multiplier array is combined into a wide bit-width multiplier in the floating-point mode, which is used to perform the mantissa multiplication of four sets of floating-point operands in parallel within one clock cycle to obtain four mantissa products.

4. The dot product accelerator according to claim 2, characterized in that, When the alignment shift module performs a right shift according to the specified right shift amount, it pads the least significant bit side of the mantissa product with zeros to preserve low-precision bits.

5. The dot product accelerator according to claim 2, characterized in that, Before accumulation, the accumulation module aligns the historical accumulated value with the partial sum; when the accumulation result overflows, the accumulation module shifts the accumulated result one bit to the right and increments the exponent by one; the bit width of the accumulation register is greater than the mantissa bit width of the input floating-point operand, and the intermediate result stored in the accumulation register is an unnormalized intermediate result.

6. The dot product accelerator according to claim 2, characterized in that, The accelerator employs a five-stage pipeline, which consists of: an operand decoding stage corresponding to the decoding module; a mantissa multiplication stage corresponding to the multiplier array; a right shift and product addition stage corresponding to the alignment shift module and the addition tree; an accumulation stage corresponding to the accumulation module; and a normalization and rounding stage corresponding to the normalization and rounding module.

7. The dot product accelerator according to any one of claims 1 to 6, characterized in that, The multiplier array and the adder tree switch the supported precision formats via the control signal, including at least two of INT4, INT8, FP8, BF16, and FP16.

8. The dot product accelerator according to any one of claims 1 to 6, characterized in that, In the fixed-point mode, the bypassed processing in the floating-point processing path includes: decoding the input data, shifting the order, and rounding. Fixed-point operands are directly fed into the multiplier array and the adder tree to complete multiplication and accumulation. Multiple low-width multipliers obtained by splitting the multiplier array process the multiplication of multiple fixed-point operands in parallel within a single cycle, and the adder tree accumulates the multiple products in parallel.

9. A method for processing dot product data, characterized in that, The dot product accelerator according to any one of claims 1 to 8 comprises: Receive input data and precision mode indication; When the precision mode is indicated as floating-point mode, the floating-point processing path decodes multiple floating-point operands to obtain the exponent and mantissa of each operand; the multiplier array is controlled to be combined into at least one wide-bit-width multiplier to perform multiplication on the mantissa of each floating-point operand, resulting in multiple mantissa products; after aligning the multiple mantissa products to the same exponent, the addition tree accumulates them into a partial sum in a single-channel wide data accumulation mode; the partial sum is accumulated with the historical accumulated value stored in the accumulation register, which stores intermediate results that have not been rounded during the accumulation process; after all accumulations are completed, the intermediate results in the accumulation register are subjected to single normalization and single rounding and then output; When the precision mode is indicated as fixed-point mode, the floating-point processing path is bypassed, and the multiplier array is split into multiple low-width multipliers. The addition tree then performs parallel multiplication and accumulation of multiple fixed-point operands in a multi-path narrow data parallel accumulation mode.

10. A processor chip, characterized in that, Includes the dot product accelerator according to any one of claims 1 to 8.