TW202121116A - Method and apparatus for setting operating frequency of chip, electronic device, and storage medium - Google Patents

Method and apparatus for setting operating frequency of chip, electronic device, and storage medium Download PDF

Info

Publication number
TW202121116A
TW202121116A TW109127158A TW109127158A TW202121116A TW 202121116 A TW202121116 A TW 202121116A TW 109127158 A TW109127158 A TW 109127158A TW 109127158 A TW109127158 A TW 109127158A TW 202121116 A TW202121116 A TW 202121116A
Authority
TW
Taiwan
Prior art keywords
subtask
frequency
chip
task
data
Prior art date
Application number
TW109127158A
Other languages
Chinese (zh)
Other versions
TWI743934B (en
Inventor
李天健
戴彥
王迎瑞
侯宇樂
楊修齊
Original Assignee
大陸商上海商湯智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 大陸商上海商湯智能科技有限公司 filed Critical 大陸商上海商湯智能科技有限公司
Publication of TW202121116A publication Critical patent/TW202121116A/en
Application granted granted Critical
Publication of TWI743934B publication Critical patent/TWI743934B/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5044Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering hardware capabilities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/324Power saving characterised by the action undertaken by lowering clock frequency
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

Examples of the present disclosure provides a method and apparatus for setting an operating frequency of a chip, an electronic device, and a storage medium. The method includes: obtaining a plurality of subtasks of a target task and a task parameter of each subtask, where the task parameter includes a parameter for representing an operational scale of the subtask; determining a target chip frequency for each subtask based on the task parameter of each subtask of the plurality of subtasks; setting an operating frequency of a chip for performing each subtask based on the determined target chip frequency for each subtask.

Description

晶片工作頻率的設置方法和裝置、電子設備及記錄媒體Method and device for setting chip operating frequency, electronic equipment and recording medium

本發明涉及智慧設備技術,具體涉及晶片工作頻率的設置方法和裝置。The present invention relates to smart device technology, in particular to a method and device for setting the operating frequency of a chip.

隨著5G和人工智慧技術的發展,終端設備(例如,智慧手機,智慧攝像機等)被賦予更多的計算需求,需要執行更多的任務。然而,終端設備中包括的用於計算處理的晶片大多存在功耗限制,不能完全發揮設備的計算峰值能力。降頻是現在晶片防止功耗超標的主要方法之一,降頻技術主要是通過臨時降低晶片的工作頻率(frequency)來減少晶片的功耗。With the development of 5G and artificial intelligence technologies, terminal devices (for example, smart phones, smart cameras, etc.) are given more computing requirements and need to perform more tasks. However, most of the chips used for computing processing included in the terminal equipment have power consumption limitations, and the computing peak capacity of the equipment cannot be fully utilized. Frequency reduction is one of the main methods to prevent the power consumption of the chip from exceeding the standard. The frequency reduction technology mainly reduces the power consumption of the chip by temporarily reducing the working frequency of the chip (frequency).

在一些技術中,可以在終端設備中運行應用程式執行前,設置一個初始工作頻率,晶片以該初始工作頻率運行以執行對應用程式的計算處理。並且,在應用程式的運行過程中,遇到晶片的功耗超標等情況時,對晶片可以採用固定降頻策略,例如,將晶片的工作頻率按照固定的比例降低,或者將其工作頻率降低到一固定的數值。In some technologies, an initial operating frequency can be set before the application program is executed in the terminal device, and the chip runs at the initial operating frequency to perform calculation processing on the application program. In addition, during the operation of the application, when the power consumption of the chip exceeds the standard, a fixed frequency reduction strategy can be adopted for the chip. For example, the working frequency of the chip is reduced by a fixed ratio, or the working frequency is reduced to A fixed value.

本發明實施例至少提供一種晶片工作頻率的設置方法和裝置。The embodiments of the present invention provide at least a method and device for setting the operating frequency of a wafer.

第一方面,提供一種晶片工作頻率的設置方法,該方法包括:獲取目標任務的多個子任務以及每個子任務的任務參數,所述任務參數包括用於表示所述子任務的運算規模的參數;基於所述多個子任務中每個子任務的任務參數,確定所述每個子任務的目標晶片頻率;根據確定的每個子任務的目標晶片頻率,設置晶片執行所述每個子任務的工作頻率。In a first aspect, a method for setting a working frequency of a wafer is provided. The method includes: acquiring a plurality of subtasks of a target task and task parameters of each subtask, the task parameters including parameters used to indicate the operation scale of the subtasks; Based on the task parameters of each subtask in the multiple subtasks, the target wafer frequency of each subtask is determined; according to the determined target wafer frequency of each subtask, the operating frequency of the wafer to execute each subtask is set.

根據本發明的任一實施例,所述方法還包括:對所述目標任務進行任務解析處理,得到所述多個子任務以及每個子任務的任務參數;儲存所述多個子任務中每個子任務與所述每個子任務的任務參數的對應關係;所述獲取目標任務的多個子任務以及每個子任務的任務參數包括:從儲存的所述對應關係中查找每個子任務的任務參數。According to any embodiment of the present invention, the method further includes: performing task analysis processing on the target task to obtain the multiple subtasks and the task parameters of each subtask; storing each subtask and each subtask in the multiple subtasks The corresponding relationship of the task parameters of each subtask; the obtaining the multiple subtasks of the target task and the task parameters of each subtask includes: searching the task parameters of each subtask from the stored corresponding relationships.

根據本發明的任一實施例,所述任務參數包括如下至少一項:所述子任務的計算量、所述子任務的訪存量。According to any embodiment of the present invention, the task parameter includes at least one of the following: a calculation amount of the subtask, and a memory access amount of the subtask.

根據本發明的任一實施例,所述基於所述多個子任務中每個子任務的任務參數,確定所述每個子任務的目標晶片頻率,包括:獲取所述晶片所在設備的設備資訊,所述設備資訊包括設備資源資訊;基於所述設備資訊和所述多個子任務中每個子任務的任務參數,確定所述每個子任務的目標晶片頻率。According to any embodiment of the present invention, the determining the target chip frequency of each subtask based on the task parameters of each subtask of the plurality of subtasks includes: obtaining device information of the device where the chip is located, and The equipment information includes equipment resource information; the target chip frequency of each subtask is determined based on the equipment information and the task parameters of each of the multiple subtasks.

根據本發明的任一實施例,所述設備資源資訊包括以下中的任意一項或多項:計算單元的數量、頻寬、儲存裝置容量。According to any embodiment of the present invention, the equipment resource information includes any one or more of the following: the number of computing units, bandwidth, and storage device capacity.

根據本發明的任一實施例,所述設備資訊還包括:所述晶片的晶片溫度;所述基於所述設備資訊和所述多個子任務中每個子任務的任務參數,確定所述每個子任務的目標晶片頻率,包括:基於所述多個子任務中的第一子任務的任務參數、所述設備資源資訊和所述第一子任務執行時的晶片溫度,確定所述第一子任務的目標晶片頻率。According to any embodiment of the present invention, the device information further includes: the wafer temperature of the wafer; the determining each subtask based on the device information and the task parameter of each subtask of the plurality of subtasks The target chip frequency of includes: determining the target of the first subtask based on the task parameters of the first subtask among the plurality of subtasks, the device resource information, and the chip temperature when the first subtask is executed Chip frequency.

根據本發明的任一實施例,所述基於所述設備資訊和所述多個子任務中每個子任務的任務參數,確定所述每個子任務的目標晶片頻率,包括:獲取多個第一資料和多個第二資料之間的預設映射關係,所述第一資料包括預設任務參數和預設設備資訊,所述第二資料包括預設晶片頻率;根據所述預設映射關係、所述設備資訊以及每個子任務的任務參數,確定所述每個子任務的目標晶片頻率。According to any embodiment of the present invention, the determining the target chip frequency of each subtask based on the device information and the task parameters of each subtask of the plurality of subtasks includes: acquiring a plurality of first data and A preset mapping relationship between a plurality of second data, the first data includes preset task parameters and preset device information, the second data includes a preset chip frequency; according to the preset mapping relationship, the Equipment information and task parameters of each subtask determine the target chip frequency of each subtask.

根據本發明的任一實施例,所述根據所述預設映射關係、所述設備資訊以及每個子任務的任務參數,確定所述每個子任務的目標晶片頻率,包括:確定第三資料與所述預設映射關係中的多個第一資料中每個第一資料之間的距離,所述第三資料包括所述多個子任務中第一子任務的任務參數和設備資訊;將所述預設映射關係中與所述第三資料距離最近的目標第一資料對應的預設晶片頻率,作為所述第一子任務的目標晶片頻率。According to any embodiment of the present invention, the determining the target chip frequency of each subtask according to the preset mapping relationship, the device information and the task parameters of each subtask includes: determining the third data and the task parameters of each subtask. The distance between each of the plurality of first data in the preset mapping relationship, the third data includes task parameters and equipment information of the first subtask among the plurality of subtasks; Let the preset chip frequency corresponding to the target first data closest to the third data in the mapping relationship be the target chip frequency of the first subtask.

根據本發明的任一實施例,所述獲取多個第一資料和多個第二資料之間的預設映射關係之前,所述方法還包括:獲取多組可選晶片頻率,並獲取採樣得到的離散的多個第一資料;對於所述多個第一資料中的每個所述第一資料,由所述多組可選晶片頻率中選擇一組晶片頻率作為與所述每個第一資料對應的第二資料,並建立所述每個第一資料和選擇的所述第二資料之間的映射關係。According to any embodiment of the present invention, before the obtaining the preset mapping relationship between the plurality of first data and the plurality of second data, the method further includes: obtaining a plurality of sets of selectable chip frequencies, and obtaining samples obtained A plurality of discrete first data; for each of the first data in the plurality of first data, a set of chip frequencies is selected from the plurality of sets of optional chip frequencies as the The data corresponds to the second data, and a mapping relationship between each of the first data and the selected second data is established.

根據本發明的任一實施例,所述預設映射關係中與所述第一資料對應的預設晶片頻率是基於在多組可選晶片頻率中每組可選晶片頻率的條件下所述第一資料對應的性能評估參數,從所述多組可選晶片頻率中選擇的。According to any embodiment of the present invention, the preset chip frequency corresponding to the first data in the preset mapping relationship is based on the second chip frequency under the condition of each group of selectable chip frequencies in the multiple sets of selectable chip frequencies. The performance evaluation parameter corresponding to a data is selected from the multiple sets of optional chip frequencies.

根據本發明的任一實施例,所述性能評估參數包括任務處理性能參數和晶片運行功耗;所述預設映射關係中與所述第一資料對應的預設晶片頻率為:所述多組可選晶片頻率中晶片運行功耗低於預設功耗且任務處理性能參數最優的可選晶片頻率。According to any embodiment of the present invention, the performance evaluation parameters include task processing performance parameters and chip operating power consumption; the preset chip frequency corresponding to the first data in the preset mapping relationship is: the multiple groups Among the optional chip frequencies, the chip operating power consumption is lower than the preset power consumption and the optional chip frequency with the best task processing performance parameters.

根據本發明的任一實施例,所述方法還包括:接收用戶輸入的對於所述預設映射關係的配置資訊。According to any embodiment of the present invention, the method further includes: receiving configuration information input by a user for the preset mapping relationship.

根據本發明的任一實施例,所述基於所述多個子任務中每個子任務的任務參數,確定所述每個子任務的目標晶片頻率,包括:基於所述多個子任務中每個子任務對應的任務參數,由多組可選晶片頻率中,選擇能夠使得所述晶片在晶片功耗限制條件下實現任務運行時間最低的晶片頻率,作為所述目標晶片頻率。According to any embodiment of the present invention, the determining the target chip frequency of each subtask based on the task parameters of each subtask in the plurality of subtasks includes: The task parameters are selected from a plurality of groups of selectable chip frequencies, and the chip frequency that enables the chip to achieve the lowest task running time under the limitation of chip power consumption is selected as the target chip frequency.

根據本發明的任一實施例,所述方法還包括:接收用戶輸入的頻率設置策略資訊;所述基於所述多個子任務中每個子任務對應的任務參數,確定所述每個子任務的目標晶片頻率,包括:基於所述頻率設置策略資訊和所述多個子任務中每個子任務的任務參數,確定所述每個子任務的目標晶片頻率。According to any embodiment of the present invention, the method further includes: receiving frequency setting strategy information input by the user; and determining the target chip of each subtask based on the task parameter corresponding to each subtask in the plurality of subtasks The frequency includes: determining the target chip frequency of each subtask based on the frequency setting strategy information and the task parameters of each subtask of the plurality of subtasks.

根據本發明的任一實施例,所述頻率設置策略資訊包括打開或關閉針對子任務的晶片頻率動態設置功能。According to any embodiment of the present invention, the frequency setting strategy information includes enabling or disabling the chip frequency dynamic setting function for subtasks.

根據本發明的任一實施例,所述工作頻率包括如下至少一項:所述晶片的核心頻率、或者儲存裝置頻率。According to any embodiment of the present invention, the operating frequency includes at least one of the following: a core frequency of the chip or a storage device frequency.

第二方面,提供一種晶片工作頻率的設置裝置,所述裝置包括:獲取模組,用於獲取目標任務的多個子任務以及每個子任務的任務參數,所述任務參數包括用於表示所述子任務的運算規模的參數;頻率控制模組,用於基於所述多個子任務中每個子任務的任務參數,確定所述每個子任務的目標晶片頻率;頻率設置模組,用於根據確定的每個子任務的目標晶片頻率,設置晶片執行所述每個子任務的工作頻率。In a second aspect, a device for setting the operating frequency of a chip is provided. The device includes: an acquisition module for acquiring multiple subtasks of a target task and task parameters of each subtask. The task parameters include The parameter of the calculation scale of the task; the frequency control module is used to determine the target chip frequency of each subtask based on the task parameter of each of the multiple subtasks; the frequency setting module is used to determine the frequency of each subtask. The target chip frequency of each subtask, and the working frequency of the chip to execute each subtask.

第三方面,提供一種電子設備,包括:儲存裝置、處理器,所述儲存裝置用於儲存電腦可讀指令,所述處理器用於調用所述電腦可讀指令,實現本發明第一方面所述的方法。In a third aspect, an electronic device is provided, including: a storage device and a processor, the storage device is used to store computer-readable instructions, and the processor is used to call the computer-readable instructions to implement the first aspect of the present invention Methods.

根據本發明的任一實施例,所述設備還包括:晶片,用於基於所述處理器設置的工作頻率對目標任務中的每個子任務進行處理。According to any one of the embodiments of the present invention, the device further includes: a chip for processing each subtask in the target task based on the operating frequency set by the processor.

第四方面,提供一種電腦可讀取記錄媒體,其上儲存有電腦程式,所述電腦程式被處理器執行時,促使所述處理器實現本發明第一方面所述的方法。In a fourth aspect, there is provided a computer-readable recording medium on which a computer program is stored. When the computer program is executed by a processor, the processor is prompted to implement the method described in the first aspect of the present invention.

本發明實施例提供的晶片工作頻率的設置方法和裝置,基於目標任務中的每個子任務的任務參數確定與該子任務的目標晶片頻率,能夠使得晶片在執行該每個子任務時以該子任務的目標晶片頻率運行,這種精細化的頻率設置方式能夠使得執行各個子任務時都盡可能的實現最優的運行性能,從而提高整個任務的運行速度。The method and device for setting the working frequency of a chip provided by the embodiment of the present invention determine the target chip frequency of each subtask in the target task based on the task parameters of the subtask, so that the chip can use the subtask when executing each subtask. The target chip frequency is running. This refined frequency setting method can achieve the best operating performance as much as possible when executing each subtask, thereby increasing the running speed of the entire task.

為了使本技術領域的人員更好地理解本發明一個或多個實施例中的技術方案,下面將結合本發明一個或多個實施例中的附圖,對本發明一個或多個實施例中的技術方案進行清楚、完整地描述,顯然,所描述的實施例僅僅是本發明一部分實施例,而不是全部的實施例。基於本發明一個或多個實施例,本領域通常知識者在沒有作出進步性勞動前提下所獲得的所有其他實施例,都應當屬於本發明保護的範圍。In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of the present invention, in the following, in conjunction with the drawings in one or more embodiments of the present invention, a comparison of the technical solutions in one or more embodiments of the present invention The technical solution is described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on one or more embodiments of the present invention, all other embodiments obtained by those skilled in the art without making progressive work shall fall within the protection scope of the present invention.

本發明實施例提供一種對終端設備中的晶片的工作頻率進行設置的方法,該方法旨在使得晶片以該設置的工作頻率運行時,設備的運行性能較好,例如,設備上運行的任務能夠以更快的速度處理完成。其中,該晶片可以為人工智慧(Artificial Intelligence,AI)晶片,例如,在智慧手機上應用的AI晶片,在自動駕駛汽車上使用的AI晶片,在物聯網的邊緣設備上使用的AI晶片,等等。也可以為其他類型的晶片,例如CPU(Central Processing Unit)晶片、DSP(Digital Signal Processing)、記憶體晶片等等,本發明實施例對此不做限定。The embodiment of the present invention provides a method for setting the operating frequency of a chip in a terminal device. The method aims to make the operating performance of the device better when the chip runs at the set operating frequency. For example, tasks running on the device can be Processing is completed at a faster speed. Among them, the chip can be an artificial intelligence (AI) chip, for example, an AI chip used in a smart phone, an AI chip used in an autonomous vehicle, an AI chip used in edge devices of the Internet of Things, etc. Wait. It may also be other types of chips, such as a CPU (Central Processing Unit) chip, a DSP (Digital Signal Processing), a memory chip, etc., which are not limited in the embodiment of the present invention.

圖1繪示了本發明一些實施例提供的晶片工作頻率的設置方法的流程圖,如圖1所示,該方法可以包括如下處理。FIG. 1 shows a flowchart of a method for setting the operating frequency of a wafer according to some embodiments of the present invention. As shown in FIG. 1, the method may include the following processing.

在步驟100中,獲取目標任務的多個子任務以及每個子任務的任務參數,所述任務參數包括用於表示所述子任務的運算規模的參數。In step 100, a plurality of subtasks of the target task and task parameters of each subtask are acquired, the task parameters including parameters used to indicate the operation scale of the subtasks.

本步驟中,所述的目標任務可以是在設備上要執行和處理的任務。例如,該任務可以是深度學習模型的訓練任務,或者一個神經網路模型的推理任務,或者,運行一個應用程式等。所述目標任務的執行需要使用到該設備上的晶片,由晶片負責任務執行過程中的計算等部分或全部處理工作。In this step, the target task may be a task to be executed and processed on the device. For example, the task may be a training task of a deep learning model, or an inference task of a neural network model, or running an application program, etc. The execution of the target task requires the use of the chip on the device, and the chip is responsible for part or all of the processing work such as calculations during the execution of the task.

所述的子任務,可以是目標任務中包括的一個相對獨立的執行單元。例如,目標任務中可以包括多個函數,可以根據函數進行劃分,每個函數作為目標任務中一個獨立的子任務。又例如,也可以將任務程式碼劃分為多個程式碼區塊並根據程式碼區塊劃分子任務,每段程式碼是相對完整的。比如,一個相對完整或獨立的程式碼區塊作為一個子任務。再例如,當目標任務是神經網路模型的訓練或推理任務時,該神經網路模型的每一層或多層可以看作一個子任務;或者,也可以是將每一層的實現過程的程式碼段作為一個子任務。再例如,也可以將多個功能模組中的一個或至少兩個功能模組作為一個子任務,等等。The subtask may be a relatively independent execution unit included in the target task. For example, the target task can include multiple functions, which can be divided according to functions, and each function is used as an independent subtask in the target task. For another example, the task code can also be divided into multiple code blocks and subtasks are divided according to the code blocks, and each piece of code is relatively complete. For example, a relatively complete or independent code block as a subtask. For another example, when the target task is the training or inference task of a neural network model, each layer or layers of the neural network model can be regarded as a subtask; or, it can also be the code segment of the realization process of each layer As a subtask. For another example, one or at least two of the multiple functional modules can also be used as a subtask, and so on.

本發明實施例不限制子任務的劃分方式,可以有多種子任務的劃分方式,比如上述提到的以函數為單位,以程式碼區塊為單位,以網路層或算子為單位,或者以功能模組為單位,等等,需要注意的是,儘管將目標任務劃分成多個子任務可以達到精細粒度的頻率設置,提高設備運行性能,但是過多的子任務數量有可能會造成較為頻繁的頻率設置,對設備運行性能有一定影響,因此,可以平衡子任務數量的設置,比如,目標任務包括的循環體的內部儘量不要再劃分成子任務,以減少頻率設置的次數,等等,具體設置可以基於實際需求進行,這裡不再贅述。The embodiment of the present invention does not limit the division of subtasks, and there may be multiple divisions of subtasks, such as the above-mentioned function as a unit, a code block as a unit, a network layer or an operator as a unit, or Take functional modules as the unit, etc. It should be noted that although dividing the target task into multiple sub-tasks can achieve fine-grained frequency settings and improve equipment operating performance, too many sub-tasks may cause more frequent The frequency setting has a certain impact on the performance of the device. Therefore, you can balance the setting of the number of subtasks. For example, try not to divide the inside of the loop body included in the target task into subtasks to reduce the number of frequency settings, etc., specific settings It can be done based on actual needs, so I won’t go into details here.

在本發明實施例中,子任務的任務參數,可以包括用於表示子任務的運算規模的參數,例如可以包括用於指示子任務需要占用的一種或多種資源的參數。作為一個例子,該任務參數可以包括但不限於如下至少一項:子任務的計算量、訪存量(訪存量即在子任務執行時晶片要存取儲存裝置的次數和/或存取資料的總量),或者還可以包括其他類型的任務參數,本發明實施例對此不做限定。In the embodiment of the present invention, the task parameter of the subtask may include a parameter used to indicate the calculation scale of the subtask, for example, may include a parameter used to indicate one or more resources that the subtask needs to occupy. As an example, the task parameters may include, but are not limited to, at least one of the following: calculation amount of subtasks, memory access amount (memory access amount is the number of times the chip needs to access the storage device and/or the total amount of data accessed during the execution of the subtask. Quantities), or other types of task parameters may also be included, which is not limited in the embodiment of the present invention.

在本發明實施例中,可以通過多種方式獲取子任務的任務參數。例如,從其他設備或從系統中的其他功能模組獲取子任務的任務參數,或者,從本地儲存裝置獲取子任務的任務參數,或者,通過對目標任務進行任務解析,得到各個子任務的任務參數,等等。In the embodiment of the present invention, the task parameters of the subtasks can be obtained in a variety of ways. For example, obtain task parameters of subtasks from other equipment or from other functional modules in the system, or obtain task parameters of subtasks from local storage devices, or obtain the task of each subtask by analyzing the target task. Parameters, etc.

在一些實施例中,為了更快速地獲取到該任務參數,可以將各個子任務與各自的任務參數的對應關係進行預先儲存。示例性的,可以預先對目標任務進行任務解析處理,得到該目標任務包括的多個子任務以及每個子任務的任務參數,並將該每個子任務及其任務參數進行儲存。這樣後續在目標任務需要運行時可以根據儲存的資訊快速的查找到每個子任務的任務參數。在一些例子中,所述子任務與任務參數之間的對應關係可以通過key-value的形式儲存,例如,可以為多個子任務分別設置對應的任務標識,並將子任務的任務標識儲存為key,將該子任務的任務參數儲存為value。key-value形式的儲存方式,適合通過主鍵進行查詢,查詢速度快,存放資料量大。但本發明不限於此。In some embodiments, in order to obtain the task parameter more quickly, the correspondence between each subtask and the respective task parameter may be stored in advance. Exemplarily, task analysis processing may be performed on the target task in advance to obtain multiple subtasks included in the target task and task parameters of each subtask, and each subtask and its task parameters are stored. In this way, when the target task needs to run, the task parameters of each subtask can be quickly found based on the stored information. In some examples, the correspondence between the subtasks and task parameters can be stored in the form of key-value. For example, corresponding task identifiers can be set for multiple subtasks, and the task identifiers of the subtasks can be stored as keys , Save the task parameter of this subtask as value. The key-value storage method is suitable for querying through the primary key, with fast query speed and large amount of stored data. However, the present invention is not limited to this.

在一些實施例中,在獲取每個子任務的任務參數之外,還可進一步獲取晶片所在設備的設備資訊,並依據該設備資訊和任務參數共同確定每個子任務的目標晶片頻率。In some embodiments, in addition to obtaining the task parameters of each subtask, the device information of the device where the chip is located can be further obtained, and the target chip frequency of each subtask can be jointly determined based on the device information and task parameters.

其中,上述的設備資訊可以包括晶片所在設備的設備資源資訊,該設備資源資訊用於指示該設備的可用資源的資訊,作為一個例子,該設備資源資訊可以包括但不限於如下的任意一項或多項設備資源資訊:計算單元的數量、頻寬、儲存裝置容量等。在一些實施例中,每個子任務的目標晶片頻率還可以依賴於多個子任務之間的依賴關係或任務執行方式,例如序列、並列、或者部分子任務之間序列且部分子任務之間並列等。例如,如果目標任務劃分得到的各個子任務的執行是序列關係,那麼晶片在執行每個子任務時都可以占用該設備上的所有可用設備資源,比如占用設備上的所有計算單元和所有頻寬,等等,但本發明實施例不限於此。Among them, the above-mentioned equipment information may include equipment resource information of the equipment where the chip is located. The equipment resource information is used to indicate information about the available resources of the equipment. As an example, the equipment resource information may include, but is not limited to, any of the following or Multiple equipment resource information: the number of computing units, bandwidth, storage capacity, etc. In some embodiments, the target chip frequency of each subtask may also depend on the dependency between multiple subtasks or the task execution mode, such as sequence, parallel, or sequence between partial subtasks and parallel between partial subtasks, etc. . For example, if the execution of each subtask obtained by the division of the target task is in a sequence relationship, then the chip can occupy all available device resources on the device when executing each subtask, such as occupying all computing units and all bandwidth on the device. And so on, but the embodiment of the present invention is not limited thereto.

在步驟102中,基於所述多個子任務中每個子任務的任務參數,確定所述每個子任務的目標晶片頻率。In step 102, the target wafer frequency of each subtask is determined based on the task parameter of each subtask in the plurality of subtasks.

本步驟中,可以根據每個子任務的任務參數確定該子任務的目標晶片頻率。或者,可以基於晶片所在設備的設備資訊和每個子任務的任務參數,共同確定所述每個子任務的目標晶片頻率。In this step, the target chip frequency of each subtask can be determined according to the task parameters of the subtask. Alternatively, the target chip frequency of each subtask may be jointly determined based on the device information of the device where the chip is located and the task parameters of each subtask.

在一些實施例中,可以確定多組可選晶片頻率,並基於一定策略從該多組可選晶片頻率中為每個子任務選取對應的可選晶片頻率。其中,所述的多組可選晶片頻率是設備中的晶片可以設置的特定數量的離散的頻率。例如,以設置晶片的核心頻率為例,該核心頻率可以包括x1、x2….xm等m種頻率值。上述策略可以基於實際需求進行設置,下面將描述幾種示例性策略,但本發明實施例不限於此。In some embodiments, multiple sets of optional chip frequencies may be determined, and a corresponding optional chip frequency can be selected for each subtask from the multiple sets of optional chip frequencies based on a certain strategy. Wherein, the multiple sets of selectable chip frequencies are a specific number of discrete frequencies that can be set for the chips in the device. For example, taking the core frequency of the chip as an example, the core frequency may include m frequency values such as x1, x2...xm. The aforementioned strategies can be set based on actual needs. Several exemplary strategies will be described below, but the embodiments of the present invention are not limited thereto.

在一些實施例中,可以將所述目標晶片頻率的確定轉化為一個最優化問題,在一些可選實現方式中,可以將任務運行時間作為選擇的主要參考因素,作為一個例子,可以基於每個子任務的任務參數,在可被設置的多組可選晶片頻率中,選擇能夠使得所述晶片在晶片功耗限制條件下實現任務運行時間最低的晶片頻率,作為所述每個子任務的目標晶片頻率。其中,在一些例子中,可以將多個子任務作為一個整體進行分析,來確定目標任務的總體任務運行時間,此時,在確定最短的任務運行時間的條件下,可以同時得到多個子任務中每個子任務的目標晶片頻率。或者,在另一些例子中,可以單獨分析每個子任務的任務運行時間,並基於每個子任務的最短的任務運行時間作為條件來確定該子任務的目標晶片頻率,等等。在另一些可選實現方式中,也可以將任務消耗的系統資源、晶片運行功耗、任務運行速度、任務執行結果的精度等一種或任意多種作為選擇的參考因素,本發明實施例對此不做限定。In some embodiments, the determination of the target chip frequency can be transformed into an optimization problem. In some alternative implementations, task running time can be used as the main reference factor for selection. As an example, it can be based on each sub The task parameters of the task, among the multiple sets of optional chip frequencies that can be set, select the chip frequency that enables the chip to achieve the lowest task running time under the limit of chip power consumption, as the target chip frequency of each subtask . Among them, in some examples, multiple subtasks can be analyzed as a whole to determine the overall task running time of the target task. At this time, under the condition of determining the shortest task running time, each of the multiple subtasks can be obtained at the same time. The target chip frequency for each subtask. Or, in other examples, the task running time of each subtask can be analyzed separately, and the target chip frequency of the subtask can be determined based on the shortest task running time of each subtask as a condition, and so on. In other optional implementation manners, one or any of the system resources consumed by the task, the power consumption of the chip, the running speed of the task, the accuracy of the task execution result, etc. can also be selected as reference factors. This embodiment of the present invention does not Make a limit.

下面以根據子任務的任務參數和設備資訊來確定目標晶片頻率為例,示例一種最優化問題的求解原理。以其中一個子任務為例,該子任務的任務參數是

Figure 02_image001
(n表示n維空間,如訪存量,計算量等),該子任務對應的設備資訊是
Figure 02_image003
(m表示m維空間,比如儲存裝置容量等),並假設晶片頻率是x,其中,該頻率可以為核心頻率、儲存裝置頻率、或是核心頻率與儲存裝置頻率的頻率組合。
Figure 02_image005
表示晶片運行功耗,可以看到,該晶片運行功耗與任務參數、設備資訊和晶片頻率有關,即使固定任務參數和設備資訊,晶片頻率變化時P也會隨之變化。
Figure 02_image007
表示任務運行時間,同理,即使固定任務參數和設備資訊,晶片頻率變化時T也會隨之變化。那麼可將上述子任務的任務參數和設備資訊分別與多種晶片頻率組合,得到對應的晶片運行功耗和任務運行時間,並基於晶片運行功耗和任務運行時間來從多種晶片頻率中選擇每個子任務的最優晶片頻率。The following is an example of determining the target chip frequency based on the task parameters and equipment information of the subtasks to illustrate the principle of solving an optimization problem. Take one of the subtasks as an example, the task parameter of the subtask is
Figure 02_image001
(N represents n-dimensional space, such as the amount of memory access, the amount of calculation, etc.), the device information corresponding to the subtask is
Figure 02_image003
(M represents m-dimensional space, such as storage device capacity, etc.), and assume that the chip frequency is x, where the frequency can be a core frequency, a storage device frequency, or a combination of core frequency and storage device frequency.
Figure 02_image005
Indicates the operating power consumption of the chip. It can be seen that the operating power consumption of the chip is related to task parameters, device information and chip frequency. Even if the task parameters and device information are fixed, P will change when the chip frequency changes.
Figure 02_image007
Represents the task running time. Similarly, even if the task parameters and equipment information are fixed, T will change when the chip frequency changes. Then the task parameters and equipment information of the above subtasks can be combined with multiple chip frequencies to obtain the corresponding chip operating power consumption and task operating time, and based on the chip operating power consumption and task operating time, each sub-task can be selected from multiple chip frequencies. The optimal chip frequency for the task.

例如,可以按照如下的公式(1)選擇最優的晶片頻率:

Figure 02_image009
…….(1)For example, the optimal chip frequency can be selected according to the following formula (1):
Figure 02_image009
…….(1)

上述公式(1)表示:在晶片功耗限制條件(不超過PowerLimited )下實現任務運行時間最低,這就是最優化問題的優化目標。以該優化目標尋找最優的晶片頻率,在晶片可以設置的多個可選晶片頻率中,若採用某一晶片頻率,使得在晶片功耗限制條件下以最短的任務運行時間處理完該子任務,則該晶片頻率就是該子任務的目標晶片頻率。The above formula (1) indicates: the lowest task running time is achieved under the condition of chip power consumption (not exceeding Power Limited ), which is the optimization goal of the optimization problem. Find the optimal chip frequency with this optimization goal. Among the multiple optional chip frequencies that the chip can set, if a certain chip frequency is used, the subtask can be processed with the shortest task running time under the condition of chip power consumption. , The chip frequency is the target chip frequency of the subtask.

由於每個子任務的任務參數和設備資訊中的至少一個參數可以是不同的,所以各個子任務的目標晶片頻率也可能不同。本步驟可以尋找到最匹配各個子任務的目標晶片頻率,使得子任務以最快的速度完成且晶片不會功耗超標。Since at least one parameter in the task parameter and the device information of each subtask may be different, the target chip frequency of each subtask may also be different. In this step, the target chip frequency that best matches each subtask can be found, so that the subtask is completed at the fastest speed and the chip does not exceed the power consumption.

在步驟104中,根據確定的每個子任務的目標晶片頻率,設置晶片執行所述每個子任務時的工作頻率。In step 104, according to the determined target wafer frequency of each subtask, the operating frequency of the wafer when each subtask is executed is set.

本步驟中,在目標任務的運行過程中,當運行到其中一個子任務時,可以將晶片的頻率設置為該子任務的目標晶片頻率,或者,可以基於該目標晶片頻率與設備或晶片在執行該子任務時的當前狀態資訊,例如,設備或晶片在晶片開始執行該子任務時的狀態資訊,如晶片溫度,來設置晶片執行該子任務時的工作頻率。其中,在一些實施例中,上述確定目標晶片頻率的過程可以在執行目標任務之前預先統一執行,並且儲存多個子任務中每個子任務的目標晶片頻率,然後,在運行每個子任務的過程中,將晶片的頻率設置為該子任務的目標晶片頻率。在另一些實施例中,也可以在執行每個子任務之前,確定該子任務的目標晶片頻率,例如,可以基於子任務的任務參數與設備或晶片的當前狀態資訊,確定該子任務的目標晶片頻率,此時,各個子任務的目標晶片頻率的確定可以是在不同時間分別執行的,本發明實施例對此不做限定。In this step, during the running process of the target task, when one of the subtasks is run, the chip frequency can be set as the target chip frequency of the subtask, or it can be based on the target chip frequency and the device or chip executing The current status information of the subtask, for example, the status information of the device or the chip when the chip starts to execute the subtask, such as the temperature of the chip, is used to set the operating frequency of the chip when the subtask is executed. Among them, in some embodiments, the above process of determining the target chip frequency may be performed uniformly before executing the target task, and the target chip frequency of each of the multiple subtasks is stored, and then, in the process of running each subtask, Set the wafer frequency to the target wafer frequency of this subtask. In other embodiments, before each subtask is executed, the target chip frequency of the subtask may be determined. For example, the target chip of the subtask may be determined based on the task parameters of the subtask and the current state information of the device or chip. Frequency. At this time, the determination of the target chip frequency of each subtask may be performed at different times, which is not limited in the embodiment of the present invention.

在本發明實施例中,所述的晶片的工作頻率可以包括如下至少一項:所述晶片的核心頻率、或者儲存裝置頻率。比如,可以通過本發明實施例的方法只用於設置晶片的核心頻率,其中,儲存裝置頻率可以設置為固定值或者以目標任務為單位進行設置,或者該方法只用於設置儲存裝置頻率,其中,核心頻率可以設置為固定值或以目標任務為單位進行設置,或者該方法用於設置晶片的核心頻率和儲存裝置頻率,例如將核心頻率和儲存裝置頻率作為一個頻率組合進行設置,每一個子任務的目標晶片頻率是該頻率組合。In the embodiment of the present invention, the operating frequency of the chip may include at least one of the following: the core frequency of the chip or the frequency of the storage device. For example, the method of the embodiment of the present invention can be used only to set the core frequency of the chip, where the storage device frequency can be set to a fixed value or set in the unit of the target task, or the method is only used to set the storage device frequency, where , The core frequency can be set to a fixed value or set in the unit of the target task, or this method is used to set the core frequency of the chip and the storage device frequency, for example, the core frequency and the storage device frequency are set as a frequency combination. The target chip frequency of the task is this frequency combination.

其中,儲存裝置的頻率可以為揮發性記憶體的頻率,如SDRAM(Synchronous Dynamic Random Access Memory,同步動態隨機存取記憶體)的頻率。例如,DDR SDRAM(Double Data Rate SDRAM,雙倍速率SDRAM)、DDR2 SDRAM、DDR3 SDRAM、DDR4 SDRAM、DDR5 SDRAM等等。儲存裝置的頻率也可以是非揮發性記憶體的頻率,如快閃記憶體(flash memory)的頻率。The frequency of the storage device may be the frequency of a volatile memory, such as the frequency of SDRAM (Synchronous Dynamic Random Access Memory). For example, DDR SDRAM (Double Data Rate SDRAM), DDR2 SDRAM, DDR3 SDRAM, DDR4 SDRAM, DDR5 SDRAM, and so on. The frequency of the storage device may also be the frequency of a non-volatile memory, such as the frequency of a flash memory.

本發明實施例的晶片工作頻率的設置方法,基於目標任務中的每個子任務的任務參數確定與該子任務的目標晶片頻率,能夠使得晶片在執行該每個子任務時以該子任務的目標晶片頻率運行,這種精細化的頻率設置方式能夠使得執行各個子任務時都盡可能的實現最優的運行性能,從而提高整個任務的運行速度。In the method for setting the working frequency of the chip in the embodiment of the present invention, the target chip frequency of each subtask is determined based on the task parameters of each subtask in the target task, so that the chip can use the target chip of the subtask when executing each subtask. Frequency operation. This refined frequency setting method can achieve the optimal operating performance as much as possible when executing each subtask, thereby increasing the operating speed of the entire task.

圖2繪示了本發明一些實施例提供的晶片工作頻率的設置方法的另一流程圖,該方法以根據子任務的任務參數和設備資訊來共同確定的目標晶片頻率為例,示例性地給出了一種確定目標晶片頻率的方式。如圖2所示,該方法可以包括如下處理,其中,與圖1相同的步驟將不再詳述。Figure 2 shows another flow chart of the method for setting the working frequency of the chip provided by some embodiments of the present invention. The method takes the target chip frequency jointly determined according to the task parameters and device information of the subtasks as an example. A way to determine the frequency of the target wafer is presented. As shown in FIG. 2, the method may include the following processing, wherein the same steps as those in FIG. 1 will not be described in detail.

在步驟200中,對設備上待運行的目標任務進行任務解析,得到多個子任務以及每個所述子任務的任務參數。例如,每個子任務的任務參數可以包括如下至少一項:該子任務的計算量和訪存量。In step 200, task analysis is performed on the target task to be run on the device to obtain multiple subtasks and task parameters of each of the subtasks. For example, the task parameter of each subtask may include at least one of the following: the calculation amount and the memory access amount of the subtask.

在步驟202中,獲取晶片所在設備的設備資訊。In step 202, the device information of the device where the chip is located is obtained.

例如,所述的晶片所在設備的設備資訊可以包括設備資源資訊,該設備資源資訊可以包括如下至少一項:頻寬、計算單元的數量和儲存裝置容量等。For example, the device information of the device where the chip is located may include device resource information, and the device resource information may include at least one of the following: bandwidth, number of computing units, and storage device capacity.

在步驟204中,獲取多個第一資料和多個第二資料之間的預設映射關係。In step 204, a preset mapping relationship between a plurality of first data and a plurality of second data is acquired.

本步驟中,設備可以預先儲存有多個第一資料和多個第二資料之間的映射關係,其中的第一資料包括子任務的預設任務參數和預設設備資訊,第二資料包括預設晶片頻率。例如,該預設晶片頻率可以是晶片的核心頻率。又例如,該預設晶片頻率可以是晶片的核心頻率和儲存裝置頻率的組合。In this step, the device may pre-store the mapping relationship between multiple first data and multiple second data, where the first data includes the preset task parameters of the subtask and the preset device information, and the second data includes the preset information. Set the chip frequency. For example, the predetermined chip frequency may be the core frequency of the chip. For another example, the predetermined chip frequency may be a combination of the core frequency of the chip and the frequency of the storage device.

例如,如下的表1示例了多個第一資料和多個第二資料的預設映射關係:For example, the following Table 1 illustrates the preset mapping relationship between multiple first data and multiple second data:

表1   映射關係示例 第一資料 第二資料 預設任務參數 預設設備資訊 預設晶片頻率 k1 d1 x1 k2 d2 x2 …… …… …… Table 1 Example of mapping relationship First data Second data Preset task parameters Default device information Default chip frequency k1 d1 x1 k2 d2 x2 ... ... ...

如下示例性說明如何建立上述的映射關係。The following example illustrates how to establish the above-mentioned mapping relationship.

假設不論設備上執行何種任務,任務參數和設備資訊的取值都會在一定的範圍內,比如,任務參數的取值在範圍F1內,設備資訊的取值在範圍F2內。該F1和F2都可以稱為預設的第一資料取值範圍。那麼,可以在該第一資料取值範圍內採樣,得到一些離散的採樣點,即得到多組第一資料,例如,(k1,d1)、(k2,d2)、(k3,d3)等,其中的k1,k2,k3表示任務參數,d1,d2和d3表示設備資訊。此外,假設要設置的晶片頻率是核心頻率,可以包括晶片可能設置的多組可選晶片頻率,例如,x1,x2,x3等。Assume that no matter what task is executed on the device, the values of the task parameters and device information will be within a certain range. For example, the value of the task parameter is within the range F1, and the value of the device information is within the range F2. Both F1 and F2 can be referred to as the preset value range of the first data. Then, you can sample within the value range of the first data to get some discrete sampling points, that is, to get multiple sets of first data, for example, (k1, d1), (k2, d2), (k3, d3), etc., Among them, k1, k2, and k3 represent task parameters, and d1, d2, and d3 represent device information. In addition, assuming that the chip frequency to be set is the core frequency, it may include multiple sets of optional chip frequencies that the chip may set, for example, x1, x2, x3, etc.

具體地,對於其中的每一組第一資料,可以由上述的多組可選晶片頻率中選擇一組晶片頻率作為與該第一資料對應的第二資料,並建立該第一資料和第二資料之間的映射關係。其中,在一些實施例中,在從多組可選晶片頻率中選擇第二資料時,可以是依據性能評估參數來選擇。例如,可以分別確定該第一資料在每組可選晶片頻率的條件下的性能評估參數,比如根據該第一資料與其中一組可選晶片頻率得到一個性能評估參數;根據該第一資料與另一組可選晶片頻率得到另一個性能評估參數,其中,該性能評估參數可以通過模擬、推理、或數學公式運算的方式得到,本發明實施例對此不做限定。Specifically, for each set of the first data, a set of chip frequencies can be selected from the above-mentioned multiple sets of optional chip frequencies as the second data corresponding to the first data, and the first data and the second data can be created. The mapping relationship between the data. Among them, in some embodiments, when selecting the second data from multiple sets of optional chip frequencies, the selection may be based on performance evaluation parameters. For example, the performance evaluation parameters of the first data under the condition of each group of optional chip frequencies can be determined separately, for example, a performance evaluation parameter can be obtained according to the first data and one group of optional chip frequencies; according to the first data and Another set of selectable chip frequencies obtains another performance evaluation parameter, where the performance evaluation parameter can be obtained through simulation, inference, or mathematical formula operation, which is not limited in the embodiment of the present invention.

在分別得到該第一資料在各組可選晶片頻率的條件下對應的性能評估參數後,可以根據該性能評估參數從所述多組可選晶片頻率中選擇一組晶片頻率作為該第一資料對應的第二資料。例如,該性能評估參數可以包括任務處理性能參數和晶片運行功耗,可以將上述多組可選晶片頻率中晶片運行功耗低於預設功耗且任務處理性能參數最優的可選晶片頻率作為該第一資料對應的第二資料。示例性的,上述的任務處理性能參數包括但不限於任務處理時間。After obtaining the corresponding performance evaluation parameters of the first data under the conditions of each set of optional chip frequencies, a group of chip frequencies can be selected from the multiple sets of optional chip frequencies as the first data according to the performance evaluation parameters The corresponding second data. For example, the performance evaluation parameters may include task processing performance parameters and chip operating power consumption. Among the multiple sets of optional chip frequencies, the chip operating power consumption can be lower than the preset power consumption and the optional chip frequency with the best task processing performance parameters. As the second data corresponding to the first data. Exemplarily, the aforementioned task processing performance parameters include but are not limited to task processing time.

圖3繪示了本發明一些實施例提供的預設映射關係的建立過程的另一流程圖。如下通過圖3,示例一種預設映射關係的建立過程,並且,在該示例描述中,以任務處理性能參數是任務運行時間,晶片頻率是核心頻率為例進行說明。FIG. 3 shows another flowchart of the process of establishing a preset mapping relationship provided by some embodiments of the present invention. As shown in FIG. 3, an example of a process of establishing a preset mapping relationship is illustrated, and in this example description, the task processing performance parameter is the task running time and the chip frequency is the core frequency as an example.

在步驟2041中,遍歷所述多組可選晶片頻率,分別根據每組可選晶片頻率與某一組第一資料得到在所述每組可選晶片頻率和該第一資料的條件下運行時的晶片運行功耗和任務運行時間。In step 2041, traverse the multiple sets of optional chip frequencies, and obtain the operating time under the conditions of each set of optional chip frequencies and the first data according to each set of optional chip frequencies and a certain set of first data. The operating power consumption and task running time of the chip.

例如,假設晶片有十組可選晶片頻率,針對一組第一資料,可以分別結合該十組晶片頻率,得到十個晶片運行功耗P和十個任務運行時間T。比如,當晶片頻率是x1時,對應的該子任務的晶片運行功耗是P1,任務運行時間是T1;當晶片頻率是x2時,對應的該子任務的晶片運行功耗是P2,任務運行時間是T2。For example, assuming that the chip has ten sets of optional chip frequencies, for a set of first data, the ten sets of chip frequencies can be combined respectively to obtain ten chip operating power consumption P and ten task operating time T. For example, when the chip frequency is x1, the corresponding chip operating power consumption of the subtask is P1, and the task running time is T1; when the chip frequency is x2, the corresponding chip operating power consumption of the subtask is P2, and the task is running Time is T2.

在一些實施例中,可以根據功耗模型確定P,根據運行時間模型確定T。其中,功耗模型的模型輸入是任務參數、設備資訊和晶片頻率,模型輸出是P。運行時間模型的模型輸入是任務參數、設備資訊和晶片頻率,模型輸出T。In some embodiments, P may be determined according to the power consumption model, and T may be determined according to the runtime model. Among them, the model input of the power consumption model is task parameters, equipment information and chip frequency, and the model output is P. The model inputs of the runtime model are task parameters, equipment information, and chip frequency, and the model outputs T.

上述的功耗模型和運行時間模型的具體結構可以通過多種方式得到,例如,支持向量機、反饋神經網路、K-means聚合算法等。The specific structure of the above-mentioned power consumption model and runtime model can be obtained in a variety of ways, for example, a support vector machine, a feedback neural network, a K-means aggregation algorithm, and so on.

下面以功耗模型和運行時間模型都是神經網路模型為例進行說明,該神經網路模型可以通過模型訓練的方式得到。其中,訓練樣本集可以給定固定的任務列表

Figure 02_image011
,設備的頻率集合為
Figure 02_image013
,這些集合作為神經網路模型的訓練集。比如,對於某一任務
Figure 02_image015
,可以得到該任務的任務參數,並獲取該設備的設備資訊,再由上述設備頻率集合中取一個頻率
Figure 02_image017
,三者作為功耗模型的輸入,經過功耗模型的處理後輸出晶片運行功耗的預測值。該預測值與設備在輸入的任務參數、設備資訊和頻率
Figure 02_image017
條件下的晶片運行功耗的真實值(真實設備運行的結果)之間具有差異,根據該差異進行反向傳播,訓練該功耗模型。同理,運行時間模型也可以按照上述方式訓練,只是將輸出改為任務運行時間,在此不再詳述。In the following, both the power consumption model and the runtime model are neural network models as an example for illustration, and the neural network model can be obtained through model training. Among them, the training sample set can be given a fixed task list
Figure 02_image011
, The frequency set of the device is
Figure 02_image013
, These sets are used as the training set of the neural network model. For example, for a task
Figure 02_image015
, The task parameters of the task can be obtained, and the device information of the device can be obtained, and then a frequency can be selected from the above-mentioned device frequency set
Figure 02_image017
, The three are used as the input of the power consumption model, and the predicted value of the operating power consumption of the chip is output after the processing of the power consumption model. The predicted value and the task parameters, equipment information and frequency input by the equipment
Figure 02_image017
There is a difference between the real values of the operating power consumption of the chip under the conditions (the result of the operation of the real device), and back-propagation is performed according to the difference, and the power consumption model is trained. In the same way, the runtime model can also be trained in the above manner, but the output is changed to the task runtime, which will not be described in detail here.

在得到訓練完成的功耗模型和運行時間模型後,向功耗模型輸入第一資料和晶片頻率,就可以得到晶片運行功耗。如,向功耗模型輸入第一資料(k1,d1)和晶片頻率xi,就可以得到晶片運行功耗Pi。向運行時間模型輸入第一資料和晶片頻率,就可以得到任務運行時間。如,向運行時間模型輸入第一資料(k1,d1)和晶片頻率xi,就可以得到任務運行時間Ti。After obtaining the trained power consumption model and the running time model, input the first data and the chip frequency to the power consumption model to obtain the running power consumption of the chip. For example, by inputting the first data (k1, d1) and the chip frequency xi into the power consumption model, the chip's operating power consumption Pi can be obtained. Input the first data and chip frequency to the runtime model to get the task runtime. For example, by inputting the first data (k1, d1) and the chip frequency xi into the runtime model, the task runtime Ti can be obtained.

在步驟2042中,選擇確定晶片運行功耗和任務運行時間最優的晶片頻率,作為該第一資料對應的第二資料。In step 2042, the chip frequency that determines the optimal chip running power consumption and task running time is selected as the second data corresponding to the first data.

本步驟中,例如可以根據公式(1)的最優晶片頻率的選擇條件,在多組晶片頻率中,選擇在晶片運行功耗的限制範圍內任務運行時間最低的晶片頻率作為第二資料。例如,在滿足Pi≤PowerLimited 的所有晶片頻率xi中,選擇Ti最小的晶片頻率,如x1,作為第一資料(k1,d1)對應的第二資料。In this step, for example, according to the selection condition of the optimal chip frequency in formula (1), among multiple sets of chip frequencies, the chip frequency with the lowest task running time within the limit of the chip operating power consumption can be selected as the second data. For example, among all chip frequencies xi satisfying Pi≤Power Limited , the chip frequency with the smallest Ti, such as x1, is selected as the second data corresponding to the first data (k1, d1).

在步驟2043中,建立該第一資料和該第二資料之間的映射關係。In step 2043, a mapping relationship between the first data and the second data is established.

如上所述的,離散採樣點對應的多組第一資料中,每一組第一資料都可以按照圖3所示的流程得到該第一資料對應的第二資料,即最優的晶片頻率。如此,可以得到多個第一資料中各個第一資料分別對應的第二資料,並據此建立各個映射關係,從而得到映射關係的集合,該集合中可以包括多組映射關係,每一組映射關係都包括一個第一資料和一個對應的第二資料。該映射關係的集合可以是步驟204所述的預設映射關係,如表1的示例。As described above, among the multiple groups of first data corresponding to the discrete sampling points, each group of first data can obtain the second data corresponding to the first data according to the process shown in FIG. 3, that is, the optimal chip frequency. In this way, the second data corresponding to each first data in the multiple first data can be obtained, and each mapping relationship can be established accordingly to obtain a set of mapping relationships. The set can include multiple sets of mapping relationships, and each set of mapping relationships The relationship includes a first data and a corresponding second data. The set of mapping relationships may be the preset mapping relationships described in step 204, as shown in Table 1 as an example.

在步驟206中,根據預設映射關係、設備資訊以及子任務的任務參數,確定所述子任務在預設映射關係中對應的晶片頻率為目標晶片頻率。In step 206, the chip frequency corresponding to the subtask in the preset mapping relationship is determined as the target chip frequency according to the preset mapping relationship, the device information, and the task parameters of the subtask.

例如,假設某一子任務的任務參數是k1,該子任務對應的設備資訊是d1

Figure 02_image019
通過查表1,可以得到的目標晶片頻率是x1。該子任務可以被稱之為第一子任務。For example, suppose the task parameter of a subtask is k1, and the device information corresponding to the subtask is d1
Figure 02_image019
By looking up Table 1, the target wafer frequency that can be obtained is x1. This subtask can be called the first subtask.

此外,由於映射關係表中的第一資料是離散的,有時第一子任務的任務參數和設備資訊並不完全與映射關係中的第一資料一致,這種情況下,作為一種可選實現方式,可以在映射關係表中找到與第一任務的設備資訊和任務參數最接近的第一資料,用該最接近的第一資料對應的晶片頻率作為第一子任務的目標晶片頻率。In addition, because the first data in the mapping relationship table is discrete, sometimes the task parameters and device information of the first subtask are not completely consistent with the first data in the mapping relationship. In this case, as an optional implementation In this way, the first data closest to the device information and task parameters of the first task can be found in the mapping relationship table, and the chip frequency corresponding to the closest first data is used as the target chip frequency of the first subtask.

例如,假設第一子任務的任務參數和設備資訊可以稱為第三資料,如(k3,d3),可以計算該第三資料與映射關係中的各個第一資料之間的距離。該距離的計算可以是將第三資料和各個第一資料都作為一個向量,計算向量之間的距離,例如,可以是(第三資料的向量和每個第一資料的向量之間的歐式距離或其他距離。可以將與第三資料距離最近的第一資料對應的晶片頻率,作為第一子任務的目標晶片頻率。For example, assuming that the task parameters and device information of the first subtask can be called the third data, such as (k3, d3), the distance between the third data and each first data in the mapping relationship can be calculated. The distance can be calculated by taking the third data and each first data as a vector to calculate the distance between the vectors, for example, it can be (Euclidean distance between the vector of the third data and the vector of each first data Or other distances. The chip frequency corresponding to the first data closest to the third data can be used as the target chip frequency of the first subtask.

其中,在一些實施例中,上述的與第三資料距離最近的第一資料可以是向下取最近的,該向下取最近是指儘量取對應晶片頻率較低的第一資料。比如,假設第三資料的兩個相鄰的第一資料分別是第一資料Y1和第一資料Y2,並且該第一資料Y1和第一資料Y2與第三資料的距離是相等的,第一資料Y1對應的晶片頻率比第二資料Y2對應的晶片頻率要低,那麼可以選擇使用Y1對應的晶片頻率。如果第一資料Y1和第一資料Y2與第三資料的距離不相等,則仍然可以選擇距離較近的第一資料作為目標第一資料。再例如,只要在第一資料Y1和第一資料Y2與第三資料的距離之間的差距在預設範圍內,則優先選擇對應晶片頻率較低的第一資料,該預設範圍可以基於實際需求設置,本發明實施例對此不做限定。Among them, in some embodiments, the above-mentioned first data closest to the third data may be the closest downward, and the closest downward refers to taking the first data with a lower frequency corresponding to the chip as much as possible. For example, suppose that the two adjacent first data of the third data are the first data Y1 and the first data Y2, and the distances between the first data Y1 and the first data Y2 and the third data are the same. The chip frequency corresponding to the data Y1 is lower than the chip frequency corresponding to the second data Y2, so you can choose to use the chip frequency corresponding to Y1. If the distance between the first data Y1 and the first data Y2 is not equal to the third data, the first data with a relatively close distance can still be selected as the target first data. For another example, as long as the distance between the first data Y1 and the distance between the first data Y2 and the third data is within a preset range, the first data corresponding to the lower chip frequency is preferentially selected. The preset range can be based on the actual The requirement setting is not limited in the embodiment of the present invention.

在步驟208中,根據確定的每個子任務的所述目標晶片頻率,設置晶片執行所述每個子任務的工作頻率。In step 208, according to the determined target wafer frequency of each subtask, the operating frequency of the wafer to execute each subtask is set.

本步驟中,在目標任務的運行過程中,當運行到其中一個子任務時,可以將晶片的頻率設置為該子任務的目標晶片頻率。In this step, in the running process of the target task, when one of the subtasks is run, the frequency of the wafer can be set as the target wafer frequency of the subtask.

本發明實施例的設備晶片的工作頻率的設置方法,對待執行的任務進行分解得到多個子任務,並分別得到各個子任務的目標晶片頻率,這種精細化的頻率設置方式能夠使得讓任務的各個子任務部分都盡可能的實現最優的運行性能,從而提高整個任務的運行速度。並且,通過預先建立任務參數、設備資訊與晶片頻率的映射關係,使得能夠加快晶片頻率的確定速度,提高設備性能。In the method for setting the operating frequency of the device chip in the embodiment of the present invention, the task to be executed is decomposed to obtain multiple subtasks, and the target chip frequency of each subtask is obtained respectively. This refined frequency setting method can make each task The sub-task part is as far as possible to achieve the best operating performance, thereby improving the running speed of the entire task. In addition, by pre-establishing the mapping relationship between task parameters, device information and chip frequency, it is possible to speed up the determination of chip frequency and improve device performance.

圖4繪示了本發明一些實施例提供的晶片工作頻率的設置方法的另一流程圖,該示例中,以設置晶片的組合頻率為例進行說明,並且,獲取的設備資訊中還可以包括晶片的晶片溫度,該晶片溫度可以是由晶片所在設備中的溫度傳感器來負責採集。此外,這裡假設要執行的目標任務是一個三層的神經網路模型的推理任務。FIG. 4 shows another flowchart of a method for setting the working frequency of a chip provided by some embodiments of the present invention. In this example, setting the combined frequency of the chip is taken as an example for description, and the acquired device information may also include the chip The wafer temperature can be collected by the temperature sensor in the device where the wafer is located. In addition, it is assumed that the target task to be performed is a three-layer neural network model inference task.

其中,對於不同的終端設備,比如GPU(Graphics Processing Unit,圖形處理單元)、CPU或者DSP晶片所在的終端設備,由於設備資訊不同,訓練得到的功耗模型和運行時間模型可能會完全不同。可以針對目標任務運行所在的特定終端設備,離線訓練確定模型。功耗模型和運行時間模型確定之後,可以將該確定的模型以及最優化問題求解引擎儲存到終端設備中。其中,最優化問題求解引擎所做的處理可以參見圖2所示流程描述中的預設映射關係建立的過程,該最優化問題求解引擎可以根據採樣的多組第一資料以及確定的模型,得到各晶片頻率分別對應的晶片運行功耗和任務運行時間,再根據公式(1)選擇出最優的晶片頻率,從而建立起第一資料和第二資料之間的映射關係。可選的,可以由設備來執行預設映射關係的建立,或者也可以由其他設備執行預設映射關係的建立處理,並將預先建立好的映射關係儲存在該目標任務運行所在的設備中,設備在運行目標任務時可以直接查表使用。Among them, for different terminal devices, such as GPU (Graphics Processing Unit, graphics processing unit), CPU or terminal device where the DSP chip is located, due to different device information, the power consumption model and runtime model obtained by training may be completely different. The model can be determined by offline training for the specific terminal device where the target task is running. After the power consumption model and the runtime model are determined, the determined model and the optimization problem solving engine can be stored in the terminal device. Among them, the processing performed by the optimization problem solving engine can be referred to the process of establishing the preset mapping relationship in the process description shown in Figure 2. The optimization problem solving engine can obtain the result based on the sampled multiple sets of first data and the determined model Each chip frequency corresponds to the chip running power consumption and task running time, and then the optimal chip frequency is selected according to formula (1), thereby establishing the mapping relationship between the first data and the second data. Optionally, the device may execute the establishment of the preset mapping relationship, or another device may execute the process of establishing the preset mapping relationship, and store the pre-established mapping relationship in the device where the target task is running. The device can directly look up the table when running the target task.

在步驟400中,對設備上待運行的目標任務進行任務解析,得到多個子任務以及每個所述子任務的任務參數。In step 400, task analysis is performed on the target task to be run on the device, and multiple subtasks and task parameters of each of the subtasks are obtained.

例如,該目標任務是三層的神經網路模型的推理任務,其中的每一層可以是一個子任務。那麼本步驟經過任務解析,可以得到一個子任務列表,該子任務列表中包括三個子任務:子任務1、子任務2和子任務3。並且,本步驟還分析得到每個子任務的任務參數,例如,子任務的訪存量和計算量等。比如,子任務列表中可以包括:<子任務1、任務參數1>、<子任務2、任務參數2>、<子任務3、任務參數3>。其中的任務參數可以表示為

Figure 02_image001
(n表示n維空間,比如訪存量,計算量)。子任務1、子任務2和子任務3可以被分別作為第一子任務。For example, the target task is an inference task of a three-layer neural network model, each of which can be a subtask. Then, after task analysis in this step, a subtask list can be obtained. The subtask list includes three subtasks: subtask 1, subtask 2, and subtask 3. In addition, this step also analyzes and obtains the task parameters of each subtask, for example, the amount of memory access and the amount of calculation of the subtask. For example, the subtask list may include: <subtask 1, task parameter 1>, <subtask 2, task parameter 2>, <subtask 3, task parameter 3>. The task parameters can be expressed as
Figure 02_image001
(N represents n-dimensional space, such as the amount of memory access, the amount of calculation). Subtask 1, subtask 2, and subtask 3 can be regarded as the first subtask, respectively.

在步驟402中,獲取晶片所在設備的設備資訊。In step 402, the device information of the device where the chip is located is obtained.

其中,設備資訊可以包括設備資源資訊。在一個示例中,子任務1、子任務2和子任務3之間是序列關係,這些子任務在運行時占用的設備資源資訊可以是相同的。比如,頻寬、計算單元數量等可以是相同的。Among them, the equipment information may include equipment resource information. In an example, the subtask 1, the subtask 2 and the subtask 3 are in a sequence relationship, and the equipment resource information occupied by these subtasks during operation may be the same. For example, the bandwidth, the number of computing units, etc. can be the same.

設備資訊可以表示為

Figure 02_image003
(m表示m維空間,比如頻寬、儲存裝置容量等)。Equipment information can be expressed as
Figure 02_image003
(M represents m-dimensional space, such as bandwidth, storage device capacity, etc.).

在步驟404中,在確定將要開始執行子任務1之前,採集晶片上的晶片溫度C1,並根據子任務1的任務參數、設備資源資訊和晶片溫度C1,確定子任務1在運行時所述設備上的晶片對應設置的目標晶片頻率。In step 404, before it is determined that the execution of subtask 1 will start, the wafer temperature C1 on the wafer is collected, and according to the task parameters of subtask 1, equipment resource information, and the wafer temperature C1, it is determined that the equipment of subtask 1 is running. The upper chip corresponds to the set target chip frequency.

本發明一些實施例中,設備資訊還可以包括晶片的晶片溫度,因為在執行任務的過程中,溫度過高也會導致晶片採取降頻的措施。也就是說,本發明實施例的設備資訊中不僅包括計算單元數量、頻寬、儲存裝置容量等設備資源資訊,還包括了晶片溫度。並且,該晶片溫度可以是動態獲取的,即在目標任務的運行過程中的每個子任務開始執行前,獲取該子任務對應的晶片溫度,並據此確定該子任務的目標晶片頻率。In some embodiments of the present invention, the device information may also include the wafer temperature of the wafer, because excessively high temperature during the execution of the task will also cause the wafer to take measures to reduce the frequency. That is to say, the device information in the embodiment of the present invention includes not only device resource information such as the number of computing units, bandwidth, storage device capacity, etc., but also chip temperature. In addition, the wafer temperature may be dynamically acquired, that is, before each subtask in the running process of the target task starts to execute, the wafer temperature corresponding to the subtask is acquired, and the target wafer frequency of the subtask is determined accordingly.

在步驟406中,將晶片的工作頻率設置成子任務1的目標晶片頻率,並開始執行子任務1。In step 406, the operating frequency of the wafer is set to the target wafer frequency of subtask 1, and the execution of subtask 1 is started.

在步驟408中,在確定將要開始執行子任務2之前,採集晶片上的晶片溫度C2,並根據子任務2的任務參數、設備資源資訊和晶片溫度C2,確定子任務2在運行時所述設備上的晶片對應設置的目標晶片頻率。In step 408, before it is determined that subtask 2 will be executed, the wafer temperature C2 on the wafer is collected, and based on the task parameters of subtask 2, equipment resource information and wafer temperature C2, it is determined that the equipment of subtask 2 is running. The upper chip corresponds to the set target chip frequency.

本發明實施例中,在目標任務的運行過程中,晶片的溫度是變化的,那麼可以在該目標任務運行過程中每次要執行一個子任務之前,都採集最新的晶片溫度,並結合該晶片溫度確定該子任務的目標晶片頻率。In the embodiment of the present invention, during the operation of the target task, the temperature of the wafer changes, then the latest wafer temperature can be collected and combined with the wafer before each subtask is executed during the operation of the target task. The temperature determines the target wafer frequency for this subtask.

還需要說明的是,本發明實施例的晶片頻率可以是一個組合頻率,或者是組合頻率中的一個頻率,即同時設置晶片的核心頻率和儲存裝置頻率。例如,核心頻率是x,儲存裝置頻率是y。比如,當子任務的任務參數和設備資訊是(k1,d1)時(其中的設備資訊可以包括設備資源資訊和晶片溫度),對應採取的晶片頻率可以是(x1,y1);當子任務的任務參數和設備資訊是(k2,d2)時,對應採取的晶片頻率可以是(x2,y2)。It should also be noted that the chip frequency in the embodiment of the present invention may be a combined frequency or one of the combined frequencies, that is, the core frequency of the chip and the storage device frequency are set at the same time. For example, the core frequency is x, and the storage device frequency is y. For example, when the task parameters and device information of the subtask are (k1, d1) (the device information can include device resource information and chip temperature), the corresponding chip frequency can be (x1, y1); when the subtask is When the task parameters and equipment information are (k2, d2), the corresponding chip frequency can be (x2, y2).

並且,在確定功耗模型和運行時間模型時,例如,功耗模型的輸入可以包括:k1,d1,x1,y1,模型的輸出可以是晶片運行功耗P;同理,運行時間模型的輸入可以包括:k1,d1,x1,y1,模型的輸出可以是任務運行時間T。並且,在訓練該功耗模型和運行時間模型時,設備資訊中可以包括晶片溫度。In addition, when determining the power consumption model and the runtime model, for example, the input of the power consumption model can include: k1, d1, x1, y1, and the output of the model can be the chip's operating power consumption P; the same way, the input of the runtime model It can include: k1, d1, x1, y1, and the output of the model can be the task running time T. Moreover, when training the power consumption model and the runtime model, the device information may include the wafer temperature.

在步驟410中,將晶片的工作頻率設置成子任務2的目標晶片頻率,並開始執行子任務2。In step 410, the operating frequency of the wafer is set to the target wafer frequency of subtask 2, and the execution of subtask 2 is started.

在步驟412中,在確定將要開始執行子任務3之前,採集設備上的晶片的晶片溫度C3,並根據子任務3的任務參數、設備資源資訊和晶片溫度C3,確定子任務3在運行時所述設備上的晶片對應設置的目標晶片頻率。In step 412, before it is determined that subtask 3 will be executed, the wafer temperature C3 of the wafer on the device is collected, and the task parameters of subtask 3, device resource information, and wafer temperature C3 are used to determine where subtask 3 is running. The chip on the device corresponds to the set target chip frequency.

在步驟414中,將晶片的工作頻率設置成子任務3的目標晶片頻率,並開始執行子任務3。In step 414, the operating frequency of the wafer is set to the target wafer frequency of subtask 3, and the execution of subtask 3 is started.

當目標任務包括的所有的子任務都執行結束後,可以將設備晶片的工作頻率重新設置為預設值,目標任務執行結束。When all the subtasks included in the target task are executed, the operating frequency of the device chip can be reset to the preset value, and the execution of the target task ends.

本發明實施例的晶片工作頻率的設置方法,對待執行的任務進行分解得到多個子任務,並分別得到各個子任務的目標晶片頻率,這種精細化的頻率設置方式能夠使得讓任務的各個子任務部分都盡可能的實現最優的運行性能,從而提高整個任務的運行速度。並且,在任務運行的過程中,動態的採集第一子任務執行時的晶片溫度,並綜合該晶片溫度確定第一子任務的目標晶片工作頻率,能夠使得晶片工作頻率的確定考慮因素更加全面,從而頻率設置更加合理,進一步提高設備運行性能。In the method for setting the working frequency of the chip in the embodiment of the present invention, the task to be executed is decomposed to obtain multiple subtasks, and the target chip frequency of each subtask is obtained respectively. This refined frequency setting method can make each subtask of the task Some parts are as far as possible to achieve the best operating performance, thereby improving the running speed of the entire task. In addition, in the process of task operation, dynamically collecting the wafer temperature during the execution of the first subtask, and synthesizing the wafer temperature to determine the target wafer operating frequency of the first subtask, which can make the determination of the wafer operating frequency more comprehensive. Therefore, the frequency setting is more reasonable, and the operation performance of the equipment is further improved.

此外,終端設備也可以提供用戶介面,通過該用戶介面可以接收輸入的對於預設映射關係的配置資訊。比如,用戶可以離線的計算出或者估計出每個子任務應使用的目標晶片頻率,並將該各個子任務與對應目標晶片頻率的預設映射關係儲存在設備中,這樣設備在運行時就根據該配置的預設映射關係設置子任務執行時對應的晶片的工作頻率即可。In addition, the terminal device may also provide a user interface through which the input configuration information for the preset mapping relationship can be received. For example, the user can calculate or estimate the target chip frequency that each subtask should use offline, and store the preset mapping relationship between each subtask and the corresponding target chip frequency in the device, so that the device runs according to the The configured preset mapping relationship only needs to set the working frequency of the corresponding chip when the subtask is executed.

上述的用戶介面還可以用於接收頻率設置策略資訊。該頻率設置策略資訊例如可以包括根據任務參數、設備資訊確定晶片運行功耗和任務運行時間的模型、或者還可以包括如何根據功耗模型和任務運行時間模型選擇確定某個子任務的目標晶片頻率。根據所述頻率設置策略資訊,就可以基於該頻率設置策略資訊和多個子任務中每個子任務的任務參數,分別確定每個子任務在運行時所述設備上的晶片對應設置的目標晶片頻率。The aforementioned user interface can also be used to receive frequency setting strategy information. The frequency setting strategy information may include, for example, a model for determining chip operating power consumption and task operating time based on task parameters and device information, or may also include how to select and determine the target chip frequency of a certain subtask based on the power consumption model and task operating time model. According to the frequency setting strategy information, the target chip frequency corresponding to the chip on the device when each subtask is running can be determined based on the frequency setting strategy information and the task parameters of each of the multiple subtasks.

此外,該頻率設置策略資訊還可以包括:打開或關閉針對子任務的晶片頻率動態設置功能。當頻率設置策略資訊包括打開針對子任務的晶片頻率動態設置功能時,設備就可以按照本發明前述實施例中所述的晶片工作頻率的設置方法,對目標任務的各個子任務確定的目標晶片頻率,比如,可以採集子任務的任務參數、晶片溫度、設備資源資訊,並根據這些資訊以及功耗模型和任務運行時間模型選擇確定要使用的目標晶片頻率。而當頻率設置策略資訊包括關閉針對子任務的晶片頻率動態設置功能時,設備就可以按照通過用戶介面配置的離線計算出的預設映射關係,直接獲取每個子任務應使用的目標晶片頻率。In addition, the frequency setting strategy information may also include: turning on or off the chip frequency dynamic setting function for subtasks. When the frequency setting strategy information includes turning on the chip frequency dynamic setting function for subtasks, the device can determine the target chip frequency for each subtask of the target task according to the method for setting the chip operating frequency described in the foregoing embodiment of the present invention. For example, you can collect task parameters, chip temperature, equipment resource information of subtasks, and select and determine the target chip frequency to be used based on these information, power consumption model and task runtime model. When the frequency setting strategy information includes turning off the chip frequency dynamic setting function for subtasks, the device can directly obtain the target chip frequency that each subtask should use according to the preset mapping relationship configured offline through the user interface.

通過上述用戶介面,可以提供更為靈活的晶片頻率設置方式,用戶可以更方便的對晶片頻率的確定方式進行更新,使得晶片頻率的確定更為合理和快速。Through the above user interface, a more flexible chip frequency setting method can be provided, and the user can update the chip frequency determination method more conveniently, making the chip frequency determination more reasonable and faster.

圖5繪示了本發明一些實施例提供的晶片工作頻率的設置裝置的方塊圖,如圖5所示,該裝置可以包括:獲取模組51、頻率控制模組52和頻率設置模組53。FIG. 5 shows a block diagram of a device for setting the operating frequency of a chip provided by some embodiments of the present invention. As shown in FIG. 5, the device may include: an acquisition module 51, a frequency control module 52, and a frequency setting module 53.

獲取模組51,用於獲取目標任務的多個子任務以及每個子任務的任務參數,所述任務參數包括用於表示所述子任務的運算規模的參數。示例性的,所述任務參數包括如下至少一項:所述子任務的計算量、子任務的訪存量。The obtaining module 51 is configured to obtain multiple subtasks of the target task and task parameters of each subtask, and the task parameters include parameters for representing the calculation scale of the subtasks. Exemplarily, the task parameter includes at least one of the following: a calculation amount of the subtask, and a memory access amount of the subtask.

頻率控制模組52,用於基於所述多個子任務中每個子任務的任務參數,確定所述每個子任務的目標晶片頻率。The frequency control module 52 is configured to determine the target chip frequency of each subtask based on the task parameter of each subtask in the plurality of subtasks.

頻率設置模組53,用於根據確定的每個子任務的目標晶片頻率,設置晶片執行所述每個子任務的工作頻率。The frequency setting module 53 is used for setting the working frequency of the chip to execute each subtask according to the determined target chip frequency of each subtask.

圖6繪示了本發明一些實施例提供的晶片工作頻率的設置裝置的另一方塊圖。在一個例子中,如圖6所示,該裝置還可以包括:任務解析模組54,用於對所述目標任務進行任務解析處理,得到所述多個子任務以及每個子任務的任務參數;並儲存所述多個子任務中每個子任務與所述每個子任務的任務參數的對應關係。獲取模組51,在用於獲取目標任務的多個子任務以及每個子任務的任務參數時,包括:從儲存的所述對應關係中查找每個子任務的任務參數。FIG. 6 shows another block diagram of the device for setting the operating frequency of a chip provided by some embodiments of the present invention. In an example, as shown in FIG. 6, the device may further include: a task analysis module 54 for performing task analysis processing on the target task to obtain the multiple subtasks and the task parameters of each subtask; and The corresponding relationship between each subtask and the task parameter of each subtask in the plurality of subtasks is stored. The obtaining module 51, when used to obtain multiple subtasks of the target task and the task parameters of each subtask, includes: searching the task parameters of each subtask from the stored correspondence relationship.

例如,在實際實施中,要開始運行一個目標任務時,可以先由任務解析模組54對目標任務進行任務解析處理,比如解析得到多個子任務,再分別對多個子任務中的每個子任務進行解析得到各個子任務的任務參數。任務解析模組54可以將解析得到的每個子任務及其任務參數的對應關係進行儲存。For example, in actual implementation, when starting to run a target task, the task analysis module 54 can first perform task analysis processing on the target task, such as analyzing multiple sub-tasks, and then separately perform tasks on each of the multiple sub-tasks. The task parameters of each subtask are obtained by parsing. The task analysis module 54 can store the corresponding relationship between each subtask obtained by the analysis and its task parameters.

獲取模組51可以負責控制目標任務的運行過程,例如,獲取模組51可以獲取上述任務解析模組54解析並儲存得到的對應關係,控制逐個執行其中的各個子任務。示例性的,假設有三個子任務,當要開始執行第一個子任務時,獲取模組51可以由對應關係中獲取到該第一個子任務的任務參數,並將任務參數以及晶片所在設備的設備資訊發送至頻率控制模組52,由頻率控制模組52根據任務參數和設備資訊確定第一個子任務的目標晶片頻率。The acquisition module 51 may be responsible for controlling the running process of the target task. For example, the acquisition module 51 may acquire the corresponding relationship parsed and stored by the task analysis module 54 described above, and control the execution of each subtask therein one by one. Exemplarily, assuming there are three subtasks, when the first subtask is to be executed, the obtaining module 51 can obtain the task parameters of the first subtask from the corresponding relationship, and combine the task parameters and the device's The equipment information is sent to the frequency control module 52, and the frequency control module 52 determines the target chip frequency of the first subtask according to the task parameters and the equipment information.

接著,頻率控制模組52可以將確定的目標晶片頻率發送至頻率設置模組53,該頻率設置模組53可以將晶片的工作頻率設置為所述的目標晶片頻率。並且,頻率設置模組53在設置晶片的工作頻率完成後,可以向獲取模組51發送一個反饋信號,以通知獲取模組51頻率設置已經完成。那麼,獲取模組51根據該反饋信號,就可以開始執行第一個子任務。Then, the frequency control module 52 can send the determined target chip frequency to the frequency setting module 53, and the frequency setting module 53 can set the working frequency of the chip to the target chip frequency. Moreover, the frequency setting module 53 may send a feedback signal to the acquisition module 51 after setting the working frequency of the chip to notify the acquisition module 51 that the frequency setting has been completed. Then, the acquisition module 51 can start to execute the first subtask according to the feedback signal.

當第一個子任務執行結束後,獲取模組51可以開始準備執行第二個子任務,同樣的,在第二個子任務開始執行前,獲取模組51可以由任務解析模組54得到的對應關係中獲得第二個子任務的任務參數,發送至頻率控制模組52確定第二個子任務的目標晶片頻率。當頻率設置模組53反饋晶片頻率設置完成後,獲取模組51開始執行第二個子任務。第三個子任務的執行同理,不再詳述。當獲取模組51確認目標任務的所有子任務都執行結束後,可以向頻率控制模組52發送頻率重置信號,頻率控制模組52據此再向頻率設置模組53發送頻率重置信號,頻率設置模組53可以將晶片的工作頻率設置為預設值。此時目標任務執行結束。After the execution of the first subtask is finished, the acquisition module 51 can start to prepare to execute the second subtask. Similarly, before the execution of the second subtask, the acquisition module 51 can obtain the corresponding relationship from the task analysis module 54 The task parameters of the second subtask are obtained in the, and sent to the frequency control module 52 to determine the target chip frequency of the second subtask. After the frequency setting module 53 feedbacks that the chip frequency setting is completed, the acquisition module 51 starts to execute the second subtask. The implementation of the third subtask is similar, and will not be detailed again. After the acquisition module 51 confirms that all subtasks of the target task have been executed, it can send a frequency reset signal to the frequency control module 52, and the frequency control module 52 then sends a frequency reset signal to the frequency setting module 53 accordingly. The frequency setting module 53 can set the operating frequency of the chip to a preset value. At this point, the execution of the target task ends.

在一個例子中,頻率控制模組52,在用於基於所述多個子任務中每個子任務的任務參數確定所述每個子任務的目標晶片頻率時,包括:獲取所述晶片所在設備的設備資訊,所述設備資訊包括設備資源資訊;基於所述設備資訊和所述多個子任務中每個子任務的任務參數,確定所述每個子任務的目標晶片頻率。例如,該設備資源資訊包括以下中的任意一項或多項:計算單元的數量、頻寬、儲存裝置容量。In one example, when the frequency control module 52 is used to determine the target chip frequency of each subtask based on the task parameters of each of the multiple subtasks, it includes: acquiring device information of the device where the chip is located , The equipment information includes equipment resource information; the target chip frequency of each subtask is determined based on the equipment information and the task parameter of each subtask of the plurality of subtasks. For example, the equipment resource information includes any one or more of the following: the number of computing units, bandwidth, and storage device capacity.

在一個例子中,所述設備資訊還包括:所述晶片的晶片溫度;頻率控制模組52,還用於:基於所述多個子任務中的第一子任務的任務參數、所述設備資源資訊和所述第一子任務執行時的晶片溫度,確定所述第一子任務的目標晶片頻率。In an example, the device information further includes: the chip temperature of the chip; the frequency control module 52 is further used for: based on the task parameters of the first subtask among the plurality of subtasks, and the device resource information And the wafer temperature during execution of the first subtask to determine the target wafer frequency of the first subtask.

在一個例子中,頻率控制模組52,用於:獲取多個第一資料和多個第二資料之間的預設映射關係,所述第一資料包括預設任務參數和預設設備資訊,所述第二資料包括預設晶片頻率;根據所述預設映射關係、所述設備資訊以及每個子任務的任務參數,確定所述每個子任務的目標晶片頻率。In an example, the frequency control module 52 is configured to obtain a preset mapping relationship between a plurality of first data and a plurality of second data, the first data including preset task parameters and preset device information, The second data includes a preset chip frequency; the target chip frequency of each subtask is determined according to the preset mapping relationship, the device information, and the task parameters of each subtask.

在一個例子中,頻率控制模組52,在用於根據所述預設映射關係、所述設備資訊以及每個子任務的任務參數,確定所述每個子任務的目標晶片頻率時,包括:確定第三資料與所述預設映射關係中的多個第一資料中每個第一資料之間的距離,所述第三資料包括所述多個子任務中第一子任務的任務參數和設備資訊;將所述預設映射關係中與所述第三資料距離最近的目標第一資料對應的預設晶片頻率,作為所述第一子任務的目標晶片頻率。In one example, when the frequency control module 52 is used to determine the target chip frequency of each subtask according to the preset mapping relationship, the device information, and the task parameters of each subtask, it includes: determining the first 3. the distance between the data and each of the plurality of first data in the preset mapping relationship, the third data including task parameters and equipment information of the first subtask among the plurality of subtasks; The preset chip frequency corresponding to the target first data closest to the third data in the preset mapping relationship is used as the target chip frequency of the first subtask.

在一個例子中,頻率控制模組52,還用於在獲取多個第一資料和多個第二資料之間的預設映射關係之前,獲取多組可選晶片頻率,並獲取採樣得到的離散的多個第一資料;對於所述多個第一資料中的每個所述第一資料,由所述多組可選晶片頻率中選擇一組晶片頻率作為與所述每個第一資料對應的第二資料,並建立所述每個第一資料和選擇的所述第二資料之間的映射關係。In one example, the frequency control module 52 is also used to obtain multiple sets of selectable chip frequencies before obtaining the preset mapping relationship between the multiple first data and the multiple second data, and obtain the discrete samples obtained A plurality of first data; for each of the first data in the plurality of first data, a set of chip frequencies is selected from the plurality of sets of selectable chip frequencies as corresponding to each of the first data And establish a mapping relationship between each of the first data and the selected second data.

在一個例子中,預設所述預設映射關係中與所述第一資料對應的預設晶片頻率是基於在多組可選晶片頻率中每組可選晶片頻率的條件下所述第一資料對應的性能評估參數,從所述多組可選晶片頻率中選擇的。In an example, the preset chip frequency corresponding to the first data in the preset mapping relationship is based on the first data under the condition of each group of selectable chip frequencies in a plurality of sets of selectable chip frequencies The corresponding performance evaluation parameters are selected from the multiple sets of optional chip frequencies.

在一個例子中,所述性能評估參數包括任務處理性能參數和晶片運行功耗;所述預設映射關係中與所述第一資料對應的預設晶片頻率為:所述多組可選晶片頻率中晶片運行功耗低於預設功耗且任務處理性能參數最優的可選晶片頻率。In an example, the performance evaluation parameters include task processing performance parameters and chip operating power consumption; the preset chip frequency corresponding to the first data in the preset mapping relationship is: the multiple sets of selectable chip frequencies The operating power consumption of the medium chip is lower than the preset power consumption and the optional chip frequency with the best task processing performance parameters.

在一個例子中,如圖6所示,該裝置還可以包括:介面模組55,用於接收用戶輸入的對於所述預設映射關係的配置資訊。In an example, as shown in FIG. 6, the device may further include: an interface module 55 for receiving configuration information input by the user for the preset mapping relationship.

在一個例子中,頻率控制模組52,在用於基於所述多個子任務中每個子任務的任務參數,確定所述每個子任務的目標晶片頻率時,包括:基於所述多個子任務中每個子任務的任務參數,由多組可選晶片頻率中,選擇能夠使得所述晶片在晶片功耗限制條件下實現任務運行時間最低的晶片頻率,作為所述目標晶片頻率。In one example, when the frequency control module 52 is used to determine the target chip frequency of each subtask based on the task parameters of each of the multiple subtasks, it includes: based on each of the multiple subtasks. The task parameters of each subtask are selected from a plurality of groups of selectable chip frequencies, and the chip frequency that enables the chip to achieve the lowest task running time under the limitation of chip power consumption is selected as the target chip frequency.

在一個例子中,介面模組55,還用於:接收用戶輸入的頻率設置策略資訊;所述頻率控制模組52,還用於:基於所述頻率設置策略資訊和所述多個子任務中每個子任務的任務參數,確定所述每個子任務的目標晶片頻率。In an example, the interface module 55 is further used to: receive frequency setting strategy information input by the user; the frequency control module 52 is further used to: based on the frequency setting strategy information and each of the multiple subtasks The task parameters of each subtask determine the target chip frequency of each subtask.

在一個例子中,所述頻率設置策略資訊包括打開或關閉針對子任務的晶片頻率動態設置功能。In one example, the frequency setting strategy information includes turning on or off the chip frequency dynamic setting function for the subtask.

在一個例子中,所述工作頻率包括如下至少一項:所述晶片的核心頻率、或者儲存裝置頻率。In an example, the operating frequency includes at least one of the following: a core frequency of the chip or a storage device frequency.

在一些實施例中,上述裝置可以用於執行上文所述的對應任意方法,為了簡潔,這裡不再贅述。In some embodiments, the above-mentioned apparatus may be used to execute any corresponding method described above. For the sake of brevity, details are not repeated here.

圖7繪示了本發明一些實施例提供的晶片工作頻率的電子設備的方塊圖。本發明實施例還提供了一種電子設備,如圖7所示,電子設備700包括儲存裝置710、處理器720,所述儲存裝置710用於儲存電腦可讀指令711,所述處理器720用於調用所述電腦可讀指令711,實現本說明書任一實施例的晶片工作頻率的設置方法。其中,晶片工作頻率設置的目標晶片可以是儲存裝置710和/或處理器720。在一個例子中,該電子設備700還可以包括通訊介面730和匯流排740。儲存裝置710、處理器720以及通訊介面730通過匯流排740相互連接。在一個例子中,該電子設備700還可以包括晶片750,該晶片750用於基於所述處理器720設置的工作頻率對目標任務中的每個子任務進行處理。FIG. 7 illustrates a block diagram of an electronic device with a chip operating frequency provided by some embodiments of the present invention. An embodiment of the present invention also provides an electronic device. As shown in FIG. 7, the electronic device 700 includes a storage device 710 and a processor 720. The storage device 710 is used for storing computer-readable instructions 711, and the processor 720 is used for The computer-readable instruction 711 is invoked to implement the method for setting the operating frequency of the chip in any embodiment of this specification. Wherein, the target chip for setting the chip operating frequency may be the storage device 710 and/or the processor 720. In an example, the electronic device 700 may further include a communication interface 730 and a bus 740. The storage device 710, the processor 720, and the communication interface 730 are connected to each other through a bus 740. In an example, the electronic device 700 may further include a wafer 750 for processing each subtask in the target task based on the operating frequency set by the processor 720.

本發明實施例還提供了一種電腦可讀取記錄媒體,其上儲存有電腦程式,所述電腦程式被處理器執行時,促使所述處理器實現本說明書任一實施例的晶片工作頻率的設置方法。在一個例子中,該電腦可讀取記錄媒體可以是圖7中的儲存裝置710。An embodiment of the present invention also provides a computer-readable recording medium on which a computer program is stored. When the computer program is executed by a processor, it prompts the processor to implement the chip operating frequency setting of any embodiment of this specification. method. In an example, the computer-readable recording medium may be the storage device 710 in FIG. 7.

本領域技術人員應明白,本發明一個或多個實施例可提供為方法、系統或電腦程式產品。因此,本發明一個或多個實施例可採用完全硬體實施例、完全軟體實施例或結合軟體和硬體方面的實施例的形式。而且,本發明一個或多個實施例可採用在一個或多個其中包含有電腦可用程式碼的電腦可讀取記錄媒體(包括但不限於磁碟儲存裝置、CD-ROM、光學儲存裝置等)上實施的計算機程式產品的形式。Those skilled in the art should understand that one or more embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, one or more embodiments of the present invention may adopt the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware. Moreover, one or more embodiments of the present invention may use one or more computer-readable recording media (including but not limited to magnetic disk storage devices, CD-ROMs, optical storage devices, etc.) containing computer-usable program codes therein. The form of a computer program product implemented on it.

其中,本發明實施例所述的“和/或”表示至少具有兩者中的其中一個,例如,“多和/或B”包括三種方案:多、B、以及“多和B”。Among them, the “and/or” in the embodiment of the present invention means having at least one of the two, for example, “multi and/or B” includes three schemes: multi, B, and “multi and B”.

本發明中的各個實施例均採用遞進的方式描述,各個實施例之間相同相似的部分互相參見即可,每個實施例重點說明的都是與其他實施例的不同之處。尤其,對於資料處理設備實施例而言,由於其基本相似於方法實施例,所以描述的比較簡單,相關之處參見方法實施例的部分說明即可。The various embodiments of the present invention are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, as for the data processing device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for related parts, please refer to the part of the description of the method embodiment.

上述對本發明特定實施例進行了描述。其它實施例在所附申請專利範圍的範圍內。在一些情況下,在申請專利範圍中記載的行為或步驟可以按照不同於實施例中的順序來執行並且仍然可以實現期望的結果。另外,在附圖中描繪的過程不一定要求繪示的特定順序或者連續順序才能實現期望的結果。在某些實施方式中,多任務處理和並列處理也是可以的或者可能是有利的。The foregoing describes specific embodiments of the present invention. Other embodiments are within the scope of the attached patent application. In some cases, the actions or steps described in the scope of the patent application may be performed in a different order from the embodiment and still achieve desired results. In addition, the processes depicted in the drawings do not necessarily require the specific sequence or sequential sequence depicted in order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

本發明中描述的主題及功能操作的實施例可以在以下中實現:數位電子電路、有形體現的電腦軟體或韌體、包括本發明中公開的結構及其結構性等同物的電腦硬體、或者它們中的一個或多個的組合。本發明中描述的主題的實施例可以實現為一個或多個電腦程式,即編碼在有形非暫時性程式載體上以被資料處理裝置執行或控制資料處理裝置的操作的電腦程式指令中的一個或多個模組。可替代地或附加地,程式指令可以被編碼在人工生成的傳播信號上,例如機器生成的電、光或電磁信號,該信號被生成以將資訊編碼並傳輸到合適的接收機裝置以由資料處理裝置執行。電腦可讀取記錄媒體可以是電腦可讀儲存設備、電腦可讀儲存基板、隨機或序列存取儲存裝置設備、或它們中的一個或多個的組合。The embodiments of the subject and functional operations described in the present invention can be implemented in the following: digital electronic circuits, tangible computer software or firmware, computer hardware including the structure disclosed in the present invention and structural equivalents thereof, or A combination of one or more of them. Embodiments of the subject matter described in the present invention can be implemented as one or more computer programs, that is, one or one of the computer program instructions encoded on a tangible non-transitory program carrier to be executed by a data processing device or to control the operation of the data processing device Multiple modules. Alternatively or additionally, the program instructions may be encoded on artificially generated propagated signals, such as machine-generated electrical, optical or electromagnetic signals, which are generated to encode information and transmit it to a suitable receiver device for data transmission. The processing device executes. The computer-readable recording medium may be a computer-readable storage device, a computer-readable storage substrate, a random or serial access storage device, or a combination of one or more of them.

本發明中描述的處理及邏輯流程可以由執行一個或多個計算機程式的一個或多個可編程計算機執行,以通過根據輸入資料進行操作並生成輸出來執行相應的功能。所述處理及邏輯流程還可以由專用邏輯電路—例如FPGA(現場可程式閘陣列)或ASIC(特殊應用積體電路)來執行,並且裝置也可以實現為專用邏輯電路。The processing and logic flow described in the present invention can be executed by one or more programmable computers executing one or more computer programs to perform corresponding functions by operating according to input data and generating output. The processing and logic flow can also be executed by a dedicated logic circuit, such as FPGA (Field Programmable Gate Array) or ASIC (Special Application Integrated Circuit), and the device can also be implemented as a dedicated logic circuit.

適合用於執行電腦程式的電腦包括,例如通用和/或專用微處理器,或任何其他類型的中央處理單元。通常,中央處理單元將從唯讀記憶體和/或隨機存取記憶體接收指令和資料。電腦的基本組件包括用於實施或執行指令的中央處理單元以及用於儲存指令和資料的一個或多個儲存裝置設備。通常,電腦還將包括用於儲存資料的一個或多個大容量儲存設備,例如磁碟、磁光碟或光碟等,或者電腦將可操作地與此大容量儲存設備耦接以從其接收資料或向其傳送資料,抑或兩種情況兼而有之。然而,電腦不是必須具有這樣的設備。此外,電腦可以嵌入在另一設備中,例如行動電話、個人數位助理(PDA)、移動音訊或視訊播放器、遊戲操縱臺、全球定位系統(GPS)接收機、或例如通用序列匯流排(USB)快閃記憶體驅動器的便攜式儲存設備,僅舉幾例。Computers suitable for executing computer programs include, for example, general-purpose and/or special-purpose microprocessors, or any other types of central processing units. Generally, the central processing unit will receive commands and data from read-only memory and/or random access memory. The basic components of a computer include a central processing unit for implementing or executing instructions and one or more storage devices for storing instructions and data. Generally, a computer will also include one or more mass storage devices for storing data, such as magnetic disks, magneto-optical disks, or optical discs, or the computer will be operably coupled to this mass storage device to receive data or Send data to it, or both. However, the computer does not have to have such equipment. In addition, the computer can be embedded in another device, such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver, or a universal serial bus (USB) ) Portable storage devices with flash drives, to name a few.

適合於儲存電腦程式指令和資料的電腦可讀取記錄媒體包括所有形式的非揮發性記憶體、媒介和儲存裝置設備,例如包括半導體儲存裝置設備(例如EPROM、EEPROM和快閃記憶體設備)、磁碟(例如內部硬碟或行動硬碟)、磁光碟以及CD ROM和DVD-ROM。處理器和儲存裝置可由專用邏輯電路補充或併入專用邏輯電路中。Computer-readable recording media suitable for storing computer program instructions and data include all forms of non-volatile memory, media, and storage devices, including semiconductor storage devices (such as EPROM, EEPROM, and flash memory devices), Disks (such as internal hard disks or mobile hard disks), magneto-optical disks, and CD ROM and DVD-ROM. The processor and storage device can be supplemented by or incorporated into a dedicated logic circuit.

雖然本發明包含許多具體實施細節,但是這些不應被解釋為限制任何公開的範圍或所要求保護的範圍,而是主要用於描述特定公開的具體實施例的特徵。本發明內在多個實施例中描述的某些特徵也可以在單個實施例中被組合實施。另一方面,在單個實施例中描述的各種特徵也可以在多個實施例中分開實施或以任何合適的子組合來實施。此外,雖然特徵可以如上所述在某些組合中起作用並且甚至最初如此要求保護,但是來自所要求保護的組合中的一個或多個特徵在一些情況下可以從該組合中去除,並且所要求保護的組合可以指向子組合或子組合的變型。Although the present invention contains many specific implementation details, these should not be construed as limiting any disclosed scope or claimed scope, but are mainly used to describe the features of specific disclosed specific embodiments. Certain features described in multiple embodiments of the present invention can also be implemented in combination in a single embodiment. On the other hand, various features described in a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub-combination. In addition, although features can function in certain combinations as described above and even initially claimed as such, one or more features from the claimed combination can in some cases be removed from the combination, and the claimed The combination of protection can be directed to a sub-combination or a variant of the sub-combination.

類似地,雖然在附圖中以特定順序描繪了操作,但是這不應被理解為要求這些操作以所示的特定順序執行或順次執行、或者要求所有例示的操作被執行,以實現期望的結果。在某些情況下,多任務和平行化處理可能是有利的。此外,上述實施例中各種系統模組和組件的分離不應被理解為在所有實施例中均需要這樣的分離,並且應當理解,所描述的程式組件和系統通常可以一起集成在單個軟體產品中,或封裝成多個軟體產品。Similarly, although operations are depicted in a specific order in the drawings, this should not be construed as requiring these operations to be performed in the specific order shown or performed sequentially, or requiring all illustrated operations to be performed to achieve desired results . In some cases, multitasking and parallel processing may be advantageous. In addition, the separation of various system modules and components in the above embodiments should not be understood as requiring such separation in all embodiments, and it should be understood that the described program components and systems can usually be integrated together in a single software product. , Or packaged into multiple software products.

由此,主題的特定實施例已被描述。其他實施例在所附申請專利範圍的範圍以內。在某些情況下,申請專利範圍中記載的動作可以以不同的順序執行並且仍實現期望的結果。此外,附圖中描繪的處理並非必需所示的特定順序或順次順序,以實現期望的結果。在某些實現中,多任務和平行化處理可能是有利的。Thus, specific embodiments of the subject matter have been described. Other embodiments are within the scope of the attached patent application. In some cases, the actions described in the scope of the patent application can be performed in a different order and still achieve desired results. In addition, the processes depicted in the drawings are not necessarily in the specific order or sequential order shown in order to achieve the desired result. In some implementations, multitasking and parallel processing may be advantageous.

以上所述僅為本發明一個或多個實施例的較佳實施例而已,並不用以限制本發明一個或多個實施例,凡在本發明一個或多個實施例的精神和原則之內,所做的任何修改、等同替換、改進等,均應包含在本發明一個或多個實施例保護的範圍之內。The foregoing descriptions are only preferred embodiments of one or more embodiments of the present invention, and are not intended to limit one or more embodiments of the present invention. All within the spirit and principle of one or more embodiments of the present invention, Any modifications, equivalent replacements, improvements, etc. made should be included in the protection scope of one or more embodiments of the present invention.

100~104, 200~208, 2041~2043, 400~414:步驟 51:獲取模組 52:頻率控制模組 53:頻率設置模組 54:任務解析模組 55:介面模組 700:電子設備 710:儲存裝置 711:指令 720:處理器 730:通訊介面 740:匯流排 750:晶片100~104, 200~208, 2041~2043, 400~414: steps 51: Obtain modules 52: Frequency control module 53: Frequency setting module 54: Task Analysis Module 55: Interface Module 700: electronic equipment 710: storage device 711: instruction 720: processor 730: Communication interface 740: Bus 750: chip

圖1繪示了本發明一些實施例提供的晶片工作頻率的設置方法的流程圖。 圖2繪示了本發明一些實施例提供的晶片工作頻率的設置方法的另一流程圖。 圖3繪示了本發明一些實施例提供的預設映射關係的建立過程的另一流程圖。 圖4繪示了本發明一些實施例提供的晶片工作頻率的設置方法的另一流程圖。 圖5繪示了本發明一些實施例提供的晶片工作頻率的設置裝置的方塊圖。 圖6繪示了本發明一些實施例提供的晶片工作頻率的設置裝置的另一方塊圖。 圖7繪示了本發明一些實施例提供的晶片工作頻率的電子設備的方塊圖。FIG. 1 shows a flowchart of a method for setting the operating frequency of a wafer according to some embodiments of the present invention. FIG. 2 illustrates another flow chart of a method for setting the operating frequency of a wafer according to some embodiments of the present invention. FIG. 3 shows another flowchart of the process of establishing a preset mapping relationship provided by some embodiments of the present invention. FIG. 4 shows another flowchart of a method for setting the operating frequency of a wafer provided by some embodiments of the present invention. FIG. 5 shows a block diagram of a device for setting the operating frequency of a chip provided by some embodiments of the present invention. FIG. 6 shows another block diagram of the device for setting the operating frequency of a chip provided by some embodiments of the present invention. FIG. 7 illustrates a block diagram of an electronic device with a chip operating frequency provided by some embodiments of the present invention.

100~104:步驟100~104: Step

Claims (15)

一種晶片工作頻率的設置方法,所述方法包括: 獲取目標任務的多個子任務以及每個子任務的任務參數,所述任務參數包括用於表示所述子任務的運算規模的參數; 基於所述多個子任務中所述每個子任務的所述任務參數,確定所述每個子任務的目標晶片頻率; 根據確定的所述每個子任務的所述目標晶片頻率,設置晶片執行所述每個子任務的工作頻率。A method for setting the working frequency of a wafer, the method comprising: Acquiring multiple subtasks of the target task and task parameters of each subtask, where the task parameters include parameters used to indicate the operation scale of the subtasks; Determining the target chip frequency of each subtask based on the task parameter of each subtask in the plurality of subtasks; According to the determined target wafer frequency of each subtask, the operating frequency of the wafer for executing each subtask is set. 如請求項1所述的方法,其中所述方法還包括: 對所述目標任務進行任務解析處理,得到所述多個子任務以及所述每個子任務的所述任務參數; 儲存所述多個子任務中所述每個子任務與所述每個子任務的所述任務參數的對應關係; 其中獲取所述目標任務的所述多個子任務以及所述每個子任務的所述任務參數的步驟包括:從儲存的所述對應關係中查找所述每個子任務的所述任務參數。The method according to claim 1, wherein the method further includes: Performing task analysis processing on the target task to obtain the multiple subtasks and the task parameters of each of the subtasks; Storing the corresponding relationship between each subtask and the task parameter of each subtask among the plurality of subtasks; The step of acquiring the multiple subtasks of the target task and the task parameters of each subtask includes: searching the task parameters of each subtask from the stored correspondence. 如請求項1或2所述的方法,其中所述任務參數包括如下至少一項:所述子任務的計算量、所述子任務的訪存量。The method according to claim 1 or 2, wherein the task parameter includes at least one of the following: a calculation amount of the subtask, and a memory access amount of the subtask. 如請求項1至3中任一項所述的方法,其中基於所述多個子任務中所述每個子任務的所述任務參數,確定所述每個子任務的所述目標晶片頻率的步驟包括: 獲取所述晶片所在設備的設備資訊,所述設備資訊包括設備資源資訊; 基於所述設備資訊和所述多個子任務中所述每個子任務的所述任務參數,確定所述每個子任務的所述目標晶片頻率。The method according to any one of claim items 1 to 3, wherein the step of determining the target chip frequency of each subtask based on the task parameter of each subtask of the plurality of subtasks includes: Acquiring device information of the device where the chip is located, where the device information includes device resource information; The target chip frequency of each subtask is determined based on the equipment information and the task parameter of each subtask of the plurality of subtasks. 如請求項4所述的方法,其中所述設備資訊還包括:所述晶片的晶片溫度; 其中基於所述設備資訊和所述多個子任務中所述每個子任務的所述任務參數,確定所述每個子任務的所述目標晶片頻率的步驟包括: 基於所述多個子任務中第一子任務的任務參數、設備資源資訊和所述第一子任務執行時的晶片溫度,確定所述第一子任務的目標晶片頻率。The method according to claim 4, wherein the device information further includes: the wafer temperature of the wafer; The step of determining the target chip frequency of each subtask based on the equipment information and the task parameters of each of the plurality of subtasks includes: The target chip frequency of the first subtask is determined based on the task parameters of the first subtask among the plurality of subtasks, equipment resource information, and the wafer temperature when the first subtask is executed. 如請求項4或5所述的方法,其中基於所述設備資訊和所述多個子任務中所述每個子任務的所述任務參數,確定所述每個子任務的所述目標晶片頻率的步驟包括: 獲取多個第一資料和多個第二資料之間的預設映射關係,所述第一資料包括預設任務參數和預設設備資訊,所述第二資料包括預設晶片頻率; 根據所述預設映射關係、所述設備資訊以及所述每個子任務的所述任務參數,確定所述每個子任務的所述目標晶片頻率。The method according to claim 4 or 5, wherein the step of determining the target chip frequency of each subtask based on the equipment information and the task parameter of each of the plurality of subtasks includes : Acquiring a preset mapping relationship between a plurality of first data and a plurality of second data, where the first data includes preset task parameters and preset device information, and the second data includes a preset chip frequency; The target chip frequency of each subtask is determined according to the preset mapping relationship, the equipment information, and the task parameter of each subtask. 如請求項6所述的方法,其中根據所述預設映射關係、所述設備資訊以及所述每個子任務的所述任務參數,確定所述每個子任務的所述目標晶片頻率的步驟包括: 確定第三資料與所述預設映射關係中的所述多個第一資料中每個第一資料之間的距離,所述第三資料包括所述多個子任務中所述第一子任務的所述任務參數和所述設備資訊; 將所述預設映射關係中與所述第三資料距離最近的所述第一資料對應的預設晶片頻率,作為所述第一子任務的所述目標晶片頻率。The method according to claim 6, wherein the step of determining the target chip frequency of each subtask according to the preset mapping relationship, the device information, and the task parameters of each subtask includes: Determine the distance between the third data and each first data in the plurality of first data in the preset mapping relationship, and the third data includes the information of the first subtask among the plurality of subtasks. The task parameters and the equipment information; The predetermined chip frequency corresponding to the first data closest to the third data in the predetermined mapping relationship is used as the target chip frequency of the first subtask. 如請求項6或7所述的方法,其中在獲取所述多個第一資料和所述多個第二資料之間的所述預設映射關係的步驟之前,所述方法還包括: 獲取多組可選晶片頻率,並獲取採樣得到的離散的所述多個第一資料; 對於所述多個第一資料中的每個所述第一資料,由所述多組可選晶片頻率中選擇一組晶片頻率作為與每個所述第一資料對應的第二資料,並建立每個所述第一資料和選擇的所述第二資料之間的映射關係。The method according to claim 6 or 7, wherein before the step of obtaining the preset mapping relationship between the plurality of first data and the plurality of second data, the method further includes: Acquiring multiple sets of selectable chip frequencies, and acquiring the plurality of discrete first data obtained by sampling; For each of the first data in the plurality of first data, select a set of chip frequencies from the plurality of selectable chip frequencies as the second data corresponding to each of the first data, and create The mapping relationship between each of the first data and the selected second data. 如請求項6至8中任一項所述的方法,其中所述預設映射關係中與所述第一資料對應的預設晶片頻率是基於在多組可選晶片頻率中每組可選晶片頻率的條件下所述第一資料對應的性能評估參數,從所述多組可選晶片頻率中選擇的。The method according to any one of claim items 6 to 8, wherein the preset chip frequency corresponding to the first data in the preset mapping relationship is based on each group of optional chip frequencies among multiple groups of optional chip frequencies The performance evaluation parameter corresponding to the first data under the condition of frequency is selected from the multiple sets of optional chip frequencies. 如請求項1至9任一項所述的方法,其中基於所述多個子任務中所述每個子任務的所述任務參數,確定所述每個子任務的所述目標晶片頻率的步驟包括: 基於所述多個子任務中所述每個子任務的所述任務參數,由多組可選晶片頻率中,選擇能夠使得所述晶片在晶片功耗限制條件下實現任務運行時間最低的晶片頻率,作為所述目標晶片頻率。The method according to any one of claim items 1 to 9, wherein the step of determining the target chip frequency of each subtask based on the task parameter of each subtask in the plurality of subtasks includes: Based on the task parameters of each of the multiple subtasks, from a plurality of sets of optional chip frequencies, select the chip frequency that enables the chip to achieve the lowest task running time under the limit of chip power consumption, as The target chip frequency. 如請求項1至10任一項所述的方法,其中所述方法還包括: 接收用戶輸入的頻率設置策略資訊; 其中基於所述多個子任務中所述每個子任務的所述任務參數,確定所述每個子任務的所述目標晶片頻率的步驟包括:基於所述頻率設置策略資訊和所述多個子任務中所述每個子任務的所述任務參數,確定所述每個子任務的所述目標晶片頻率。The method according to any one of claims 1 to 10, wherein the method further comprises: Receive frequency setting strategy information input by the user; The step of determining the target chip frequency of each subtask based on the task parameters of each of the plurality of subtasks includes: setting strategy information based on the frequency and all of the plurality of subtasks The task parameters of each subtask determine the target wafer frequency of each subtask. 如請求項1至11任一項所述的方法,其中所述工作頻率包括如下至少一項:所述晶片的核心頻率、或者儲存裝置頻率。The method according to any one of claims 1 to 11, wherein the operating frequency includes at least one of the following: a core frequency of the chip or a storage device frequency. 一種晶片工作頻率的設置裝置,其中所述裝置包括: 獲取模組,用於獲取目標任務的多個子任務以及每個所述子任務的任務參數,所述任務參數包括用於表示所述子任務的運算規模的參數; 頻率控制模組,用於基於所述多個子任務中所述每個子任務的所述任務參數,確定所述每個子任務的目標晶片頻率; 頻率設置模組,用於根據確定的所述每個子任務的所述目標晶片頻率,設置晶片執行所述每個子任務的工作頻率。A device for setting the operating frequency of a wafer, wherein the device comprises: An obtaining module for obtaining multiple subtasks of the target task and task parameters of each of the subtasks, where the task parameters include parameters used to indicate the operation scale of the subtasks; A frequency control module, configured to determine the target chip frequency of each subtask based on the task parameter of each of the multiple subtasks; The frequency setting module is used for setting the working frequency of the chip to execute each subtask according to the determined target chip frequency of each subtask. 一種電子設備,包括:儲存裝置、處理器,所述儲存裝置用於儲存電腦可讀指令,所述處理器用於調用所述電腦可讀指令,實現請求項1至12任一項所述的方法。An electronic device comprising: a storage device and a processor, the storage device is used to store computer-readable instructions, and the processor is used to call the computer-readable instructions to implement the method described in any one of claim items 1 to 12 . 一種電腦可讀取記錄媒體,其上儲存有電腦程式,其中所述電腦程式被處理器執行時,所述處理器實現請求項1至12任一項所述的方法。A computer-readable recording medium has a computer program stored thereon, wherein when the computer program is executed by a processor, the processor implements the method described in any one of request items 1 to 12.
TW109127158A 2019-11-29 2020-08-11 Method and apparatus for setting operating frequency of chip, electronic device, and storage medium TWI743934B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911201455.9 2019-11-29
CN201911201455.9A CN112882819B (en) 2019-11-29 2019-11-29 Method and device for setting chip working frequency

Publications (2)

Publication Number Publication Date
TW202121116A true TW202121116A (en) 2021-06-01
TWI743934B TWI743934B (en) 2021-10-21

Family

ID=76038734

Family Applications (1)

Application Number Title Priority Date Filing Date
TW109127158A TWI743934B (en) 2019-11-29 2020-08-11 Method and apparatus for setting operating frequency of chip, electronic device, and storage medium

Country Status (5)

Country Link
JP (1) JP2022516549A (en)
KR (1) KR20210098508A (en)
CN (1) CN112882819B (en)
TW (1) TWI743934B (en)
WO (1) WO2021103618A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114785376B (en) * 2022-05-06 2023-07-21 Oppo广东移动通信有限公司 Frequency-voltage pre-configuration method and related device

Family Cites Families (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPWO2003083693A1 (en) * 2002-04-03 2005-08-04 富士通株式会社 Task scheduling device in distributed processing system
US7206950B2 (en) * 2004-06-16 2007-04-17 Matsushita Electric Industrial Co., Ltd. Processor system, instruction sequence optimization device, and instruction sequence optimization program
WO2006011189A1 (en) * 2004-07-26 2006-02-02 Mitsubishi Denki Kabushiki Kaisha Parallel computer
US20100064124A1 (en) * 2006-11-16 2010-03-11 Karl Rinne Digital power controller
TWI336453B (en) * 2006-12-18 2011-01-21 Asustek Comp Inc Method for adjusting working frequency of chip
WO2009047853A1 (en) * 2007-10-11 2009-04-16 Fujitsu Limited Information processor, operation control method, and operation control program
EP2362297B1 (en) * 2010-02-25 2014-05-14 Telefonaktiebolaget L M Ericsson (publ) Technique for selecting a frequency of operation in a processor system
US8381004B2 (en) * 2010-05-26 2013-02-19 International Business Machines Corporation Optimizing energy consumption and application performance in a multi-core multi-threaded processor system
CN102169357B (en) * 2011-02-23 2013-05-08 北京大学深圳研究生院 DSP (Digital Signal Processor) capable of regulating working voltage and clock frequency and regulating method thereof
KR101885857B1 (en) * 2012-01-04 2018-08-06 삼성전자주식회사 Temperature management unit, system on chip including the same and method of managing temperature in a system on chip
JP5898342B2 (en) * 2012-12-21 2016-04-06 ルネサスエレクトロニクス株式会社 Semiconductor device and control method thereof
US9494996B2 (en) * 2013-03-15 2016-11-15 Intel Corporation Processor having frequency of operation information for guaranteed operation under high temperature events
US9400518B2 (en) * 2013-06-05 2016-07-26 Qualcomm Innovation Center, Inc. Temporary frequency adjustment of mobile device processors based on task migration
CN103955264B (en) * 2014-05-15 2016-10-12 乐视致新电子科技(天津)有限公司 Dynamically regulate the method and system of processor working frequency
CN104407690B (en) * 2014-12-19 2018-03-06 中科创达软件股份有限公司 Adjust the method, device and mobile terminal of CPU working frequencies
CN105045702B (en) * 2015-07-22 2018-03-20 Tcl移动通信科技(宁波)有限公司 It is a kind of that the method for chip, system and chip are protected according to chip temperature
CN106527653A (en) * 2016-10-12 2017-03-22 东软集团股份有限公司 CPU frequency adjusting method and apparatus
JP2018106591A (en) * 2016-12-28 2018-07-05 ルネサスエレクトロニクス株式会社 Semiconductor device, operation control method, and program
CN108334405A (en) * 2017-01-20 2018-07-27 阿里巴巴集团控股有限公司 Frequency isomery CPU, frequency isomery implementation method, device and method for scheduling task
US10921874B2 (en) * 2017-03-06 2021-02-16 Facebook Technologies, Llc Hardware-based operating point controller for circuit regions in an integrated circuit
CN107357658A (en) * 2017-06-29 2017-11-17 上海斐讯数据通信技术有限公司 A kind of method and system for adjusting mobile terminal cpu frequency
CN109212306B (en) * 2017-07-06 2021-02-26 龙芯中科技术股份有限公司 Method, circuit and device for adjusting chip power consumption
CN107562682A (en) * 2017-08-01 2018-01-09 华南理工大学 Communication means based on many-core chip coker heat energy in the heart
CN107678855B (en) * 2017-09-19 2020-06-12 中国电子产品可靠性与环境试验研究所 Processor dynamic adjustment method and device and processor chip
CN108268265A (en) * 2018-01-24 2018-07-10 深圳市道通科技股份有限公司 Link mapping method, software code method for burn-recording and the burning host in common code library

Also Published As

Publication number Publication date
CN112882819B (en) 2022-03-08
KR20210098508A (en) 2021-08-10
CN112882819A (en) 2021-06-01
WO2021103618A1 (en) 2021-06-03
TWI743934B (en) 2021-10-21
JP2022516549A (en) 2022-02-28

Similar Documents

Publication Publication Date Title
US20180157711A1 (en) Method and apparatus for processing query based on heterogeneous computing device
JP7287397B2 (en) Information processing method, information processing apparatus, and information processing program
WO2020206637A1 (en) Deep network acceleration methods and apparatuses based on data stream, device, and storage medium
KR20240005113A (en) Holistic global performance and power management
TWI775210B (en) Data dividing method and processor for convolution operation
TWI743934B (en) Method and apparatus for setting operating frequency of chip, electronic device, and storage medium
CN116521380A (en) Resource self-adaptive collaborative model training acceleration method, device and equipment
US10409350B2 (en) Instruction optimization using voltage-based functional performance variation
US20210256373A1 (en) Method and apparatus with accelerator
CN110069284A (en) A kind of Compilation Method and compiler based on OPU instruction set
CN108897619B (en) Multi-level resource flexible configuration method for super computer
WO2018168695A1 (en) Distributed machine learning device, distributed machine learning method, and distributed machine learning recording medium
CN114675975B (en) Job scheduling method, device and equipment based on reinforcement learning
CN112988275B (en) Task perception-based mobile edge computing multi-user computing unloading method
CN114429195A (en) Performance optimization method and device for hybrid expert model training
WO2021180190A1 (en) Method for generating and processing single instruction multiple data (simd) instruction, and related device
CN115309502A (en) Container scheduling method and device
CN108763381A (en) Divide table method and apparatus based on consistency hash algorithm
JP6492779B2 (en) Mapping information generating program, mapping information generating method, and mapping information generating apparatus
US20200004503A1 (en) Information processing device, information processing method, and computer readable medium
JP2018132899A (en) Storage method, storage device and storage program
CN115965070B (en) Computational graph processing method, apparatus, device, storage medium, and program product
CN113596994B (en) Wireless video transmission resource allocation method and device and electronic equipment
WO2022178731A1 (en) Operating method and apparatus for accelerator
TW202328984A (en) Control method and system based on layer-wise adaptive channel pruning