Control method and device

By splitting the processor into more graphics processing units and allocating according to application needs, the problem of resource allocation among multiple applications is solved, and the reasonable resource allocation of each application and priority allocation of target applications is achieved, improving the Resource utilization efficiency.

CN119248468APending Publication Date: 2025-01-03LENOVO (BEIJING) LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411035477.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

When multiple applications use image processing resources at the same time, how to reasonably allocate image processing resources has become a difficult problem, and the prior art is difficult to effectively solve this problem.

Method used

By splitting the processor according to the number of applications in the running state, the number of split processing units is greater than the number of applications. Each application is allocated at least one processing unit, and more processing is allocated based on the actual needs of the application. Unit to the target application.

Benefits of technology

The processing resource allocation of each application is realized, ensuring that special applications obtain more resources, meet their needs, and improving the rationality and efficiency of resource allocation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248468A_ABST
    Figure CN119248468A_ABST
Patent Text Reader

Abstract

The invention discloses a control method and device, and the method comprises the steps: splitting a processor according to a first number of application programs in a running state, so as to obtain a second number of processing units; the second number is greater than the first number; the processing unit is allocated to the application program; wherein each application program is respectively allocated with at least one processing unit; the number of the processing units allocated to the target application program in the first number of application programs is greater than the number of the processing units allocated to other application programs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a control method and device. Background Art

[0002] With the development of technology, more and more application scenarios require user image processing resources.

[0003] When two or more applications need to use the image processing unit at the same time, how to reasonably allocate image processing resources becomes a difficult task. Summary of the invention

[0004] In view of this, the present application provides a control method, device and electronic device as follows:

[0005] A control method, comprising:

[0006] Splitting the processor according to a first number of running applications to obtain a second number of graphics processing units; the second number is greater than the first number;

[0007] assigning the processing unit to the application;

[0008] Each of the applications is respectively allocated with at least one of the processing units; and among the first number of applications, a target application is allocated with a larger number of processing units than other applications.

[0009] In the above method, preferably, the processor is a graphics processor, and the graphics processor can be split into the second number of graphics processing units.

[0010] In the above method, preferably, the target application is: an application satisfying a preferred condition among the first number of applications;

[0011] The preferred conditions include: an application window of the target application is in an active state, and / or the target application matches a preset application type.

[0012] In the above method, preferably, the target application is: an application selected according to a polling rule from among the first number of applications.

[0013] In the above method, preferably, the polling rule includes a polling duration, and the polling duration is a duration during which each application in the first number of applications is selected as a target application;

[0014] The polling duration is determined based on an operating parameter of the target application; the operating parameter represents an operating parameter of the target application executing a rendering task using the allocated processing unit.

[0015] The above method, preferably, further comprises:

[0016] If there is a first application that does not occupy the allocated processing unit, the processing unit allocated to the first application is allocated to other applications.

[0017] The above method, preferably, allocating the processing unit allocated to the first application to other applications, includes:

[0018] Splitting the processing unit assigned to the first application to obtain multiple new processing units, and assigning the multiple new processing units to each running application respectively;

[0019] or,

[0020] According to the order of the running applications, the processing unit assigned to the first application is assigned to each running application according to a polling rule;

[0021] or,

[0022] Re-splitting the processor according to the third number of the running applications to obtain a plurality of new processing units; pausing the running applications; respectively allocating at least one of the new processing units to each of the running applications; and resuming the suspended applications;

[0023] or,

[0024] The processing unit to which the first application is allocated is allocated to the target application.

[0025] The above method, preferably, further comprises:

[0026] If a second application is started, a new processing unit is split from the processing unit to which the target application is allocated;

[0027] The new processing unit is allocated to the second application; the number of processing units allocated to the target application is greater than the number of processing units allocated to other applications.

[0028] The above method preferably splits the processor, including:

[0029] According to the computing performance of the processor, the computing unit in the processor is split to obtain a plurality of processing units, each of which includes at least one computing unit;

[0030] or,

