Video memory allocation method, video memory request method, and device 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, and the normal operation and performance guarantee of each application are achieved.

WO2025044675A1PCT designated stage expired Publication Date: 2025-03-06ALIBABA CLOUD COMPUTING CO LTD

Patent Information

Application Number
PCT/CN2024/109422
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-09-01
Filing Date
2024-08-02
Publication Date
2025-03-06

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 determines 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 instruction and supports retrying the 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 all applications, and prevents application crashes or performance degradation due to insufficient video memory.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024109422_06032025_PF_FP_ABST
    Figure CN2024109422_06032025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present disclosure are a video memory allocation method, a video memory request method, and a device and a storage medium. In the embodiments of the present disclosure, it is proposed that a video memory occupation request initiated by an application in a physical machine is intercepted, and a video memory occupation upper limit value is configured for each application in the physical machine; on this basis, when the video memory occupation request is intercepted, whether the sum of a video memory amount to be occupied that is requested by the application this time and a video memory amount which has been occupied by the application has exceeded the video memory occupation upper limit value corresponding to the application can be determined, and if the sum thereof has exceeded the video memory occupation upper limit value, a refusal to respond to the video memory occupation request is given. Therefore, a video memory occupation request generated in a physical machine can be filtered on the basis of video memory occupation upper limit values configured for different applications, so as to effectively isolate video memories occupied by the different applications, and thus the problem of the video memories being excessively occupied by some of the applications is avoided, such that the normal performance of the applications that share the video memories is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

A video memory allocation method, request method, device and storage medium

[0001] This disclosure claims priority to application number 202311125060.1, filed with the Patent Office of China on September 1, 2023, entitled “A method for allocating video memory, a method for requesting video memory, a device and a storage medium,” the entire contents of which are incorporated herein by reference. Technical Field

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

[0003] Cloud rendering is a key application in heterogeneous computing. Broadly speaking, cloud rendering encompasses scenarios such as cloud desktops, cloud phones, cloud gaming, and the metaverse. Its purpose is to offload traditional applications that require local rendering to high-performance heterogeneous cloud servers. For example, cloud gaming involves running game programs that traditionally require local rendering on heterogeneous cloud servers, utilizing their GPUs for rendering. The resulting rendering is then retrieved over the network for local display.

[0004] Currently, considering that different applications typically don't occupy the GPU's associated video memory simultaneously, a single GPU can provide cloud rendering services for multiple applications simultaneously. However, to improve their own operational smoothness, applications typically occupy as much video memory as possible. However, the video memory associated with a GPU is limited, which can result in insufficient video memory allocation for other applications served by the GPU. This can cause applications to exit or performance degradation, ultimately leading to a poor user experience.

[0005] Summary of the Invention

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

[0007] An embodiment of the present disclosure provides a method for allocating video memory, applicable to a physical machine equipped with video memory. The method includes:

[0008] When a video memory occupation request initiated by any application running on the physical machine is intercepted, determining the amount of video memory to be occupied requested by the application;

[0009] 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 video memory occupation corresponding to the application;

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

[0011] The present disclosure also provides a method for requesting video memory, which is applicable to an application on a physical machine equipped with video memory. The method includes:

[0012] 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;

[0013] If a response failure notification is received from the application rendering component, a retry request is sent to the application rendering component, where 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;

[0014] Among them, 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 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 if it is determined that the video memory occupation request does not meet the release conditions.

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

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

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

[0018] An embodiment of the present disclosure further provides a computer-readable storage medium storing computer instructions, which, when executed by one or more processors, causes the one or more processors to execute the aforementioned method for allocating video memory or the method for requesting video memory.

[0019] In the disclosed embodiment, it is proposed to intercept video memory occupation requests initiated by applications in a physical machine, and configure a video memory occupation upper limit for each application in the physical machine. Based on this, when a 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 corresponding to the application. If so, the video memory occupation request is rejected. In this way, based on the video memory occupation upper limits configured for different applications, video memory occupation requests generated 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 video memory occupation by some applications, and thus ensuring the normal performance of each application that shares the video memory. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0021] FIG1 is a flow chart of a method for allocating video memory provided by an exemplary embodiment of the present disclosure;

[0022] FIG2 is a logic diagram of a method for allocating video memory provided by an exemplary embodiment of the present disclosure;

