Frequency adjusting method and device, electronic equipment, chip and medium

By dynamically adjusting the operating frequency for each operator in the AI ​​chip, combining energy and delay, the problem of difficulty in finding the optimal solution between power consumption and performance of the AI ​​chip is solved, and more efficient frequency adjustment is achieved, reducing the Power consumption.

CN119045644AActive Publication Date: 2024-11-29BEIJING X RING TECHNOLOGY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202310618329.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-29
Publication Date
2024-11-29
Estimated Expiration
2043-05-29

AI Technical Summary

Technical Problem

It is difficult to find the optimal solution between power consumption and performance in existing AI chips. Traditional frequency adjustment methods such as DVFS and layer-by-layer dynamic frequency scaling have problems of inefficiency, and adaptive frequency regulation and voltage regulation technology increases the difficulty of timing verification.

Method used

By dynamically adjusting the chip's operating frequency for each operator, based on the energy and delay of the operator execution, combined with AI model parameters and hardware parameters, the target state is determined to adjust the frequency, and the optimal balance of power consumption and performance is achieved.

Benefits of technology

It improves the working efficiency of the chip, reduces power consumption, and avoids the problem of excessive frequency adjustment particle size in traditional methods, simplifies the frequency adjustment process, and enhances the balance of performance and power consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119045644A_ABST
    Figure CN119045644A_ABST
Patent Text Reader

Abstract

The invention provides a frequency adjustment method and device, electronic equipment, a chip and a medium, and relates to the field of artificial intelligence chips, the method comprises the following steps: determining first data and second data of one or more first operators, the first data at least comprising energy required for executing the first operators, and the second data at least comprising time delay for executing the first operators; and based on the first data and the second data, the first working frequency of the chip is adjusted to the second working frequency, and the working efficiency of the chip is improved and the power consumption is reduced by dynamically adjusting the working frequency of the chip for each operator.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence chips, and in particular to a frequency adjustment method, device, electronic device, chip and medium. Background Art

[0002] Artificial intelligence (AI) chips are the core component of AI server computing power. They are chips designed specifically for the field of artificial intelligence. Their architecture and instruction set are specially optimized for various algorithms and applications in the field of artificial intelligence, and can efficiently support intelligent processing tasks such as vision, speech, natural language processing, and traditional machine learning. With the development of technology, the scale of AI computing power has grown rapidly, the integration and complexity of AI chips have become higher and higher, and the corresponding functions have become more and more powerful. In order to complete chip design with lower power consumption, it is crucial to design efficient chips during the chip development process. Summary of the invention

[0003] The present disclosure provides a frequency adjustment method, device, electronic device, chip and medium to solve the problems in the related art, and improve the working efficiency of the chip and reduce power consumption by dynamically adjusting the working frequency of the chip for each operator.

[0004] The first aspect embodiment of the present disclosure proposes a frequency adjustment method, which is executed by a chip. The method includes: determining first data and second data of one or more first operators, the first data at least including the energy required to execute the first operator, and the second data at least including the delay of executing the first operator; based on the first data and the second data, adjusting the first operating frequency of the chip to the second operating frequency.

[0005] In some embodiments of the present disclosure, determining the first data and the second data of one or more first operators includes: based on a first parameter, obtaining a first operand and a first utilization of the first operator, the first utilization being the utilization of executing the first operator to perform a second operation, the first parameter including an AI model parameter and / or a hardware parameter corresponding to the AI ​​model, and the first operator being at least one of the AI ​​model operators; based on the first operand and the first utilization, determining a second operand corresponding to the first operator, the second operand being the operand for executing the first operator to perform the second operation, and the second operand being greater than or equal to the first operand; based on the first parameter, determining a third operand within a preset time, the third operand being the operand for executing the first operator to perform the second operation within the preset time; based on the second operand and the third operand, determining the first data and the second data of the first operator.

[0006] In some embodiments of the present disclosure, determining the first data of the first operator based on the second operand and the third operand includes: determining the operation cycle of the first operator based on the second operand and the third operand; determining the operation time of the first operator according to the first operating frequency and the operation cycle; determining the power of the first operator based on the first operating frequency and a first corresponding relationship, the first corresponding relationship being the relationship between the operating frequency and voltage of the first operator; and determining the first data according to the power and operation time of the first operator.