[0031] According to the video memory area corresponding to the processor, the computing unit in the processor is split to obtain a plurality of processing units, each of the processing units includes at least one computing unit, the video memory area is divided into a plurality of storage units, and the number of computing units in each processing unit corresponds to the storage unit corresponding to the processing unit in the video memory area.

[0032] A control device, comprising:

[0033] A processor splitting unit, configured to split the processor according to a first number of application programs in a running state to obtain a second number of processing units; the second number is greater than the first number;

[0034] A processor allocation unit, configured to allocate the processing unit to the application program;

[0035] Each of the applications is respectively allocated with at least one of the processing units; and among the first number of applications, a target application is allocated with a larger number of processing units than other applications.

[0036] An electronic device, comprising:

[0037] processor;

[0038] A controller, configured to split the processor according to a first number of running applications to obtain a second number of processing units, wherein the second number is greater than the first number, and allocate the processing units to the applications;

[0039] Each of the applications is respectively allocated with at least one of the processing units; and among the first number of applications, a target application is allocated with a larger number of processing units than other applications.

[0040] It can be seen from the above technical solution that in a control method and device disclosed in the present application, by splitting the processor according to the number of applications in operation, the number of split processing units is greater than the number of applications, so that after the processing units are allocated to the applications, each application is respectively allocated at least one processing unit, and the number of processing units allocated to the target application in the first number of applications is greater than the number of processing units allocated to other applications. It can be seen that in this embodiment, according to the number of applications in operation, the processor is split into a larger number of processing units, so that at least one processing unit can be allocated to each application, and more processing units can be allocated to special target applications relative to other applications, so that a corresponding number of processing units can be allocated to the application according to the actual needs of the application, thereby realizing the reasonable allocation of processing resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0042] Figure 1 A flow chart of a control method provided in an embodiment of the present application;

[0043] Figure 2 This is an example diagram of allocating GPUs in an embodiment of the present application;

[0044] Figure 3 Another example diagram of allocating GPUs in an embodiment of the present application;

[0045] Figure 4 This is an example diagram of polling and allocating sub-GPUs in an embodiment of the present application;

[0046] Figure 5 This is an example diagram of splitting and redistributing sub-GPUs in an embodiment of the present application;

[0047] Figure 6 This is an example diagram of reallocating a sub-GPU in an embodiment of the present application;

[0048] Figure 7 This is an example diagram of re-dividing the GPU and allocating it to the application program in an embodiment of the present application;

[0049] Figure 8 Another example diagram of reallocating a sub-GPU in an embodiment of the present application;

[0050] Fig. 9Another example diagram of reallocating a sub-GPU in an embodiment of the present application;

[0051] Fig.10 Another example diagram of re-dividing the GPU and allocating it to an application program in an embodiment of the present application;

[0052] Fig.11 A schematic diagram of the structure of a control device provided in an embodiment of the present application;

[0053] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0054] Fig.13 This is an example diagram of dividing the GPU and the corresponding VRAM in an embodiment of the present application;

[0055] Fig.14 This is a flowchart of allocating sub-GPUs and sub-VRAMs in an embodiment of the present application. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0057] refer to Figure 1 As shown, it is a flow chart for realizing a control method provided in an embodiment of the present application, and the method can be applied to an electronic device that supports the operation of an application program through a processor. For example, the processor can be a graphics processor GPU (graphics processing unit) or a neural network processor NPU (Neural Processing Unit), etc. The electronic device can be a mobile phone, a tablet device, a notebook or other device with a display screen, and the application program is a program that needs to use a graphics processor to realize the output of the application window, such as a game application, a social application, etc. The technical solution in this embodiment is mainly used to reasonably allocate graphics processing resources for the application program.

[0058] Specifically, the method in this embodiment may include the following steps:

[0059] Step 101: Split a processor according to a first number of running application programs to obtain a second number of processing units.

[0060] The second number is greater than the first number. Taking the processor as a GPU as an example, the GPU includes multiple computing units, and each computing unit uses the video memory area corresponding to the GPU to implement a corresponding graphics processing function. The graphics processing unit split from the graphics processor can also be called a sub-GPU, and each sub-GPU can include at least one computing unit.