[0023] FIG3 is a logic diagram of an optional implementation of a method for allocating video memory provided by an exemplary embodiment of the present disclosure;

[0024] FIG4 is a flow chart of another method for allocating video memory provided by an exemplary embodiment of the present disclosure;

[0025] FIG5 is a flow chart of a method for requesting video memory provided by another exemplary embodiment of the present disclosure;

[0026] FIG6 is a schematic diagram of an application scenario provided by an exemplary embodiment of the present disclosure;

[0027] FIG7 is a schematic structural diagram of a physical machine provided by yet another exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] To make the objectives, technical solutions, and advantages of the present disclosure more clear, the technical solutions of the present disclosure will be clearly and completely described below in conjunction with the specific embodiments of the present disclosure and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present disclosure.

[0029] At present, in order to improve the smoothness of its own operation, applications usually occupy as much video memory as possible, which may result in insufficient video memory being allocated to other applications served by the GPU, leading to application exit or performance degradation, and ultimately a degradation in user experience. To this end, in some embodiments of the present disclosure: it is proposed to intercept video memory occupation requests initiated by applications in a physical machine, and configure a video memory occupation upper limit value for each application in the physical machine; based on this, when a 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 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 requests 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 video memory by some applications, and thus ensuring the normal performance of each application that shares the video memory.

[0030] The technical solutions provided by various embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.

[0031] FIG1 is a flow chart of a method for allocating video memory provided by an exemplary embodiment of the present disclosure, and FIG2 is a logic diagram of a method for allocating video memory provided by an exemplary embodiment of the present disclosure. The method can be executed by a video memory filtering component, which can be implemented as software, hardware, or a combination of software and hardware, and the video memory filtering component can be integrated into a physical machine. Referring to FIG2 , a physical machine is equipped with video memory. As an important component of a graphics card, video memory can be connected to a bus in a physical machine to couple with components such as a processor in the physical machine based on a bus protocol.

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

[0033] 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 applications running on the physical machine.

[0034] The video memory allocation method provided in this embodiment can be applied to various scenarios using GPUs for heterogeneous acceleration. In cloud rendering scenarios such as cloud desktop scenarios, cloud gaming scenarios, or cloud mobile phone scenarios, the physical machine in this embodiment can be a cloud server. A cloud rendering application can be understood as a type of application that completes rendering calculations in a cloud server using GPU acceleration and sends the rendering results to the user 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, such as a server in an enterprise computer room or a user's personal computer. In different scenarios, the applications that need to share the video memory on a physical machine are also diverse. For example, in a cloud rendering scenario, the application in this embodiment can be a cloud desktop program, a cloud gaming program, a cloud mobile phone program, or other cloud rendering application; while in a non-cloud rendering scenario, the application in this embodiment can be a local desktop program or a browser program. This embodiment does not limit the application scenario, the role played by the physical machine in different application scenarios, or the types of applications supported in different application scenarios.

[0035] Furthermore, this embodiment does not limit the solution used within the physical machine to support applications running on it in accessing the GPU. For example, a virtualized approach could be used to provide the physical GPU (including its associated video memory) to applications. Another example could be supporting applications directly accessing the GPU through I / O. Regardless of the solution used, it does not affect the implementation of the video memory allocation method in this embodiment.

[0036] Based on this, with reference to FIG1 , the method for allocating video memory provided in this embodiment may include:

[0037] 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;

[0038] Step 101: 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;

[0039] Step 102: If the number exceeds the limit, the video memory occupation request is rejected.

[0040] 2 , this embodiment proposes to add a video memory filter component to a physical machine, and to use the video memory filter component to execute the video memory allocation method provided in this embodiment.

[0041] Referring to Figure 1, in step 100, video memory usage requests originating from a physical machine can be intercepted. When a video memory usage request originating from an application running on the physical machine is intercepted, the amount of video memory requested by the application can be parsed from the video memory usage request. Referring to Figure 2, the video memory filtering component can monitor video memory usage requests originating from the physical machine and intercept the monitored video memory usage requests.

