Distribution method and request method of video memory, equipment and storage medium

By adding a video memory filtering component to the physical machine to intercept and manage the video memory requests of applications and configure the upper limit, the problem of uneven video memory usage in cloud rendering is solved, ensuring the normal operation and performance of each application.

CN119557077APending Publication Date: 2025-03-04HANGZHOU ALICLOUD FEITIAN INFORMATION TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202311125060.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-01
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

In cloud rendering scenarios, applications may consume excessive video memory to improve smoothness, resulting in insufficient video memory allocation for other applications on the GPU service, leading to performance degradation and a poor user experience.

Method used

A video memory filtering component is added to the physical machine to intercept video memory usage requests from applications. A video memory usage limit is configured for each application. The system checks whether the number of requests exceeds the limit. If it does, the request is rejected. The video memory filtering component interacts with the application rendering component to return a rejection command and trigger a retry request.

Benefits of technology

It effectively isolates the video memory usage of different applications, avoids excessive usage by some applications, ensures the normal performance of applications sharing video memory, and prevents application exit or performance degradation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557077A_ABST
    Figure CN119557077A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a video memory allocation method, a video memory request method, equipment and a storage medium. In the embodiment of the invention, a video memory occupation request initiated by an application program in a physical machine is intercepted, and a video memory occupation upper limit value is configured for each application program in the physical machine; on the basis, under the condition that the video memory occupation request is intercepted, whether the sum of the to-be-occupied video memory amount requested by the application program at this time and the occupied video memory amount of the application program exceeds the video memory occupation upper limit value corresponding to the application program or not can be judged, and if yes, response to the video memory occupation request is refused. Therefore, the video memory occupation requests generated in the physical machine can be filtered based on the video memory occupation upper limit values configured for the different application programs, so that the video memories occupied by the different application programs are effectively isolated, the problem that the video memories are excessively occupied by part of the application programs is avoided, and the user experience is improved. And thus, the normal performance of each application program sharing the video memory is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of heterogeneous computing technology, and in particular to a method for allocating video memory, a method for requesting video memory, a device, and a storage medium. Background Art

[0002] Cloud rendering is an important scenario in the field of heterogeneous computing technology. In a broad sense, cloud rendering includes cloud desktops, cloud phones, cloud games, metaverse and other scenarios. Its purpose is to put traditional applications that require local rendering on powerful cloud heterogeneous servers for execution. For example, cloud gaming is to put traditional game programs that require local rendering on cloud heterogeneous servers, use the GPU of cloud heterogeneous servers for rendering, and then retrieve the results through the network and finally display them locally.

[0003] At present, considering that different applications usually do not occupy the video memory associated with the GPU at the same time, a GPU can provide cloud rendering services for multiple applications at the same time. However, in order to improve the smoothness of their own operation, applications usually occupy as much video memory as possible, while the video memory associated with the GPU is limited, which may result in insufficient video memory allocation for other applications served by the GPU, leading to application exit or performance degradation, and ultimately a decline in user experience. Summary of the invention

[0004] Multiple aspects of the present application provide a method for allocating video memory, a method for requesting video memory, a device, and a storage medium to ensure the performance of various applications that share video memory.

[0005] The embodiment of the present application provides a method for allocating video memory, which is applicable to a physical machine, wherein the physical machine is equipped with video memory, and the method includes:

[0006] In the case of intercepting a video memory occupation request initiated by any application running on the physical machine, determining the amount of video memory to be occupied requested by the application;

[0007] Determine whether the sum of the amount of video memory to be occupied and the amount of video memory already occupied by the application exceeds the upper limit of the video memory occupation corresponding to the application;

[0008] If it exceeds, the video memory occupation request will be rejected.

[0009] The embodiment of the present application further provides a method for requesting video memory, which is applicable to an application on a physical machine, and the physical machine is equipped with video memory, and the method includes:

[0010] Initiating a video memory occupation request to the application rendering component on the physical machine, wherein the video memory occupation request carries the amount of video memory to be occupied;

[0011] If a response failure notification fed back by the application rendering component is received, a retry request is initiated to the application rendering component, wherein the amount of video memory to be occupied carried in the retry request is lower than the amount of video memory to be occupied carried in the video memory occupation request to which the response failed;

[0012] Among them, the response failure notification is fed back to the application by the application rendering component after receiving a rejection instruction sent by the video memory filtering component added to the physical machine. The video memory filtering component is used to intercept the video memory occupation request in the application rendering component and send a rejection instruction to the application rendering component when it is determined that the video memory occupation request does not meet the release conditions.

[0013] The embodiment of the present application further provides a physical machine, including a memory and a processor, wherein the physical machine is equipped with a video memory;

[0014] The memory is used to store one or more computer instructions;

[0015] The processor is coupled to the storage and the video memory, and is used to execute the one or more computer instructions to execute the aforementioned video memory allocation method or video memory request method.

[0016] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the aforementioned video memory allocation method or video memory request method.