[0061] In one implementation, step 101 may be implemented in the following manner:

[0062] According to the computing performance of the processor, the computing unit in the processor is split to obtain multiple processing units. Each processing unit includes at least one computing unit.

[0063] It should be noted that, taking the processor as a graphics processor as an example, the computing performance of the graphics processor can be represented by totalTOPS (Tera Operations Per Second). Based on this, according to the first number, combined with the TOPS of the GPU, the computing unit in the GPU is split to obtain multiple sub-GPUs, each of which includes at least one computing unit.

[0064] In another implementation, step 101 may be implemented in the following manner:

[0065] According to the video memory area corresponding to the processor, the computing unit in the processor is split to obtain a plurality of processing units, each of which includes at least one computing unit.

[0066] It should be noted that the video memory area corresponding to the processor is divided into multiple storage units, and the number of computing units in each processing unit corresponds to the storage unit corresponding to the processing unit in the video memory area. For example, the more computing units in the processing unit, the larger the storage space of the storage unit corresponding to the processing unit in the video memory area. For example, taking the processor as a GPU as an example, the video memory area can be a video random access memory VRAM (Video Random Access Memory). In this embodiment, according to the first number, combined with the size of the VRAM, the computing units in the GPU are split to obtain multiple sub-GPUs, each of which contains at least one computing unit, and the number of computing units in each sub-GPU corresponds to the size of the storage unit corresponding to the sub-GPU in the VRAM.

[0067] Step 102: Allocate processing units to applications.

[0068] Each application is respectively allocated with at least one processing unit, and the number of processing units allocated to the target application among the first number of applications is greater than the number of processing units allocated to other applications.

[0069] For example, taking a mobile phone as an example, if there is an application a running in the mobile phone, the graphics processor can be directly allocated to the application a, or the graphics processor can be split into two graphics processing units, one of which is first allocated to the application a, and the other graphics processing unit can be left unallocated or allocated to the application a;

[0070] For another example, if there are two applications a and b running in the mobile phone, the graphics processing is divided into at least three graphics processing units: sub-GPU1, sub-GPU2 and sub-GPU3, etc. When allocating graphics processing units, firstly, two of the graphics processing units, sub-GPU1 and sub-GPU2, are allocated to application a and application b respectively, and the remaining graphics processing unit, sub-GPU3, can be allocated to one of the target applications, which can be any one of application a and application b, such as Figure 2 as shown in .

[0071] For another example, if there are three applications a, b and c running in the mobile phone, then the graphics processing is divided into at least four graphics processing units: sub-GPU1, sub-GPU2, sub-GPU3 and sub-GPU4, etc. When allocating graphics processing units, firstly, three of the graphics processing units, sub-GPU1, sub-GPU2 and sub-GPU3, are allocated to application a, application b and application c respectively, and the remaining graphics processing unit, sub-GPU4, can be allocated to one of the target applications, and the target application can be any one of application a, application b and application c, such as Figure 3 as shown in .

[0072] It can be seen from the above technical solution that in a control method provided by an embodiment of the present application, by splitting the processor according to the number of applications in operation, the number of split processing units is greater than the number of applications, so that after the processing units are allocated to the applications, each application is respectively allocated at least one processing unit, and the number of processing units allocated to the target application in the first number of applications is greater than the number of processing units allocated to other applications. It can be seen that in this embodiment, according to the number of applications in operation, the processor is split into a larger number of graphics processing units, so that at least one processing unit can be allocated to each application, and more processing units can be allocated to special target applications relative to other applications, so that the corresponding number of processing units can be allocated to the application according to the actual needs of the application, thereby realizing the reasonable allocation of processing resources.

[0073] In one implementation, the target application may be an application that meets a preferred condition among the first number of applications (ie, applications in a running state).

[0074] The preferred conditions may include: an application window of the target application is in an active state, and / or the target application matches a preset application type.

