Graphics processor resource management method, device, equipment and storage medium
By adjusting the processing order of the task process in real time, and efficiently allocating GPU resources on the cloud server-side according to the resource requirements and consumption of each task process, solving the problems of resource competition and waste in cloud games, and improving rendering quality and resource utilization.
Patent Information
- Application Number
- CN202210135158.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-14
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2042-02-14
AI Technical Summary
In cloud games, due to the limited GPU resources on the cloud server side, multiple game processes share hardware computing resources, resulting in resource competition, affecting the rendering effect, and providing GPUs for each game process alone will cause waste of resources.
By determining the processing order of these task processes in real time based on the resource requirements of each task process and the resource consumption it has generated, thus achieving efficient allocation of graphics processor resources.
It realizes that the quality of multi-game process rendering is improved under limited GPU resources, avoids resource competition, and improves the utilization rate of GPU resources.
Smart Images

Figure CN114490082B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of cloud technology, and more specifically, to a graphics processor resource management method, apparatus, device and storage medium. Background Art
[0002] With the continuous development of cloud technology, cloud gaming is becoming more and more popular in the gaming industry. Cloud gaming completes the game screen rendering work on the Graphic Processing Unit (GPU) on the cloud server side, and transmits the rendering results to the user's client through the network. However, due to the limited GPU resources on the cloud server side, in the cloud server that provides cloud gaming, multiple game processes hosted on the cloud server may share the hardware computing resources of the cloud server, so there will be competition for hardware computing resources. If multiple game processes are run on a GPU at the same time, these game processes will compete for GPU resources and affect the rendering effect. If a separate GPU is provided for each game process, although the rendering quality of each game process can be guaranteed, this will inevitably cause a serious waste of GPU resources.
[0003] Therefore, an efficient GPU resource management method is needed to achieve higher quality multi-game process rendering with limited GPU resources. Summary of the invention
[0004] In order to solve the above problems, the present disclosure determines the processing order of these task processes in real time according to the resource requirements of each task process and the resource consumption it has generated, thereby achieving efficient allocation of graphics manager resources.
[0005] Embodiments of the present disclosure provide a graphics processor resource management method, apparatus, device, and computer-readable storage medium.
[0006] An embodiment of the present disclosure provides a method for managing graphics processor resources, comprising: determining a plurality of graphics processors that can be used to process application processes; obtaining a plurality of application processes to be processed, and allocating one of the plurality of graphics processors to each of the plurality of application processes; for each of at least one application process allocated to a graphics processor, determining the amount of remaining available resources of the application process in currently reserved resources of the graphics processor, wherein the amount of remaining available resources is related to the amount of remaining available resources of the application process in previously reserved resources of the graphics processor; and determining a resource allocation command for each of the at least one application process based on the amount of remaining available resources of each of the at least one application process in the currently reserved resources, wherein the resource allocation command indicates whether to process the application process; wherein the resource allocation command is used to make the amount of remaining available resources of the application process in the currently reserved resources approach zero.
[0007] An embodiment of the present disclosure also provides a method for managing graphics processor resources, comprising: starting a scheduling process, the scheduling process comprising an allocation thread and a plurality of processing threads; determining a plurality of graphics processors that can be used to process an application process through the allocation thread, and allocating a processing thread to each of the plurality of graphics processors; starting a plurality of application processes, each of the plurality of application processes comprising a scheduling library preconfigured by the scheduling process; for each of the plurality of application processes, allocating a graphics processor and a corresponding processing thread to each of the plurality of application processes through the scheduling library of the application process and the allocation thread; for each of at least one application process allocated to a graphics processor, determining the amount of remaining available resources of the application process in the currently reserved resources of the graphics processor through the processing thread corresponding to the application process, so as to determine a resource allocation command for the application process, the resource allocation command indicating whether to process the application process; wherein the amount of remaining available resources is related to the amount of remaining available resources of the application process in the previously reserved resources of the graphics processor, and the resource allocation command is used to make the amount of remaining available resources of the application process in the currently reserved resources approach zero.
[0008] An embodiment of the present disclosure provides a graphics processor resource management device, comprising: a processor determination module, configured to determine a plurality of graphics processors that can be used to process an application process; a processor allocation module, configured to obtain a plurality of application processes to be processed, and allocate one of the plurality of graphics processors to each of the plurality of application processes; a remaining resource determination module, configured to determine, for each of at least one application process allocated to a graphics processor, the amount of remaining available resources of the application process in the current reserved resources of the graphics processor, wherein the amount of remaining available resources is related to the amount of remaining available resources of the application process in the previous reserved resources of the graphics processor; and a resource allocation module, configured to determine a resource allocation command for each of the at least one application process based on the amount of remaining available resources of each of the at least one application process in the current reserved resources, wherein the resource allocation command indicates whether to process the application process; wherein the resource allocation command is used to make the amount of remaining available resources of the application process in the current reserved resources approach zero.
[0009] An embodiment of the present disclosure provides a graphics processor resource management device, comprising: one or more processors; and one or more memories, wherein a computer executable program is stored in the one or more memories, and when the computer executable program is executed by the processor, the graphics processor resource management method described above is executed.
[0010] An embodiment of the present disclosure provides a computer-readable storage medium having computer-executable instructions stored thereon. When the instructions are executed by a processor, the instructions are used to implement the above-mentioned graphics processor resource management method.
[0011] The embodiment of the present disclosure provides a computer program product or a computer program, which includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the graphics processor resource management method according to the embodiment of the present disclosure.
[0012] Compared with the traditional graphics processor resource management method, the method provided by the embodiment of the present disclosure utilizes the past resource consumption of the application process running on the graphics processor as a reference for resource allocation, so as to adjust the resource allocation in real time according to the actual amount of resources available to each application process, thereby avoiding resource competition among multiple application processes.
[0013] The method provided by the embodiment of the present disclosure is for multiple application processes running simultaneously on the same graphics processor, taking into account the remaining available resources of these application processes in the previous resource allocation, and determining the resource allocation scheme in real time based on the amount of resources currently available to these application processes in the resources of the graphics processor, thereby achieving efficient allocation of graphics manager resources. The method of the embodiment of the present disclosure can reasonably allocate graphics processor resources according to the resource requirements of each application process, avoid the impact of competition between multiple application processes, and improve the utilization rate of graphics processor resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some exemplary embodiments of the present disclosure, and a person of ordinary skill in the art can obtain other drawings based on these drawings without creative work.
[0015] Figure 1 is an example schematic diagram showing a scenario in which multiple application processes use GPU resources according to an embodiment of the present disclosure;
[0016] Figure 2A is a flowchart illustrating a graphics processor resource management method according to an embodiment of the present disclosure;
[0017] Figure 2B is a schematic flowchart showing a method for managing graphics processor resources according to an embodiment of the present disclosure;
[0018] Figure 2C is a timing diagram showing a method for managing graphics processor resources according to an embodiment of the present disclosure;
[0019] Figure 3 is a schematic diagram showing allocation of graphics processors to multiple application processes according to an embodiment of the present disclosure;
[0020] Figure 4A is a schematic diagram showing two resource usage situations according to an embodiment of the present disclosure;
[0021] Figure 4B is a schematic diagram showing resource allocation ratios of multiple application processes according to an embodiment of the present disclosure;
[0022] Figure 5 is a schematic diagram showing an acquisition queue and a processing queue according to an embodiment of the present disclosure;
[0023] Figure 6 is an exemplary schematic diagram showing a first increment of the amount of resources used by an application process in currently reserved resources according to an embodiment of the present disclosure;
[0024] Figure 7 is a schematic diagram illustrating acquisition and processing of a first increment according to an embodiment of the present disclosure;
[0025] Fig. 8A is a schematic diagram showing a double buffering method of a CPU and a GPU when determining a first increment according to an embodiment of the present disclosure;
[0026] Figure 8B is a schematic diagram showing an adaptive buffering method of a CPU and a GPU when determining a first increment according to an embodiment of the present disclosure;
[0027] Fig. 9A is a schematic diagram showing a graphics processor resource management method according to an embodiment of the present disclosure;
[0028] Fig. 9B is a schematic diagram showing the scheduling logic of a graphics processor resource management method according to an embodiment of the present disclosure;
[0029] Fig.10 is a schematic diagram showing a graphics processor resource management device according to an embodiment of the present disclosure;
[0030] Fig.11 A schematic diagram of a graphics processor resource management device according to an embodiment of the present disclosure is shown;
[0031] Fig.12 A schematic diagram illustrating the architecture of an exemplary computing device according to an embodiment of the present disclosure; and
[0032] Fig.13 A schematic diagram of a storage medium according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the present disclosure more obvious, the exemplary embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure, and it should be understood that the present disclosure is not limited to the exemplary embodiments described here.
[0034] In this specification and the accompanying drawings, substantially the same or similar steps and elements are represented by the same or similar reference numerals, and repeated descriptions of these steps and elements will be omitted. At the same time, in the description of the present disclosure, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance or ranking.
[0035] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present disclosure pertains. The terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.
[0036] To facilitate description of the present disclosure, concepts related to the present disclosure are introduced below.
[0037] The graphics processor resource management method disclosed in the present invention can be based on cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network in a wide area network or a local area network to realize the calculation, storage, processing, and sharing of data. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model application, which can form a resource pool and be used on demand, flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites, and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately, and all kinds of industry data require strong system backing support, which can only be achieved through cloud computing.
[0038] The graphics processor resource management method disclosed in the present invention can be based on cloud gaming. Cloud gaming, also known as gaming on demand, is an online gaming technology based on cloud computing technology. Cloud gaming technology enables thin clients with relatively limited graphics processing and data computing capabilities to run high-quality games. In a cloud gaming scenario, the game is not run on the player's game terminal, but on a cloud server, and the cloud server renders the game scene as a video and audio stream, which is transmitted to the player's game terminal over the network. The player's game terminal does not need to have powerful graphics computing and data processing capabilities, but only needs to have basic streaming media playback capabilities and the ability to obtain player input instructions and send them to the cloud server.
[0039] In summary, the solutions provided by the embodiments of the present disclosure involve cloud technology, cloud gaming and other technologies. The embodiments of the present disclosure will be further described below in conjunction with the accompanying drawings.
[0040] Figure 1 is an example schematic diagram showing a scenario in which multiple application processes use GPU resources according to an embodiment of the present disclosure.
[0041] Currently, many mobile phone applications or computer software need to use the network to realize their functions, especially for game applications. The network can be the Internet of Things (IoT) based on the Internet and / or telecommunications network, which can be a wired network or a wireless network, for example, it can be a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a cellular data communication network, and other electronic networks that can realize information exchange functions. Figure 1 As shown, the mobile phone application or computer software on the user terminal can send the control command input by the user to the server, thereby starting the corresponding application process. The server can have a variety of hardware computing resources, such as a central processing unit, a communication interface, a memory, etc. Figure 1 Taking the GPU resources shown in as an example, there are multiple GPUs (e.g., GPU-1, GPU-2, etc.) on the server, and each of these GPUs may perform related calculations for multiple different application processes.
[0042] Optionally, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The user terminal can be a smart phone, a tablet computer, a laptop, a desktop computer, a smart speaker, a smart watch, etc., but is not limited to this. The user terminal and the server can be directly or indirectly connected via wired or wireless communication, and this application is not limited here. For example, in an embodiment of the present disclosure, a networked game application usually relies on the GPU on the cloud server to synthesize the game screen displayed by the user terminal or perform hardware encoding. Such a game application is also called a cloud game (also called "game on demand"). The user terminal can transmit the data of the user operating the game to the cloud server through the control flow, and the cloud server transmits one or more audio frames and video frames to the user terminal through the data stream.
[0043] In cloud gaming, games are stored, synchronized, and presented in a remote cloud server and delivered to players using streaming technology. This is a completely different type of online gaming service. Specifically, the cloud server runs the game, presents and encodes its graphical output as a video, and then streams the video to the network client. The client decodes and displays the video stream for the player to interact with the game, while sending the control commands entered by the player to the cloud server. In this way, cloud gaming transfers the computing load of the game from the client to the cloud, thereby removing its constraints on the player's device. In addition, cloud gaming allows players to start the game immediately without spending time downloading and installing the game client. Due to these advantages, cloud gaming has attracted great attention from academia and industry.
[0044] As mentioned above, the cloud server is responsible for interpreting player input, executing game code and rendering graphics, and transmitting game scenes to the client through the network, while the client is responsible for decoding and displaying game scenes to players, capturing and sending game player operations on the game in real time and using them as input to the cloud server. In the process of the cloud server using GPU to perform graphics rendering, due to the limited GPU hardware computing resources, and in the cloud server providing cloud games, multiple virtual entities hosted on the cloud server may share the hardware computing resources of the cloud server, so there will be competition for hardware computing resources. Usually, the rendering of GPU hardware is to process the rendering requests provided by all game processes on it according to the first-come-first-rendering principle, and the increase in the rendering load of a single game process will affect the normal rendering of other game processes. For example, in the case of a rendering timeout of any game process, other game processes are forced to shorten the rendering time, resulting in low rendering quality, and this deterioration in rendering quality may gradually accumulate as the rendering process proceeds, seriously affecting the user's gaming experience.
[0045] Current GPU resource management methods choose to completely isolate resource allocation or allow resource preemption in the management of GPU resources. They do not isolate GPU memory and high-speed serial computer expansion bus standard (Peripheral Component Interconnect Express, PCI-E) bus bandwidth, which may cause the GPU occupancy rate to be very high at a certain moment, while the PCI-E bus is idle, resulting in low overall resource utilization. Technologies such as virtualized GPUs can only achieve a granularity of half or quarter GPU resources for GPU resource division, and cannot perform finer-grained resource division. Moreover, such resource management methods rely on pre-configuration for specific application processes, and cannot allocate GPU computing resources to them in real time and flexibly according to the entry and exit of application processes.
[0046] Based on this, the present disclosure provides a graphics processor resource management method, which determines the processing order of these task processes in real time according to the resource requirements of each task process and the resource consumption it has generated, thereby achieving efficient allocation of graphics manager resources.
[0047] Compared with the traditional graphics processor resource management method, the method provided by the embodiment of the present disclosure utilizes the past resource consumption of the application process running on the graphics processor as a reference for resource allocation, so as to adjust the resource allocation in real time according to the actual amount of resources available to each application process, thereby avoiding resource competition among multiple application processes.
[0048] The method provided by the embodiment of the present disclosure is for multiple application processes running simultaneously on the same graphics processor, taking into account the remaining available resources of these application processes in the previous resource allocation, and determining the resource allocation scheme in real time based on the amount of resources currently available to these application processes in the resources of the graphics processor, thereby achieving efficient allocation of graphics manager resources. The method of the embodiment of the present disclosure can reasonably allocate graphics processor resources according to the resource requirements of each application process, avoid the impact of competition between multiple application processes, and improve the utilization rate of graphics processor resources.
[0049] Figure 2A is a flow chart illustrating a graphics processor resource management method 200 according to an embodiment of the present disclosure. Figure 2B is a schematic flowchart illustrating a method for managing graphics processor resources according to an embodiment of the present disclosure. Figure 2C is a timing diagram illustrating a method for managing graphics processor resources according to an embodiment of the present disclosure.
[0050] like Figure 2A As shown, in step 201, a plurality of graphics processors available for processing an application process may be determined.
[0051] Optionally, GPU resource management can be done in Figure 2C The application process and the scheduling service shown are performed in coordination, wherein the application process portion corresponds to the operations performed by the application process (e.g., a game instance) during the GPU resource management process, and the scheduling service portion corresponds to the GPU resource management scheduling operations for the corresponding application process. Optionally, the application process can be various application processes such as a game process, a video process, and a conference process. In the present disclosure, a game process developed by a graphics engine such as OpenGL (Open Graphics Library) is used as an example rather than a limitation for description, and any process that requires GPU resource scheduling can be applicable to the GPU resource management method of the present disclosure.
[0052] like Figure 2C As shown, before the application process is started, the allocation thread in the scheduling service can first determine the multiple GPUs that are currently available for processing the application process, and create corresponding processing threads for these GPUs in the scheduling service. The subsequent resource allocation management for each GPU can be performed on its corresponding processing thread. For example, for the graphics rendering task of an application process such as a game instance, the determined GPU should have the ability to perform certain rendering calculations. It should be understood that although the following describes the graphics rendering of game instances in cloud gaming scenarios in many cases, the GPU resource management method disclosed in the present invention is also applicable to the processing of other application processes, and this article does not limit this.
[0053] In step 202, a plurality of application processes to be processed may be obtained, and one of the plurality of graphics processors may be allocated to each of the plurality of application processes.
[0054] like Figure 2C As shown, when each user terminal starts an application, the server can register the corresponding application process for it, including but not limited to allocating a GPU for its graphics rendering processing to each application process, and returning its registration information to the application process, such as the index of the allocated GPU and its corresponding processing thread.
[0055] Optionally, when the GPU resource requirements of the application process exceed the determined available resources of each GPU, the application process's request for GPU resources can be forwarded to different GPUs for execution, so that multiple GPUs can be virtualized into one GPU to implement application process processing in this case.
[0056] Optionally, under the condition that the GPU computing performance limit is met, more than one application process may be assigned to the same GPU, that is, processing tasks of more than one application process may be executed simultaneously on the same GPU.
[0057] Figure 3 FIG. 2 is a schematic diagram showing how to allocate a graphics processor to multiple application processes according to an embodiment of the present disclosure. Figure 3 As shown, in the case where there are three application processes A, B and C and three available GPUs 1, 2 and 3, by executing the operation of allocating GPUs in step 202, application processes A and C are allocated to GPU 1 for processing, application process B is allocated to GPU 2 for processing, and GPU C may not be allocated to execute the processing of any application process. Therefore, for application processes A and C running on GPU 1 together, these application processes can share the computing resources on GPU 1, so the resource usage of these application processes may also be in competition. The GPU resource management method disclosed in the present invention can avoid the competitive influence between these application processes.
[0058] According to an embodiment of the present disclosure, each of the multiple application processes may have a predetermined resource requirement weight. Optionally, the resource requirement weight of each application process may be determined based on the amount of GPU resources required for its calculation, and the resource requirement weight may be predetermined and notified to the scheduling service at the time of registration. For example, for multiple game instances, their corresponding resource requirement weights may be predetermined based on the complexity and amount of calculation of their screen rendering, and the weight may be the proportion of the screen rendering of the game instance required in the unit GPU resource. For example, when the screen rendering of the game instance requires 200ms in 1s of GPU hardware calculation time, the resource requirement weight of the game instance may be 0.2 (200ms / 1s).
[0059] According to an embodiment of the present disclosure, allocating one of the multiple graphics processors to each of the multiple application processes in step 202 may include: determining an available resource ratio of each of the multiple graphics processors, the available resource ratio being a proportion of resources in the graphics processor that can be used to process the application process; and determining a graphics processor to be allocated to each application process based on a resource requirement weight of each of the multiple application processes and the available resource ratio of each of the multiple graphics processors.
[0060] As described above, each of the multiple GPUs is a GPU that is currently available for processing application processes, but the available computing resources in these GPUs are not necessarily equal and are not necessarily equal to their total computing resources. Therefore, before allocating GPUs to application processes with specific resource requirements, it is necessary to determine the available resources of the available GPUs. Similar to the above description of resource requirement weights, the available resources of a GPU can be represented by its available resource ratio, which can represent the proportion of the resources in a GPU that can be used to process application processes in its unit resources. For example, in 1s of GPU hardware computing time, the time available for processing application processes is 0.8s, and the available resource ratio of the GPU can be 0.8.
[0061] Therefore, the GPU allocation to the application process can be jointly determined based on the resource demand weights of each application process and the available resource ratio of each GPU. According to an embodiment of the present disclosure, the sum of the resource demand weights of at least one application process allocated to a graphics processor is not greater than the available resource ratio of the graphics processor. For a GPU, the sum of the resource demand weights of the application processes allocated to it for processing cannot be greater than the available resource ratio of the GPU, that is, the amount of resources actually used in the GPU to process the application process cannot be greater than the expected amount of resources.
[0062] In step 203, for each of the at least one application process allocated to a graphics processor, the remaining available resource amount of the application process in the current reserved resources of the graphics processor may be determined, and the remaining available resource amount may be related to the remaining available resource amount of the application process in the previous reserved resources of the graphics processor. According to an embodiment of the present disclosure, the resource amounts respectively included in the previous reserved resources and the current reserved resources of the graphics processor may both be reserved resource amounts.
[0063] Optionally, the resource amounts (i.e., the predetermined resource amounts) respectively included in the previously scheduled resources and the currently scheduled resources may be unit GPU resources as described above. The usage amount of the unit GPU resources may be used to determine the utilization rate of the GPU (the ratio of the actual working time of the GPU to the running time), so the GPU resource allocation in the present disclosure may be based on the allocation of unit GPU resources. For example, the unit GPU resource may be a unit length of computing time, such as the 1s or 1 frame time described above, and the present disclosure is not limited to this. According to an embodiment of the present disclosure, the resource requirement weight of each application process in the multiple application processes may indicate the proportion of the amount of resources required by the application process in the predetermined amount of resources. As described above, the resource requirement weight of an application process may be the proportion of resources required for the processing of the application process in the unit GPU resource.
[0064] In an embodiment of the present disclosure, the current resource allocation can be determined based on the historical state of resource allocation to the application process. The historical state may include the remaining amount of resources of the application process in the previous resource allocation, that is, the amount of resources that can be used but not used. The existence of the remaining available amount of resources may be due to the occupation of the resources of the application process due to the processing timeout of other application processes. Such resource occupation may cause the rendering effect of the application process to be poor. Therefore, in order to avoid the accumulation of such resource occupation, corresponding adjustments can be made in subsequent resource allocations, such as associating the available amount of resources of the application process in the current resource allocation with the remaining available amount of resources in the previous resource allocation.
[0065] According to an embodiment of the present disclosure, determining the remaining amount of available resources of the application process in the currently reserved resources in step 203 may include: determining the remaining amount of available resources of the application process in the currently reserved resources based on the remaining amount of available resources of the application process in the previously reserved resources, the amount of resources used by the application process in the currently reserved resources, and the resource demand weight of the application process.
[0066] Optionally, the total amount of available resources for the application process in the currently reserved resources can be determined based on the resource demand weight of the application process and its remaining available resources in the previously reserved resources. Therefore, on this basis, the remaining available resources for the application process in the currently reserved resources can be determined based on the amount of resources used by the application process in the currently reserved resources.
[0067] By determining the remaining available resource amount of the application process in the current scheduled resources based on the remaining available resource amount of the application process in the previous scheduled resources, the current resource allocation can be adjusted based on the error in the previous resource allocation to reduce or even eliminate the resource allocation error. For example, in the case where the remaining available resource amount of the application process in the previous scheduled resources is less than zero, the resource allocation error can be effectively reduced by subtracting the absolute value of the remaining available resource amount of the application process in the previous scheduled resources from the remaining available resource amount of the application process in the current scheduled resources.
[0068] Therefore, according to an embodiment of the present disclosure, the graphics processor resource management method 200 may also include: for each application process in the at least one application process, obtaining the remaining available resources of the application process in the previously reserved resources, and determining the used resources of the application process in the currently reserved resources.
[0069] Optionally, the amount of resources used by the application process in the currently reserved resources may include the amount of resources used by the application process in a previous resource allocation and the amount of resources used in an earlier resource allocation for the currently reserved resources, wherein the amount of resources used by the application process in the previous resource allocation corresponds to the computing resources used by its most recent processing.
[0070] Therefore, determining the amount of resources used by the application process in the currently reserved resources may include determining a first increment in the amount of resources used by the application process in the currently reserved resources, and the first increment may correspond to a previous processing of a processing task from the application process by a graphics processor corresponding to the application process.
[0071] Optionally, for a rendering task of a game instance, the first increment may correspond to the time when the GPU last executed the rendering process of the game instance, such as Figure 2C As shown, the rendering time can be obtained by the application process and notified to the scheduling service through the scheduling library set therein, so that the scheduling service processes the rendering time based on the rendering time, including determining the remaining available resources of the application process in the currently reserved resources, etc.
[0072] As described above, by determining the remaining available resources of each application process on the same GPU in the currently reserved resources, the scheduling service can jointly determine the current resource allocation scheme and notify the application process whether to render. During this period, the application process waits for the rendering notification from the scheduling service, such as Figure 2C Therefore, obtaining the remaining available resources of each application process, especially obtaining the first increment of each application process, is very important for the GPU resource management of the present disclosure. For the method of obtaining the first increment, please refer to the following description of Figure 6 and Figure 7 The relevant description will not be elaborated here.
[0073] In step 204, a resource allocation command for each of the at least one application process may be determined based on the remaining available resources of each of the at least one application process in the currently reserved resources, wherein the resource allocation command indicates whether to process the application process.
[0074] According to an embodiment of the present disclosure, step 204 may include: for each application process among the at least one application process, when the amount of remaining available resources of the application process in the currently reserved resources is not greater than zero, determining a resource allocation command for the application process to indicate that the application process is not to be processed; and for other application processes among the at least one application process whose amount of remaining available resources is greater than zero, determining a resource allocation command for each application process based on the priority of each application process among the other application processes.
[0075] Optionally, as described above, for application processes whose remaining available resources in the current scheduled resources are not greater than zero, no more resources may be allocated to them in the current scheduled resources, so as not to affect the processing of other application processes. For application processes whose remaining available resources in the current scheduled resources are still greater than zero, consideration may be given to continuing to allocate GPU computing resources to these application processes. Optionally, resource allocation to these application processes may be based on the priority of these application processes, rather than just based on the first-come-first-served competition mode described previously.
[0076] According to an embodiment of the present disclosure, the priority of each of the other application processes may be related to the length of time the application process has been waiting to be processed and the time sequence of determining its latest first increment. For example, for an application process to be processed that is about to experience screen freezes, its priority may be set higher so that it can be processed first; and for processing opportunities where there is no such emergency, its priority may be determined based on the time sequence of obtaining the first increments of these application processes, for example, the application process that first obtains its first increment and has a remaining available resource amount greater than zero in the currently reserved resources may be processed first.
[0077] According to an embodiment of the present disclosure, determining the resource allocation command for each application process based on the priority of each application process in the other application processes may include: for each application process in the other application processes, in a case where there is an application process whose waiting time length meets a predetermined condition, determining the resource allocation command for the application process based on the time sequence of determining the latest first increment of the application process; and in a case where there is no application process whose waiting time length meets the predetermined condition, determining the resource allocation command for each application process based on the time sequence of determining the latest first increment of each application process in the other application processes.
[0078] As described above, the priority setting of application processes may consider (including but not limited to) the following factors: ① the amount of remaining available resources, which can set a low priority (indicating non-execution) for application processes whose remaining available resources in the current scheduled resources are not greater than zero; ② urgency, which can assign a high priority to application processes that are currently in urgent need of processing, such as when the screen display is about to freeze or other emergency situations; and ③ the order of obtaining the first increment, which can assign a higher priority to the application process that obtains its first increment first, so that the GPU resource allocation is more continuous, thereby improving the utilization rate of GPU resources. It should be understood that when setting the priority of processing application processes, the method of the present disclosure may also consider various other factors, and the above-mentioned factors are only used as examples and not limitations.
[0079] According to an embodiment of the present disclosure, the resource allocation command indicates whether the corresponding application process is to send a processing task to the corresponding graphics processor for processing by the graphics processor, wherein the processing of the processing task by the graphics processor corresponds to the use of the resources of the graphics processor by the application process.
[0080] As described above, the execution of the above various operation steps can be performed based on event triggering, without the need for a traditional instruction stream system that redirects rendering instructions of all application processes to a scheduling process for rendering, thereby improving R&D efficiency and reducing costs.
[0081] like Figure 2B As shown, the GPU resource management disclosed in the present invention controls the sending of processing tasks by these application processes by evaluating the resource usage of GPU hardware resources by each application process. Figure 2B Taking graphics rendering tasks as an example, GPU resource management can control the delivery of rendering instructions to each application process through resource allocation commands.
[0082] Optionally, each application process may determine whether to send a processing task to a corresponding GPU according to the received resource allocation command (for example, Figure 2B The GPU will consume a certain amount of GPU hardware resources to execute the processing task, and the certain amount of computing resources may correspond to the first increment of the application process referenced in the next resource allocation.
[0083] According to an embodiment of the present disclosure, the resource allocation command may be used to make the remaining available resource amount of the application process in the current reserved resource approach zero. Optionally, the resource allocation command may reduce the error of resource allocation to each application process.
[0084] Figure 4A is a schematic diagram showing two resource usage situations according to an embodiment of the present disclosure. For example, in the case where the remaining available resources of the application process are greater than zero (for example, Figure 4A In the normal case shown in FIG. 1 , the resource allocation command to the application process can cause the application process to send a processing task and then use a certain amount of computing resources, so that the remaining available resources greater than zero are reduced; and in the case where the remaining available resources of the application process are less than zero (for example, Figure 4A In the timeout situation shown in the figure, the application process can no longer use any resources in the current reserved resources, so no resources are allocated to the application process in the current reserved resources, so that the remaining available resources no longer continue to decrease.
[0085] According to an embodiment of the present disclosure, the resource allocation command is used to make the resource proportion used by the application process in the current reserved resources closer to the resource demand weight of the application process than the resource proportion used by the application process in the previously reserved resources.
[0086] Figure 4B is a schematic diagram showing resource allocation ratios of multiple application processes according to an embodiment of the present disclosure. Figure 4BAs shown in the figure, the resource demand weights of the three application processes A, B and C are 0.5, 0.2 and 0.3 respectively. In the previously reserved resources, application process A used more resources than its reserved resource demand (58%), resulting in insufficient resources for the other two application processes B and C (17% and 25% respectively, both less than the resource proportion corresponding to their reserved resource weights).
[0087] Therefore, according to the GPU resource management method disclosed in the present invention, the remaining available resources of the application process A in the previously reserved resources are less than zero (for example, Figure 4B In the example, it is -0.08), and the resource allocation to it should be reduced in the current scheduled resources according to the amount of resources it overused (i.e., 0.08). Therefore, in the resource allocation result of the current scheduled resources, 42% of the available resources are allocated to application process A through resource allocation adjustment, and resource compensation is made to other application processes B and C whose resources are occupied (i.e., the available resources of application process B are 20% + (20% - 17%) = 23%, and the available resources of application process C are 30% + (30% - 25%) = 35%).
[0088] By making the remaining available resources of the application process in the currently scheduled resources approach zero as described above, the resources used by the application process in the currently scheduled resources can be made closer to the expected resources, that is, the resource demand corresponding to its resource demand weight. Therefore, on-demand resource allocation for the application process can be achieved, and efficient use of GPU resources can be achieved.
[0089] Considering that the above-mentioned timing allocation of GPU hardware resources may require binding accurate timers to the processing threads to trigger the time allocation, in order to reduce the complexity of the method, it can be completed by creating a collection queue and a processing queue, which are used for collecting rendering time and processing rendering time respectively. Figure 2C Notification render time in and handling render time operations.
[0090] Figure 5 is a schematic diagram showing a collection queue and a processing queue according to an embodiment of the present disclosure. Figure 5 As shown, the acquisition queue inserts multiple new rendering time data in sequence through input events, and the processing queue performs rendering time processing during this period. After the processing is completed, it can be exchanged with the acquisition queue, so that the acquisition queue becomes the new processing queue, and the processing queue becomes the new acquisition queue. The timing allocation of time is achieved through the alternation of queues.
[0091] In the process of collecting rendering time, the method of obtaining the first increment may also change based on the different rendering methods of the application process. According to an embodiment of the present disclosure, the method of determining the first increment may be determined based on the processing method of the graphics processor for the processing task, and the processing method may include at least one of synchronous rendering and asynchronous rendering.
[0092] According to an embodiment of the present disclosure, the above-mentioned determination of the first increment of the amount of resources used by the application process in the currently reserved resources can be performed by one of the following: estimating the first increment by marking the start and end of the previous processing; or obtaining the first increment from the graphics processor by using a query instruction.
[0093] Optionally, for the asynchronous rendering mode, the determination of the first increment can be completed by using a signal interception GPU hardware queue. In this case, according to an embodiment of the present disclosure, the first increment of the amount of resources used by the application process in the current reserved resources can be estimated by marking the start and end of the previous processing.
[0094] Figure 6 is an exemplary schematic diagram showing a first increment of the amount of resources used by an application process in currently reserved resources according to an embodiment of the present disclosure.
[0095] Alternatively, the actual rendering time can be determined by calculating the time it takes to execute the drawing function. Figure 6 As shown, the execution time of the drawing function may include preparation time and actual rendering time. During the preparation time, the drawing function is executed through the PCI-E channel for transmission and preparation for rendering, including the execution of rendering instructions, while the actual rendering time is actually the drawing instruction execution part. Therefore, a command signal may be inserted before and after the drawing instruction to inform the application process (or scheduling service) to perform timing when the signal is triggered.
[0096] Optionally, for synchronous rendering, the determination of the first increment may be completed locally in the application thread by querying. In this case, according to an embodiment of the present disclosure, the first increment of the amount of resources used by the application process in the current reserved resources may be obtained from the graphics processor by using a query instruction.
[0097] Figure 7 is a schematic diagram illustrating acquisition and processing of a first increment according to an embodiment of the present disclosure.
[0098] In the case of synchronous rendering, a query operation can be sent to the GPU in the form of a query, which can determine the time between two specified query points through the GPU. Figure 7 As shown, "start query" and "end query" are two specified query points inserted in the GPU to query the GPU time spent on executing the drawing function of the rendering instructions in between, that is, the rendering time. The first inserted "end query" point is discarded because the insertion position of the corresponding "start query" point cannot be known. Figure 7 The gray box part in the figure indicates that the GPU resource management processing is performed based on the obtained rendering time, that is, the obtained rendering time is notified to the scheduling service and then the scheduling service is waited for to notify the rendering, and the scheduling service performs the rendering time processing and sends the rendering notification (that is, the resource allocation command) to the application process through the event notification method.
[0099] In the rendering time query operation as described above, since the operation of waiting for the query time is a synchronous operation on the central processing unit (CPU) side, the waiting process of obtaining the rendering time may greatly affect the performance of the application. Therefore, the GPU resource management method disclosed in the present invention can use the time of the CPU running the rendering instruction to offset the time of the GPU preparing the query result.
[0100] Fig. 8A is a schematic diagram illustrating a double buffering method of a CPU and a GPU when determining a first increment according to an embodiment of the present disclosure.
[0101] In order to ensure the disjoint query mechanism in the GPU, that is, the start and end points of the query must be included in the disjoint query, that is, multiple start points cannot be inserted continuously, this embodiment will perform the interaction between the CPU and the GPU in a way that the GPU delays calculation once. Fig. 8A As shown, the indexes of the CPU and GPU indicate their respective processing orders, where the processing of CPU 2 corresponds to the query time of GPU 1, and the processing of CPU 3 corresponds to the query time of GPU 2. Through such a double buffering method, the processing performance of the CPU during the CPU waiting for the GPU query time is effectively improved. However, since the CPU processing may be faster than the GPU part, the double buffering method may still not completely avoid the CPU waiting. Therefore, based on the above double buffering method, the GPU management method of the present disclosure can also solve the above-mentioned problem based on an adaptive buffering mechanism.
[0102] Figure 8B is a schematic diagram illustrating an adaptive buffering method of a CPU and a GPU when determining a first increment according to an embodiment of the present disclosure.
[0103] In the adaptive buffer mechanism, the double buffer mechanism can still be used. However, if the previous drawing cannot be queried to be completed, the query may not be terminated until it is determined that the previous drawing is definitely completed. Multiple drawing calls can be made during this period.
[0104] Since the adaptive buffering method expands the number of draw calls in the query compared to the double buffering method, the single draw call of the query is expanded into multiple random calls. When processing multiple application processes at the same time, the system accuracy may be reduced. This is because there may be cross-rendering between different application processes. The GPU only reads the time of the current query point and cannot distinguish between different application processes, resulting in inaccurate queries.
[0105] Therefore, in order to better control the submission of the rendering instruction queue, the rendering instruction buffer can be forced to be refreshed asynchronously when the GPU query ends, which will generate a large number of fast drawings. Such drawings can quickly obtain the rendering time results of the GPU without using the adaptive buffering method, but this also leads to the communication transmission burden. In order to balance the system performance and accuracy, while ensuring the communication efficiency, the mutual influence between multiple application processes can be reduced. Therefore, the Monte Carlo algorithm can be used, which combines the basic algorithm and the adaptive algorithm of the double buffering method to obtain a better solution (relative to the optimal solution) through probabilistic statistics. The degradation of the adaptive algorithm to the double buffering basic algorithm can be limited by the number of drawing calls or the system running time. Among them, lower values of these parameters may lead to reduced communication performance, while higher values may increase the influence between multiple application processes. Therefore, the rationality of the system can be further guaranteed by adopting the Monte Carlo algorithm.
[0106] Fig. 9A is a schematic diagram showing a method 300 for managing graphics processor resources according to an embodiment of the present disclosure. Fig. 9A As shown, the GPU resource management method 300 may include two parts of operations respectively executed by the scheduling process and the application process. The GPU resource management method 300 may mainly include the following steps, wherein the number of each step is the same as Fig. 9A The reference numerals in correspondence.
[0107] ① Start a scheduling process, which may include an allocation thread and multiple processing threads.
[0108] like Fig. 9A As shown, the scheduling process may include an allocation thread and multiple processing threads, wherein the allocation thread may be used for allocation of GPUs and application processes and distribution of messages, and the processing thread may be used for rendering time processing for the GPU.
[0109] ② Determine multiple graphics processors that can be used to process the application process through the allocation thread.
[0110] As described above, multiple GPUs currently available for processing the application process may be determined to facilitate subsequent resource allocation management of each GPU.
[0111] ③ Allocate a processing thread to each of the multiple graphics processors.
[0112] like Fig. 9A As shown, for the three currently determined available GPUs, the scheduling process can allocate three processing threads 1, 2 and 3 for respectively processing the rendering time of these three GPUs. Therefore, subsequent resource allocation of each GPU can be executed by the corresponding processing thread.
[0113] ④ Start multiple application processes, each of the multiple application processes may include a scheduling library pre-configured by the scheduling process.
[0114] Optionally, the scheduling library can be shared among the multiple application processes, and the information exchange between the application process and the scheduling process can be realized through the scheduling library. After the application process is started, the scheduling library can send the information of the application process to the scheduling process for registration, and the registration operation of the application process is a synchronous operation. In order to reduce the backflow of data, the application process can continue to send messages after registration, and the scheduling process can notify the processing of the application process through a shared event.
[0115] ⑤ For each of the multiple application processes, one graphics processor from the multiple graphics processors and a processing thread corresponding to the graphics processor are allocated to each of the multiple application processes through the scheduling library of the application process and the allocation thread.
[0116] like Fig. 9A As shown, three application processes can be allocated GPUs for their graphics rendering processing. For example, application processes 1 and 2 are allocated to GPU 1 for graphics rendering, application process 3 is allocated to GPU 3 for graphics rendering, and GPU 2 is not allocated for processing these three application processes. After the registration operation of the application process is completed on the scheduling process, the corresponding registration information can be returned to each application process, such as the index of the allocated GPU and its corresponding processing thread.
[0117] ⑥ For each of at least one application process allocated to a graphics processor, the amount of remaining available resources of the application process in the current reserved resources of the graphics processor is determined by a processing thread corresponding to the application process to determine a resource allocation command for the application process, wherein the resource allocation command indicates whether to process the application process.
[0118] The rendering processing operation of the scheduling service as described above can be performed by the corresponding processing thread in the scheduling process. For example, the processing thread 1 corresponding to GPU 1 can process the rendering time of application processes 1 and 2, including determining the remaining available resources of the two application processes in the current reserved resources and determining the corresponding resource allocation command based on the remaining available resources of the two application processes in the current reserved resources. After receiving the corresponding resource allocation command, each application process determines whether to send a processing task to the corresponding GPU based on the resource allocation command for the GPU to process.
[0119] As described above, the way to obtain the first increment is different based on the different ways in which the GPU processes the processing task. For example, in the case of asynchronous rendering, the first increment can be estimated by the scheduling library directly from the GPU through signal interception; while in the case of synchronous rendering, the first increment can be obtained by the scheduling library from the GPU through query instructions, that is, returning along the solid line from the GPU to the scheduling library.
[0120] According to an embodiment of the present disclosure, the remaining available resource amount is related to the remaining available resource amount of the application process in the previously reserved resources of the graphics processor, and the resource allocation command is used to make the remaining available resource amount of the application process in the currently reserved resources approach zero. By making the remaining available resource amount of the application process in the currently reserved resources approach zero as described above, the amount of resources used by the application process in the currently reserved resources can be made closer to the expected amount of resources, that is, the amount of resource demand corresponding to its resource demand weight. Therefore, on-demand resource allocation for the application process can be achieved, and efficient use of GPU resources can be achieved.
[0121] Fig. 9B : is a schematic diagram showing the scheduling logic of the GPU resource management method according to an embodiment of the present disclosure. Optionally, the GPU resource management method of the present disclosure may involve three runtime libraries based on the current design of common graphics systems, namely, client injection (SchedulingClient), scheduling service (SchedulingService) and scheduling logic (Scheduling). Among them, the client injection and scheduling service only handle the function injection and external event communication method, and the core logic lies in the scheduling logic. Fig. 9B As shown, you can call Fig. 9B Various functions in (e.g., ResourceScheduling, SchedulingProtocol, etc.) are used to determine resource allocation commands for each application process by collecting and calculating rendering time and calculating whether to render based on the rendering time.
[0122] Fig.10is a schematic diagram showing a graphics processor resource management device 1000 according to an embodiment of the present disclosure.
[0123] The graphics processor resource management device 1000 may include a processor determination module 1001 , a processor allocation module 1002 , a remaining resource determination module 1003 and a resource allocation module 1004 .
[0124] According to an embodiment of the present disclosure, the processor determination module 1001 may be configured to determine a plurality of graphics processors that can be used to process an application process.
[0125] Optionally, the processor determination module 1001 may perform the operations described above with respect to step 201 .
[0126] Optionally, the application process may be various application processes such as a game process, a video process, and a conference process. Correspondingly, for a graphics rendering task of an application process such as a game instance, the determined GPU should be a GPU capable of performing certain rendering calculations.
[0127] The processor allocation module 1002 may be configured to obtain a plurality of application processes to be processed, and allocate a graphics processor from the plurality of graphics processors to each of the plurality of application processes.
[0128] Optionally, the processor allocation module 1002 may perform the operations described above with respect to step 202 .
[0129] Optionally, when each user terminal starts an application, the server can register the corresponding application process for it, including allocating a GPU for its graphics rendering processing to each application process. Under the condition that the GPU computing performance limit is met, more than one application process can be allocated to the same GPU, that is, more than one application process processing tasks can be executed on the same GPU at the same time, but the load allocated to the GPU cannot exceed the computing performance limit of the GPU.
[0130] The remaining resource determination module 1003 can be configured to determine, for each application process among at least one application process allocated to a graphics processor, the amount of remaining available resources of the application process in the currently reserved resources of the graphics processor, wherein the remaining available resources are related to the amount of remaining available resources of the application process in the previously reserved resources of the graphics processor.
[0131] Optionally, the remaining resource determination module 1003 may perform the operations described above with respect to step 203. By determining the remaining available resource amount of the application process in the current reserved resources based on the remaining available resource amount of the application process in the previous reserved resources, the current resource allocation may be adjusted based on the error in the previous resource allocation to reduce or even eliminate the resource allocation error.
[0132] The resource allocation module 1004 may be configured to determine a resource allocation command for each of the at least one application process based on the remaining available resource amount of each of the at least one application process in the currently scheduled resources, wherein the resource allocation command indicates whether to process the application process. The resource allocation command is used to make the remaining available resource amount of the application process in the currently scheduled resources approach zero.
[0133] Optionally, the resource allocation module 1004 may perform the operations described above with respect to step 204. By making the remaining available resources of the application process in the currently scheduled resources approach zero as described above, the resources used by the application process in the currently scheduled resources can be made closer to the expected resources, that is, the resource demand corresponding to its resource demand weight. Therefore, on-demand resource allocation to the application process can be achieved, and efficient use of GPU resources can be achieved.
[0134] According to yet another aspect of the present disclosure, a graphics processor resource management device is provided. Fig.11 FIG. 2 is a schematic diagram of a graphics processor resource management device 2000 according to an embodiment of the present disclosure.
[0135] like Fig.11 As shown, the graphics processor resource management device 2000 may include one or more processors 2010 and one or more memories 2020. The memory 2020 stores a computer readable code, and when the computer readable code is executed by the one or more processors 2010, the graphics processor resource management method described above may be executed.
[0136] The processor in the embodiments of the present disclosure may be an integrated circuit chip having signal processing capabilities. The processor may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc., and may be an X86 architecture or an ARM architecture.
[0137] In general, various example embodiments of the present disclosure may be implemented in hardware or dedicated circuits, software, firmware, logic, or any combination thereof. Certain aspects may be implemented in hardware, while other aspects may be implemented in firmware or software that may be executed by a controller, microprocessor, or other computing device. When various aspects of the embodiments of the present disclosure are illustrated or described as block diagrams, flow charts, or using some other graphical representation, it will be understood that the blocks, devices, systems, techniques, or methods described herein may be implemented in hardware, software, firmware, dedicated circuits or logic, general purpose hardware or controllers or other computing devices, or some combination thereof as non-limiting examples.
[0138] For example, the method or device according to the embodiment of the present disclosure may also be implemented by Fig.12 The architecture of the computing device 3000 shown in FIG. Fig.12 As shown, the computing device 3000 may include a bus 3010, one or more CPUs 3020, a read-only memory (ROM) 3030, a random access memory (RAM) 3040, a communication port 3050 connected to a network, an input / output component 3060, a hard disk 3070, etc. The storage device in the computing device 3000, such as the ROM 3030 or the hard disk 3070, may store various data or files used for processing and / or communication of the graphics processor resource management method provided in the present disclosure, as well as program instructions executed by the CPU. The computing device 3000 may also include a user interface 3080. Of course, Fig.11 The architecture shown is only exemplary and can be omitted according to actual needs when implementing different devices. Fig.12 One or more components of a computing device are shown.
[0139] According to yet another aspect of the present disclosure, a computer-readable storage medium is provided. Fig.13 A schematic diagram 4000 of a storage medium according to the present disclosure is shown.
[0140] like Fig.13As shown, the computer storage medium 4020 stores computer readable instructions 4010. When the computer readable instructions 4010 are executed by the processor, the graphics processor resource management method according to the embodiment of the present disclosure described with reference to the above figures can be executed. The computer readable storage medium in the embodiment of the present disclosure may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. The non-volatile memory may be 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), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronously linked dynamic random access memory (SLDRAM), and direct memory bus random access memory (DR RAM). It should be noted that memory of the methods described herein is intended to include, but is not limited to, these and any other suitable types of memory. It should be noted that memory of the methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0141] The embodiment of the present disclosure also provides a computer program product or a computer program, which includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the graphics processor resource management method according to the embodiment of the present disclosure.
[0142] Embodiments of the present disclosure provide a graphics processor resource management method, apparatus, device, and computer-readable storage medium.
[0143] Compared with the traditional graphics processor resource management method, the method provided by the embodiment of the present disclosure utilizes the past resource consumption of the application process running on the graphics processor as a reference for resource allocation, so as to adjust the resource allocation in real time according to the actual amount of resources available to each application process, thereby avoiding resource competition among multiple application processes.
[0144] The method provided by the embodiment of the present disclosure is for multiple application processes running simultaneously on the same graphics processor, taking into account the remaining available resources of these application processes in the previous resource allocation, and determining the resource allocation scheme in real time based on the amount of resources currently available to these application processes in the resources of the graphics processor, thereby achieving efficient allocation of graphics manager resources. The method of the embodiment of the present disclosure can reasonably allocate graphics processor resources according to the resource requirements of each application process, avoid the impact of competition between multiple application processes, and improve the utilization rate of graphics processor resources.
[0145] It should be noted that the flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a part of a code, and the module, program segment, or a part of the code contains at least one executable instruction for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0146] In general, various example embodiments of the present disclosure may be implemented in hardware or dedicated circuits, software, firmware, logic, or any combination thereof. Certain aspects may be implemented in hardware, while other aspects may be implemented in firmware or software that may be executed by a controller, microprocessor, or other computing device. When various aspects of the embodiments of the present disclosure are illustrated or described as block diagrams, flow charts, or using some other graphical representation, it will be understood that the blocks, devices, systems, techniques, or methods described herein may be implemented in hardware, software, firmware, dedicated circuits or logic, general purpose hardware or controllers or other computing devices, or some combination thereof as non-limiting examples.
[0147] The exemplary embodiments of the present disclosure described in detail above are merely illustrative and not restrictive. It should be understood by those skilled in the art that various modifications and combinations may be made to these embodiments or their features without departing from the principles and spirit of the present disclosure, and such modifications should fall within the scope of the present disclosure.
Claims
1. A graphics processor resource management method, comprising: determining a number of graphics processors available to process the application process; Acquire a plurality of application processes to be processed, and allocate one of the plurality of graphics processors to each of the plurality of application processes; For each of at least one application process allocated to a graphics processor, determining the remaining available resource amount of the application process in the current reserved resources of the graphics processor based on the remaining available resource amount of the application process in the previous reserved resources of the graphics processor, including determining the total available resource amount of the application process in the current reserved resources of the graphics processor based on the remaining available resource amount of the application process in the previous reserved resources of the graphics processor, and determining the remaining available resource amount of the application process in the current reserved resources of the graphics processor based on the total available resource amount and the used resource amount of the application process in the current reserved resources of the graphics processor; as well as Determine, based on the remaining available resource amount of each application process in the currently reserved resources, a resource allocation command for each application process in the at least one application process, wherein the resource allocation command indicates whether to process the application process; The resource allocation command is used to make the remaining available resource amount of the application process in the current reserved resources approach zero.
2. The method of claim 1, wherein: Each of the multiple application processes has a predetermined resource requirement weight, and the method further includes: For each application process in the at least one application process, obtaining the remaining available resource amount of the application process in the previously reserved resources, and determining the used resource amount of the application process in the currently reserved resources; The determining of the remaining available resource amount of the application process in the current reserved resources of the graphics processor based on the remaining available resource amount of the application process in the previous reserved resources of the graphics processor comprises: Determine the remaining available resources of the application process in the currently scheduled resources based on the remaining available resources of the application process in the previously scheduled resources, the used resources of the application process in the currently scheduled resources, and the resource demand weight of the application process; The resource allocation command is used to make the resource ratio used by the application process in the current reserved resources closer to the resource demand weight of the application process than the resource ratio used by the application process in the previous reserved resources.
3. The method of claim 2, wherein: The resource amounts respectively included in the previously reserved resources and the currently reserved resources of the graphics processor are both the reserved resource amounts; The resource requirement weight of each application process among the plurality of application processes indicates a proportion of the amount of resources required by the application process in the predetermined amount of resources; Wherein, allocating one of the multiple graphics processors to each of the multiple application processes comprises: Determining an available resource ratio of each of the plurality of graphics processors, the available resource ratio being a ratio of resources in the graphics processor that can be used to process an application process; and Determine a graphics processor to be allocated to each application process based on a resource requirement weight of each application process in the plurality of application processes and an available resource ratio of each graphics processor in the plurality of graphics processors; The sum of the resource demand weights of at least one application process allocated to one graphics processor is not greater than the available resource ratio of the graphics processor.
4. The method of claim 2, wherein: The resource allocation command indicates whether the corresponding application process is to send a processing task to the corresponding graphics processor for processing by the graphics processor, wherein the processing of the processing task by the graphics processor corresponds to the use of the resources of the graphics processor by the application process; Among them, determining the amount of resources used by the application process in the currently reserved resources includes determining a first increment of the amount of resources used by the application process in the currently reserved resources, and the first increment corresponds to the previous processing of a processing task from the application process by a graphics processor corresponding to the application process.
5. The method of claim 4, wherein: Determining a first increment of the amount of resources used by the application process in the current reserved resources is performed by one of the following: estimating the first increment by marking the beginning and the end of the previous processing; or Obtaining the first increment from the graphics processor by using a query instruction; The manner of determining the first increment is determined based on a manner in which the graphics processor processes the processing task, and the processing manner includes at least one of synchronous rendering and asynchronous rendering.
6. The method of claim 4, wherein: Based on the remaining available resource amount of each application process in the currently reserved resources, determining a resource allocation command for each application process in the at least one application process comprises: For each of the at least one application process, if the remaining available resource amount of the application process in the currently reserved resources is not greater than zero, determining that the resource allocation command for the application process indicates not to process the application process; and For other application processes of the at least one application process whose remaining available resource amount is greater than zero, a resource allocation command for each application process is determined based on a priority of each application process of the other application processes.
7. The method of claim 6, wherein: The priority of each of the other application processes is related to the length of time the application process has waited to be processed and the time sequence of determining the latest first increment thereof; Determining a resource allocation command for each application process based on the priority of each application process in the other application processes includes: For each of the other application processes, if there is an application process whose waiting time to be processed meets a predetermined condition, determining a resource allocation command for the application process based on a time sequence of determining the latest first increment of the application process; as well as In the case that there is no application process whose waiting time to be processed meets a predetermined condition, a resource allocation command for each application process is determined based on a time sequence of determining a latest first increment of each of the other application processes.
8. A graphics processor resource management method, comprising: Starting a scheduling process, wherein the scheduling process includes an allocation thread and a plurality of processing threads; Determine a plurality of graphics processors that can be used to process the application process by allocating threads, and allocate a processing thread to each of the plurality of graphics processors; Starting a plurality of application processes, each of the plurality of application processes comprising a scheduling library preconfigured by the scheduling process; For each of the multiple application processes, allocate one of the multiple graphics processors and a corresponding processing thread to each of the multiple application processes through the scheduling library of the application process and the allocation thread; For each of the at least one application process allocated to a graphics processor, determining, by a processing thread corresponding to the application process, an amount of remaining available resources of the application process in currently reserved resources of the graphics processor based on an amount of remaining available resources of the application process in previously reserved resources of the graphics processor, so as to determine a resource allocation command for the application process, the resource allocation command indicating whether to process the application process; Wherein, determining the remaining available amount of resources of the application process in the current reserved resources of the graphics processor based on the remaining available amount of resources of the application process in the previous reserved resources of the graphics processor comprises determining the total amount of available resources of the application process in the current reserved resources of the graphics processor based on the remaining available amount of resources of the application process in the previous reserved resources of the graphics processor, and determining the remaining amount of available resources of the application process in the current reserved resources of the graphics processor based on the total amount of available resources and the used amount of resources in the current reserved resources of the graphics processor; The resource allocation command is used to make the remaining available resource amount of the application process in the current reserved resources approach zero.
9. A graphics processor resource management device, comprising: a processor determination module configured to determine a plurality of graphics processors available for processing an application process; A processor allocation module is configured to obtain a plurality of application processes to be processed, and allocate one of the plurality of graphics processors to each of the plurality of application processes; a remaining resource determination module configured to determine, for each of at least one application process allocated to a graphics processor, the remaining available resource amount of the application process in the current reserved resources of the graphics processor based on the remaining available resource amount of the application process in the previous reserved resources of the graphics processor, including determining the total available resource amount of the application process in the current reserved resources of the graphics processor based on the remaining available resource amount of the application process in the previous reserved resources of the graphics processor, and determining the remaining available resource amount of the application process in the current reserved resources of the graphics processor based on the total available resource amount and the used resource amount of the application process in the current reserved resources of the graphics processor; as well as a resource allocation module configured to determine a resource allocation command for each of the at least one application process based on the remaining available resource amount of each of the at least one application process in the currently reserved resources, wherein the resource allocation command indicates whether to process the application process; The resource allocation command is used to make the remaining available resource amount of the application process in the current reserved resources approach zero.
10. The device of claim 9, wherein: Each of the multiple application processes has a predetermined resource requirement weight, and the remaining resource determination module is further configured to: For each application process in the at least one application process, obtaining the remaining available resource amount of the application process in the previously reserved resources, and determining the used resource amount of the application process in the currently reserved resources; The determining of the remaining available resource amount of the application process in the current reserved resources of the graphics processor based on the remaining available resource amount of the application process in the previous reserved resources of the graphics processor comprises: Determine the remaining available resources of the application process in the currently scheduled resources based on the remaining available resources of the application process in the previously scheduled resources, the used resources of the application process in the currently scheduled resources, and the resource demand weight of the application process; The resource allocation command is used to make the resource ratio used by the application process in the current reserved resources closer to the resource demand weight of the application process than the resource ratio used by the application process in the previous reserved resources.
11. The device of claim 10, wherein: The resource allocation command indicates whether the corresponding application process is to send a processing task to the corresponding graphics processor for processing by the graphics processor, wherein the processing of the processing task by the graphics processor corresponds to the use of the resources of the graphics processor by the application process; Among them, determining the amount of resources used by the application process in the currently reserved resources includes determining a first increment of the amount of resources used by the application process in the currently reserved resources, and the first increment corresponds to the previous processing of a processing task from the application process by a graphics processor corresponding to the application process.
12. The device of claim 11, wherein: Based on the remaining available resource amount of each application process in the currently reserved resources, determining a resource allocation command for each application process in the at least one application process comprises: For each of the at least one application process, if the remaining available resource amount of the application process in the currently reserved resources is not greater than zero, determining that the resource allocation command for the application process indicates not to process the application process; and For other application processes of the at least one application process whose remaining available resource amount is greater than zero, a resource allocation command for each application process is determined based on a priority of each application process of the other application processes.
13. The device of claim 12, wherein: The priority of each of the other application processes is related to the length of time the application process has waited to be processed and the time sequence of determining the latest first increment thereof; Determining a resource allocation command for each application process based on the priority of each application process in the other application processes includes: For each of the other application processes, if there is an application process whose waiting time to be processed meets a predetermined condition, determining a resource allocation command for the application process based on a time sequence of determining the latest first increment of the application process; as well as In the case that there is no application process whose waiting time to be processed meets a predetermined condition, a resource allocation command for each application process is determined based on a time sequence of determining a latest first increment of each of the other application processes.
14. A graphics processor resource management device, comprising: one or more processors; as well as One or more memories storing a computer executable program, wherein when the computer executable program is executed by the processor, the method according to any one of claims 1 to 8 is performed.
15. A computer-readable storage medium having computer-executable instructions stored thereon, wherein the instructions are used to implement the method according to any one of claims 1 to 8 when executed by a processor.
Citation Information
Patent Citations
Resource allocation method and device of graphics processor and storage medium
CN112870726A
Data processing task allocation method and device, electronic equipment and storage medium
CN113849312A