[0042] FIG3 is a logical diagram of an optional implementation of a method for allocating video memory provided by an exemplary embodiment of the present disclosure. Referring to FIG3 , in an optional interception implementation scheme, a video memory filtering component can interface with an application rendering component in a physical machine via a second preset interface. Based on this, the video memory filtering component can use the second preset interface to monitor a designated interface in the application rendering component in the physical machine, and, if it detects that the designated interface initiates a video memory occupation request to a graphics driver component in the physical machine, it can intercept the detected video memory occupation request. The designated interface in the application rendering component can be an interface for sending a video memory occupation request to the graphics driver component. In this interception implementation scheme, a second preset interface is provided in the video memory filtering component, and the interface is configured with an interface function: monitoring video memory occupation requests sent by the application rendering component to the graphics driver component and intercepting the detected video memory occupation requests. In a traditional video memory allocation scheme, the application rendering component in the physical machine is used to receive video memory occupation requests initiated by applications in the physical machine and forward the video memory occupation requests to the graphics driver component in the physical machine. Unlike the traditional rendering process, in the above-mentioned optional interception implementation scheme, a video memory filter component provided by this embodiment is added between the application rendering component and the graphics driver component. 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 video memory usage requests initiated by the application rendering component to the graphics driver component, thereby preventing the video memory usage requests from being directly released to the graphics driver component and being responded to. In other words, this interception implementation method performs the interception operation at the forwarding exit of the application rendering component.

[0043] It is worth noting that the above interception implementation scheme is merely exemplary and this embodiment is not limited thereto. For example, the second preset interface can also be configured to monitor the interface in the application rendering component of the physical machine for receiving video memory usage requests initiated by the application program, and intercept the monitored video memory usage requests. In other words, the interception operation is performed at the forwarding entry of the application rendering component.

[0044] The interception in this embodiment means prohibiting the detected video memory occupation request from being sent to the graphics card driver component. In actual applications, the interception of video memory occupation request can be achieved through technologies such as filter Filter, which is not limited or elaborated here.

[0045] Furthermore, it should be understood that this embodiment does not limit the type of operating system used in the physical machine. The application rendering component may be referred to differently in different operating systems, and detailed examples are not provided here. The application rendering component in this embodiment may refer to an existing component in various operating systems that interfaces with the application layer, receives rendering tasks initiated by applications from the application layer, and dispatches rendering tasks to the graphics driver component. In this embodiment, no modifications are required to the existing application rendering component. Instead, a graphics memory filter component added to the physical machine interacts with the existing application rendering component to intercept graphics memory allocation requests from the physical machine. Similarly, the graphics driver component may be referred to differently in different operating systems, and detailed examples are not provided here. The graphics driver component in this embodiment may refer to an existing component used to drive a graphics card in various operating systems. Similarly, in this embodiment, no modifications are required to the graphics driver component. Instead, a graphics memory filter component added to the physical machine interacts with the existing graphics driver component to obtain the relevant information required to execute the graphics memory allocation method provided in this embodiment. 3 , in this embodiment, the video memory filter component added to the physical machine can be set between the application rendering component and the graphics driver component, and the video memory filter component can interact with the application rendering component and the graphics driver component respectively.

[0046] Compared to traditional video memory allocation schemes, in this embodiment, video memory usage requests issued by applications are not directly transmitted to the graphics card driver component, but are intercepted by the graphics card filter component in this embodiment. As a result, applications can no longer immediately occupy the requested amount of memory as in traditional rendering processes, but must wait for further scheduling by the graphics card filter component in this embodiment.

[0047] In this embodiment, the video memory occupation request may include the amount of video memory to be occupied requested by the application. In actual applications, a single application may initiate one or more video memory occupation requests, all of which may be intercepted in step 100. Subsequently, the intercepted video memory occupation requests may be subjected to conditional judgment indiscriminately according to the release conditions in step 101.

[0048] 1 , in step 101 , a video memory usage upper limit value may be configured for each application running on the physical machine. The video memory usage upper limits corresponding to different applications may not be exactly the same.

[0049] In one exemplary implementation, a video memory filtering component can dynamically configure a video memory usage limit for each application. In this exemplary implementation, the video memory filtering component can determine the number and types of applications currently requiring shared video memory on the physical machine in response to reaching a video memory usage limit configuration opportunity. Based on the total amount of video memory on the physical machine and the determined amount and types, the component can configure video memory usage limits for each application currently requiring shared video memory. The sum of the video memory usage limits allocated to the applications currently requiring shared video memory does not exceed the total amount of video memory on the physical machine.