[0007] In some embodiments of the present disclosure, determining the second data of the first operator based on the second operand and the third operand includes: determining the second data of the first operator based on the first operand, the first utilization rate, the third operand, and the first operating frequency.

[0008] In some embodiments of the present disclosure, based on the first data and the second data, adjusting the first operating frequency of the chip to the second operating frequency includes: determining a target state of the chip, and determining a first preset coefficient and a second preset coefficient based on the target state, the target state including one of a target performance or a target power consumption; determining a frequency adjustment value of the chip based on the first preset coefficient, the second preset coefficient, the first data, and the second data; and adjusting the first operating frequency of the chip to the second operating frequency through the frequency adjustment value.

[0009] In some embodiments of the present disclosure, determining the target state of the chip includes: determining the target state of the chip based on a first operator.

[0010] In some embodiments of the present disclosure, adjusting the first operating frequency of the chip to the second operating frequency based on the first data and the second data includes: in response to a received frequency modulation instruction, adjusting the first operating frequency of the chip to the second operating frequency based on the first data and the second data.

[0011] The second aspect embodiment of the present disclosure proposes a frequency adjustment device, which is applied to a chip, and includes: a determination unit, used to determine first data and second data of one or more first operators, the first data at least including the energy required to execute the first operator, and the second data at least including the delay of executing the first operator; an adjustment unit, used to adjust the first operating frequency of the chip to the second operating frequency based on the first data and the second data.

[0012] The third aspect embodiment of the present disclosure proposes a chip, which includes one or more interface circuits and one or more processors; the processor is used to execute the method described in the first aspect embodiment of the present disclosure.

[0013] A fourth aspect embodiment of the present disclosure provides an electronic device, which includes the device described in the second aspect embodiment of the present disclosure, or the chip described in the third aspect embodiment of the present disclosure.

[0014] The fifth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in the first aspect embodiment of the present disclosure.

[0015] In summary, according to the frequency adjustment method proposed in the present disclosure, the first data and the second data of one or more first operators are determined, the first data at least includes the energy required to execute the first operator, and the second data at least includes the delay of executing the first operator; based on the first data and the second data, the first operating frequency of the chip is adjusted to the second operating frequency, and the operating frequency of the chip is dynamically adjusted for each operator, thereby improving the working efficiency of the chip and reducing power consumption.

[0016] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0018] Figure 1 A flow chart of a frequency adjustment method provided in an embodiment of the present disclosure;

[0019] Figure 2 A flow chart of a frequency adjustment method provided in an embodiment of the present disclosure;

[0020] Figure 3 A schematic diagram of the structure of a frequency adjustment device provided in an embodiment of the present disclosure;

[0021] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0022] The embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions.

[0023] The chip frequency modulation and voltage regulation technologies in related technologies mainly include the following:

[0024] Dynamic Voltage and Frequency Scaling (DVFS) technology:

[0025] This technology divides the chip into several different voltage regions. When the workload increases, the frequency and voltage are increased, and when the workload decreases, the frequency and voltage are decreased. This method is simple to implement and uses several fixed voltage levels and frequencies. However, DVFS fixes the adjustable voltage level and frequency, which can easily limit the scope of reducing power consumption.

[0026] Adaptive Voltage Frequency Scaling (AVFS):

[0027] AVFS uses sensors to measure detection data in real time, and can freely adjust the system's power supply voltage and frequency within a certain range. This method can more accurately adjust the voltage and frequency values ​​within a certain range. However, it will greatly increase the difficulty of timing signoff (timing verification). It is difficult to cover all voltage and frequency combinations with a few PVT (Process, Voltage, Temperature) conditions. At the same time, adding PVT conditions may face the problem of too many signoff corners (verification corners) or incomplete timing libraries.

[0028] Frequency and voltage modulation technology based on the complexity of the neural networks (NN) model (usage scenario):