[0017] In the embodiment of the present application, it is proposed to intercept the video memory occupation request initiated by the application in the physical machine, and configure the video memory occupation upper limit value for each application in the physical machine; based on this, in the case of intercepting the video memory occupation request, it can be determined whether the sum of the video memory to be occupied by the application and the video memory already occupied by the application has exceeded the video memory occupation upper limit value corresponding to the application, and if it has exceeded, the video memory occupation request is rejected. In this way, based on the video memory occupation upper limit value configured for different applications, the video memory occupation request occurring in the physical machine can be filtered to achieve effective isolation of the video memory occupied by different applications, thereby avoiding the problem of excessive occupation of the video memory by some applications, and then ensuring the normal performance of each application that shares the video memory. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0019] Figure 1A flowchart of a method for allocating video memory provided by an exemplary embodiment of the present application;

[0020] Figure 2 A logical schematic diagram of a method for allocating video memory provided by an exemplary embodiment of the present application;

[0021] Figure 3 A logical schematic diagram of an optional implementation of a method for allocating video memory provided by an exemplary embodiment of the present application;

[0022] Figure 4 A flowchart of another method for allocating video memory provided by an exemplary embodiment of the present application;

[0023] Figure 5 A flowchart of a method for requesting video memory provided by another exemplary embodiment of the present application;

[0024] Figure 6 A schematic diagram of an application scenario provided for an exemplary embodiment of the present application;

[0025] Figure 7 A schematic diagram of the structure of a physical machine is provided for yet another exemplary embodiment of the present application. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0027] At present, in order to improve the smoothness of its own operation, applications usually occupy as much video memory as possible, which may cause other applications served by the GPU to be unable to allocate sufficient video memory, thereby causing the application to exit or performance degradation, and ultimately leading to a degradation in user experience. To this end, in some embodiments of the present application: it is proposed to intercept the video memory occupation request initiated by the application in the physical machine, and configure the video memory occupation upper limit value for each application in the physical machine; based on this, when the video memory occupation request is intercepted, it can be determined whether the sum of the video memory to be occupied requested by the application this time and the video memory occupied by the application has exceeded the video memory occupation upper limit value corresponding to the application. If it has exceeded, the video memory occupation request is rejected. In this way, based on the video memory occupation upper limit value configured for different applications, the video memory occupation request occurring in the physical machine can be filtered to achieve effective isolation of the video memory occupied by different applications, thereby avoiding the problem of excessive occupation of the video memory by some applications, and thus ensuring the normal performance of each application that shares the video memory.

[0028] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0029] Figure 1 A flowchart of a method for allocating video memory provided by an exemplary embodiment of the present application is provided. Figure 2 A logical diagram of a method for allocating video memory provided by an exemplary embodiment of the present application. The method can be executed by a video memory filter component, which can be implemented as software, hardware, or a combination of software and hardware, and the video memory filter component can be integrated in a physical machine. Figure 2 , the physical machine is equipped with video memory. As an important component of the graphics card, the video memory can be connected to the bus in the physical machine to couple with the processor and other components in the physical machine based on the bus protocol.

[0030] The video memory can be understood as the memory of the graphics card, which can also be called the frame buffer, and its function is to store the rendering data processed or to be extracted by the display chip. In this embodiment, the type and specification of the graphics card chip are not limited. The graphics card chip in this embodiment can refer to a GPU (graphics processing unit).

[0031] It is worth noting that the GPU in this embodiment can be used as a heterogeneous acceleration device of the physical machine, and the GPU can provide acceleration services for various application programs running on the physical machine.

[0032] The method for allocating video memory provided in this embodiment can be applied to various scenarios using GPU for heterogeneous acceleration. In cloud rendering scenarios such as cloud desktop scenarios, cloud game scenarios, or cloud mobile phone scenarios, the physical machine in this embodiment can be a cloud server. Among them, cloud rendering applications can be understood as a type of application that completes rendering calculations in a cloud server by GPU acceleration and sends the rendering results to the user side for display. In non-cloud rendering scenarios such as local desktop scenarios or browser scenarios, the physical machine in this embodiment can be a non-cloud server, for example, a server in an enterprise computer room, a user's personal computer, etc. In different scenarios, there are also various applications that need to share video memory on a physical machine. For example, in a cloud rendering scenario, the application in this embodiment can be a cloud desktop program, a cloud game program, a cloud mobile phone program, or other cloud rendering applications; while in a non-cloud rendering scenario, the application in this embodiment can be a local desktop program or a browser program, etc. This embodiment does not limit the application scenario, the work role of the physical machine in different application scenarios, and the types of applications supported in different application scenarios.

[0033] In addition, in this embodiment, it is not limited to which solution is used inside the physical machine to support the application running on it to call the GPU. For example, a physical GPU (including its associated video memory) can be provided to the application for use in a virtualized manner. For another example, the application can be supported to directly access the GPU in an I / O manner. Regardless of which solution is used, it does not affect the implementation of the video memory allocation method in this embodiment.

[0034] Based on this, reference Figure 1 The video memory allocation method provided in this embodiment may include:

[0035] Step 100: when a video memory occupation request initiated by any application running on the physical machine is intercepted, determine the amount of video memory to be occupied requested by the application;

[0036] Step 101, determining whether the sum of the amount of video memory to be occupied and the amount of video memory already occupied by the application exceeds the upper limit of the video memory occupied by the application;