[0050] In this exemplary implementation, the video memory filtering component may periodically execute the aforementioned video memory usage 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 usage upper limit allocated to the same application in 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 usage upper limit may be allocated based on the priority information and quantity information. The allocation rules are not limited here, and no further examples are given.

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

[0052] Based on this, in step 101 , it may 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.

[0053] The amount of video memory already occupied by an application refers to the amount of video memory already occupied before it 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 occupy through the current video memory occupation request. Thus, 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 corresponding video memory occupation limit value of 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 corresponding video memory occupation limit value, that is, it will cause the application to preempt excessive video memory.

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

[0055] Referring to Figure 3, in this optional implementation, the video memory filtering component can be connected to the graphics card driver component through a 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 by the graphics card driver component in the physical machine for the application 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 that the corresponding video memory occupation record and / or video memory release record can be generated based on the application.

[0056] Among them, the video memory occupancy record can reflect the total historical occupation of the video memory by the application, while 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 occupation of the video memory by the application and the total historical release, 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 in the corresponding video memory record information or the video memory release record will be empty. Similarly, if the application has not successfully allocated any video memory, there will be no video memory occupation record in the corresponding existing record information or the video memory occupation record will be empty. In this optional implementation method, the video memory record information can be maintained for each application separately according to the video memory occupation operations and video memory release operations actually monitored from the graphics card driver component.

[0057] As can be seen, in an optional implementation, a memory filter component is proposed to maintain separate memory records for each application. This allows the component to comprehensively and timely understand the memory usage of each application, thereby accurately determining the amount of memory occupied by each application. Compared to traditional memory allocation schemes, this no longer allocates memory on a first-come, first-served basis. Instead, it considers the memory usage of each application and limits allocation, thus preventing the problem of early-arrival applications overusing memory.

[0058] Continuing with reference to FIG. 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.

[0059] Referring to Figure 3 , based on the connection between the video memory filtering component and the application rendering component, in step 102, a rejection instruction can be returned to the application rendering component to prohibit the video memory usage request from being sent to the graphics driver component. This triggers the application rendering component to return a response failure notification to the application that initiated the video memory usage request. For example, the STATUS_NO_MEMORY error code (indicating insufficient video memory capacity) can be used as the rejection instruction, but this is not limiting.

[0060] 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 notifies the application rendering component of the failure to respond to the video memory usage request, and also triggers the application rendering component to return a response failure notification to the application that initiated the video memory usage request. From the perspective of the graphics card driver component, it is unaware of the existence of the rejected video memory usage request. From the perspective of the application, upon receiving the response failure notification, it is informed that the response to its initiated video memory usage request has failed.

[0061] 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 a traditional video memory allocation solution, so that the application rendering component understands the rejection instruction in step 102 according to the existing communication protocol. In this way, from the perspective of the application rendering component, it will not be aware of the process of the video memory occupation request being intercepted.

[0062] In traditional video memory allocation schemes, upon receiving a response failure notification, an application typically interprets it as no more video memory available on the physical machine and therefore stops making further video memory requests. Unlike traditional video memory allocation schemes, this embodiment allows applications to retry rejected video memory requests.

[0063] To improve the success rate of retry requests issued by applications, in this embodiment, the rejection instruction returned by the graphics card filtering component to the application rendering component can use a specified format, distinguishing it from the rejection instruction returned by the graphics card driver component to the application rendering component in traditional video memory allocation schemes. In this case, the rejection instruction in a specified format can be used to indicate the rejection reason, namely, an excessive video memory request. Furthermore, the graphics card filtering component can also include a video memory request amount recommendation in the rejection instruction. For example, the graphics card filtering component can calculate the remaining available video memory based on the application's video memory usage limit and the amount of video memory already occupied, and use this as the recommended video memory request amount. Furthermore, the response failure notification sent back by the application rendering component to the application can also use a specified format to indicate the response failure reason, namely, an excessive video memory request. Furthermore, the aforementioned video memory request amount recommendation can also be included in the response failure notification. Upon receiving this response failure notification, the application can initiate a retry request for the rejected video memory request. It should be understood that the retry request is still essentially a video memory request. Furthermore, in this embodiment, the amount of video memory requested in the retry request initiated by the application can be lower than the amount of video memory requested in the corresponding rejected video memory occupation request. If the response failure notification includes a video memory request amount suggestion, the application can configure the amount of video memory to be occupied in the retry request based on the video memory request amount suggestion. For example, the amount of video memory to be occupied can be configured to be lower than or equal to the available video memory indicated in the video memory request amount suggestion.