[0075] For example, taking the graphics processor as an example, in this embodiment, after the first number of graphics processing units are respectively allocated to each application in the running state, the remaining number of graphics processing units in the second number are allocated to the target application whose application window is in the active state. In this way, all applications are allocated with graphics processing units, and the target application whose application window is in the active state can obtain more graphics processing units to realize graphics data processing. For example, the application window of a social application is in an active state, such as being selected by a user and the user inputs characters in the application window, while the application of a game application is not in an active state, such as being blocked by the social application. At this time, the remaining number of graphics processing units in the second number are allocated to the social application. In this way, both the social application and the game application can be allocated with image processing units, and the application window of the social application is in an active state and is allocated with more graphics processing units to meet the social users' use needs for the social application.

[0076] For another example, taking the graphics processor as an example, in this embodiment, after the first number of graphics processing units are respectively allocated to each application in the running state, the remaining number of graphics processing units in the second number are allocated to the target application matching the preset application type, so that all applications are allocated with graphics processing units, and applications of the preset application type can obtain more graphics processing units to realize graphics data processing. For example, the game type and the drawing type are preset application types. In this embodiment, the remaining number of graphics processing units in the second number are allocated to the game application instead of the social application. In this way, both the social application and the game application can be allocated with image processing units, and the game application as the preset application type can be allocated with more graphics processing units to support the use of games and meet the viewing needs of game users for the game screen.

[0077] In another implementation, the target application may be: an application selected from the first number of applications according to a polling rule.

[0078] For example, taking the graphics processor as an example, in this embodiment, after the first number of graphics processing units are allocated to each running application respectively, the remaining number of graphics processing units in the second number are allocated to each application in turn according to the polling rule, so that each application can monopolize a part of the graphics processing units while using the allocated remaining number of graphics processing units in a specific time period. The application that uses the allocated remaining number of graphics processing units is the target application.

[0079] For example, if there are three applications a, application b and application c running in a mobile phone, then the graphics processing is divided into at least four graphics processing units. When allocating graphics processing units, three of them are first allocated to application a, application b and application c respectively, and the remaining graphics processing units are allocated to each application in turn according to the polling rule. The target application can be one of application a, application b and application c selected in a specific time period.

[0080] Based on the above implementation scheme, the polling rule includes a polling duration, where the polling duration is: the duration during which each application in the first number of applications is selected as a target application.

[0081] For example, if there are three applications a, b and c running in a mobile phone, then the graphics processing is divided into at least four graphics processing units: sub-GPU1, sub-GPU2, sub-GPU3 and sub-GPU4, etc. When allocating graphics processing units, firstly, three of the graphics processing units, sub-GPU1, sub-GPU2 and sub-GPU3, are allocated to applications a, b and c respectively, and the remaining graphics processing unit, sub-GPU4, is allocated to each application in turn according to the polling rule. Applications a, b and c take turns to occupy the remaining graphics processing units for a preset polling time, such as 20 milliseconds. Figure 4 as shown in .

[0082] It should be noted that the polling duration is determined based on the operating parameters of the target application. The operating parameters represent the operating parameters of the target application using the allocated processing unit to perform the rendering task.

[0083] For example, taking a graphics processor as an example, the operating parameters may be: the number of rendering commands processed by the graphics processing unit per second, the size of which represents the task load size of the rendering task. Different target applications have different operating parameters, and the polling durations allocated to the target applications are different. For example, if application a uses the assigned sub-GPU to perform rendering tasks with a heavy load, then the polling duration allocated to application a (application a as the target application) by the remaining graphics processing units is longer; if application b uses the assigned sub-GPU to perform rendering tasks with a light load, then the polling duration allocated to application b (application b as the target application) by the remaining graphics processing units is shorter.

[0084] In one implementation, the method in this embodiment may further include the following processing:

[0085] It is monitored whether there is a first application program that no longer occupies the allocated processing unit. If there is a first application program that no longer occupies the allocated processing unit, the processing unit allocated to the first application program is allocated to other applications.

