Adaptive frequency modification scheme for hardware accelerator during inferencing of machine learning model
By dynamically adjusting the frequency of hardware accelerators based on memory bandwidth, the inefficiencies in power usage on resource-constrained devices are addressed, enhancing performance and reducing power consumption during machine learning model inferencing.
Patent Information
- Application Number
- PCT/CN2024/114693
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2026-03-05
AI Technical Summary
Resource-constrained devices face inefficiencies in power usage due to fixed hardware accelerator frequencies during machine learning model inferencing, leading to idle computation units and memory, especially in layers with varying arithmetic intensity.
Dynamically adjust the frequency of the hardware accelerator based on memory bandwidth utilization to minimize power loss by reducing frequency during memory-bound layers.
Improves power efficiency by optimizing hardware accelerator operation, ensuring high-speed inference and reduced power consumption on resource-constrained devices.
Smart Images

Figure CN2024114693_05032026_PF_FP_ABST
Abstract
Description
ADAPTIVE FREQUENCY MODIFICATION SCHEME FOR HARDWARE ACCELERATOR DURING INFERENCING OF MACHINE LEARNING MODEL
[0001] INTRODUCTION
[0002] Aspects of the present disclosure relate to machine learning.BACKGROUND
[0003] A wide variety of machine learning model architectures have been trained to perform an assortment of diverse tasks, including computer vision tasks, language tasks, classification and regression tasks, and the like. Recently, research has yielded substantial success in using large models (e.g., deep neural networks, large language models (LLMs) , large vision models (LVMs) , large multimodal models (LMMs) , and the like) to process and generate output data. These large models are computationally expensive during inference (e.g., relying on substantial memory and power) , rendering use of many modern machine learning models intractable on resource-constrained devices (e.g., battery operated devices and the like) .
[0004] BRIEF SUMMARY
[0005] The following description and the related drawings set forth in detail certain illustrative features of one or more aspects.
[0006] In one aspect, a method for machine learning is provided. The method generally includes: inferencing a machine learning model using a hardware accelerator of an electronic device; monitoring bandwidth of memory of the electronic device during the inferencing, the memory being separate from the hardware accelerator; determining a current bandwidth of the memory corresponds to a threshold bandwidth based on the monitoring; and adjusting a frequency for the hardware accelerator based on the determining.
[0007] In another aspect, an apparatus is provided. The apparatus includes a hardware accelerator, memory that is separate from the hardware accelerator, one or more processors configured to perform operations comprising: inferencing a machine learning model using the hardware accelerator; monitoring bandwidth of the memory during the inferencing; determining a current bandwidth of the memory corresponds to a threshold bandwidth based on the monitoring; and adjusting a frequency for the hardware accelerator based on the determining.
[0008] In yet another aspect, a non-transitory computer-readable medium is provided. The non-transitory computer-readable medium includes instructions to be executed in a processor, wherein the instructions when executed in the processor cause the processor to perform operations comprising: inferencing a machine learning model using a hardware accelerator of an electronic device; monitoring bandwidth of memory of the electronic device during the inferencing, the memory being separate from the hardware accelerator; determining a current bandwidth of the memory corresponds to a threshold bandwidth based on the monitoring; and adjusting a frequency for the hardware accelerator based on the determining.BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The appended figures depict example features of certain aspects of the present disclosure and are therefore not to be considered limiting of the scope of this disclosure.
[0010] FIG. 1 depicts an example architecture for a machine learning model according to aspects of the present disclosure.
[0011] FIG. 2 depicts a block diagram illustrating components of a hardware accelerator according to aspects of the present disclosure.
[0012] FIG. 3A depicts a graph illustrating a memory roofline of a memory device according to some aspects of the present disclosure.
[0013] FIG. 3B depicts a table classifying different layers of a machine learning model as compute-bound or memory-bound according to some aspects of the present disclosure.
[0014] FIG. 4 depicts a graph illustrating different layers of a machine learning model as being compute-bound or memory-bound according to some aspects of the present disclosure.
[0015] FIG. 5 depicts a system for dynamically adjusting a frequency for a hardware accelerator during inferencing of a machine learning model according to some aspects of the present disclosure.
[0016] FIG. 6 depicts a flow diagram of a method for dynamically adjusting a frequency for a hardware accelerator during inferencing of a machine learning model according to some aspects of the present disclosure.
[0017] FIG. 7 depicts a flow diagram of a method for machine learning according to some aspects of the present disclosure.
[0018] FIG. 8 depicts an example processing system configured to perform various aspects of the present disclosure.
[0019] To facilitate understanding, identical reference numerals have been used, where possible, to designate identical elements that are common to the drawings. It is contemplated that elements and features of one aspect may be beneficially incorporated in other aspects without further recitation.DETAILED DESCRIPTION
[0020] Aspects of the present disclosure provide apparatuses, methods, processing systems, and non-transitory computer-readable mediums for providing improved machine learning. Specifically, in some aspects of the present disclosure, techniques for dynamically adjusting a frequency (e.g., clock signal) for a hardware accelerator (e.g., of a resource-constrained electronic device) during inferencing of a machine learning model.
[0021] Example aspects of the present disclosure are directed to inferencing machine learning models using a hardware accelerator on a resource-constrained electronic device, such as a smartphone, table, or IoT. The operating frequency of the hardware accelerator is typically fixed (e.g., stays the same) when executing the different layers of a machine learning model. However, the arithmetic intensity associated with executing the different layers of the machine learning model is not uniform. For example, the arithmetic intensity associated with the hardware accelerator executing one layer (e.g., a transformer layer) of the machine learning may be different (e.g., lower) than the arithmetic intensity associated with the hardware accelerator executing another layer (e.g., a different transformer layer) of the machine learning model. Layers of the machine learning model that require less than a threshold arithmetic intensity may result in the hardware accelerator being idle for at least a duration of the time it takes to execute such layers of the machine learning model. Since the hardware accelerator draws power even when idle, powering the hardware accelerator during execution of such layers of the machine learning represents a power loss, which is generally undesirable given that the resource-constrained electronic device has a limited amount of power.
[0022] Example aspects of the present disclosure are directed to techniques for dynamically adjusting a frequency (e.g., of a clock signal) for the hardware accelerator (e.g., neural processing unit) during inferencing of a machine learning model. For example, in some aspects, the disclosed techniques may include dynamically adjusting the frequency for the hardware accelerator when executing a layer of the machine learning model that utilizes the maximum bandwidth of remote memory (e.g., double data rate memory) of the resource-constrained electronic device. More specifically, the frequency of the hardware accelerator may be reduced (e.g., lowered) such that the maximum bandwidth of the remote memory is no longer utilized. In this manner, the power losses that come with the hardware accelerator being idle (e.g., due to the remote memory operating at the maximum bandwidth) during the execution of the layer of the machine learning model may be minimized (or at least reduced) .
[0023] Example Architecture for Large Language Processing Models
[0024] FIG. 1 depicts an example architecture 100 for a LLM 102 according to some aspects of the present disclosure.
[0025] In some aspects, the architecture 100 for the LLM 102 may be a neural network architecture. For instance, the architecture 100 may include an embedding layer 104, a plurality of transformer layers 106, and a prediction head layer 108. Each of the plurality of transformer layers 106 may include multiple operators, with each of the operators configured to perform a different function (e.g., input normalization, matrix multiplication, elementwise operations) .
[0026] The LLM 102 may be used to generate or predict outputs for new, unseen inputs. This process of prompting the LLM 102 with new, unseen inputs to prompt the LLM 102 to generate or predict outputs may be referred to as “inferencing” the LLM 102. As illustrated, an input token 110 may be provided to the LLM 102 to inference the LLM 102. In some aspects, the input token 110 may be representative of natural language text that, in some aspects, may have been included in a prompt for the LLM 102.
[0027] The input token 110 may be provided to the embedding layer 104 of the LLM 102. The embedding layer 104 may be configured to process the input token 110 (e.g. a token) to generate an embedding 114 of the input token 110. For instance, the embedding layer 104 may be configured to convert the input token 110 into a continuous, dense vector (e.g., the embedding 114) .
[0028] The embedding 114 of the input token 112 may be provided to an initial transformer layer 116 of the plurality of transformer layers 106. The initial transformer layer 116 may process the embedding 114 to generate an initial output 118 (e.g., an attention output) . For instance, one or more of the multiple operators included in the initial transformer layer 116 may process the embedding 114 to generate the initial output 118 that, as illustrated in FIG. 1, may be provided to a subsequent transformer layer 120.
[0029] The subsequent transformer layer 120 may process the initial output 118 to generate an intermediate output 122 (e.g., another attention output) . For instance, one or more of the multiple operators included in the subsequent transformer layer 120 may process the initial output 118 to generate the intermediate output 122 that, as illustrated in FIG. 1, may be provided to a final transformer layer 124.
[0030] The final transformer layer 124 may process the intermediate output 122 to generate a final output 126 (e.g., another attention output) . For instance, one or more of the multiple operators included in the final transformer layer 124 may process the intermediate output 122 to generate the final output 126 that, as illustrated in FIG. 1, may be provided to the prediction head layer 108 of the LLM 102.
[0031] In some aspects, the prediction head layer 108 may be configured to transform the final output 126 received from the final transformer layer 124 into a format that can be used for text generation. For instance, the prediction head layer 108 may transform the final output 126 into a probability distribution over the vocabulary of the LLM 102. In some aspects, the prediction head layer 108 may apply a linear transformation to the final output 126 to map the feature representations to the size of the vocabulary. This linear transformation may be parameterized by a weight matrix and a bias term, which may be learned during training of the LLM 102. In some aspects, the prediction head layer 108 may include an activation function (e.g., a softmax function) that may be applied to the linearly transformed output to normalize the values into a valid probability distribution. Furthermore, in some aspects, the resulting probability distribution may be projected onto a token embedding matrix (not shown) of the LLM 102. The resulting probability distribution over the vocabulary may represent a prediction of the next token, which is a critical output for language modeling, text generation, and other natural language processing tasks.
[0032] Example Hardware Accelerator for Performing Computations for Machine Learning Inference
[0033] FIG. 2 depicts a block diagram of a hardware accelerator 200 according to some aspects of the present disclosure. In some aspects, the hardware accelerator 200 may be a component of a resource-constrained electronic device (e.g., smartphone, tablet, IoT device) on which a machine learning model (e.g., the LLM 102 of FIG. 1) is deployed. In some aspects, the hardware accelerator 200 may be a neural processing unit. In other aspects, the hardware accelerator 200 may be a graphics processing unit.
[0034] The hardware accelerator 200 may include local memory 202 (e.g., on-chip memory) . In some aspects, the local memory 202 may be a specialized type of memory designed for accelerating the inference of machine learning models, such as the LLM 102 of FIG. 1. For example, the local memory 202 may include vector tightly coupled memory (VTCM) .
[0035] The hardware accelerator 200 may include a plurality of computation units 204. For example, in some aspects, the plurality of computation units 204 may include at least one of a matrix computation unit 206, a vector computation unit 208, and a scalar computation unit 210.
[0036] To execute a layer (e.g, . one of the plurality of transformer layers 106 in FIG. 1) of the machine learning model, data 212 related to the layer of the machine learning model that is stored in a remote memory 214 (e.g., double data rate, high-bandwidth memory) that is separate (e.g., off-chip) from the hardware accelerator 200 may be loaded onto the local memory 202 of the hardware accelerator 200. One or more of the computation units 204 may access (e.g., retrieve) the data 212 from the local memory 202 and perform computations based on the data 212. Furthermore, the computation unit (s) 204 may store a result 216 of the computations in the local memory 202. In some aspects, the result 216 of the computations may offloaded to the remote memory 214 as illustrated in FIG. 2.
[0037] In some aspects, a layer of the machine learning model may represent a computation bottleneck or a memory bottleneck. A layer may be classified as a computation bottleneck or a memory bottleneck based on an arithmetic intensity (e.g., measured in operations per byte) associated with executing the layer. For example, if an arithmetic intensity associated with executing the layer exceeds (e.g., is greater than) a threshold arithmetic intensity, the layer may require extensive computations but minimal memory access and may therefore be classified as a computation bottleneck. Alternatively, if the arithmetic intensity associated with executing layer does not exceed (e.g., is less than) the threshold arithmetic intensity, the layer may require substantial memory accesses with fewer computational demands and therefore may be classified as a memory bottleneck.
[0038] Examples of Compute-Bound and Memory-Bound Layers of a Machine Learning
[0039] FIG. 3A depicts a graph 300 illustrating computational performance for layers of a machine learning model as a function of arithmetic intensity according to some aspects of the present disclosure. The graph 300 includes a line 302 (e.g., memory roofline) having a slope representing a maximum memory bandwidth available on the resource-constrained electronic device on which the machine learning model is being inferenced. For example, the maximum memory bandwidth may be for the remote memory 214 discussed above with reference to FIG. 2.
[0040] As illustrated, the graph 300 depicts a turning point 304 corresponding to a threshold arithmetic intensity (e.g., depicted along the horizontal axis of the graph 300) . The arithmetic intensity for a given layer of the machine learning model may be determined by dividing the required operations associated with executing the given layer by an amount of data transferred (e.g., to and from the remote memory 214) while executing the given layer. Thus, layers of the machine learning model having an arbitration intensity that is less than the threshold arithmetic intensity (e.g., the turning point 304) are within a memory-bound region 306 of the graph 300. Conversely, layers of the machine learning model having an arbitration intensity that is greater than threshold arbitration intensity are within a compute-bound region 308 of the graph 300.
[0041] FIG. 3B depicts a table 320 classifying different layers of a machine learning model as being memory-bound (e.g., a memory-bottleneck) or compute-bound (e.g., a compute-bottleneck) . For example, a first row of the table 320 includes a first layer (e.g., q-proj) that is classified as compute-bound because an arithmetic intensity (e.g., 1024) associated with executing the first layer exceeds the threshold arithmetic intensity. A second row of the table 320 includes a second layer (e.g., k-proj) that is also classified as compute-bound because an arithmetic intensity (e.g., also 1024) associated with executing the second layer exceeds the threshold arithmetic intensity. A third row of the table 320 and a fourth row of the table 320 include a third layer (e.g., qk matmul) and a fourth layer (e.g., softmax) , respectively. As illustrated, the third layer and the fourth layer are both classified as memory-bound, because an arithmetic intensity (e.g., 114 for the third layer and 1.25 for the fourth layer) of both layers is less than the threshold arithmetic intensity.
[0042] When a layer of the machine learning model is memory-bound, the computational workload required per memory access is low and saturating the peak bandwidth (e.g., of the remote memory 214) does not fully utilize all of the computation units (e.g., the computation units 204 in FIG. 2) of the hardware accelerator. In such instances, some of the computation units may remain idle. When a layer of the machine learning model is compute-bound, only a small amount of memory access occurs to consume a significant amount of computational capability. In such instance, some memory (e.g., the remote memory 214) may remain idle. Both instances (e.g., compute-bound and memory-bound) may result in an inefficient utilization of power (e.g., powering idle computation units or memory units) on a device (e.g., smartphone, tablet, IoT) having a limited power supply (e.g., a battery) .
[0043] FIG. 4 depicts a graph 400 including a waveform 402 indicative of bandwidth utilization of a memory (e.g., remote memory 214 in FIG. 2) during inferencing of a machine learning model (e.g., the LLM 102 in FIG. 1) .
[0044] As illustrated, a first region 404 of the waveform 402 corresponds to a first layer of the machine learning model that is compute-bound. A second region 406 of the waveform 402 corresponds to a second layer of the machine learning model that is memory-bound. A third region 408 of the waveform 402 corresponds to a third layer of the machine learning model that is also memory-bound.
[0045] Example aspects of the present disclosure are directed to a technique for dynamically adjusting an operating frequency (e.g., a clock signal) for the hardware accelerator while executing the machine learning model. More specifically, the disclosed technique is directed to adjusting the frequency of the hardware accelerator when executing memory-bound layers of the machine learning model. For example, when executing such memory-bound layers of the machine learning model, the hardware accelerator is idle. Thus, by adjusting the frequency of the hardware accelerator when executing memory-bound layers of the machine learning model, the disclosed techniques allow each inference (e.g., token generation) of the machine learning model to be performed at a high speed.
[0046] Example System for Dynamically Adjusting a Frequency of a Hardware Accelerator During Inferencing of a Machine Learning Model
[0047] FIG. 5 depicts a system 500 for dynamically adjusting a frequency of a hardware accelerator during inferencing of a machine learning model according to some aspects of the present disclosure. The system 500 will be discussed in the context of the hardware accelerator 200 discussed above with reference to FIG. 2.
[0048] As illustrated, the system 500 may include a frequency controller 502. The frequency controller 502 may obtain (e.g., monitor) bandwidth data 504 for the remote memory 214 during inferencing of the machine learning model. In some aspects, the frequency controller 502 may obtain the bandwidth data 504 continuously. In other aspects, the frequency controller 502 may request the bandwidth data 504 at discrete intervals of time. For instance, in some aspects, the frequency controller 502 may obtain bandwidth data 504 each time the hardware accelerator 200 begins executing a next layer of the machine learning model.
[0049] In some aspects, the frequency controller 502 may be configured to compare the bandwidth data 504 to a frequency map for the hardware accelerator 200. Based on the comparison, the frequency controller 502 may take no action or generate a frequency adjustment 506. The frequency adjustment 506 may be provided to the hardware accelerator 200. In some aspects, the frequency adjustment 506 may be a control signal that, when received by the hardware accelerator 200, causes the hardware accelerator 200 to adjust (e.g., increase or decrease) its operating frequency from a first frequency label (e.g., associated with a first power mode of the hardware accelerator 200) to a second frequency label (e.g., associated with a second power mode of the hardware accelerator 200) . By monitoring the bandwidth of the remote memory 214 while the hardware accelerator 200 is executing the machine learning, the frequency controller 502 can detect layers of the machine learning model that saturate the bandwidth of the remote memory 214 resulting in a memory-bottleneck. Furthermore, by dynamically adjusting the operating frequency of the hardware accelerator 200, the frequency controller 502 can correct for the memory-bottleneck and avoid power losses (e.g., powering idle computation units) associated with the memory-bottleneck. In this manner, the system 500 may improve operation of resource-constrained devices (e.g., smartphone, tablet, etc. ) on which the hardware accelerator is implemented (e.g., due to the minimized power losses associated with inferencing the machine learning model) .
[0050] Example Method for Dynamically Adjusting a Frequency of a Hardware Accelerator During Inferencing of a Machine Learning Model
[0051] FIG. 6 depicts a flow diagram of a method 600 for dynamically adjusting a frequency of a hardware accelerator during inferencing of a machine learning model according to some aspects of the present disclosure. The method 600 may be implemented using the system 500 discussed above with reference to FIG. 5. Furthermore, although FIG. 6 depicts steps performed in a particular order for purposes of illustration and discussion, the method 600 discussed herein is not intended to be limited to any particular order or arrangement. One skilled in the art, using the disclosure provided herein, will appreciate that various steps of the method 600 can be omitted, rearranged, combined and / or adapted in various ways without deviating from the scope of the present disclosure.
[0052] At (602) , the method 600 includes building a layer-frequency map of the machine learning model. For example, the layer-frequency map may include each of the different layers (e.g., the plurality of transformer layers 106 in FIG. 1) of the machine learning model. In some aspects, building the layer-frequency map may include assigning a frequency label to each of the different layers of the machine learning model. For example, in some aspects, the same frequency label may be assigned to each of the different layers of the machine learning model. In other aspects, different frequency labels may be assigned to one or more of the layers. For example, a first frequency label (e.g., associated with a first power setting of the hardware accelerator) may be assigned to one or more layers of the machine learning model and a second frequency label (e.g., associated with a second power setting of the hardware accelerator) may be assigned to one or more layers of the machine learning model.
[0053] At (604) , the method 600 include inferencing the machine learning model according to the layer-frequency map. In some aspects, inferencing the machine learning model may include providing an input (e.g., a token) to the machine learning model that causes the machine learning model to generate an embedding of the input and subsequently process the embedding through each of a plurality of layers (e.g., transformer layers) of the machine learning model.
[0054] At (606) , the method 600 includes monitoring a bandwidth of remote memory (e.g., remote memory 214 in FIG. 2) during inferencing of the machine learning model at (604) . For instance, in some aspects, the bandwidth of the remote memory may be continuously sampled. In other aspects, the bandwidth of the remote memory may be sampled in response to a triggering event. For example, in some aspects, the triggering event may be the hardware accelerator transitioning from executing a first layer of the machine learning model to executing a second layer of the machine learning model. As another example, in some aspects, the triggering event may be the passage of predetermined amount of time since the most-recent sample of the bandwidth of the remote memory was obtained.
[0055] At (608) , the method 600 includes comparing the sampled bandwidth of the remote memory to a threshold bandwidth of the remote memory. For example, in some aspects, the threshold bandwidth may be a maximum bandwidth (e.g., 100%bandwidth) of the remote memory. In other aspects, the threshold bandwidth may be set to a bandwidth that is less than the maximum bandwidth.
[0056] If the sampled bandwidth of the remote memory is less than the threshold bandwidth, the method 600 reverts to (604) . Otherwise, the method 600 proceeds to (610) .
[0057] At (610) , the method 600 includes adjusting the frequency for the hardware accelerator. For example, adjusting the frequency for the hardware accelerator may include reducing the frequency for the hardware accelerator. In some aspects, the frequency for the hardware accelerator may be reduced by a predetermined amount. In other aspects, an amount by which the frequency for the hardware accelerator may depend on various factors (e.g., the current layer of the machine learning model) .
[0058] At (612) , the method 600 includes updating the layer-frequency map with the updated frequency for the current layer of the machine learning model.
[0059] At (614) , the method 600 includes determining whether inferencing of the machine learning model is finished. For example, in some aspects, determining inferencing of the machine learning model is finished may include determining whether the current layer of the machine learning model is the last layer (e.g., prediction head layer 108 in FIG. 1) of the machine learning. If it is determined that the current layer of the machine learning model is the last layer of the machine learning model, the method proceeds to (616) . Otherwise, the method 600 reverts to (604) as illustrated.
[0060] At (616) , the method 600 includes finalizing the layer-frequency map for the machine learning model. For example, finalizing the layer-frequency map may including freezing the layer-frequency map such that the frequency labels currently included in the layer-frequency map are the final frequency labels until the layer-frequency map is unfreezed.
[0061] At (618) , the method 600 includes inferencing the machine learning model using the finalized layer-frequency map.
[0062] Example Method for Machine Learning
[0063] FIG. 7 depicts a flow diagram of a method 700 for machine learning according to some aspects of the present disclosure. The method 700 may be implemented using the system 500 discussed above with reference to FIG. 5. Furthermore, although FIG. 7 depicts steps performed in a particular order for purposes of illustration and discussion, the method 700 discussed herein is not intended to be limited to any particular order or arrangement. One skilled in the art, using the disclosure provided herein, will appreciate that various steps of the method 700 can be omitted, rearranged, combined and / or adapted in various ways without deviating from the scope of the present disclosure.
[0064] At 702, the method 700 includes inferencing a machine learning model using a hardware accelerator (e.g., the hardware accelerator 200 of FIG. 2) of an electronic device (e.g., smartphone, tablet, IoT) . For example, as illustrated in FIG. 1, the machine learning model may include a large language model and inferencing the large language model may be initiated by providing an input toke (e.g., the input token 112 of FIG. 1) to the large language model. In some aspects, inferencing the machine learning model may include executing each of a plurality of layers of the machine learning model using the hardware accelerator.
[0065] At 704, the method 700 includes monitoring bandwidth of memory (e.g., the remote memory 214 of FIG. 2) of the electronic device during the inferencing, the memory being separate from the hardware accelerator. For example, in some aspects, monitoring the bandwidth of the memory may include continuously sampling the bandwidth of the memory. In other aspects, monitoring the bandwidth of the memory may include sampling the memory in response to a trigger event (e.g., passage of a predetermined amount of time since the bandwidth was last sampled) .
[0066] At 706, the method 700 includes determining a current bandwidth of the memory corresponds to a threshold bandwidth based on the monitoring. For example, in some embodiments, the threshold bandwidth may correspond to a maximum bandwidth of the memory.
[0067] At 708, the method 700 includes adjusting a frequency for the hardware accelerator based on the determining. For example, in some aspects, adjusting the frequeuncy for the hardware accelerator includes reducing (e.g., lowering) the frequeuncy for the hardware accelerator from a first frequeuncy label (e.g., associated with a first power setting for the hardware accelerator) to a second frequeuncy label (e.g., associated with a second power setting for the hardware accelerator) .
[0068] Example Processing System
[0069] FIG. 8 depicts an example processing system 800 configured to perform various aspects of the present disclosure, including, for example, the techniques and methods described with respect to FIG. 6 and FIG. 7. In some aspects, the processing system 800 may dynamically adjust the frequency for a hardware accelerator (e.g., neural processing unit) during inferencing of a machine learning model according to methods described with respect to FIG. 6 and FIG. 7. Also, although depicted as a single system for conceptual clarity, in at least some aspects, as discussed above, the operations described below with respect to the processing system 800 may be distributed across any number of devices.
[0070] The processing system 800 includes a central processing unit (CPU) 802, which in some examples may be a multi-core CPU. Instructions executed at the CPU 802 may be loaded, for example, from a program memory associated with the CPU 802 or may be loaded from a partition of memory 824.
[0071] The processing system 800 also includes additional processing components tailored to specific functions, such as a graphics processing unit (GPU) 804, a digital signal processor (DSP) 806, a neural processing unit (NPU) 808, a multimedia processing unit 810, and a wireless connectivity component 812.
[0072] An NPU, such as NPU 808, is generally a specialized circuit configured for implementing control and arithmetic logic for executing machine learning algorithms, such as algorithms for processing artificial neural networks (ANNs) , deep neural networks (DNNs) , random forests (RFs) , and the like. An NPU may sometimes alternatively be referred to as a neural signal processor (NSP) , tensor processing unit (TPU) , neural network processor (NNP) , intelligence processing unit (IPU) , vision processing unit (VPU) , or graph processing unit.
[0073] NPUs, such as the NPU 808, are configured to accelerate the performance of common machine learning tasks, such as image classification, machine translation, object detection, and various other predictive models. In some examples, a plurality of NPUs may be instantiated on a single chip, such as a system-on-a-chip (SoC) , while in other examples the NPUs may be part of a dedicated neural-network accelerator.
[0074] NPUs may be optimized for training or inference, or in some cases configured to balance performance between both. For NPUs that are capable of performing both training and inference, the two tasks may still generally be performed independently.
[0075] NPUs designed to accelerate training are generally configured to accelerate the optimization of new models, which is a highly compute-intensive operation that involves inputting an existing dataset (often labeled or tagged) , iterating over the dataset, and then adjusting model parameters, such as weights and biases, in order to improve model performance. Generally, optimizing based on a wrong prediction involves propagating back through the layers of the model and determining gradients to reduce the prediction error.
[0076] NPUs designed to accelerate inference are generally configured to operate on complete models. Such NPUs may thus be configured to input a new piece of data and rapidly process this new data through an already trained model to generate a model output (e.g., an inference) .
[0077] In some implementations, the NPU 808 is a part of one or more of the CPU 802, the GPU 804, and / or the DSP 806.
[0078] In some examples, the wireless connectivity component 812 may include subcomponents, for example, for third generation (3G) connectivity, fourth generation (4G) connectivity (e.g., 4G Long-Term Evolution (LTE) ) , fifth generation (5G) connectivity (e.g., New Radio (NR) ) , Wi-Fi connectivity, Bluetooth connectivity, and other wireless transmission standards. The wireless connectivity component 812 is further coupled to one or more antennas 814.
[0079] The processing system 800 may also include one or more sensor processing units 816 associated with any manner of sensor, one or more image signal processors (ISPs) 818 associated with any manner of image sensor, and / or a navigation component 820, which may include satellite-based positioning system components (e.g., GPS or GLONASS) as well as inertial positioning system components.
[0080] The processing system 800 may also include one or more input and / or output devices 822, such as screens, touch-sensitive surfaces (including touch-sensitive displays) , physical buttons, speakers, microphones, and the like.
[0081] In some examples, one or more of the processors of the processing system 800 may be based on an ARM or RISC-V instruction set.
[0082] The processing system 800 also includes the memory 824, which is representative of one or more static and / or dynamic memories, such as a dynamic random access memory, a flash-based static memory, and the like. In this example, the memory 824 includes computer-executable components, which may be executed by one or more of the aforementioned processors of the processing system 800.
[0083] In particular, in this example, the memory 824 includes a frequency controller 826 (e.g., the frequeuncy controller 502 of FIG. 5) .
[0084] Generally, the processing system 800 and / or components thereof may be configured to perform the methods described herein.
[0085] Notably, in other aspects, aspects of the processing system 800 may be omitted, such as where the processing system 800 is a server computer or the like. For example, the multimedia processing unit 810, the wireless connectivity component 812, the sensor processing units 816, the ISPs 818, and / or the navigation component 820 may be omitted in other aspects. Further, aspects of the processing system 800 may be distributed between multiple devices.
[0086] Example Clauses
[0087] Implementation details of various aspects of the present disclosure are described in the following numbered clauses:
[0088] Aspect 1: A method for machine learning, comprising: inferencing a machine learning model using a hardware accelerator of an electronic device; monitoring bandwidth of memory of the electronic device during the inferencing, the memory being separate from the hardware accelerator; determining a current bandwidth of the memory corresponds to a threshold bandwidth based on the monitoring; and adjusting a frequency for the hardware accelerator based on the determining.
[0089] Aspect 2: The method of Aspect 1, wherein: the machine learning model includes a plurality of transformer layers; and inferencing the machine learning model comprises executing each of the plurality of transformer layers.
[0090] Aspect 3: The method of Aspect 2, wherein the determining comprises determining the current bandwidth of the memory corresponds to the threshold bandwidth while the hardware accelerator is executing a transformer layer of the plurality of transformer layers.
[0091] Aspect 4: The method of Aspect 3, further comprising: updating a layer-frequeuncy map for the machine learning model with the adjusted frequency for the transformer layer.
[0092] Aspect 5: The method of any of Aspects 1 to 4, wherein the adjusting comprises reducing the frequency for the hardware accelerator from a first frequency to a second frequeuncy.
[0093] Aspect 6: The method of Aspect 5, wherein: the first frequeuncy corresponds to a first power setting for the hardware accelerator; and the second frequeuncy corresponds to a second power setting for the hardware accelerator, the hardware accelerator consuming less power at the second power setting than at the second power setting.
[0094] Aspect 7: The method of any of Aspects 1 to 6, wherein the memory comprises double data rate memory.
[0095] Aspect 8: The method any of Aspects 1 to 7, wherein the hardware accelerator comprises a neural processing unit having a local memory and a plurality of computation units.
[0096] Aspect 9: The method of Aspect 8, wherein the plurality of computation units comprise at least one of a matrix computation unit and a vector computation unit.
[0097] Aspect 10: The method of any of Aspects 1 to 9, wherein the machine learning model comprises a large language model.
[0098] Aspect 11: The method of Aspect 10, wherein inferencing the machine learning model comprises providing an input token to the large language model.
[0099] Aspect 12: An apparatus, comprising: a hardware accelerator; memory that is separate from the hardware accelerator; and one or more processors configured to perform operations comprising: inferencing a machine learning model using the hardware accelerator; monitoring bandwidth of the memory during the inferencing; determining a current bandwidth of the memory corresponds to a threshold bandwidth based on the monitoring; and adjusting a frequency for the hardware accelerator based on the determining.
[0100] Aspect 13: The apparatus of Aspect 12, wherein: the machine learning model includes a plurality of transformer layers; and inferencing the machine learning model comprises executing each of the plurality of transformer layers.
[0101] Aspect 14: The apparatus of Aspect 13, wherein the determining comprises determining the current bandwidth of the memory corresponds to the threshold bandwidth while the hardware accelerator is executing a transformer layer of the plurality of transformer layers.
[0102] Aspect 15: The apparatus of any of Aspects 12 to 14, further comprising: updating a layer-frequeuncy map for the machine learning model with the adjusted frequency for the transformer layer.
[0103] Aspect 16: The apparatus of any of Aspects 12 to 15, wherein the adjusting comprises reducing the frequency for the hardware accelerator from a first frequency to a second frequeuncy.
[0104] Aspect 17: The apparatus of Aspect 16, wherein: the first frequeuncy corresponds to a first power setting for the hardware accelerator; and the second frequeuncy corresponds to a second power setting for the hardware accelerator, the hardware accelerator consuming less power at the second power setting than at the second power setting.
[0105] Aspect 18: The apparatus of any of Aspects 12 to 17, wherein the memory comprises double data rate memory.
[0106] Aspect 19: The apparatus of any of Aspects 12 to 18, wherein the hardware accelerator comprises a neural processing unit having a local memory and a plurality of computation units.
[0107] Aspect 20: A non-transitory computer-readable medium comprising instructions to be executed in a processor, wherein the instructions when executed in the processor cause the processor to perform operations comprising: inferencing a machine learning model using a hardware accelerator of an electronic device; monitoring bandwidth of memory of the electronic device during the inferencing, the memory being separate from the hardware accelerator; determining a current bandwidth of the memory corresponds to a threshold bandwidth based on the monitoring; and adjusting a frequency for the hardware accelerator based on the determining.
[0108] Additional Considerations
[0109] The preceding description is provided to enable any person skilled in the art to practice the various aspects described herein. The examples discussed herein are not limiting of the scope, applicability, or aspects set forth in the claims. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects. For example, changes may be made in the function and arrangement of elements discussed without departing from the scope of the disclosure. Various examples may omit, substitute, or add various procedures or components as appropriate. For instance, the methods described may be performed in an order different from that described, and various steps may be added, omitted, or combined. Also, features described with respect to some examples may be combined in some other examples. For example, an apparatus may be implemented or a method may be practiced using any number of the aspects set forth herein. In addition, the scope of the disclosure is intended to cover such an apparatus or method that is practiced using other structure, functionality, or structure and functionality in addition to, or other than, the various aspects of the disclosure set forth herein. It should be understood that any aspect of the disclosure disclosed herein may be embodied by one or more elements of a claim.
[0110] As used herein, the word “exemplary” means “serving as an example, instance, or illustration. ” Any aspect described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other aspects.
[0111] As used herein, a phrase referring to “at least one of” a list of items refers to any combination of those items, including single members. As an example, “at least one of:a, b, or c” is intended to cover a, b, c, a-b, a-c, b-c, and a-b-c, as well as any combination with multiples of the same element (e.g., a-a, a-a-a, a-a-b, a-a-c, a-b-b, a-c-c, b-b, b-b-b, b-b-c, c-c, and c-c-c or any other ordering of a, b, and c) .
[0112] As used herein, the term “determining” encompasses a wide variety of actions. For example, “determining” may include calculating, computing, processing, deriving, investigating, looking up (e.g., looking up in a table, a database or another data structure) , ascertaining, and the like. Also, “determining” may include receiving (e.g., receiving information) , accessing (e.g., accessing data in a memory) , and the like. Also, “determining” may include resolving, selecting, choosing, establishing, and the like.
[0113] The methods disclosed herein comprise one or more steps or actions for achieving the methods. The method steps and / or actions may be interchanged with one another without departing from the scope of the claims. In other words, unless a specific order of steps or actions is specified, the order and / or use of specific steps and / or actions may be modified without departing from the scope of the claims. Further, the various operations of methods described above may be performed by any suitable means capable of performing the corresponding functions. The means may include various hardware and / or software component (s) and / or module (s) , including, but not limited to a circuit, an application specific integrated circuit (ASIC) , or processor. Generally, where there are operations illustrated in figures, those operations may have corresponding counterpart means-plus-function components with similar numbering.
[0114] The following claims are not intended to be limited to the aspects shown herein, but are to be accorded the full scope consistent with the language of the claims. Within a claim, reference to an element in the singular is not intended to mean “one and only one” unless specifically so stated, but rather “one or more. ” Unless specifically stated otherwise, the term “some” refers to one or more. No claim element is to be construed under the provisions of 35 U.S.C. § 112 (f) unless the element is expressly recited using the phrase “means for” or, in the case of a method claim, the element is recited using the phrase “step for. ” All structural and functional equivalents to the elements of the various aspects described throughout this disclosure that are known or later come to be known to those of ordinary skill in the art are expressly incorporated herein by reference and are intended to be encompassed by the claims. Moreover, nothing disclosed herein is intended to be dedicated to the public regardless of whether such disclosure is explicitly recited in the claims.
Claims
1.A method for machine learning, comprising:inferencing a machine learning model using a hardware accelerator of an electronic device;monitoring bandwidth of memory of the electronic device during the inferencing, the memory being separate from the hardware accelerator;determining a current bandwidth of the memory corresponds to a threshold bandwidth based on the monitoring; andadjusting a frequency for the hardware accelerator based on the determining.2.The method of Claim 1, wherein:the machine learning model includes a plurality of transformer layers; andinferencing the machine learning model comprises executing each of the plurality of transformer layers.3.The method of Claim 2, wherein the determining comprises determining the current bandwidth of the memory corresponds to the threshold bandwidth while the hardware accelerator is executing a transformer layer of the plurality of transformer layers.4.The method of Claim 3, further comprising:updating a layer-frequeuncy map for the machine learning model with the adjusted frequency for the transformer layer.5.The method of Claim 1, wherein the adjusting comprises reducing the frequency for the hardware accelerator from a first frequency to a second frequeuncy.6.The method of Claim 5, wherein:the first frequeuncy corresponds to a first power setting for the hardware accelerator; andthe second frequeuncy corresponds to a second power setting for the hardware accelerator, the hardware accelerator consuming less power at the second power setting than at the second power setting.7.The method of Claim 1, wherein the memory comprises double data rate memory.8.The method of Claim 1, wherein the hardware accelerator comprises a neural processing unit having a local memory and a plurality of computation units.9.The method of Claim 8, wherein the plurality of computation units comprise at least one of a matrix computation unit and a vector computation unit.10.The method of Claim 1, wherein the machine learning model comprises a large language model.11.The method of Claim 10, wherein inferencing the machine learning model comprises providing an input token to the large language model.12.An apparatus, comprising:a hardware accelerator;memory that is separate from the hardware accelerator; andone or more processors configured to perform operations comprising:inferencing a machine learning model using the hardware accelerator;monitoring bandwidth of the memory during the inferencing;determining a current bandwidth of the memory corresponds to a threshold bandwidth based on the monitoring; andadjusting a frequency for the hardware accelerator based on the determining.13.The apparatus of Claims 12, wherein:the machine learning model includes a plurality of transformer layers; andinferencing the machine learning model comprises executing each of the plurality of transformer layers.14.The apparatus of Claim 13, wherein the determining comprises determining the current bandwidth of the memory corresponds to the threshold bandwidth while the hardware accelerator is executing a transformer layer of the plurality of transformer layers.15.The apparatus of Claim 14, further comprising:updating a layer-frequeuncy map for the machine learning model with the adjusted frequency for the transformer layer.16.The apparatus of Claim 12, wherein the adjusting comprises reducing the frequency for the hardware accelerator from a first frequency to a second frequeuncy.17.The apparatus of Claim 16, wherein:the first frequeuncy corresponds to a first power setting for the hardware accelerator; andthe second frequeuncy corresponds to a second power setting for the hardware accelerator, the hardware accelerator consuming less power at the second power setting than at the second power setting.18.The apparatus of Claim 12, wherein the memory comprises double data rate memory.19.The apparatus of Claim 12, wherein the hardware accelerator comprises a neural processing unit having a local memory and a plurality of computation units.20.A non-transitory computer-readable medium comprising instructions to be executed in a processor, wherein the instructions when executed in the processor cause the processor to perform operations comprising:inferencing a machine learning model using a hardware accelerator of an electronic device;monitoring bandwidth of memory of the electronic device during the inferencing, the memory being separate from the hardware accelerator;determining a current bandwidth of the memory corresponds to a threshold bandwidth based on the monitoring; andadjusting a frequency for the hardware accelerator based on the determining.
Citation Information
Patent Citations
Methods and apparatus to manage power of deep learning accelerator systems
US20190370086A1
Techniques for efficiently operating a processing system based on energy characteristics of instructions and machine learning
US20200050920A1
Power management for execution of machine learning workloads
US20230273832A1
Performing segmented inference operations of a machine learning model
WO2023043459A1