[0064] To this end, in this embodiment, if it is detected that the application has initiated a retry request after receiving a response failure notification, the process of determining the amount of video memory to be occupied and subsequent operations requested by the application will be repeated for the retry request to determine whether to allow the response to the retry request. In other words, steps 100-102 described above in this embodiment will also be executed for the retry request initiated by the application to determine whether to run the response to the retry request. Similarly, if the retry request does not meet the release conditions in step 101, it will still be rejected.

[0065] FIG4 is a flow chart of another method for allocating video memory provided by an exemplary embodiment of the present disclosure. Referring to FIG4 , the method may include:

[0066] 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;

[0067] 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;

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

[0069] Step 403: Send 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.

[0070] Among them, steps 400-401 can refer to the relevant descriptions in the previous embodiment and are not 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 already occupied by the application does not exceed the video memory occupation upper limit corresponding to the application. Under this process branch, the video memory filtering 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 filtering 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.

[0071] As can be seen, in this embodiment, if it is determined in step 101 that the video memory occupation request meets the release conditions, the video memory occupation request can be released, thereby responding normally to such video memory occupation requests. In this way, only video memory occupation requests that will not cause application filtering to occupy video memory will be released. This ensures that the amount of video memory allocated to each application running on the physical machine does not exceed its corresponding video memory occupation limit, thereby effectively preventing the problem of excessive video memory preemption by some applications.

[0072] In summary, this embodiment proposes intercepting video memory occupation requests initiated by applications on a physical machine and configuring a video memory occupation limit for each application on the physical machine. Based on this, when a video memory occupation request is intercepted, it is determined whether the sum of the video memory requested by the application and the video memory already occupied by the application exceeds the corresponding video memory occupation limit for the application. If so, the video memory occupation request is rejected. In this way, based on the video memory occupation limits configured for different applications, video memory occupation requests generated on the physical machine can be filtered to effectively isolate the video memory occupied by different applications, thereby avoiding the problem of excessive video memory occupation by some applications and ensuring the normal performance of each application sharing the video memory.

[0073] FIG5 is a flow chart of a method for requesting video memory provided by another exemplary embodiment of the present disclosure. Referring to FIG5 , the method may be applicable to an application in a physical machine equipped with video memory. The method may include:

[0074] 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;

[0075] Step 501: If a response failure notification feedback from the application rendering component is received, determine whether the response failure notification is in a specified format;

[0076] Step 502: If yes, a retry request is sent to the application rendering component, where 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;

[0077] The response failure notification is fed back to the application by the application rendering component after receiving a rejection instruction from the video memory filtering component added to the physical machine. The video memory filtering component is used to intercept the video memory usage request from the application rendering component and send a rejection instruction to the application rendering component if it determines that the video memory usage request does not meet the release conditions. Alternatively, the release condition here can refer to whether the sum of the video memory to be occupied and the video memory already occupied by the application exceeds the video memory usage limit corresponding to the application.

[0078] For the relevant technical logic of the video memory filtering component, reference may be made to the relevant description in the aforementioned embodiment, which will not be elaborated here.

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

[0080] If the response failure notification carries a video memory request amount suggestion, the video memory amount 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 occupation upper limit value and the occupied video memory amount corresponding to the application and provided to the application rendering component.

[0081] In summary, based on the video memory request method provided in this embodiment, an application on a physical machine can adjust the amount of video memory to be occupied and initiate a retry request after receiving a response failure notification from the application rendering component, in order to request the amount of video memory allowed by the graphics card filtering component. Compared to traditional video memory request schemes, after a video memory occupation request fails, the application no longer blindly abandons the request. Instead, it can initiate a retry request based on a more appropriate amount of video memory to be occupied. This allows the application to request an appropriate amount of video memory, thereby achieving video memory isolation for different applications, avoiding problems such as some applications occupying too much video memory causing other applications to be unable to operate normally due to insufficient video memory.

[0082] FIG6 is a schematic diagram of an application scenario provided by an exemplary embodiment of the present disclosure. Referring to FIG6 , let's take a video memory occupation request initiated by application A running on a 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:

[0083] 1) Application A initiates a video memory occupation request to the application rendering component, requesting 2GB of video memory to be occupied.

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

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

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

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

[0088] 6) After a while, application A sends a retry request to the application rendering component for the rejected video memory occupation request. The amount of video memory to be occupied in the retry request is 1GB. Repeat step 2).

[0089] 7) The video memory filter 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 video memory usage upper limit of 4G.

[0090] 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.

[0091] As can be seen, the video memory allocation and request methods provided in this embodiment can limit the amount of video memory occupied by a single application to no more than its corresponding video memory usage limit, thereby preventing a single application from excessively preempting video memory. Furthermore, based on the video memory usage limit, each application can be guaranteed to be allocated at least an amount of video memory that is less than or equal to its video memory usage limit, thereby ensuring that each application can run normally.

[0092] Furthermore, this embodiment does not directly interfere with the start and stop of applications. Instead, it filters the video memory usage requests initiated by applications (for example, if an application is running in a container, this embodiment does not directly interfere with the pausing or releasing of the container in which the application resides). Instead, it leaves the decision to the application itself, allowing the application to decide whether to retry or directly suspend a rejected video memory usage request. This effectively avoids problems such as application exit or performance degradation caused by improper video memory allocation.

[0093] 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 may be executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the serial 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., and do not represent the order of precedence, nor do they limit "first" and "second" to be different types.

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

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

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

[0097] When a video memory occupation request initiated by any application running on the physical machine is intercepted, determining the amount of video memory to be occupied requested by the application;

[0098] 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 video memory occupation corresponding to the application;

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

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

[0101] 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;

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

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

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

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

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

[0107] 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;

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

[0109] In an optional embodiment, when the processor 71 refuses to respond to the video memory occupation request, it may be specifically configured to:

[0110] 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.

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

[0112] When it is detected 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 the response to the retry request is allowed.

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

[0114] 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 occupation upper limit corresponding to the application, the video memory occupation 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 occupation request.

[0115] 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.

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

[0117] In response to reaching a configuration timing of an 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;

[0118] configuring upper limits for video memory usage for the applications currently requiring video memory sharing based on the total amount of video memory on the physical machine and the determined amount and type;

[0119] 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.

[0120] In some other designs, the processor 71 may also be configured to:

[0121] 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;

[0122] If a response failure notification feedback from the application rendering component is received, determining whether the response failure notification is in a specified format;

[0123] If yes, a retry request is sent 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;

[0124] Among them, 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 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 if it is determined that the video memory occupation request does not meet the release conditions.

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

[0126] 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;

[0127] 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 amount corresponding to the application program and provided to the application rendering component.

[0128] Furthermore, as shown in Figure 7 , the physical machine also includes other components such as a communication component 72 and a power supply component 73. Figure 7 only schematically shows some components, which does not mean that the physical machine only includes the components shown in Figure 7 .

[0129] It is worth noting that the technical details in the above-mentioned embodiments of the physical machine can be referred 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 any loss of the protection scope of this disclosure.

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

[0131] The memory in FIG. 7 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, images, 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.

[0132] The communication component in Figure 7 above 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.

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

[0134] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0135] The present disclosure 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 disclosure. 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 produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0136] These computer program instructions may also be stored in a computer-readable memory that can direct 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 a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0137] 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, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0138] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0139] 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 disclosure 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 relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0140] The foregoing is merely an embodiment of the present disclosure and is not intended to limit the present disclosure. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included within the scope of protection of the present disclosure.

Claims

1. A method for allocating video memory, wherein: 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 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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, wherein: 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.

14. A computer program, wherein: The method comprises computer instructions, which, when executed by a processor, implement the method for allocating video memory described in any one of claims 1 to 9 or the method for requesting video memory described in any one of claims 10 to 11.

Citation Information

Patent Citations

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

    CN119557077A

  • Video memory control method and device of deep learning framework and storage medium

    CN110413408A

  • Video memory allocation method and device, electronic equipment and storage medium

    CN111400035A

  • Data processing method, device and equipment and readable storage medium

    CN113467958A

  • Video memory allocation method and device, medium and electronic equipment

    CN114625536A

Cited By

  • Dynamic video memory allocation method and system based on data characteristics

    CN120315866A

  • Video memory processing method and device, storage medium and program product

    CN121785804A