[0029] This technology adjusts the frequency and voltage according to the overall complexity of the NN model or the usage scenario. This method can adjust the voltage and frequency for different NN models. However, the adjustment is carried out based on the entire model, and the adjustment granularity is large, which can easily cause excess performance during NN reasoning.

[0030] Layer-by-layer dynamic frequency scaling technology:

[0031] This technology calculates the power behavior of each layer according to the operation type and data size of each layer of the NN network, and performs dynamic frequency scaling. This technology can implement layer-by-layer adjustment for the NN model, taking into account the problem of different operation types and data sizes at each layer, and the adjustment granularity is fine. However, the algorithm is relatively complex, and the NPU needs to generate an interrupt at each layer to notify the completion of a layer. Since the CPU has inevitable delays in processing interrupts and scaling frequencies during operation, and the CPU also takes time to wake up, each layer will have a certain execution time.

[0032] In order to solve the problems existing in the related art, the present disclosure proposes a frequency adjustment method, which can be applied to NPU chips or other chips running NN. The frequency adjustment method provided in the present disclosure starts from the perspective of power consumption and performance, takes the operator as the adjustment granularity, and adjusts the operating frequency to find the optimal solution that satisfies the system between power consumption and performance.

[0033] The frequency adjustment method provided in the present application is described in detail below with reference to the accompanying drawings.

[0034] Figure 1 A flow chart of a frequency adjustment method provided in an embodiment of the present disclosure.

[0035] The frequency adjustment method provided in the present disclosure can be performed by a chip, which may include a general chip or a dedicated chip. For example, the general chip may include a CPU or a GPU, and the dedicated chip may include but is not limited to a chip such as an NPU or a video processing unit (VPU). The chip can run one or more AI models.

[0036] like Figure 1 As shown, the frequency adjustment method includes the following steps:

[0037] Step 101 : determining first data and second data of one or more first operators, wherein the first data at least includes energy required to execute the first operator, and the second data at least includes a delay to execute the first operator.

[0038] In an embodiment of the present disclosure, the chip may run one or more AI models, each of which may include one or more operators. An operator is a mapping from a function space to another function space (or itself), and an operator in the present disclosure may indicate one or more computing units of an AI model. The operator in the present disclosure may include any one of summation operators, convolution operators, deconvolution operators, and activation function operators, without specific limitation.

[0039] In an embodiment of the present disclosure, the first data and the second data of one or more first operators can be determined by a first parameter, and the first parameter includes an AI model parameter and / or a hardware parameter corresponding to the AI ​​model. For example, the AI ​​model parameter may include the operation type of each operator in the model, the data size, and other relevant parameters of the model, and the hardware parameters corresponding to the AI ​​model may include actual bandwidth, memory and other information.

[0040] The first data may include energy required to execute the first operator, and the second data may include a maximum latency required to execute the first operator.

[0041] Step 102: Based on the first data and the second data, adjust the first operating frequency of the chip to the second operating frequency.

[0042] In the embodiments of the present disclosure, the first data, i.e., the energy required to execute the first operator, mainly considers the power consumption of the electronic device; the second data, i.e., the maximum delay of executing the first operator, mainly considers the performance of the electronic device. By combining the first data with the second data, it is possible to obtain the optimal solution that satisfies the system between power consumption and performance from the perspective of power consumption and performance.

[0043] The first operating frequency refers to the current operating frequency corresponding to the first operator, that is, the operating frequency before adjustment; the second operating frequency refers to the operating frequency of the first operator after adjustment based on the target state.

[0044] In summary, according to the frequency adjustment method proposed in the present disclosure, the first data and the second data of one or more first operators are determined, the first data at least includes the energy required to execute the first operator, and the second data at least includes the delay of executing the first operator; based on the first data and the second data, the first operating frequency of the first operator is adjusted to the second operating frequency, and the operating frequency of the chip is dynamically adjusted for each operator, thereby improving the working efficiency of the chip and reducing power consumption.

