Resource allocation method and device and electronic equipment
By determining the hardware resource requirements of the running object in the artificial intelligence device and allocating resources based on the device status information, the problem of unreasonable resource allocation in the existing technology is solved, and the full utilization of hardware resources and performance improvement is achieved.
Patent Information
- Application Number
- CN202411388084.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-02-28
AI Technical Summary
The existing technology lacks a global perspective when allocating resources and cannot fully utilize the hardware resources of artificial intelligence devices, resulting in limited performance improvement and may affect the operation of other software, resulting in slow response or lag.
The first processing module determines the hardware resource requirements of the running object, and determines the target allocation strategy based on the device status information and the resource requirements of other objects to reasonably allocate hardware resources and achieves performance acceleration.
It realizes global and reasonable resource scheduling of artificial intelligence operating objects, makes full use of hardware resources, improves performance, while taking into account other user tasks, balancing performance, and improving user experience.
Smart Images

Figure CN119536984A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a resource allocation method, device and electronic device. Background Art
[0002] When loading, running or training, large language models (LLM) or artificial intelligence agents (AI Agents) are usually matched with neural network processors (CPU, Neural Processing Unit), graphics processors (GPU, Graphics Processing Unit), neural network processors (NPU, Neural-network Processing Unit) to accelerate reasoning or calculations. However, this method lacks global vision and boundaries, and cannot fully utilize the hardware resources on artificial intelligence (AI, Artificial Intelligence) personal computers (PC, Personal computer). For example, when loading a large number of parallel computing models, GPU resources are specified. At this time, the GPU is almost fully loaded, and there are still many idle resources available for CPUs, NPUs, etc. Although they may not be completely suitable for this type of operation, using these idle resources can still improve performance. The relevant technical solutions are only scheduled according to the specified resource type, and resources cannot be used reasonably. In addition, due to unreasonable scheduling, large games or software with high rendering requirements that users are running at the same time may also be affected, resulting in slow response or jamming. Summary of the invention
[0003] The present disclosure provides a resource allocation method, apparatus, device and storage medium.
[0004] According to a first aspect of the present disclosure, a resource allocation method is provided, the method comprising:
[0005] The first processing module determines the hardware resource requirements required for at least one first type of running object to perform a task; the hardware resource requirements include: hardware resource type and resource requirement;
[0006] The first processing module determines a target allocation strategy for at least one first-type running object based on the hardware resource requirements, device status information and resource requirements required for at least one first-type running object to perform tasks, wherein the target allocation strategy includes target hardware resources allocated to each of the running objects so that each of the running objects performs performance acceleration based on the allocated target hardware resources; the device status information includes: idle resources of at least one hardware resource.
[0007] According to a second aspect of the present disclosure, a resource scheduling device is provided, the device comprising:
[0008] A determination module, configured to determine hardware resource requirements required for at least one first type of running object to perform a task; the hardware resource requirements include: hardware resource type and resource requirement;
[0009] A processing module is used to determine a target allocation strategy for at least one first-type running object based on the hardware resource requirements, device status information and resource requirements required for at least one first-type running object to perform tasks, wherein the target allocation strategy includes target hardware resources allocated to each of the running objects so that each of the running objects performs performance acceleration based on the allocated target hardware resources; the device status information includes: idle resources of at least one hardware resource.
[0010] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0011] at least one processor; and
[0012] a memory communicatively connected to the at least one processor; wherein,
[0013] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present disclosure.
[0014] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:
[0016] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
[0017] Figure 1 A schematic diagram of a process of resource allocation method provided by an embodiment of the present disclosure is shown;
[0018] Figure 2 The following is a schematic diagram showing a process of a resource allocation method provided by an application embodiment of the present disclosure. Figure 1 ;
[0019] Figure 3The following is a schematic diagram showing a process of a resource allocation method provided by an application embodiment of the present disclosure. Figure 2 ;
[0020] Figure 4 A schematic diagram of the structure of a resource allocation device provided by an embodiment of the present disclosure is shown;
[0021] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0022] In order to make the purpose, features, and advantages of the present disclosure more obvious and easy to understand, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0023] Figure 1 A schematic diagram of a resource allocation method provided by an embodiment of the present disclosure is shown; Figure 1 As shown, the resource allocation method includes:
[0024] Step 101: A first processing module determines a hardware resource requirement for at least one first type of running object to perform a task; the hardware resource requirement includes: a hardware resource type and a resource requirement;
[0025] Step 102, the first processing module determines a target allocation strategy for at least one first-type running object based on the hardware resource requirements, device status information and resource requirements required for at least one first-type running object to perform tasks, the target allocation strategy including target hardware resources allocated to each of the running objects so that each of the running objects performs performance acceleration based on the allocated target hardware resources; the device status information includes: idle resources of at least one hardware resource.
[0026] In some embodiments, the resource allocation method is applied to an electronic device;
[0027] The first processing module is a module for performing global resource scheduling in the electronic device, which is equivalent to a global scheduler and is used to allocate various resources in the electronic device.
[0028] The first type of operating objects are objects that use artificial intelligence (AI) technology. The first type of operating objects include, but are not limited to: large language models (LLM, such as ChatGPT, BERT and other models), audit network models (models used for financial compliance or data auditing), and various other AI models, intelligent agents (AIAgent) and AI applications. These operating objects can automatically perform tasks and provide intelligent decision support through complex data processing and algorithm analysis, and show broad application potential in multiple fields, such as natural language processing, computer vision, data analysis, etc.
[0029] For example, large language models can process text data, perform language understanding and generation, and are applied to chatbots, content creation, and other fields. AI agents can autonomously perform a range of tasks, from simple automatic replies to complex process optimization, to improve work efficiency. AI applications can perform image content analysis, image recognition, object recognition, text processing, and more.
[0030] Here, the number of running objects of the first type can be one or more, that is, for a certain running object A, in addition to the second type of objects, when determining the target hardware resources to be allocated to running object A, other running objects, such as running object B, running object C, etc., may also be considered. The hardware resources occupied and / or the hardware resources required to be allocated.
[0031] The method also includes determining device status information and resource requirements required for objects of the second type.
[0032] Among them, the second type of object is an object that does not use the AI model. The second type of object can be an already running object or a predicted object to be started, for example, an application in an electronic device, such as a game, chat software, etc. Although the resources occupied by the running objects can be reflected by the idle resources of the device status information, the resources required by the running objects may change dynamically. As the scene or loading task changes, it is still considered as part of the scheduling.
[0033] The device status information includes: idle resources of at least one hardware resource.
[0034] The hardware resources may include: xPU hardware resources, where xPU refers to various types of processing units, such as CPU, GPU (such as iGPU, dGPU), NPU, TPU (Tensor Processing Unit), etc. "x" can represent any prefix to indicate that the hardware resources can be various types of resources, which are not limited here.
[0035] In this way, based on the hardware resource requirements, device status information and resource requirements required for at least one first type of running object to perform tasks, the target allocation strategy of at least one of the first type of running objects is determined to achieve global and reasonable resource scheduling for each first type of running objects, thereby making full use of xPU resources and releasing computing power; at the same time, other user tasks (such as second type of objects) are taken into account, performance is balanced, and the user experience is improved.
[0036] In some embodiments, the target allocation strategy further includes: reserving resource amounts;
[0037] The method further comprises:
[0038] Based on the device status information, the status of the second type of object and the status of the first type of running object, a reserved resource amount is determined, and the reserved resource amount is used to allocate reserved resources to the second type of object and / or the first type of running object.
[0039] Here, the reserved resource amount is the supplementary hardware resources that can be obtained during the execution of the second type of object and / or the first type of running object, which can ensure sufficient resource flexibility in the dynamic operation of the running object.
[0040] The amount of reserved resources can be set according to actual conditions. The amount of reserved resources will be different for different device status information, different states of the second type of objects, and different states of the first type of running objects. Electronic devices can re-evaluate the amount of reserved resources periodically or based on specific trigger conditions to ensure that it always reflects the current operating status and demand changes, making resource allocation more flexible and adaptable, thereby improving the stability and efficiency of the overall system. The reserved amount of resources allows the running object to respond quickly and provide the required computing and storage capabilities when faced with sudden changes in tasks or resource requirements, thereby providing the necessary guarantees at critical moments to ensure the smooth execution of various tasks and an improved user experience.
[0041] Here, the reserved resource amount may be dynamically allocated to the second type of object and / or the first type of object according to the state of the second type of object and the running state of the first type of running object.
[0042] For example, if a certain second type of object has a higher priority, part or all of the reserved resources may be allocated to the second type of object.
[0043] For another example, if a first type of running object has a higher priority, even if the running object already has target hardware resources, but its priority is relatively high, part or all of the reserved resources can be allocated to the first type of running object.
[0044] Among them, the priority can be determined based on the status of each object, which can include task status, such as in progress, waiting to run or completed, and can also include other requirements, such as response speed requirements, whether there is a request for further acceleration during the operation process, etc.
[0045] In this way, through this dynamic resource allocation, not only can the priority requirements of different objects be effectively responded to, but also the operating efficiency of the overall system can be improved, ensuring the rational use of resources in a multi-tasking environment.
[0046] In some embodiments, determining hardware resource requirements required for at least one first type of running object to perform a task includes:
[0047] Receiving an acceleration request sent by at least one running object, the acceleration request including: a task type and a task data size to be performed by the running object;
[0048] The hardware resource type and resource requirement matched by each of the running objects are determined according to the task type and task data size required to be executed by each of the running objects.
[0049] Here, the task type can be used to indicate the type of task to be processed, such as text processing, image recognition, speech recognition, etc.
[0050] Task data size can be used to indicate the size of the data to be processed, usually measured in bytes, kilobytes (KB), megabytes (MB) or larger units. Data size can affect the processing time and the choice of computing resources. For example, the resources required to process a few thousand text records are very different from those required to process millions of images. Therefore, understanding the task data size can help to allocate resources appropriately and ensure smooth and efficient processing.
[0051] Each task type has its matching hardware resource type. After determining the task type and task data size based on the task requirements, determine its matching hardware resource type and resource requirements. In this way, reasonable allocation can be made to avoid resource waste or shortage and improve the overall efficiency of the system.
[0052] Here, each task type and various types of hardware resources (such as CPU, GPU, TPU, etc.) can also have a certain degree of matching, and the matching degree indicates whether the hardware resource of this type is suitable for processing the corresponding task type, and the specific degree of matching. The matching degree of each task type and various types of hardware resources can be determined and saved in advance by the developer, and there is no limitation on how to determine the matching degree and the value of the matching degree.
[0053] For example, if the task type is natural language processing, such as sentiment analysis and text generation, GPU or TPU is suitable for it, and the corresponding matching degree is the highest, but other types of resources can also be used, and the corresponding matching degree is lower;
[0054] For another example, the task type is image recognition, such as object detection, face recognition, etc., which is suitable for GPU and has the highest corresponding matching degree, but other types of resources can also be used, and the corresponding matching degree is lower.
[0055] In this way, resources can be reasonably allocated according to task requirements, avoiding resource waste or shortage, and improving the overall efficiency of the system; and matching appropriate hardware resources can significantly improve task processing speed.
[0056] In some embodiments, based on hardware resource requirements, device status information, and resource requirements of at least one first type of running object required to perform a task, determining a target allocation strategy for at least one first type of running object includes:
[0057] Determining at least one hardware resource type of each of the running objects and a priority of each hardware resource type;
[0058] Determine, according to the device status information, the resource requirements required by the second type of objects, at least one hardware resource type of each of the running objects, and the priority of each hardware resource type, at least one candidate hardware resource for allocation to each of the running objects, the resource requirement and the priority of each candidate hardware resource;
[0059] At least one target hardware resource is selected from the at least one candidate hardware resource according to at least one candidate hardware resource of each of the running objects, the resource requirement and the priority of each candidate hardware resource.
[0060] Here, during the resource allocation process, at least one candidate hardware resource can be determined for allocation to each running object. The resource requirement refers to the specific amount of hardware resources required to be provided by the candidate hardware resources; for example, if a running object needs to be processed with high efficiency, the requirement for a specific hardware resource may be relatively large, and the corresponding amount of hardware resources is large; or, if the size of the task data to be processed is large, the requirement for a specific hardware resource may be relatively large, and the corresponding amount of hardware resources is large.
[0061] Priority can be used to indicate the order of multiple candidate hardware resources when they are allocated. Priority can be determined based on the matching degree, the amount of hardware resources, the size of the idle resources of the hardware resources, etc. For example, if all types of hardware resources are sufficient, the priority of hardware resources with a high matching degree is relatively higher, while if the idle resources of a hardware resource with a high matching degree are very few, such as far less than the resource demand, even if the hardware resource is allocated, the task cannot be completed efficiently, and the priority should be relatively low.
[0062] Of course, the above is merely an example of determining priority. In actual application, the determination of candidate hardware resources, resource requirements and priorities of candidate hardware resources can be performed based on preset rules, and there is no limitation on the preset rules.
[0063] In this way, after comprehensively considering the above factors, a reasonable allocation strategy is formulated to ensure that each running object can obtain the required and reasonable hardware resource support during execution. This not only improves the overall performance of the system, but also optimizes the utilization efficiency of resources, meets the needs of different application scenarios, and improves the user experience.
[0064] In some embodiments, the device status information also includes: battery level and / or performance mode;
[0065] The method further comprises:
[0066] The target allocation strategy is selected from at least one allocation strategy according to the battery power and / or performance mode.
[0067] Here, battery power can refer to the amount of power currently remaining in the electronic device and whether it is connected to a power source, usually expressed as a percentage;
[0068] Performance mode can refer to the operating state of an electronic device under specific conditions, such as "high performance", "power saving" or "balanced" mode.
[0069] Considering that when the battery power is low, the user may need to preserve the power as much as possible, and the demand for task processing efficiency can be reduced, therefore, it is proposed that the optimal target allocation strategy can be selected from multiple allocation strategies according to the battery power and / or performance mode. For example, when the battery power is low, it can automatically switch to the energy-saving mode, and the allocated resources can be less, reducing the degree of performance acceleration. When the battery power is sufficient, the high-performance mode can be used to fully release the computing power of the device, so that the performance can be accelerated as much as possible.
[0070] Of course, the user may also select the target allocation strategy. For example, after determining at least one allocation strategy, the user is prompted with the current battery power and / or performance mode, and is prompted to make a selection. The target allocation strategy is selected based on the user's selection result.
[0071] In this way, electronic devices can manage resources more intelligently, allowing users to get the best experience in different situations while taking all aspects of their needs into account.
[0072] In some embodiments, the method further comprises:
[0073] The state of the running object of the first type is detected, and hardware resources are reallocated to the running object according to the state of the running object of the first type and the target hardware resources of the running object.
[0074] Here, the state of the running object is either in the foreground or in the background; the foreground running object directly interacts with the user, while the background running object performs background processing while supporting the user experience.
[0075] For objects in the foreground, more hardware resources can be allocated first to ensure that they respond quickly and meet the immediate needs of users. For objects in the background, which have relatively low requirements for real-time response, resource allocation can be appropriately reduced.
[0076] In this way, dynamic resource reallocation combined with changes in the status of running objects not only ensures the efficiency of foreground tasks, but also provides necessary support for background tasks, thereby achieving optimal resource configuration and improving overall performance and user experience.
[0077] In some embodiments, the target hardware resources include: a maximum resource value and a minimum resource value;
[0078] The method further comprises:
[0079] If the running object is in the foreground, allocating hardware resources to the running object according to the maximum value of the target hardware resources;
[0080] If the running object is located in the background, allocating hardware resources to the running object according to the minimum resource value of the target hardware resources;
[0081] If no trigger instruction from the user is received within a predetermined time period for the running object, hardware resources are allocated to the running object according to a value between the maximum resource value and the minimum resource value of the target hardware resources.
[0082] Here, the target hardware resource may include two or more values, or may be understood as a range of values between a maximum resource value and a minimum resource value.
[0083] The maximum resource value is the highest hardware resource limit that can be allocated; the minimum resource value is the minimum resource limit required to ensure its normal operation.
[0084] When implementing resource allocation, for foreground running objects, hardware resources can be allocated according to the maximum resource value of the target hardware resources, thus ensuring that the foreground application can obtain sufficient computing power to achieve a smooth user experience and instant response.
[0085] For background running objects, they can be allocated according to the minimum resource value of the target hardware resources, thus saving hardware resources while ensuring that background tasks can still be executed effectively without affecting the performance of foreground operations.
[0086] If no user trigger instruction is received within the predetermined time, it can be considered that the running object does not need to guarantee immediate response, and hardware resources can be allocated to the running object according to any intermediate value between the maximum and minimum resource values of the target hardware resources. At this time, the allocation of resources will be appropriately adjusted to adapt to the current demand changes, avoiding resource waste and ensuring the flexibility of the system.
[0087] Through the above allocation strategy, hardware resource allocation can be intelligently adjusted, performance can be optimized, user experience can be improved, and the smooth operation of various tasks can be ensured.
[0088] In some embodiments, the method further comprises:
[0089] If the task of the running object is completed or a stop execution instruction for the running object is received, the hardware resources of the running object are released, and the idle resources of the at least one hardware resource are re-detected;
[0090] According to the re-detected free resources of the at least one hardware resource, target hardware resources of other running objects are adjusted.
[0091] Here, considering that when the task of the running object is completed or a stop execution instruction is received, it indicates that there is no need to allocate hardware resources, the previously allocated hardware resources can be recovered or released; accordingly, the idle resources of the hardware resources change accordingly. Therefore, it is proposed to re-detect the idle resources of at least one hardware resource, and adjust the target hardware resources of other running objects according to the re-detected idle resources of at least one hardware resource.
[0092] In this way, the status of various hardware resources can be monitored and controlled in real time, so as to provide more timely target hardware resources for the operating objects, ensuring that resources are optimally configured throughout the life cycle of task execution, thereby improving operating efficiency and user experience.
[0093] Figure 2 The following is a schematic diagram showing a process of a resource allocation method provided by an application embodiment of the present disclosure. Figure 1 ;like Figure 2 As shown, the resource allocation method includes:
[0094] Step 201: Determine the hardware resource requirements for one or more first-type running objects to perform tasks;
[0095] Here, when loading each first-type running object, the first-type running object will send the required accelerated computing type (such as text, image, etc.) to the Framework through an interface (specifically a software architecture that performs resource scheduling and accelerates the performance of the first-type running object, equivalent to the above-mentioned first processing module). Correspondingly, after receiving the demand, the Framework can determine the hardware resource requirements of the running object, and the hardware resource requirements include: hardware resource type and resource demand.
[0096] For example, the first type of running objects includes: running object A, running object B;
[0097] The accelerated computing type of running object A (deep learning model) is Class A, and the hardware resource requirements are determined as: GPU, requirement A1, or NPU, requirement A2;
[0098] The accelerated computing type of the running object B (real-time video processing model) is Class B, and the hardware resource requirements are determined as: GPU, requirement B2 (a candidate hardware resource), or CPU, requirement B2.
[0099] Step 202: Determine a target allocation strategy for at least one of the first type of running objects based on the hardware resource requirements, device status information, and resource requirements of the second type of objects required for each running object to perform a task;
[0100] Here, the target allocation strategy includes target hardware resources allocated to each of the running objects, so that each of the running objects performs performance acceleration based on the allocated target hardware resources.
[0101] Combined with the above example, assume that the current device status information includes:
[0102] CPU resources: Current utilization is 30%, and remaining idle resources are 70%;
[0103] GPU resources: Current utilization is 80%, and remaining idle resources are 20%;
[0104] NPU resources: The current utilization is 20%, and the remaining idle resources are 80%.
[0105] The second type of objects includes: object C, whose demand or estimated demand for CPU resources, demand amount C1;
[0106] According to the above information, a target allocation strategy is determined to allocate target hardware resources to the running objects A and B, and a resource allocation strategy for the second type of object C is determined.
[0107] For example, for running object A, since the GPU has few remaining idle resources, but the NPU has sufficient remaining space resources and meets the demand A2, NPU resources can be allocated to it, and the allocated resource amount is the demand A2.
[0108] For running object B, since the GPU has few remaining idle resources, but the CPU has sufficient remaining space resources and meets the demand of demand B2, CPU resources can be allocated to it, and the allocated resource amount is demand B2.
[0109] In this way, the Framework coordinates the xPU resources in the electronic device to perform accelerated computing and reasoning based on the hardware resource requirements of at least one first-type running object to perform tasks, as well as the actual status of the electronic device, such as device status information and resource requirements of the second-type objects, to achieve global coordination of xPU resources, allocate reasonable resources to each first-type running object, and reserve a portion of computing resources for AI Acceleration and other user tasks, dynamically balancing according to actual conditions.
[0110] Figure 3 The following is a schematic diagram showing a process of a resource allocation method provided by an application embodiment of the present disclosure. Figure 2 ;like Figure 3 As shown, the resource allocation method includes:
[0111] Step 301, LLM or AI Agent is started, and an API (Application Programming Interface) is called to send an acceleration request;
[0112] Here, the resource allocation method is applied to any AIPC, which can run LLM or intelligent agent; the AIPC has an AI acceleration framework (AI Acceleration Framework) for resource scheduling to accelerate the performance of LLM or intelligent agent, which is equivalent to the above-mentioned first processing module.
[0113] LLM or intelligent agent can send acceleration request to AI acceleration framework through API. After receiving the acceleration request sent by LLM or intelligent agent, AI acceleration framework can identify the most suitable hardware resource type for acceleration, and search and check which idle resources can be used for acceleration according to the local hardware configuration, and allocate corresponding hardware resources for acceleration, that is, execute step 302.
[0114] Step 302: The AI acceleration framework confirms the acceleration request and allocates xPU hardware (such as CPU, iGPU, dGPU, NPU, etc.) resources;
[0115] Here, "x" can represent any prefix to indicate that the hardware resources can be various types of resources, such as CPU, iGPU, dGPU, NPU, etc.
[0116] The AI acceleration framework confirms the acceleration request and allocates xPU hardware resources, which may include:
[0117] The AI acceleration framework confirms the acceleration request, which may include: the acceleration computing type (such as text processing, image recognition, speech recognition, etc.) and the task data size;
[0118] Determining the matched hardware resource type and resource requirement according to the acceleration request;
[0119] The matched hardware resource type and resource requirement are determined in combination with the device status information and the acceleration request, and a target allocation strategy is determined; the target allocation strategy includes: allocating corresponding xPU hardware resources to the LLM or smart agent so that the LLM or smart agent performs performance acceleration based on the allocated hardware resources.
[0120] Here, the device status information may include: idle resources, battery power and / or performance mode of at least one hardware resource.
[0121] Here, if multiple LLMs or smart agents send acceleration requests, the target allocation strategy can be determined in combination with the acceleration requests of each LLM or smart agent. Accordingly, the target allocation strategy includes: xPU hardware resources allocated to each LLM or smart agent, so that each LLM or smart agent performs performance acceleration based on the hardware resources allocated to it.
[0122] Here, if it is determined that there are other objects that do not utilize the AI model, they may be running objects or predicted objects to be started. Considering that these objects may also require their corresponding hardware resources, and the required resources may change dynamically, the target allocation strategy can be determined in combination with the resource requirements of these objects that do not utilize the AI model.
[0123] Step 303: The AI acceleration framework balances other user tasks;
[0124] Here, the AI acceleration framework also has the function of a balancer, that is, it can monitor the status of other user tasks. For example, if a new task is established, the AI acceleration framework can converge some hardware resources for acceleration based on the current running status and compensate for other types of tasks; for example, if it is monitored that there are released or releasable resources, the released or releasable resources can be compensated to LLM or intelligent agents for performance acceleration.
[0125] Step 304: Task execution is completed.
[0126] Figure 4 A schematic diagram of the structure of a resource allocation device provided by an embodiment of the present disclosure is shown; Figure 4 As shown, the resource allocation device includes:
[0127] A determination module, configured to determine hardware resource requirements required for at least one first type of running object to perform a task; the hardware resource requirements include: hardware resource type and resource requirement;
[0128] A processing module is used to determine a target allocation strategy for at least one first-type running object based on the hardware resource requirements, device status information and resource requirements required for at least one first-type running object to perform tasks, wherein the target allocation strategy includes target hardware resources allocated to each of the running objects so that each of the running objects performs performance acceleration based on the allocated target hardware resources; the device status information includes: idle resources of at least one hardware resource.
[0129] In some embodiments, the target allocation strategy further includes: reserving resource amounts;
[0130] The processing module is also used to determine the amount of reserved resources based on the device status information, the status of the second type of object and the status of the first type of running object, and the reserved resource amount is used to allocate reserved resources to the second type of object and / or the first type of running object.
[0131] In some embodiments, the determination module is used to receive an acceleration request sent by at least one running object, the acceleration request including: a task type and a task data size to be performed by the running object;
[0132] The hardware resource type and resource requirement matched by each of the running objects are determined according to the task type and task data size required to be executed by each of the running objects.
[0133] In some embodiments, the device status information also includes: battery level and / or performance mode;
[0134] The processing module is further configured to select the target allocation strategy from at least one allocation strategy according to the battery power and / or performance mode.
[0135] In some embodiments, the processing module is used to determine at least one hardware resource type of each of the running objects and a priority of each hardware resource type;
[0136] Determine, according to the device status information, the resource requirements required by the second type of objects, at least one hardware resource type of each of the running objects, and the priority of each hardware resource type, at least one candidate hardware resource for allocation to each of the running objects, the resource requirement and the priority of each candidate hardware resource;
[0137] At least one target hardware resource is selected from the at least one candidate hardware resource according to at least one candidate hardware resource of each of the running objects, the resource requirement and the priority of each candidate hardware resource.
[0138] In some embodiments, the processing module is further used to detect the state of the first type of running object, and reallocate hardware resources to the running object according to the state of the first type of running object and the target hardware resources of the running object.
[0139] In some embodiments, the target hardware resources include: a maximum resource value and a minimum resource value;
[0140] The processing module is further configured to allocate hardware resources to the running object according to the maximum value of the target hardware resources if the running object is in the foreground;
[0141] If the running object is located in the background, allocating hardware resources to the running object according to the minimum resource value of the target hardware resources;
[0142] If no trigger instruction from the user is received within a predetermined time period for the running object, hardware resources are allocated to the running object according to a value between the maximum resource value and the minimum resource value of the target hardware resources.
[0143] In some embodiments, the processing module is further used to release the hardware resources of the running object and re-detect the idle resources of the at least one hardware resource if the task of the running object is completed or a stop execution instruction for the running object is received;
[0144] According to the re-detected free resources of the at least one hardware resource, target hardware resources of other running objects are adjusted.
[0145] It is understandable that when the resource allocation device provided in the above embodiment implements the corresponding resource allocation method, the above processing can be assigned to different program modules as needed to complete all or part of the above-described processing. In addition, the device provided in the above embodiment and the embodiment of the corresponding method belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0146] An embodiment of the present disclosure provides a computer-readable storage medium storing executable instructions, wherein the executable instructions are stored. When the executable instructions are executed by a processor, the processor will be triggered to execute the resource allocation method provided by the embodiment of the present disclosure.
[0147] In some embodiments, the computer-readable storage medium may be a ferroelectric random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disk, or a CD-ROM; it may also be various devices including one or any combination of the above memories.
[0148] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, model, subroutine or other unit suitable for use in a computing environment.
[0149] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.
[0150] An embodiment of the present disclosure provides a computer program product, which includes a computer program / instructions. When the computer program / instructions are executed by a processor, the resource allocation method described in the present disclosure is implemented.
[0151] Figure 5 FIG. 1 shows a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Figure 5As shown, the electronic device 50 includes: a processor 501 and a memory 502 for storing a computer program that can be run on the processor; when the processor 501 is used to run the computer program, it executes the resource allocation method provided in the embodiment of the present disclosure.
[0152] In actual application, the electronic device 50 may further include: at least one network interface 503. The various components in the electronic device 50 are coupled together via a bus system 504. It is understood that the bus system 504 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 504 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 5 In the figure, various buses are all labeled as bus system 504. There may be at least one processor 501. The network interface 503 is used for wired or wireless communication between the electronic device 50 and other devices.
[0153] The memory 502 in the embodiment of the present disclosure is used to store various types of data to support the operation of the electronic device 50 .
[0154] The method disclosed in the above embodiment of the present disclosure can be applied to the processor 501, or implemented by the processor 501. The processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 501 or the instruction in the form of software. The above processor 501 can be a general processor, a digital signal processor (DSP, DiGital Signal Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 501 can implement or execute the disclosed methods, steps and logic block diagrams in the embodiment of the present disclosure. The general processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiment of the present disclosure can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor can be combined to execute. The software module can be located in a storage medium, which is located in the memory 502. The processor 501 reads the information in the memory 502 and completes the steps of the above method in combination with its hardware.
[0155] In some embodiments, the electronic device 50 can be implemented by one or more application specific integrated circuits (ASIC), DSP, programmable logic device (PLD), complex programmable logic device (CPLD), field programmable gate array (FPGA), general processor, controller, microcontroller (MCU), microprocessor, or other electronic components to execute the aforementioned method.
[0156] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0157] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0158] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A resource allocation method, the method comprising: The first processing module determines the hardware resource requirements required for at least one first type of running object to perform a task; The hardware resource requirements include: hardware resource type and resource requirement; The first processing module determines a target allocation strategy for at least one first-type running object based on the hardware resource requirements, device status information and resource requirements required for at least one first-type running object to perform tasks, wherein the target allocation strategy includes target hardware resources allocated to each of the running objects so that each of the running objects performs performance acceleration based on the allocated target hardware resources; the device status information includes: idle resources of at least one hardware resource.
2. The method according to claim 1, characterized in that The target allocation strategy also includes: reserving resource amounts; The method further comprises: Based on the device status information, the status of the second type of object and the status of the first type of running object, a reserved resource amount is determined, and the reserved resource amount is used to allocate reserved resources to the second type of object and / or the first type of running object.
3. The method according to claim 1, determining the hardware resource requirements required for at least one first type of running object to perform a task, comprising: Receiving an acceleration request sent by at least one running object, the acceleration request including: a task type and a task data size to be performed by the running object; The hardware resource type and resource requirement matched by each of the running objects are determined according to the task type and task data size required to be executed by each of the running objects.
4. The method according to claim 1, wherein the device status information further comprises: battery level and / or performance mode; The method further comprises: The target allocation strategy is selected from at least one allocation strategy according to the battery power and / or performance mode.
5. The method according to claim 1, determining a target allocation strategy for at least one first-type running object based on hardware resource requirements, device status information and resource requirements of at least one second-type running object required to perform a task, comprises: Determining at least one hardware resource type of each of the running objects and a priority of each hardware resource type; Determine, according to the device status information, the resource requirements required by the second type of objects, at least one hardware resource type of each of the running objects, and the priority of each hardware resource type, at least one candidate hardware resource for allocation to each of the running objects, the resource requirement and the priority of each candidate hardware resource; At least one target hardware resource is selected from the at least one candidate hardware resource according to at least one candidate hardware resource of each of the running objects, the resource requirement and the priority of each candidate hardware resource.
6. The method according to claim 1, further comprising: The state of the running object of the first type is detected, and hardware resources are reallocated to the running object according to the state of the running object of the first type and the target hardware resources of the running object.
7. The method according to claim 1, wherein the target hardware resources include: Maximum and minimum resource values; The method further comprises: If the running object is in the foreground, allocating hardware resources to the running object according to the maximum value of the target hardware resources; If the running object is located in the background, allocating hardware resources to the running object according to the minimum resource value of the target hardware resources; If no trigger instruction from the user is received within a predetermined time period for the running object, hardware resources are allocated to the running object according to a value between the maximum resource value and the minimum resource value of the target hardware resources.
8. The method according to claim 1, further comprising: If the task of the running object is completed or a stop execution instruction for the running object is received, the hardware resources of the running object are released, and the idle resources of the at least one hardware resource are re-detected; According to the re-detected free resources of the at least one hardware resource, target hardware resources of other running objects are adjusted.
9. A resource scheduling device, comprising: A determination module, configured to determine hardware resource requirements required for at least one first type of running object to perform a task; The hardware resource requirements include: hardware resource type and resource requirement; A processing module is used to determine a target allocation strategy for at least one first-type running object based on the hardware resource requirements, device status information and resource requirements required for at least one first-type running object to perform tasks, wherein the target allocation strategy includes target hardware resources allocated to each of the running objects so that each of the running objects performs performance acceleration based on the allocated target hardware resources; the device status information includes: idle resources of at least one hardware resource.
10. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to execute: Determine the hardware resource requirements of at least one first type of running object required to perform a task; the hardware resource requirements include: hardware resource type and resource requirement; Based on the hardware resource requirements, device status information and resource requirements required for at least one first type of running object to perform tasks, a target allocation strategy for at least one of the first type of running objects is determined, wherein the target allocation strategy includes target hardware resources allocated to each of the running objects so that each of the running objects performs performance acceleration based on the allocated target hardware resources; the device status information includes: idle resources of at least one hardware resource.
Citation Information
Cited By
Information processing method and device, equipment and medium
CN122489292A