[0037] Step 102: If it exceeds, then refuse to respond to the video memory occupation request.

[0038] refer to Figure 2 In this embodiment, it is proposed to add a video memory filter component in the physical machine, and to execute the video memory allocation method provided in this embodiment through the video memory filter component.

[0039] refer to Figure 1In step 100, the video memory occupation request generated on the physical machine can be intercepted. In the case of intercepting a video memory occupation request initiated by any application running on the physical machine, the amount of video memory to be occupied requested by the application can be parsed from the video memory occupation request. Figure 2 ,The video memory filtering component can monitor the video memory occupation requests occurring on the physical machine and intercept the monitored video memory occupation requests.

[0040] Figure 3 A logical diagram of an optional implementation of a method for allocating video memory provided by an exemplary embodiment of the present application. Figure 3 In an optional interception implementation scheme, the video memory filtering component can be connected to the application rendering component in the physical machine through a second preset interface. Based on this, the video memory filtering component can use the second preset interface to monitor the specified interface in the application rendering component in the physical machine, and can intercept the monitored video memory occupancy request when it is detected that the specified interface initiates a video memory occupancy request to the graphics card driver component in the physical machine. Among them, the specified interface in the application rendering component can be an interface for sending a video memory occupancy request to the graphics card driver component. In this interception implementation scheme, a second preset interface is set in the video memory filtering component, and an interface function is configured for the interface: monitor the video memory occupancy request sent by the application rendering component to the graphics card driver component and intercept the monitored video memory occupancy request. In the traditional video memory allocation scheme, the application rendering component in the physical machine is used to receive the video memory occupancy request initiated by the application in the physical machine, and forward the video memory occupancy request to the graphics card driver component in the physical machine. Different from the traditional rendering process, in the above optional interception implementation scheme, a video memory filter component provided by this embodiment is added between the application rendering component and the graphics card driver component, and based on the interface function configured for the second preset interface mentioned above, the video memory filter component can use the second preset interface to intercept the video memory occupation request initiated by the application rendering component to the graphics card driver component, so as to avoid the video memory occupation request being directly released to the graphics card driver component and responded to. That is, the interception implementation method is to perform the interception operation at the forwarding exit of the application rendering component.

[0041] It is worth noting that the above interception implementation scheme is only exemplary, and the present embodiment is not limited thereto. For example, the second preset interface can also be configured to monitor the interface for receiving the video memory occupation request initiated by the application program in the application rendering component in the physical machine, and intercept the monitored video memory occupation request. That is, the interception operation is performed at the forwarding entrance of the application rendering component.

[0042] The interception in this embodiment refers to prohibiting the monitored video memory occupation request from being sent to the graphics card driver component. In practical applications, the video memory occupation request can be intercepted by using technologies such as filter, which is not limited or elaborated here.

[0043] In addition, it should be understood that the present embodiment does not limit the type of operating system used in the physical machine. In different types of operating systems, the application rendering component may be referred to differently, and no detailed examples are given here. The application rendering component in the present embodiment may refer to an existing component in various operating systems that is used to connect to the application layer and receive rendering tasks initiated by the application program from the application layer, and to send the rendering tasks to the graphics card driver component. In the present embodiment, there is no need to make any modifications to the existing application rendering component, but the video memory filter component added in the physical machine is used to interact with the existing application rendering component to intercept the video memory occupation request occurring in the physical machine. Similarly, in different types of operating systems, the graphics card driver component may be referred to differently, and no detailed examples are given here. The graphics card driver component in the present embodiment may refer to an existing component used to drive the graphics card in various operating systems. Similarly, in the present embodiment, the graphics card driver component is not modified in any way, but the video memory filter component added in the physical machine is used to interact with the existing graphics card driver component to obtain the relevant information required to execute the video memory allocation method provided in the present embodiment. Reference Figure 3 In this embodiment, the video memory filter component added in the physical machine can be set between the application rendering component and the graphics card driver component, and the video memory filter component can interact with the application rendering component and the graphics card driver component respectively.

[0044] Compared with the traditional video memory allocation scheme, in this embodiment, the video memory occupation request issued by the application will not be directly transmitted to the graphics card driver component, but will be intercepted by the graphics card filter component in this embodiment. In this way, the application will no longer be able to occupy as much as requested as in the traditional rendering process, but will need to wait for further scheduling by the graphics card filter component in this embodiment.

[0045] In this embodiment, the video memory occupation request may carry the video memory amount to be occupied requested by the application. In actual applications, a single application may initiate one or more video memory occupation requests, and these video memory occupation requests may be intercepted in step 100. Thereafter, the intercepted video memory occupation requests may be conditionally judged indiscriminately according to the release conditions in step 101.

[0046] Continue to refer Figure 1 In step 101, the upper limit of video memory usage may be configured for each application running on the physical machine. The upper limit of video memory usage corresponding to different applications may not be completely the same.