[0045] based on Figure 1 The embodiment shown, Figure 2 A flow chart of a frequency adjustment method proposed in the present disclosure is further shown. Figure 2 based on Figure 1 In the embodiment shown, step 101 and step 102 are further defined. Figure 2 In the embodiment shown, step 101 includes step 201, step 202, step 203 and step 204, and step 102 includes step 205, step 206 and step 207. Figure 2 As shown, the method comprises the following steps:

[0046] Step 201 : Based on a first parameter, a first operand and a first utilization of a first operator are obtained, where the first utilization is a utilization of executing the first operator to perform a second operation.

[0047] In an embodiment of the present disclosure, the first parameter includes an AI model parameter and / or a hardware parameter corresponding to the AI ​​model, and the first operator is one of the AI ​​model operators. The first operand refers to the amount of calculation required by the first operator, and the first utilization refers to the MAC utilization that can be actually obtained based on the first parameter after the hardware is determined. Among them, MAC, multiply-accumulate operation (MultiplyAccumulate, MAC) refers to the operation of the smallest unit required in the execution process of the first operator, which is a special operation in a digital signal processor or some microprocessors. The hardware circuit unit that implements this operation operation may also be called a "multiplier accumulator".

[0048] Specifically, the chip can obtain the amount of computation required for each operator (N) according to the operation type, data size, other relevant parameters of the model and / or the actual bandwidth and memory corresponding to the AI ​​model. need Because the computing power of computing chips (such as NPU) is limited by hardware resources, NPU may only play a part of the theoretical computing power. Therefore, when the hardware is determined, the chip can actually obtain the MAC utilization rate (MAC ratio ).

[0049] Step 202: determine a second operand corresponding to the first operator based on the first operand and the first utilization rate, where the second operand is an operand for executing the first operator to perform a second operation, and the second operand is greater than or equal to the first operand.

[0050] In the embodiments of the present disclosure, the second operation refers to the multiplication and addition operation that needs to be performed during the execution of the first operator on hardware, and the second operand refers to the operand required to perform the second operation when actually executing the first operator obtained according to the first utilization rate.

[0051] Specifically, according to Formula 1, the number of MACs that the current first operator needs to execute on the hardware is obtained according to the MAC utilization rate, that is, MAC hw-need .

[0052]

[0053] Among them, MAC hw-need It refers to the number of MACs that the first operator needs to execute on the hardware, that is, the second operand; N need Refers to the amount of calculation required for each operator, that is, the first operand; MAC ratio Refers to MAC utilization, that is, the first utilization, MAC ratio Between 0-1.

[0054] Step 203: determining a third operand within a preset time based on the first parameter, where the third operand is an operand for executing the first operator to perform the second operation within the preset time.

[0055] In the embodiment of the present disclosure, the third operand refers to the operand of the operation of the multiplication and addition operation actually performed within the preset time.

[0056] It is understandable that the third operand may be the same as or different from the second operand, and the third operand is limited by the actual hardware parameter, i.e., the first parameter. The preset time may be a unit time, such as one second, one millisecond, etc. The specific time is set according to actual needs and is not limited in the embodiments of the present disclosure.

[0057] Specifically, the actual computing power of the hardware in a unit time can be obtained based on the actual hardware configuration parameters. The actual computing power refers to the number of MACs that can actually be calculated, that is, HW C .

[0058] Step 204 : determining first data and second data of the first operator based on the second operand and the third operand.

[0059] In the embodiment of the present disclosure, the first data and the second data of the first operator are determined based on the second operand and the third operand, respectively. It should be noted that in the present disclosure, the first data can be determined first, or the second data can be determined first, and the order of determining the first data and determining the second data is not limited in the embodiment of the present disclosure.

[0060] In an optional embodiment of the present disclosure, determining the first data of the first operator based on the second operand and the third operand includes: determining the operation cycle of the first operator based on the second operand and the third operand; determining the operation time of the first operator according to the first operating frequency and the operation cycle; determining the power of the first operator based on the first operating frequency and a first corresponding relationship, the first corresponding relationship being the relationship between the operating frequency and voltage of the first operator; and determining the first data according to the power and operation time of the first operator.