[0086] The first application does not occupy the allocated processing unit, which means: the first application is closed, so that the allocated processing unit enters an idle state; or the first application is switched to the background, so that the first application does not need to use the processing unit to perform rendering tasks, so that the allocated processing unit enters an idle state. Based on this, if the first application does not occupy the allocated processing unit, the allocated processing unit of the first application can be allocated to other applications.

[0087] Based on the above implementation scheme, when the processing unit allocated to the first application is allocated to other applications, it can be implemented in at least one of the following ways:

[0088] In one implementation, in this embodiment, the processing unit assigned to the first application can be split to obtain multiple new processing units, so that these multiple new processing units can be respectively assigned to each application in a running state.

[0089] For example, if application a no longer occupies the allocated sub-GPU, the sub-GPU1 allocated to application a is split into two graphics processing units, and the two graphics processing units are respectively allocated to application b and application c. Figure 5 as shown in .

[0090] In another implementation, in this embodiment, the processing unit allocated to the first application can be allocated to each application in the running state according to the order between the application programs in the running state according to the polling rule.

[0091] That is to say, in this embodiment, the processing unit allocated to the first application is used as the remaining processing unit and allocated to each application in the running state according to the polling rule.

[0092] For example, if application a no longer occupies the allocated sub-GPU, then the sub-GPU1 allocated to application a is allocated to application b and application c in turn according to the polling rule, such as Figure 6 as shown in .

[0093] In another implementation, in this embodiment, the processor can be re-split according to the third number of running applications to obtain multiple new processing units; then the running applications are paused, and then at least one new processing unit is allocated to each running application (i.e., the paused application), and then the suspended application is resumed.

[0094] For example, if application a no longer occupies the allocated sub-GPU, then the GPU is re-divided into at least three sub-GPUs according to application b and application c: sub-GPU1, sub-GPU2, sub-GPU3, etc., and then after pausing application b and application c, two sub-GPUs in the newly divided sub-GPUs: sub-GPU1 and sub-GPU2 are respectively allocated to application b and application c, and the remaining sub-GPU3 is allocated to one of the applications, such as application b or application c, and then application b and application c are resumed to continue running, such as Figure 7 as shown in .

[0095] In another implementation, in this embodiment, the processing unit to which the first application is assigned may be assigned to the target application.

[0096] For example, if application a no longer occupies the allocated sub-GPU, then the sub-GPU1 allocated to application a can be allocated to application b as the target application, such as Figure 8 as shown in .

[0097] In one implementation, the present embodiment may also include the following processing:

[0098] It is monitored whether a second application is started. If a second application is started, a new processing unit is split from the processing unit to which the target application is allocated, and then the new processing unit is allocated to the second application.

[0099] The number of processing units allocated to the target application is greater than the number of processing units allocated to other applications. That is, in this embodiment, a portion of the processing units occupied by the target application with more allocated processing units are split out to the newly started second application, but the number of processing units allocated to the target application is still greater.

[0100] For example, application a is assigned three sub-GPUs as the target application: sub-GPU1, sub-GPU2, and sub-GPU3. Application b and application c are assigned one sub-GPU each: sub-GPU4 and sub-GPU5. If application d is started, then one sub-GPU3 can be allocated from the three sub-GPUs assigned to application a and assigned to application d. Fig. 9 as shown in .

[0101] In another implementation, in this embodiment, when it is detected that a second application is started, the processor can be split again according to the third number of running applications to obtain multiple new processing units; then the running applications are paused, and then at least one new processing unit is allocated to each running application (i.e., the paused application), and then the paused application is resumed.

[0102] For example, application a is assigned with three sub-GPUs as the target application: sub-GPU1, sub-GPU2, and sub-GPU3, and application b and application c are assigned with one sub-GPU each: sub-GPU4 and sub-GPU5. When application d is started, the GPU can be divided into at least five sub-GPUs according to application a, b, c, and d. Then, after pausing application a, b, c, and d, four sub-GPUs in the newly divided sub-GPUs: sub-GPU1, sub-GPU2, sub-GPU3, and sub-GPU4 are assigned to application a, b, c, and d, respectively, and the remaining sub-GPU5 is assigned to application a as the target application. Then, application a, b, c, and d are resumed to continue running. Fig.10 as shown in .