[0047] In an exemplary implementation, the video memory filter component can dynamically configure the video memory usage upper limit for each application. In this exemplary implementation: the video memory filter component can determine the number and type of applications that currently need to share video memory on the physical machine in response to reaching the video memory usage upper limit configuration opportunity; configure the video memory usage upper limit for each application that currently needs to share video memory according to the total amount of video memory on the physical machine and the determined amount and type; wherein the sum of the video memory usage upper limits allocated to the applications that currently need to share video memory does not exceed the total amount of video memory on the physical machine.

[0048] In this exemplary implementation, the video memory filtering component may periodically execute the aforementioned video memory occupancy upper limit configuration logic. During each round of configuration, the number and type of applications on the physical machine that need to share video memory may change. Accordingly, the video memory occupancy upper limit allocated to the same application during different rounds of configuration may change dynamically. The specific allocation rules used in the above configuration logic are not limited here. For example, the applications may be prioritized by type, and the video memory occupancy upper limit may be allocated based on the priority information and quantity information, etc. The allocation rules are not limited here, and no further examples are given.

[0049] It should be understood that the above-mentioned configuration scheme of the upper limit of video memory usage is only exemplary, and the present embodiment is not limited thereto. In the present embodiment, other schemes may be used to configure the upper limit of video memory usage for the application. For example, the upper limit of video memory usage may be configured for different applications based on experience.

[0050] Based on this, in step 101, it can be determined whether the sum of the amount of video memory to be occupied and the amount of video memory already occupied by the application exceeds the upper limit of the video memory occupation corresponding to the application.

[0051] The amount of video memory already occupied by the application refers to the amount of video memory already occupied before the application initiates the current video memory occupation request. The amount of video memory to be occupied refers to the amount of video memory that the application expects to request to occupy through the current video memory occupation request. In this way, if the sum of the amount of video memory to be occupied and the amount of video memory already occupied by the application exceeds the upper limit of video memory occupation corresponding to the application, it indicates that responding to the video memory occupation request will cause the amount of video memory occupied by the application to exceed the upper limit of video memory occupation corresponding to the application, that is, it will cause the application to occupy excessive video memory.

[0052] In an optional implementation, video memory record information may be maintained for each application, and the video memory record information may include video memory occupation and / or release records of the application. In this way, the video memory record information associated with the application in step 100 may be queried; and based on the queried video memory record information, the amount of video memory occupied by the application may be calculated.

[0053] refer to Figure 3 In this optional implementation, the video memory filtering component can be connected to the graphics card driver component through the first preset interface. Based on this, the video memory filtering component can use the first preset interface to monitor the video memory occupation and / or release operations performed on the application by the graphics card driver component in the physical machine to update the video memory record information maintained for the application. It is worth noting that the graphics card driver component in the physical machine is used to undertake the video memory allocation work. That is, the graphics card driver component is used to respond to the video memory occupation request to perform the video memory occupation operation for the corresponding application; the graphics card release operation may also occur in the graphics card driver component to release the video memory occupied by the corresponding application. In this optional implementation, the video memory occupation and / or release operations in the graphics card driver component can be monitored, so as to generate corresponding video memory occupation records and / or video memory release records based on the application.

[0054] Among them, the video memory occupancy record can reflect the total historical occupancy of the video memory by the application, and the video memory release record can reflect the total historical release of the video memory by the application. On this basis, by calculating the difference between the total historical occupancy and the total historical release of the video memory by the application, the amount of video memory occupied by the application can be obtained. It is worth noting that in actual applications, the application may not have a video memory release event. In this case, there will be no video memory release record or the video memory release record will be empty in the corresponding video memory record information. Similarly, if the application has not successfully allocated any video memory, there will be no video memory occupancy record or the video memory occupancy record will be empty in the corresponding existing record information. In this optional implementation method, the video memory record information can be maintained for each application separately according to the video memory occupancy operation and video memory release operation actually monitored from the graphics card driver component.

[0055] It can be seen that in an optional implementation, it is proposed that the video memory filter component maintains video memory record information for each application, so that the video memory filter component can comprehensively and timely grasp the video memory occupancy of each application, thereby accurately determining the amount of video memory occupied by the application. Compared with the traditional video memory allocation scheme, this is no longer allocated on a first-come, first-served basis, but will pay attention to the video memory occupancy of the application and allocate it in limited quantities, thereby avoiding the problem of excessive video memory occupation by the first-arrived application.

[0056] Continue to refer Figure 1 In step 102, if it is determined that the sum of the amount of video memory to be occupied and the amount of video memory already occupied by the application exceeds the upper limit of the video memory occupation corresponding to the application, the video memory occupation request is rejected.

[0057] refer to Figure 3Based on the docking relationship between the video memory filter component and the application rendering component, in step 102, a rejection instruction may be returned to the application rendering component to prohibit the video memory occupation request from being sent to the graphics driver component; triggering the application rendering component to return a response failure notification to the application that initiated the video memory occupation request. For example, the STATUS_NO_MEMORY (indicating insufficient video memory capacity) error code may be used as the rejection instruction, but it is certainly not limited thereto.

[0058] Thus, from the perspective of the application rendering component, the rejection instruction returned by the video memory filtering component to the application rendering component in this embodiment can, on the one hand, allow the application rendering component to know that the video memory occupation request response has failed, and on the other hand, can trigger the application rendering component to return a response failure notification to the application that initiated the video memory occupation request. From the perspective of the graphics card driver component, it will not perceive the existence of the rejected video memory occupation request. From the perspective of the application, it can know that the video memory occupation request response initiated by it has failed after receiving the response failure notification.