[0061] Specifically, according to Formula 2, the present disclosure can obtain the number of operation cycles (cycles) required for the hardware to execute the first operator based on the number of MACs that the hardware can actually execute in a unit time, i.e., the third operand, and the number of MACs that the current first operator needs to execute on the hardware, i.e., the second operand.

[0062]

[0063] According to Formula 3, the present disclosure can obtain the time t required to execute the first operator, that is, the running time, based on the first operating frequency f before the first operator is adjusted and the operation cycle obtained from the above Formula 2.

[0064]

[0065] Since different frequencies f in the first corresponding relationship correspond to different voltages U, the first voltage corresponding to the first operating frequency can be determined according to the first operating frequency of the first operator. At the same time, the first resistance can be determined according to the current hardware environment of the first operator. The first current I can be calculated based on the first voltage and the first resistance.

[0066] According to the relationship P=UI, and the first voltage and the first current determined above, the corresponding relationship between the first operating frequency f and the power P can be determined, that is,

[0067] P=F(f) (Formula 4)

[0068] The first correspondence table represents the relationship between the operating frequency and the voltage, that is, different operating frequency f levels correspond to different voltage levels U. The first correspondence is preset, and the first correspondence can be determined by searching the first correspondence table, which is not limited in the disclosed embodiment.

[0069] According to the power calculated above and the time t required to execute the first operator, the energy W required to execute the first operator can be obtained according to Formula 5: op , that is, the first data.

[0070] W op =t*P (Formula 5)

[0071] In an optional embodiment of the present disclosure, determining the second data of the first operator based on the second operand and the third operand includes: determining the second data of the first operator based on the first operand, the first utilization rate, the third operand and the first operating frequency.

[0072] Specifically, according to Formula 6, the present disclosure takes into account the performance and operator-by-operator adjustment aspects, and can determine the maximum latency required to actually calculate the first operator, that is, the second data, according to the amount of calculation required by the first operator, the number of MACs actually executed per unit time, the MAC utilization actually obtainable based on the first parameter, and the first operating frequency f.

[0073]

[0074] Step 205 , determining a target state of the chip, and determining a first preset coefficient and a second preset coefficient based on the target state.

[0075] In the present disclosure, the target state includes one of a target performance or a target power consumption.

[0076] In an embodiment of the present disclosure, the first preset coefficient and the second preset coefficient are determined based on the primary and secondary relationship of the optimization objectives, and the first preset coefficient and the second preset coefficient are both between 0 and 1.

[0077] The target state of the chip is determined based on the first parameter. Specifically, when the first operator has an operator with a memory access bottleneck, the target state is determined to be the target power consumption, that is, power consumption is given priority. At this time, the first preset coefficient is determined to be larger and the second preset coefficient is smaller, that is, the first operating frequency is lowered. When the first operator has an operator with a large computational density, the target state is determined to be the target performance, that is, performance is given priority. At this time, the first preset coefficient is determined to be smaller and the second preset coefficient is larger, that is, the first operating frequency is increased.

[0078] It can be understood that the first preset coefficient and the second preset coefficient are pre-set, and the specific values ​​are set according to actual needs and are not limited in the embodiments of the present disclosure.

[0079] Step 206 , determining a frequency adjustment value of the chip based on the first preset coefficient, the second preset coefficient, the first data, and the second data.

[0080] In an embodiment of the present disclosure, as shown in Formula 7, the frequency adjustment value of the chip is determined according to the first preset coefficient and the second preset coefficient determined based on the target state, so as to minimize the cost.

[0081] minimize Cost = A*W op +B*Latency (Formula 7)

[0082] Among them, in the present disclosure, A is the first preset coefficient, and B is the second preset coefficient.

[0083] Step 207: adjusting the first operating frequency of the chip to a second operating frequency by using the frequency adjustment value.

[0084] In the embodiment of the present disclosure, the second operating frequency is determined according to the frequency adjustment value determined above. Since the first operating frequency is adjusted according to the target state, the adjusted operating frequency can meet the requirements of low power consumption while maximizing the chip operating efficiency.