[0103] refer to Fig.11 , is a schematic diagram of the structure of a control device provided in an embodiment of the present application, which can be deployed in an electronic device that supports the operation of an application program through a processor. For example, the processor can be a GPU or an NPU, etc. The electronic device can be a mobile phone, a tablet device, a notebook or other device with a display screen, and the application program is a program that needs to use a graphics processor to implement application window output, such as a game application, a social application, etc. The technical solution in this embodiment is mainly used to reasonably allocate graphics processing resources for the application program.

[0104] Specifically, the device in this embodiment may include the following units:

[0105] The processor splitting unit 1101 is used to split the processor according to the first number of running application programs to obtain a second number of processing units; the second number is greater than the first number;

[0106] A processor allocation unit 1102, configured to allocate the processing unit to the application;

[0107] Each of the applications is respectively allocated with at least one of the processing units; and among the first number of applications, a target application is allocated with a larger number of processing units than other applications.

[0108] It can be seen from the above technical solution that in a control device provided by an embodiment of the present application, by splitting the processor according to the number of applications in operation, the number of split processing units is greater than the number of applications, so that after the processing units are allocated to the applications, each application is respectively allocated at least one processing unit, and the number of processing units allocated to the target application in the first number of applications is greater than the number of processing units allocated to other applications. It can be seen that in this embodiment, according to the number of applications in operation, the processor is split into a larger number of processing units, so that at least one processing unit can be allocated to each application, and more processing units can be allocated to special target applications relative to other applications, so that a corresponding number of processing units can be allocated to the application according to the actual needs of the application, thereby realizing the reasonable allocation of processing resources.

[0109] In one implementation, the processor is a graphics processor, and the graphics processor can be split into the second number of graphics processing units.

[0110] In one implementation, the target application is: an application that satisfies a preferred condition among the first number of applications;

[0111] The preferred conditions include: an application window of the target application is in an active state, and / or the target application matches a preset application type.

[0112] In one implementation, the target application is an application selected from the first number of applications according to a polling rule.

[0113] In a preferred embodiment, the polling rule includes a polling duration, which is the duration during which each application among the first number of applications is selected as a target application; wherein the polling duration is determined based on operating parameters of the target application; and the operating parameters represent operating parameters of the target application using the processing unit assigned to it to perform rendering tasks.

[0114] In one implementation, the processor allocation unit 1102 is further configured to allocate the processing unit allocated to the first application to other applications if the first application does not occupy the allocated processing unit.

[0115] Specifically, the processor allocation unit 1102 allocates the processing unit allocated to the first application to other applications in any of the following ways:

[0116] Splitting the processing unit assigned to the first application to obtain multiple new processing units, and assigning the multiple new processing units to each running application respectively;

[0117] or,

[0118] According to the order of the running applications, the processing unit assigned to the first application is assigned to each running application according to a polling rule;

[0119] or,

[0120] Re-splitting the processor according to the third number of the running applications to obtain a plurality of new processing units; pausing the running applications; respectively allocating at least one of the new processing units to each of the running applications; and resuming the suspended applications;

[0121] or,

[0122] The processing unit to which the first application is allocated is allocated to the target application.

[0123] In one implementation, the processor splitting unit 1101 is also used to: if a second application is started, split a new processing unit from the processing unit allocated to the target application; the processor allocation unit 1102 then allocates the new processing unit to the second application; the number of processing units allocated to the target application is greater than the number of processing units allocated to other applications.

[0124] In one implementation, the processor splitting unit 1101 may split the processor by any of the following methods:

[0125] According to the computing performance of the processor, the computing unit in the processor is split to obtain a plurality of processing units, each of which includes at least one computing unit;

[0126] or,

