The present disclosure relates to an automatic overclocking controller suitable for a field programmable gate array (FPGA)-based neural network accelerator.
In recent years, an FPGA-based neural network accelerator has been widely applied [1], and various performance optimization methods have been proposed in succession [2]. At present, a mainstream static timing analysis tool of an FPGA reserves a certain timing margin to use a worst working condition. Therefore, an overclocking technology can be used to remove an overly conservative time margin to maximize performance. Although the overclocking technology may cause a timing error, a plurality of studies have shown that a neural network can tolerate a small quantity of errors [3], which makes it possible to combine the overclocking technology with a neural network accelerator.
There are currently two main methods for handling a potential timing error, namely an algorithm based fault tolerance (ABFT) method and a method based on timing error warning/delay measurement. The ABFT method verifies an input and an output of an algorithm [4], and if a verification value does not meet certain characteristics, an error may occur. However, the ABFT method can only be applied to a convolution calculation and cannot be applied to other operators in the neural network. Although the method based on timing error warning/delay measurement can be applied to any operator, a timing detector used cannot be applied to all timing paths [5].
A calculation problem to be resolved by the present disclosure is that an existing ABFT method can only be applied to convolution calculation and cannot be applied to other operators in a neural network, and a timing detector used in a method based on timing error warning/delay measurement cannot be applicable to all timing paths.
In order to resolve the above technical problem, technical solutions of the present disclosure provide an automatic overclocking controller based on circuit delay measurement, including a central processing unit (CPU), a clock generator, and a timing delay monitor (TDM) controller, where
frame of data to an
frame of data, where M represents a coefficient of the horizontal multi-frame fusion;
Preferably, if the average value of the sampling values obtained from the N times of sampling in the current phase is not greater than 0.5, a final sampling value of the current phase is 0, otherwise a final sampling value of the current phase is 1.
Preferably, the TDM controller includes a sampler and a transition point finder, where the sampler controls the circuit delay detector to obtain the final sampling values of all the phases and perform the horizontal multi-frame fusion, and the transition point finder searches for the transition points θ1 and θ2.
Preferably, the sampler shares a plurality of circuit delay detectors, and the CPU calculates the circuit delay td for a plurality of paths by using the plurality of circuit delay detectors, and selects a longest circuit delay td from a plurality of circuit delays td to determine the frequency fnext of the accelerator for the next operating cycle.
Preferably, the CPU calculates the circuit delay td according to a following formula:
and T represents a clock cycle.
Compared with the prior art, the present disclosure has following innovative points:
The present disclosure will be further described below with reference to specific embodiments. It should be understood that these embodiments are only intended to describe the present disclosure, rather than to limit the scope of the present disclosure. In addition, it should be understood that various changes and modifications may be made on the present disclosure by those skilled in the art after reading the content of the present disclosure, and these equivalent forms also fall within the scope defined by the appended claims of the present disclosure.
In order to efficiently implement an automatic overclocking controller, an embodiment proposes a control scheme based on a hybrid FPGA, which includes a CPU, a clock generator, and a TDM controller, as shown in
The TDM controller consists of a sampler and a transition point finder, and has three states: idle (IDLE), sampling (SampleValues), and post-processing (Find Transition Points), as shown in
and T represents a clock cycle.
As shown in
and
However, in a process of changing the sampling value from 1 to 0, there will be a stage in which the sampling value is unstable, which is referred to as a sampling jitter and involves a stage from θ1′ to θ1″ and a stage from θ2′ to θ2″, which are shadowed in
The vertical fusion is completed in a sampling process. The sampler controls the circuit delay detector to perform a plurality of times of sampling in a same phase, and an average value of the plurality of times of sampling is taken as a sampling value of a current frame corresponding to the phase. For example, if five times of sampling are performed at 100°, sampling values are all 10010, and an average value is 0.4, 0 is taken as a sampling value of 100°. The horizontal multi-frame fusion is completed after the sampling, and needs to be performed for each phase. A quantity of frames to be fused is defined by a developer as required. In this embodiment, if a coefficient of the horizontal multi-frame fusion is 7, an obtained sampling value of an nth frame after the horizontal multi-frame fusion is an average value of sampling values of an (n−3)th frame, (n−2)th frame, (n−1)th frame, the original nth frame, an (n+3)th frame, an (n+2)th frame, and an (n+1)th frame. Before the horizontal multi-frame fusion, both ends of a sampled sequence need to be filled to cover a boundary situation. Assuming that a complete phase is 360° and the coefficient of the horizontal multi-frame fusion is 7, it is necessary to fill data values of 357°, 358°, and 359° to −3°, −2°, and −1°. A data value of a phase of 0° is determined by an average value of data values of 7 phase points at −3° to 3°. By analogy, a final value of each phase point is determined by an average value of sampling values of neighboring phases of the phase point. In hardware implementation, first in first out (FIFO) can be used to achieve the horizontal multi-frame fusion. As shown in
Firstly, the CPU sends a startup signal, and an accelerator and the TDM controller are started simultaneously. The sampler performs a plurality of times of sampling in a same phase and then moves to a next phase, until all phases are sampled. Then, the transition point finder performs the horizontal multi-frame fusion on each path to find transition points θ1 and θ2. It should be noted that this operation needs to be completed before the accelerator ends running. When the accelerator ends running, the CPU obtains the transition points of each path from the TDM controller to calculate circuit delay td, and determines frequency fnext of the accelerator for a next operating cycle based on longest delay td. A frequency modulation strategy is determined by the developer. A simplest frequency modulation strategy is as follows: If td is less than a current clock cycle, an operating frequency increases by 1 MHz, and vice versa, the operating frequency decrease by 1 MHz.
The above technical solutions can be applied to an FPGA-based neural network accelerator.
Number | Date | Country | Kind |
---|---|---|---|
202310016209.6 | Jan 2023 | CN | national |
This application is a continuation application of International Application No. PCT/CN2023/083293, filed on Mar. 23, 2023, which is based upon and claims priority to Chinese Patent Application No. 202310016209.6, filed on Jan. 6, 2023, the entire contents of which are incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2023/083293 | Mar 2023 | WO |
Child | 18224579 | US |