[0085] In addition, in an optional embodiment of the present disclosure, in response to the received frequency modulation instruction, the first operating frequency of the chip is adjusted to the second operating frequency based on the first data and the second data. In other words, a command about frequency modulation is inserted before each first operator calculation to notify the frequency modulation module, that is, to notify the chip to perform frequency modulation, and the specific frequency adjustment value is obtained through step 206. In the present disclosure, the frequency modulation instruction can be sent by the CPU or other control modules in the chip, which is not limited in the embodiment of the present disclosure.

[0086] For example, when the AI ​​model consists of five operators, the present disclosure can first determine the second operating frequency table corresponding to the five operators, and use the second operating frequency table as a frequency modulation instruction. The frequency modulation instruction (i.e., the second operating frequency table) is sent to the NPU or the corresponding AI processing chip, and the adjustment unit corresponding to the NPU or the corresponding AI processing chip performs the frequency modulation operation according to the frequency modulation instruction.

[0087] In summary, according to the method provided by the present disclosure, the first operating frequency of the chip is adjusted to the second operating frequency according to the target state based on the energy and delay of the first operator, and the frequency adjustment is performed for the first operator. It is more suitable for computing chips (such as NPU chips) than the traditional DVFS method, and the frequency adjustment effect is better; compared with the method of adjusting the frequency layer by layer, the method of adjusting the frequency by operator in the present disclosure does not need to set breakpoints, does not need to be fed back to the CPU or other control modules layer by layer, and can directly respond to the frequency modulation instruction for frequency adjustment, which is easier to implement. At the same time, the method disclosed in the present disclosure can determine the target state based on the first operator, thereby dynamically adjusting the frequency, so that the power consumption is reduced when the target state is met.

[0088] Figure 3 FIG. 3 is a schematic diagram of a frequency adjustment device 300 provided in an embodiment of the present disclosure. Figure 3 As shown, the device is applied to a chip, and the frequency adjustment device includes:

[0089] A determining unit 310, configured to determine first data and second data of one or more first operators, the first data at least including energy required to execute the first operator, and the second data at least including a delay to execute the first operator;

[0090] The adjustment unit 320 is used to adjust the first operating frequency of the chip to the second operating frequency based on the first data and the second data.

[0091] In some embodiments, the determination unit 310 is used to: obtain a first operand and a first utilization of the first operator based on a first parameter, the first utilization being the utilization of executing the first operator to perform a second operation, the first parameter including an AI model parameter and / or a hardware parameter corresponding to the AI ​​model, and the first operator being at least one of the AI ​​model operators; determine a second operand corresponding to the first operator based on the first operand and the first utilization, the second operand being the operand for executing the first operator to perform the second operation, and the second operand being greater than or equal to the first operand; determine a third operand within a preset time based on the first parameter, the third operand being the operand for executing the first operator to perform the second operation within the preset time; determine first data and second data of the first operator based on the second operand and the third operand.

[0092] In some embodiments, the determination unit 310 is used to: determine the operation cycle of the first operator based on the second operand and the third operand; determine the running time of the first operator according to the first operating frequency and the operation cycle; determine the power of the first operator based on the first operating frequency and the first corresponding relationship, the first corresponding relationship being the relationship between the operating frequency and the voltage of the first operator; determine the first data according to the power and running time of the first operator.

[0093] In some embodiments, the determination unit 310 is configured to determine the second data of the first operator based on the first operand, the first utilization rate, the third operand, and the first operating frequency.

[0094] In some embodiments, the adjustment unit 320 is used to: determine a target state of the chip, and determine a first preset coefficient and a second preset coefficient based on the target state, the target state including one of a target performance or a target power consumption; determine a frequency adjustment value of the chip based on the first preset coefficient, the second preset coefficient, the first data, and the second data; and adjust the first operating frequency of the chip to the second operating frequency through the frequency adjustment value.

[0095] In some embodiments, the adjustment unit 320 is used to determine a target state of the chip based on the first operator.

[0096] In some embodiments, the determination unit 320 is used to: in response to the received frequency modulation instruction, adjust the first operating frequency of the chip to the second operating frequency based on the first data and the second data.