[0127] According to the video memory area corresponding to the processor, the computing unit in the processor is split to obtain a plurality of processing units, each of the processing units includes at least one computing unit, the video memory area is divided into a plurality of storage units, and the number of computing units in each processing unit corresponds to the storage unit corresponding to the processing unit in the video memory area.

[0128] It should be noted that the specific implementation method of each unit in this embodiment can refer to the corresponding content in the previous text and will not be described in detail here.

[0129] refer to Fig.12 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, and the electronic device may be an electronic device that supports the running of an application program through a processor. For example, the processor may be a GPU or an NPU, etc. The electronic device may be a mobile phone, a tablet device, a notebook, etc. having a display screen, and the application program is a program that needs to use a graphics processor to implement application window output, such as a game application, a social application, etc. The technical solution in this embodiment is mainly used to reasonably allocate graphics processing resources for the application program.

[0130] Specifically, the electronic device may include the following structure:

[0131] A processor 1201, such as a GPU;

[0132] A controller 1202, such as a controller corresponding to a GPU, is configured to split the processor 1201 according to a first number of running applications to obtain a second number of processing units; the second number is greater than the first number; and allocate the processing units to the applications;

[0133] Each of the applications is respectively allocated with at least one of the processing units; and among the first number of applications, a target application is allocated with a larger number of processing units than other applications.

[0134] It can be seen from the above technical solution that in an electronic device provided by an embodiment of the present application, by splitting the processor according to the number of applications in operation, the number of split processing units is greater than the number of applications, so that after the processing units are allocated to the applications, each application is respectively allocated at least one processing unit, and the number of processing units allocated to the target application in the first number of applications is greater than the number of processing units allocated to other applications. It can be seen that in this embodiment, according to the number of applications in operation, the processor is split into a larger number of processing units, so that at least one processing unit can be allocated to each application, and more processing units can be allocated to special target applications relative to other applications, so that a corresponding number of processing units can be allocated to the application according to the actual needs of the application, thereby realizing the reasonable allocation of processing resources.

[0135] Taking a mobile phone equipped with a GPU as an example, the technical solution of this application is described below:

[0136] With the rise of generative artificial intelligence (AI), more and more scenarios require the use of GPUs, such as traditional games. When users run two or more GPU applications at the same time, how to reasonably allocate GPU resources to ensure the maximum performance benefits for users is a difficult task.

[0137] In view of this, the present application can divide the GPU into several different sub-GPUs and assign them to applications respectively, and reserve a shared sub-GPU at the same time, and then decide to allocate the shared GPU to a certain application according to different scenarios.

[0138] refer to Fig.13 The GPU and the corresponding VRAM are divided into sub-GPU1, sub-GPU2, sub-GPU3, and a shared (comm) sub-GPU, and the VRAM is correspondingly divided into sub-VRAM1, sub-VRAM2, sub-VRAM3, and a shared sub-VRAM. Fig.14 The process of GPU resource allocation for this application is as follows:

[0139] In this embodiment, each time a user opens an application APP, it is detected whether the APP calls the graphics card. If so, the count is increased by 1, and the count represents the number of activated APPs that need to use the graphics card.

[0140] Based on this, every time the count changes, the count is determined. When the count is 1, the GPU is not split. When the count is not 1 but N, the GPU is divided into N+1 sub-GPUs. The N sub-GPUs are allocated to N apps that use the graphics card. The N+1 sub-GPU is allocated based on user operations.

[0141] Specifically: determine whether there is a pinned APP (an active APP) running. If there is a pinned APP running, then allocate the N+1th sub-GPU, i.e. the shared sub-GPU, to the pinned APP. If there is an APP closed, i.e. taskclose, then reduce the count by one. If there is no pinned APP running, then detect the GPU occupancy rate of each APP. Then, based on the GPU occupancy rate of the APP, decide how long to add the shared sub-GPU to each APP. If there is an APP closed, i.e. taskclose, then reduce the count by one.

[0142] The specific steps for implementing the plan are as follows:

[0143] 1. When it is detected that the user has opened a program that requires a graphics card, the GPU will not be split.