[0059] Optionally, the rejection instruction in this embodiment may adopt an instruction format consistent with the rejection instruction returned by the graphics card driver component to the application rendering component in the traditional video memory allocation solution, so that the application rendering component understands the rejection instruction in step 102 according to the original communication protocol. In this way, from the perspective of the application rendering component, it will not perceive the process of the video memory occupation request being intercepted.

[0060] In a traditional video memory allocation scheme, after receiving a response failure notification, the application usually understands that there is no video memory left on the physical machine, and the application usually does not continue to make video memory requests. Different from the traditional video memory allocation scheme, this embodiment supports the application to issue a retry request for a video memory occupation request that has been rejected.

[0061] In order to improve the success rate of the retry request issued by the application, in this embodiment, the rejection instruction returned by the graphics card filter component to the application rendering component can adopt a specified format to distinguish it from the rejection instruction returned by the graphics card driver component to the application rendering component in the traditional video memory allocation scheme. In this case, the rejection instruction in a specific format can be used to indicate the rejection reason of excessive video memory request. Further, the graphics card filter component can also carry a video memory request amount suggestion in the rejection instruction. For example, the graphics card filter component can calculate the remaining available video memory according to the upper limit of the video memory occupation of the application and the occupied video memory as the video memory request amount suggestion. In addition, the response failure notification fed back by the application rendering component to the application can also adopt a specified format to indicate the response failure reason of excessive video memory request. Further, the aforementioned video memory request amount suggestion can also be carried in the response failure notification. For the application, after receiving such a response failure notification, a retry request can be initiated for the rejected video memory occupation request. It should be understood that the essence of the retry request is still a video memory occupation request. In addition, in this embodiment, the amount of video memory to be occupied requested in the retry request initiated by the application may be lower than the amount of video memory to be occupied requested in the corresponding rejected video memory occupation request. In the case where the response failure notification carries a video memory request amount suggestion, the application may configure the amount of video memory to be occupied in the retry request according to the video memory request amount suggestion. For example, it may be configured to be lower than or equal to the available video memory indicated in the video memory request amount suggestion.

[0062] To this end, in this embodiment, when it is detected that the application initiates a retry request after receiving the response failure notification, the amount of video memory to be occupied requested by the application and subsequent operations are determined again for the retry request to determine whether the response to the retry request is allowed. That is, for the retry request initiated by the application, the aforementioned steps 100-102 of this embodiment will also be executed to determine whether to run the response to the retry request. Similarly, if the retry request does not meet the release condition in step 101, it will still be rejected again.

[0063] Figure 4 A flowchart of another method for allocating video memory provided by an exemplary embodiment of the present application. Figure 4 , the method may include:

[0064] Step 400: when a video memory occupation request initiated by any application running on the physical machine is intercepted, determine the amount of video memory to be occupied requested by the application;

[0065] Step 401, determine whether the sum of the amount of video memory to be occupied and the amount of video memory already occupied by the application exceeds the upper limit of the video memory occupied by the application; if so, execute step 402; if not, execute step 403;

[0066] Step 402: Refuse to respond to the video memory occupation request;

[0067] Step 403, sending the video memory occupation request to the graphics card driver component in the physical machine to trigger the graphics card driver component to respond to the video memory occupation request.

[0068] Among them, steps 400-401 can refer to the relevant descriptions in the above-mentioned embodiments, and will not be repeated here. Based on step 403, this embodiment provides a process branch when the sum of the amount of video memory to be occupied and the amount of video memory occupied by the application does not exceed the upper limit of the video memory occupation corresponding to the application. Under this process branch, the video memory filter component can forward the video memory occupation request intercepted from the application rendering component to the graphics card driver component; of course, the video memory filter component can also control the application rendering component to send the video memory occupation request to the graphics card driver component, which is not limited here.

[0069] It can be seen that in this embodiment, if it is determined in step 101 that the video memory occupation request meets the release condition, the video memory occupation request can be released to respond to such video memory occupation request normally. In this way, only the video memory occupation request that will not cause the application to filter and occupy the video memory will be released, which can ensure that the amount of video memory allocated to each application running on the physical machine will not exceed its corresponding video memory occupation upper limit, thereby effectively avoiding the problem of excessive preemption of the video memory by some applications.

[0070] In summary, in this embodiment, it is proposed to intercept the video memory occupation request initiated by the application in the physical machine, and configure the video memory occupation upper limit value for each application in the physical machine; based on this, when the video memory occupation request is intercepted, it can be determined whether the sum of the video memory to be occupied by the application and the video memory already occupied by the application has exceeded the video memory occupation upper limit value corresponding to the application. If it has exceeded, the video memory occupation request is rejected. In this way, based on the video memory occupation upper limit value configured for different applications, the video memory occupation request occurring in the physical machine can be filtered to achieve effective isolation of the video memory occupied by different applications, thereby avoiding the problem of excessive occupation of the video memory by some applications, and then ensuring the normal performance of each application that shares the video memory.