[0097] In summary, by determining the first data and the second data of the first operator in the first module, the first data at least includes the energy required to execute the first operator, and the second data at least includes the delay of executing the first operator; based on the first data and the second data, the first operating frequency of the chip is adjusted to the second operating frequency, and by dynamically adjusting the operating frequency of the chip for each operator, the working efficiency of the chip is improved and the power consumption is reduced.

[0098] Corresponding to the methods provided in the above-mentioned embodiments, the present disclosure also provides a frequency adjustment device. Since the device provided in the embodiment of the present disclosure corresponds to the methods provided in the above-mentioned embodiments, the implementation method of the method is also applicable to the device provided in this embodiment and will not be described in detail in this embodiment.

[0099] In the embodiments provided in the present application, the methods and devices provided in the embodiments of the present application are introduced. In order to implement the functions in the methods provided in the embodiments of the present application, the electronic device may include a hardware structure and a software module, and implement the functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. A function of the functions may be executed in the form of a hardware structure, a software module, or a hardware structure plus a software module.

[0100] Figure 4 4 is a block diagram of an electronic device 400 for implementing the above-mentioned frequency adjustment method according to an exemplary embodiment. For example, the electronic device 400 may be a mobile phone, a computer, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0101] Reference Figure 4 , the electronic device 400 may include one or more of the following components: a processing component 402 , a memory 404 , a power component 406 , a multimedia component 408 , an audio component 410 , an input / output (I / O) interface 412 , a sensor component 414 , and a communication component 416 .

[0102] The processing component 402 generally controls the overall operation of the electronic device 400, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 402 may include one or more modules to facilitate the interaction between the processing component 402 and other components. For example, the processing component 402 may include a multimedia module to facilitate the interaction between the multimedia component 408 and the processing component 402.

[0103] The memory 404 is configured to store various types of data to support operations on the electronic device 400. Examples of such data include instructions for any application or method operating on the electronic device 400, contact data, phone book data, messages, pictures, videos, etc. The memory 404 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0104] The power supply component 406 provides power to the various components of the electronic device 400. The power supply component 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 400.

[0105] The multimedia component 408 includes a screen that provides an output interface between the electronic device 400 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 408 includes a front camera and / or a rear camera. When the electronic device 400 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0106] The audio component 410 is configured to output and / or input audio signals. For example, the audio component 410 includes a microphone (MIC), and when the electronic device 400 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 404 or sent via the communication component 416. In some embodiments, the audio component 410 also includes a speaker for outputting audio signals.

[0107] I / O interface 412 provides an interface between processing component 402 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0108] The sensor assembly 414 includes one or more sensors for providing various aspects of status assessment for the electronic device 400. For example, the sensor assembly 414 can detect the open / closed state of the electronic device 400, the relative positioning of components, such as the display and keypad of the electronic device 400, and the sensor assembly 414 can also detect the position change of the electronic device 400 or a component of the electronic device 400, the presence or absence of user contact with the electronic device 400, the orientation or acceleration / deceleration of the electronic device 400, and the temperature change of the electronic device 400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 414 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0109] The communication component 416 is configured to facilitate wired or wireless communication between the electronic device 400 and other devices. The electronic device 400 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G LTE, 5G NR (NewRadio) or a combination thereof. In an exemplary embodiment, the communication component 416 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0110] In an exemplary embodiment, the electronic device 400 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0111] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 404 including instructions, and the instructions can be executed by a processor 420 of an electronic device 400 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0112] The embodiments of the present disclosure further provide a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the frequency adjustment method described in the above embodiments of the present disclosure.

[0113] An embodiment of the present disclosure further provides a computer program product, including a computer program, which executes the frequency adjustment method described in the above embodiment of the present disclosure when a processor executes the computer program.

[0114] The embodiments of the present disclosure also propose a chip, which includes one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from a memory of an electronic device and send a signal to the processor, the signal includes a computer instruction stored in the memory, and when the processor executes the computer instruction, the electronic device executes the frequency adjustment method described in the above embodiment of the present disclosure. In addition, the interface circuit can also send a signal to the electronic device, that is, transmit information in the reverse direction. For example, after the chip completes the task, it passes the result or status to the outside for use by other modules (such as CPU or ISP). Among them, the chip refers to the computing chip of the AI ​​model, which can be a NPU chip.