[0144] 2. When it is detected that the user has opened two applications that require the GPU, the GPU will automatically divide itself into three sub-GPUs: sub-GPU1, sub-GPU2, and sub-GPU3;

[0145] 3. Sub-GPU1 and sub-GPU2 are each responsible for the corresponding APP;

[0146] 4. If the top AP also uses a graphics card, a shared sub-GPU such as sub-GPU3 will be allocated to the top APP to ensure that the top APP can obtain the best performance.

[0147] 5. If all apps using the graphics card are not pinned at this time, sub-GPU3 will be polled and superimposed on the first two sub-GPUs at different times according to the load severity.

[0148] 6. If you open three apps that need to call the graphics card, allocate the GPU into four sub-GPUs and continue with steps 3 to 5.

[0149] 7. When one of the tasks, i.e., APP, is completed and the corresponding sub-GPU is released, the GPU is reallocated until the task is completed.

[0150] 8. The GPU allocation method can be based on the size of VRAM or total TOPS and other principles.

[0151] Therefore, the technical solution of the present application can solve the problem of multiple APPs competing for resources at the same time.

[0152] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0153] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0154] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0155] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A control method, comprising: Splitting the processor according to a first number of running application programs to obtain a second number of processing units; the second amount is greater than the first amount; assigning the processing unit to the application; Each of the applications is respectively allocated with at least one of the processing units; and among the first number of applications, a target application is allocated with a larger number of processing units than other applications. 2 . The method according to claim 1 , wherein the processor is a graphics processor, and the graphics processor can be split into the second number of graphics processing units.

3. The method according to claim 1, wherein the target application is: an application that meets a preferred condition among the first number of applications; in, The preferred conditions include: an application window of the target application is in an active state, and / or the target application matches a preset application type. 4 . The method according to claim 1 , wherein the target application is an application selected from the first number of applications according to a polling rule.

5. The method according to claim 4, wherein the polling rule comprises a polling duration, wherein the polling duration is a duration during which each application in the first number of applications is selected as a target application; in, The polling duration is determined based on an operating parameter of the target application; the operating parameter represents an operating parameter of the target application executing a rendering task using the allocated processing unit.

6. The method according to claim 1, 2, 3 or 4, further comprising: If there is a first application that does not occupy the allocated processing unit, the processing unit allocated to the first application is allocated to other applications.

7. The method according to claim 6, allocating the processing unit allocated to the first application to other applications, comprising: Splitting the processing unit assigned to the first application to obtain multiple new processing units, and assigning the multiple new processing units to each running application respectively; or, According to the order of the running applications, the processing unit assigned to the first application is assigned to each running application according to a polling rule; or, Re-splitting the processor according to a third number of the application programs in operation to obtain a plurality of new processing units; suspending the running application; Allocating at least one of the new processing units to each of the running applications; resuming the suspended applications; or, The processing unit to which the first application is allocated is allocated to the target application.

8. The method according to claim 1, 2, 3 or 4, further comprising: If a second application is started, a new processing unit is split from the processing unit to which the target application is allocated; The new processing unit is allocated to the second application; the number of processing units allocated to the target application is greater than the number of processing units allocated to other applications.

9. The method according to claim 1, 2, 3 or 4, wherein the processor is split, comprising: According to the computing performance of the processor, the computing unit in the processor is split to obtain a plurality of processing units, each of which includes at least one computing unit; or, According to the video memory area corresponding to the processor, the computing unit in the processor is split to obtain a plurality of processing units, each of the processing units includes at least one computing unit, the video memory area is divided into a plurality of storage units, and the number of computing units in each processing unit corresponds to the storage unit corresponding to the processing unit in the video memory area.

10. A control device comprising: a processor splitting unit, configured to split the processor according to a first number of application programs in operation to obtain a second number of processing units; the second amount is greater than the first amount; A processor allocation unit, configured to allocate the processing unit to the application program; Each of the applications is respectively allocated with at least one of the processing units; and among the first number of applications, a target application is allocated with a larger number of processing units than other applications.