[0071] Figure 5 A flowchart of a method for requesting video memory provided by another exemplary embodiment of the present application. Figure 5 The method may be applicable to an application in a physical machine, where a video memory is installed. The method may include:

[0072] Step 500: Initiate a video memory occupation request to the application rendering component on the physical machine, where the video memory occupation request carries the amount of video memory to be occupied;

[0073] Step 501: If a response failure notification fed back by an application rendering component is received, determine whether the response failure notification is in a specified format;

[0074] Step 502: If yes, a retry request is sent to the application rendering component, and the amount of video memory to be occupied carried in the retry request is lower than the amount of video memory to be occupied carried in the video memory occupation request to which the response failed;

[0075] The response failure notification is fed back to the application by the application rendering component after receiving the rejection instruction sent by the video memory filter component added on the physical machine. The video memory filter component is used to intercept the video memory occupation request in the application rendering component and send a rejection instruction to the application rendering component if it is determined that the video memory occupation request does not meet the release condition. In addition, the release condition here can refer to whether the sum of the video memory to be occupied and the video memory occupied by the application exceeds the video memory occupation upper limit corresponding to the application.

[0076] Among them, the relevant technical logic of the video memory filtering component can be referred to the relevant description in the aforementioned embodiment, and will not be repeated here.

[0077] In an optional embodiment, a method for initiating a retry request to an application rendering component may be:

[0078] If the response failure notification carries a video memory request amount suggestion, the amount of video memory to be occupied carried in the retry request is configured according to the video memory request amount suggestion; wherein the video memory request amount suggestion is determined by the video memory filtering component based on the video memory occupancy upper limit value and the occupied video memory amount corresponding to the application and provided to the application rendering component.

[0079] In summary, based on the video memory request method provided in this embodiment, the application in the physical machine can adjust the amount of video memory to be occupied and initiate a retry request after receiving the response failure notification fed back by the application rendering component, so as to request the amount of video memory allowed by the graphics card filtering component. Compared with the traditional video memory request scheme, after the video memory occupation request fails, the application no longer blindly abandons the request, but can initiate a retry request based on a more appropriate amount of video memory to be occupied. In this way, the application can request an appropriate amount of video memory, and then realize video memory isolation for different applications, avoiding the problem that some applications occupy too much video memory, causing other applications to be unable to run normally due to insufficient video memory.

[0080] Figure 6 A schematic diagram of an application scenario provided by an exemplary embodiment of the present application. Figure 6 , taking the video memory occupation request initiated by application A running on the physical machine as an example. Based on the video memory allocation method and request method provided in this embodiment, the general processing process is as follows:

[0081] 1) Application A initiates a video memory occupation request to the application rendering component, and the requested video memory to be occupied is 2G.

[0082] 2) The video memory filtering component intercepts the video memory occupation request initiated by application A in 1) from the application rendering component.

[0083] 3) The video memory filter component also monitors the video memory occupation and release operations in the graphics driver component, maintains video memory record information for application A, and learns that the amount of video memory occupied by application A is 3G by querying the video memory record information.

[0084] 4) The video memory filtering component calculates that the sum of the video memory to be occupied and the video memory already occupied by application A is 5G, which exceeds the upper limit of its video memory occupation of 4G.

[0085] 5) The video memory filter component returns the STATUS_NO_MEMORY error code for the video memory occupation request to the application rendering component. The application rendering component returns a response failure notification to application A.

[0086] 6) After a period of time, application A initiates a retry request to the application rendering component for the rejected video memory occupation request. The amount of video memory to be occupied requested in the retry request is 1G. Repeat step 2).

[0087] 7) The video memory filtering component calculates that the sum of the video memory to be occupied and the video memory already occupied by application A is 4G, which does not exceed the upper limit of its video memory occupation of 4G.

[0088] 8) The retry request is sent to the graphics card driver component, and the graphics card driver component allocates 1G video memory to application A.

[0089] It can be seen that, through the video memory allocation method and request method provided in this embodiment, the video memory occupied by a single application can be limited to not exceed its corresponding video memory occupation upper limit, thereby avoiding excessive preemption of video memory by a single application. Moreover, based on the video memory occupation upper limit, it can be ensured that each application can at least be allocated a video memory amount that is lower than or equal to its video memory occupation upper limit, thereby ensuring that each application can run normally.

[0090] In addition, in this embodiment, the start and stop of the application will not be directly interfered with, but only the video memory occupation request initiated by the application will be filtered (for example, when the application is running in a container, this embodiment will not directly interfere with the suspension or release of the container in which the application is located), but the decision-making power is given to the application itself, and the application can decide whether to retry or directly suspend its rejected video memory occupation request. This can effectively avoid problems such as application exit or performance degradation due to unreasonable allocation of video memory.

[0091] It should be noted that in some of the processes described in the above embodiments and the accompanying drawings, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel, and the sequence numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different preset interfaces, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.

[0092] Figure 7 A schematic diagram of the structure of a physical machine provided by another exemplary embodiment of the present application. Figure 7 As shown, the physical machine may include: a memory 70 and a processor 71. The physical machine is also equipped with a video memory.