[0115] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0116] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0117] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.

[0118] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processing module, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (control method), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary, and then stored in a computer memory.

[0119] It should be understood that the various parts of the embodiments of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0120] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0121] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0122] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A frequency adjustment method, characterized in that: The method is executed by a chip and includes: Determine first data and second data of one or more first operators, wherein the first data at least includes energy required to execute the first operator, and the second data at least includes a delay to execute the first operator; Based on the first data and the second data, a first operating frequency of the chip is adjusted to a second operating frequency.

2. The method according to claim 1, characterized in that The determining of the first data and the second data of the one or more first operators comprises: Based on a first parameter, obtaining a first operand and a first utilization of the first operator, where the first utilization is a utilization of executing the first operator to perform a second operation, the first parameter includes an AI model parameter and / or a hardware parameter corresponding to the AI ​​model, and the first operator is at least one of the AI ​​model operators; Determine, based on the first operand and the first utilization rate, a second operand corresponding to the first operator, where the second operand is an operand for executing the first operator to perform the second operation, and the second operand is greater than or equal to the first operand; Based on the first parameter, determining a third operand within a preset time, the third operand being an operand of executing the first operator to perform a second operation within the preset time; Based on the second operand and the third operand, first data and second data of the first operator are determined.

3. The method according to claim 2, characterized in that Determining first data of the first operator based on the second operand and the third operand includes: determining an operation period of the first operator based on the second operand and the third operand; Determining a running time of the first operator according to the first operating frequency and the operating cycle; determining the power of the first operator based on the first operating frequency and a first corresponding relationship, wherein the first corresponding relationship is a relationship between the operating frequency and voltage of the first operator; The first data is determined according to the power of the first operator and the running time.

4. The method according to claim 2, characterized in that: Determining second data of the first operator based on the second operand and the third operand includes: Second data of the first operator is determined based on the first operand, the first utilization rate, the third operand, and the first operating frequency.

5. The method according to claim 1, characterized in that The adjusting the first operating frequency of the chip to the second operating frequency based on the first data and the second data includes: Determining a target state of the chip, and determining a first preset coefficient and a second preset coefficient based on the target state, wherein the target state includes one of a target performance or a target power consumption; Determine a frequency adjustment value of the chip based on the first preset coefficient, the second preset coefficient, the first data, and the second data; The first operating frequency of the chip is adjusted to a second operating frequency by using the frequency adjustment value.

6. The method according to claim 5, characterized in that Determining the target state of the chip includes: Based on the first operator, a target state of the chip is determined.

7. The method according to claim 1, characterized in that The step of adjusting the first operating frequency of the chip to the second operating frequency based on the first data and the second data to determine the first data and the second data of one or more first operators includes: In response to the received frequency adjustment instruction, the first operating frequency of the chip is adjusted to a second operating frequency based on the first data and the second data.

8. A frequency adjustment device, characterized in that: The device is applied to a chip, and the device comprises: a determining unit, configured to determine first data and second data of one or more first operators, wherein the first data at least includes energy required to execute the first operator, and the second data at least includes a delay to execute the first operator; An adjustment unit is used to adjust the first operating frequency of the chip to a second operating frequency based on the first data and the second data.

9. A chip, characterized in that: The method comprises one or more interface circuits and one or more processors; the processor is used to execute the method according to any one of claims 1-7.

10. An electronic device, characterized in that: The electronic device comprises the frequency adjustment device as claimed in claim 8 or the chip as claimed in claim 9.

11. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Dynamic adjustment method and dynamic adjustment coprocessor

    CN109376845A

  • NPU power consumption optimization system and method based on neural network structure

    CN114217688A

  • Operating method of power optimization scheduler and computing apparatus including power optimization scheduler

    US20210247838A1

  • Configuration of operating frequency of chip

    WO2021103618A1

  • Fine-grained stochastic neural architecture search

    WO2021159101A1