[0093] The processor 71 is coupled to the memory 70 and the video memory, and is used to execute the computer program in the memory 70 .

[0094] In some designs, processor 71 may be configured to:

[0095] In the case of intercepting a video memory occupation request initiated by any application running on the physical machine, determining the amount of video memory to be occupied requested by the application;

[0096] Determine whether the sum of the amount of video memory to be occupied and the amount of video memory already occupied by the application exceeds the upper limit of the video memory occupation corresponding to the application;

[0097] If it exceeds, the video memory occupation request will be rejected.

[0098] In an optional embodiment, the processor 71 may also be configured to:

[0099] Querying video memory record information associated with the application, wherein the video memory record information includes video memory occupation and / or release records of the application;

[0100] Based on the video memory record information, the amount of video memory occupied by the application is calculated.

[0101] In an optional embodiment, the processor 71 may also be configured to:

[0102] The first preset interface is used to monitor the video memory occupation and / or release operation performed on the application program in the graphics card driver component in the physical machine, so as to update the video memory record information maintained for the application program.

[0103] In an optional embodiment, the processor 71 may also be configured to:

[0104] Using the second preset interface, monitoring a designated interface in the application rendering component in the physical machine;

[0105] If it is detected that the designated interface initiates a video memory occupation request to the graphics card driver component in the physical machine, intercepting the detected video memory occupation request;

[0106] The application rendering component is used to receive a video memory occupation request initiated by an application program in the physical machine.

[0107] In an optional embodiment, when the processor 71 refuses to respond to the video memory occupation request, it can be specifically used to:

[0108] A rejection instruction is returned to the application rendering component to trigger the application rendering component to return a response failure notification to the application program that initiated the video memory occupation request.

[0109] In an optional embodiment, the processor 71 may also be configured to:

[0110] In the case where it is monitored that the application initiates a retry request after receiving the response failure notification, the determination of the amount of video memory to be occupied requested by the application and subsequent operations are performed again for the retry request to determine whether to allow the response to the retry request.

[0111] In an optional embodiment, the processor 71 may also be configured to:

[0112] If the sum of the amount of video memory to be occupied and the amount of video memory already occupied by the application does not exceed the video memory occupancy upper limit corresponding to the application, the video memory occupancy request is sent to the graphics card driver component in the physical machine to trigger the graphics card driver component to respond to the video memory occupancy request.

[0113] In an optional embodiment, when the physical machine is a cloud server, the application includes a cloud rendering application, which includes a cloud desktop program, a cloud game program, or a cloud phone program; when the physical machine is a non-cloud server, the application includes a local rendering application, which includes a local desktop program or a browser program.

[0114] In an optional embodiment, the processor 71 may also be configured to:

[0115] In response to reaching the configuration timing of the upper limit value of video memory usage, determining the number and type of application programs on the physical machine that currently need to share video memory;

[0116] According to the total amount of video memory on the physical machine and the determined amount and type, respectively configure the upper limit of video memory usage for the application programs that currently need to share video memory;

[0117] The sum of the upper limits of video memory usage allocated to the application programs that currently need to share video memory does not exceed the total amount of video memory on the physical machine.

[0118] In some other designs, the processor 71 may also be used to:

[0119] Initiating a video memory occupation request to the application rendering component on the physical machine, wherein the video memory occupation request carries the amount of video memory to be occupied;

[0120] If a response failure notification fed back by the application rendering component is received, determining whether the response failure notification is in a specified format;

[0121] If yes, a retry request is initiated to the application rendering component, wherein the amount of video memory to be occupied carried in the retry request is lower than the amount of video memory to be occupied carried in the video memory occupation request to which the response failed;

[0122] Among them, the response failure notification is fed back to the application by the application rendering component after receiving a rejection instruction sent by the video memory filtering component added to the physical machine. The video memory filtering component is used to intercept the video memory occupation request in the application rendering component and send a rejection instruction to the application rendering component when it is determined that the video memory occupation request does not meet the release conditions.

[0123] In an optional embodiment, when the processor 71 initiates a retry request to the application rendering component, it may be specifically configured to:

[0124] If the response failure notification carries a video memory request amount suggestion, configuring the video memory amount to be occupied carried in the retry request according to the video memory request amount suggestion;

[0125] The video memory request suggestion is determined by the video memory filtering component according to the video memory occupancy upper limit and the occupied video memory corresponding to the application program and provided to the application rendering component.

[0126] Further, if Figure 7 As shown, the physical machine also includes: a communication component 72, a power supply component 73 and other components. Figure 7 Only some components are shown schematically, which does not mean that the physical machine only includes Figure 7 Components shown.

[0127] It is worth noting that the technical details in the above-mentioned embodiments of the physical machine can refer to the relevant description in the aforementioned method embodiments. In order to save space, they will not be repeated here, but this should not cause a loss in the scope of protection of this application.

[0128] Accordingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which can implement the steps in the above method embodiment when the computer program is executed.

[0129] Above Figure 7 The memory in the computer is used to store computer programs and can be configured to store various other data to support operations on the computing platform. Examples of such data include instructions for any application or method operating on the computing platform, contact data, phone book data, messages, pictures, videos, etc. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0130] Above Figure 7 The communication component in is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G / LTE, 5G and other mobile communication networks, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0131] Above Figure 7 The power supply component in the device provides power to various components of the device where the power supply component is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device where the power supply component is located.

[0132] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0133] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0134] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0135] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0136] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0137] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0138] The above is only the embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims

1. A method for allocating video memory, characterized in that: Applicable to a physical machine, the physical machine is equipped with a video memory, and the method includes: In the case of intercepting a video memory occupation request initiated by any application running on the physical machine, determining the amount of video memory to be occupied requested by the application; Determine whether the sum of the amount of video memory to be occupied and the amount of video memory already occupied by the application exceeds the upper limit of the video memory occupation corresponding to the application; If it exceeds, the video memory occupation request will be rejected.

2. The method according to claim 1, characterized in that The method further comprises: Querying video memory record information associated with the application, wherein the video memory record information includes video memory occupation and / or release records of the application; Based on the video memory record information, the amount of video memory occupied by the application is calculated.

3. The method according to claim 2, characterized in that The method further comprises: The first preset interface is used to monitor the video memory occupation and / or release operation performed on the application program in the graphics card driver component in the physical machine, so as to update the video memory record information maintained for the application program.

4. The method according to claim 1, characterized in that: The method further comprises: Using the second preset interface, monitoring a designated interface in the application rendering component in the physical machine; If it is detected that the designated interface initiates a video memory occupation request to the graphics card driver component in the physical machine, intercepting the detected video memory occupation request; The application rendering component is used to receive a video memory occupation request initiated by an application program in the physical machine.

5. The method according to claim 4, characterized in that Refusing to respond to the video memory occupation request includes: Returning a rejection instruction to the application rendering component to trigger the application rendering component to return a response failure notification in a specified format to the application that initiated the video memory occupation request; The rejection instruction carries a suggestion for the amount of video memory requested.

6. The method according to claim 5, characterized in that The method further comprises: In the case where it is monitored that the application initiates a retry request after receiving the response failure notification, the determination of the amount of video memory to be occupied requested by the application and subsequent operations are performed again for the retry request to determine whether to allow the response to the retry request.

7. The method according to claim 1, characterized in that The method further comprises: If the sum of the amount of video memory to be occupied and the amount of video memory already occupied by the application does not exceed the video memory occupancy upper limit corresponding to the application, the video memory occupancy request is sent to the graphics card driver component in the physical machine to trigger the graphics card driver component to respond to the video memory occupancy request.

8. The method according to claim 1, characterized in that When the physical machine is a cloud server, the application includes a cloud rendering application, which includes a cloud desktop program, a cloud game program, or a cloud phone program; when the physical machine is a non-cloud server, the application includes a local rendering application, which includes a local desktop program or a browser program.

9. The method according to claim 1, characterized in that: The method further comprises: In response to reaching the configuration timing of the upper limit value of video memory usage, determining the number and type of application programs on the physical machine that currently need to share video memory; According to the total amount of video memory on the physical machine and the determined amount and type, respectively configure the upper limit of video memory usage for the application programs that currently need to share video memory; The sum of the upper limits of video memory usage allocated to the application programs that currently need to share video memory does not exceed the total amount of video memory on the physical machine.

10. A method for requesting video memory, characterized in that: Adapted to an application on a physical machine, the physical machine being equipped with a video memory, the method comprising: Initiating a video memory occupation request to the application rendering component on the physical machine, wherein the video memory occupation request carries the amount of video memory to be occupied; If a response failure notification fed back by the application rendering component is received, determining whether the response failure notification is in a specified format; If yes, a retry request is initiated to the application rendering component, wherein the amount of video memory to be occupied carried in the retry request is lower than the amount of video memory to be occupied carried in the video memory occupation request to which the response failed; Among them, the response failure notification is fed back to the application by the application rendering component after receiving a rejection instruction sent by the video memory filtering component added to the physical machine. The video memory filtering component is used to intercept the video memory occupation request in the application rendering component and send a rejection instruction to the application rendering component when it is determined that the video memory occupation request does not meet the release conditions.

11. The method according to claim 10, characterized in that Initiating a retry request to the application rendering component, including: If the response failure notification carries a video memory request amount suggestion, configuring the video memory amount to be occupied carried in the retry request according to the video memory request amount suggestion; The video memory request suggestion is determined by the video memory filtering component according to the video memory occupancy upper limit and the occupied video memory corresponding to the application program and provided to the application rendering component.

12. A physical machine, characterized in that: The physical machine comprises a memory and a processor, and the physical machine is equipped with a video memory; The memory is used to store one or more computer instructions; The processor is coupled to the memory and the video memory, and is used to execute the one or more computer instructions to execute the video memory allocation method described in any one of claims 1-9 or the video memory request method described in any one of claims 10-11.

13. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the video memory allocation method described in any one of claims 1-9 or the video memory request method described in any one of claims 10-11.

Citation Information

Cited By

  • Video memory allocation method, video memory request method, and device and storage medium

    EP4773004A1

  • Video memory allocation method, video memory request method, and device and storage medium

    WO2025044675A1