Display memory control method, device, equipment, system and computer storage medium
By acquiring the page tables before and after the upgrade and locking the data cleanup queue, the problems of high memory consumption, long processing time, and data consistency risks in the traditional GPU driver upgrade process are solved. This enables efficient driver upgrades without backup or restart, improving the speed of GPU driver upgrades and the utilization of video memory.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ALIBABA CLOUD COMPUTING CO LTD
- Filing Date
- 2025-12-02
- Publication Date
- 2026-04-24
AI Technical Summary
Traditional GPU driver upgrades require shutdown, restart, or task migration, resulting in high memory usage, long upgrade times, and high data consistency risks, impacting system high availability and user experience.
By obtaining the page tables before and after the upgrade, locking the data cleanup queue, and adjusting the GPU memory data based on the page table mapping relationship, driver upgrades can be achieved without memory backup or restart.
It reduces memory overhead, improves GPU driver upgrade speed and memory utilization, ensures data consistency and GPU deployment quality, and enhances the practicality of the method.
Smart Images

Figure CN121255472B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video memory technology, and in particular to a video memory control method, apparatus, device, system, and computer storage medium. Background Technology
[0002] With the widespread adoption of applications such as artificial intelligence, big data, cloud computing, and high-performance graphics processing, the Graphics Processing Unit (GPU) has become the core computing platform in data centers and various computing scenarios. To continuously improve system performance, fix driver defects, and support new hardware or features, operations and maintenance teams and developers often need to upgrade GPU drivers. However, traditional driver upgrades typically require shutting down, restarting, or migrating tasks, and moving all data from the CPU's video memory to system memory. This not only reduces the efficiency of GPU driver upgrades but also easily leads to data loss in video memory. Summary of the Invention
[0003] This application provides a method, apparatus, device, system, and computer storage medium for controlling video memory. It enables GPU driver upgrades without requiring video memory backup, shutdown, restart, or task migration, thus reducing memory overhead and increasing the speed of GPU driver upgrades.
[0004] This invention provides a video memory control method, including:
[0005] In response to the obtained driver upgrade request of the image processing unit (GPU), the upgrade front page table corresponding to the GPU is obtained, and the upgrade front page table includes: the mapping relationship between the physical address and virtual address of the GPU memory;
[0006] A data cleanup queue corresponding to the GPU is determined, and the data cleanup queue is used to perform global cleanup of the data in the GPU's video memory;
[0007] With the data cleanup queue locked, a driver upgrade operation is performed on the GPU based on the driver upgrade request to obtain the upgraded page table corresponding to the GPU. The upgraded page table includes the mapping relationship between the physical address and virtual address of the GPU memory.
[0008] The data in the GPU memory is adjusted based on the page table before the upgrade and the page table after the upgrade.
[0009] This invention provides a video memory control device, comprising:
[0010] The first acquisition module is used to acquire the pre-upgrade page table corresponding to the GPU in response to the obtained driver upgrade request of the image processing unit GPU. The pre-upgrade page table includes the mapping relationship between the physical address and virtual address of the GPU memory.
[0011] The first determining module is used to determine a data cleanup queue corresponding to the GPU, the data cleanup queue being used to perform global cleanup of the data in the GPU's video memory;
[0012] The first processing module is configured to perform a driver upgrade operation on the GPU based on the driver upgrade request while locking the data cleanup queue, and obtain an upgraded page table corresponding to the GPU. The upgraded page table includes a mapping relationship between the physical address and virtual address of the GPU memory.
[0013] The first control module is used to regulate the data in the GPU memory based on the page table before the upgrade and the page table after the upgrade.
[0014] This invention provides a video memory control system, including: a video memory control device and a graphics processing unit (GPU) communicatively connected to the video memory control device;
[0015] The memory control device is configured to, in response to a received driver upgrade request from a graphics processing unit (GPU), acquire a pre-upgrade page table corresponding to the GPU, the pre-upgrade page table including a mapping relationship between the physical addresses and virtual addresses of the GPU memory; determine a data cleanup queue corresponding to the GPU, the data cleanup queue being used to perform global cleanup of data in the GPU memory; while locking the data cleanup queue, perform a driver upgrade operation on the GPU based on the driver upgrade request, acquire a post-upgrade page table corresponding to the GPU, the post-upgrade page table including a mapping relationship between the physical addresses and virtual addresses of the GPU memory; generate a control instruction based on the pre-upgrade page table and the post-upgrade page table, and send the control instruction to the GPU;
[0016] The GPU is used to regulate the data in the GPU memory based on the regulation instructions.
[0017] This invention provides an electronic device, including: a memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method in the first aspect described above.
[0018] This invention provides a computer storage medium for storing a computer program that, when executed by a computer, implements the method described in the first aspect above.
[0019] This invention provides a computer program product, including: a computer-readable storage medium storing computer instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the method in the first aspect described above.
[0020] The memory control method, apparatus, device, system, and computer storage medium provided in this embodiment, in response to a obtained GPU driver upgrade request, obtains the pre-upgrade page table corresponding to the GPU, determines the data cleanup queue corresponding to the GPU, and, with the data cleanup queue locked, performs a driver upgrade operation on the GPU based on the driver upgrade request, obtains the post-upgrade page table corresponding to the GPU, and then performs control operations on the data in the GPU memory based on the pre-upgrade page table and the post-upgrade page table. This effectively enables the GPU to perform driver upgrade operations without requiring memory backup, shutdown, restart, or migration tasks, thereby not only reducing memory overhead and improving the upgrade speed and memory utilization of the GPU driver, but also helping to ensure the actual deployment quality and effect of the GPU, further improving the practicality of the method. Attached Figure Description
[0021] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0022] Figure 1 A schematic diagram illustrating a scenario of a video memory control method provided for an exemplary embodiment of this application;
[0023] Figure 2 A flowchart illustrating a video memory control method provided for an exemplary embodiment of this application;
[0024] Figure 3 A schematic diagram illustrating the process of obtaining the upgraded page table corresponding to the GPU, provided for an exemplary embodiment of this application;
[0025] Figure 4 A schematic diagram illustrating the process of regulating data in the GPU memory based on the pre-upgrade page table and the post-upgrade page table, provided as an exemplary embodiment of this application;
[0026] Figure 5 A flowchart illustrating another video memory control method provided for an exemplary embodiment of this application;
[0027] Figure 6A schematic diagram illustrating the principle of a rapid hot-upgrade method for GPU driver memory with zero backup, provided as an exemplary application embodiment of this application;
[0028] Figure 7 A schematic diagram of a video memory control device provided for an exemplary embodiment of this application;
[0029] Figure 8 A schematic diagram of the structure of an electronic device provided in an exemplary embodiment of this application;
[0030] Figure 9 This is a schematic diagram of a video memory control system provided for an exemplary embodiment of this application. Detailed Implementation
[0031] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0032] It should be noted that, in the cases involving user information in the embodiments of this application, 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 the embodiments of this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse. In addition, the various models involved in this application (including but not limited to language models or large models) comply with relevant laws and standards.
[0033] Additionally, it should be noted that when user interaction operations or triggering operations are involved in the embodiments of this application, these operations include, but are not limited to, various interaction methods such as touch operations, gesture operations, voice operations, head movement operations, and eye movement operations. Touch operations include, but are not limited to, click operations, double-click operations, long-press operations, swipe operations, pinch operations, or mouse hover operations. Swipe operations include, but are not limited to, straight-line swipes and curved-line swipes.
[0034] Terminology definition:
[0035] Containers are lightweight, packaged, and portable software technologies that allow developers to encapsulate applications with their environments, enabling them to run quickly in different computing environments.
[0036] Video memory (VRAM) is a dedicated memory device for the GPU, used to store data and textures used by the GPU, thereby improving the speed and efficiency of graphics processing.
[0037] Drivers are software layers situated between the operating system and the hardware, responsible for enabling the system to correctly identify and operate the hardware. GPU drivers are specifically responsible for managing and scheduling GPU resources, providing API interfaces to the operating system and applications, allowing them to call upon the GPU for tasks such as graphics rendering and data computation. Drivers implement functions such as hardware initialization, command transmission, resource management, and error handling, acting as a bridge for the normal operation of the hardware.
[0038] Page tables are data structures used by operating systems or hardware to record the mapping relationship between virtual addresses and physical addresses when managing virtual memory. For GPUs, page tables are typically maintained by hardware or drivers to ensure that virtual memory addresses are correctly translated into physical memory addresses when the GPU accesses them. Page tables enable memory protection, sharing, and segmentation management, and are key technologies for virtualizing memory and supporting large-capacity memory.
[0039] GMMU: Graphics Memory Management Unit. The GMMU is a dedicated hardware module for GPU memory management, responsible for managing the mapping between the GPU's virtual address space and physical video memory. The GMMU quickly translates virtual addresses in GPU instructions into physical video memory addresses based on page table contents, achieving memory virtualization, address space isolation, and resource allocation. GMMUs typically possess efficient address translation capabilities, support multi-process and secure access, and are an important component of modern GPU architectures.
[0040] The control plane refers to the part of the system that manages and controls system resources, configuration, policies, scheduling, and other functions. In GPU drivers or system architectures, the control plane is typically responsible for making decisions and scheduling processes such as data transmission, resource allocation, and access control. It is usually separated from the data plane and emphasizes logical control, collaboration, and policy enforcement.
[0041] The data plane refers to the system component responsible for actual data processing and flow. In GPU architecture, the data plane mainly comprises a large area of video memory used for storage and reading / writing. Various buffers requested by the user, model data, textures, parameters, etc., are all stored in the data plane. The data plane typically consumes a large amount of video memory resources and is the primary data carrier for GPUs during graphics rendering, AI inference, and high-performance computing.
[0042] To facilitate understanding of the video memory control method, apparatus, device, system, and computer storage medium provided in the embodiments of this application, the relevant technologies are briefly described below:
[0043] With the widespread application of deep learning and high-performance computing, Graphics Processing Units (GPUs) have become critical computing resources in data centers and various computing scenarios. To continuously improve system performance, fix driver defects, and support new hardware or features, operations and maintenance teams and developers often need to upgrade GPU drivers. Among these, hot upgrades of GPU drivers refer to replacing the underlying driver in real time to fix vulnerabilities or improve performance without disabling user programs.
[0044] However, traditional driver upgrade operations usually require shutting down, restarting, or migrating tasks. Specifically, before upgrading the GPU driver, all user data currently in the video memory (e.g., models, cached data, etc.) can be backed up to the host memory or disk using various methods. After the driver upgrade is completed and the system restarts, the backed-up data is restored to the video memory, ensuring data and task continuity.
[0045] However, the above technical solution has the following drawbacks:
[0046] 1) Extremely high memory / disk usage: Since the amount of data in GPU memory is often very large, backing it up to host memory or disk will consume a lot of resources, which will affect the normal operation of other tasks;
[0047] 2) Long upgrade time: Data backup and recovery processes are very time-consuming, causing the system to be unavailable or downgraded for a long time;
[0048] 3) Data consistency risk: During data backup and recovery, data loss or corruption can easily occur, affecting the correctness of the model or application operation;
[0049] 4) High implementation complexity: Additional mechanisms are required to ensure complete data backup and recovery operations, which increases the burden on operation and maintenance and development.
[0050] In summary, the above-mentioned technical solutions will seriously affect the high availability and user experience of the system, especially in cloud server, deep learning training and inference scenarios. The GPU memory usually stores a large amount of user data (such as model weights, input and output parameters, etc.). Existing hot upgrade solutions often require backup and restore operations of GPU memory data, which not only leads to extremely high memory consumption and slow upgrade speed, but also easily causes data inconsistency and security risks.
[0051] To address the aforementioned technical problems, embodiments of this application provide a video memory control method, apparatus, device, system, and computer storage medium, as detailed in the appendix. Figure 1As shown, the execution entity of this memory control method can be a memory control device 200, which can be implemented as a local server, a cloud server, a mobile phone, a personal computer (PC), a tablet computer, a configuration application, etc. When the memory control device 200 is implemented as a cloud server, the memory control method can be executed in the cloud. Several computing processes (cloud servers) can be deployed in the cloud, each with computing and storage resources. In the cloud, multiple computing processes can be organized to provide a certain service; of course, a single computing process can also provide one or more services. The cloud can provide this service by providing an external service interface, which users can call to use the corresponding service. Service interfaces include Software Development Kits (SDKs), Application Programming Interfaces (APIs), etc.
[0052] The memory controller 200 is communicatively connected to the GPU 100, which is used by the user to perform applications and trigger data processing operations. The GPU 100 can be any computing device with some information interaction capability; specifically, it can be deployed in mobile phones, PCs, tablets, etc. Furthermore, the basic structure of the GPU 100 may include at least one processor. The number of processors depends on the client's configuration and type. The memory controller 200 may also include memory, which can be volatile, such as Random Access Memory (RAM), or non-volatile, such as Read-Only Memory (ROM), flash memory, or both. The memory typically stores the operating system (OS), one or more applications, and may also store program data. In addition to the processing unit and memory, the memory controller 200 also includes some basic configurations, such as a network interface card (NIC) chip, an I / O bus, a display component, and some peripheral devices. Optionally, some peripheral devices may include, for example, a keyboard, mouse, stylus, printer, etc. Other peripheral devices are well known in the art and will not be described in detail here.
[0053] In the above embodiment, the GPU 100 and the memory control device 200 are connected via a network, which can be a wireless or wired network connection. If the GPU 100 and the memory control device 200 are connected via a communication connection, the network standard of the mobile network can be any one of 2G (Global System for Mobile Communications GSM), 2.5G (General Packet Radio Service GPRS), 3G (Wideband Code Division Multiple Access (WCDMA), Time Division Synchronous Code Division Multiple Access (TD-SCDMA), 4G (Long Term Evolution LTE), 4G+ (Enhanced Long Term Evolution LTE+), Global Microwave Access Interoperability (WiMax), 5G, 6G, etc.
[0054] In this embodiment of the application, GPU 100 is used by a user to perform data processing operations. In some cases, in order to ensure the quality and efficiency of data processing operations performed by GPU 100, the driver of GPU 100 can be upgraded. At this time, a driver upgrade request for GPU 100 can be obtained. The driver upgrade request can be automatically obtained through the triggering operation of a preset timed upgrade task, or the driver upgrade request can be obtained based on the user's human-computer interaction operation.
[0055] The memory control device 200 is used to obtain a driver upgrade request for the GPU 100. In response to the obtained driver upgrade request for the GPU, it can obtain the page table before upgrade corresponding to the GPU 100. The page table before upgrade can include the mapping relationship between the physical address and virtual address of the GPU memory. For example, multiple mapping relationships in the page table before upgrade can include: the mapping relationship between physical address 1 and virtual address 1, the mapping relationship between physical address 2 and virtual address 2, the mapping relationship between physical address 3 and virtual address 3, the mapping relationship between physical address 4 and virtual address 4, and so on.
[0056] Since upgrading the GPU 100 driver will update the mapping between the physical and virtual addresses of the GPU memory, a data cleanup queue corresponding to the GPU 100 can be defined to improve the upgrade speed. This data cleanup queue is used to perform global cleanup of the data in the GPU memory. To enable the GPU driver upgrade without requiring memory backup, shutdown, restart, or migration tasks, the data cleanup queue can be locked. Then, the driver upgrade operation is performed on the GPU 100 based on the driver upgrade request. Afterward, the upgraded page table corresponding to the GPU 100 can be obtained. The upgraded page table can include the mapping between the physical and virtual addresses of the GPU memory after the driver upgrade operation.
[0057] Since the mapping relationship in the page table before the upgrade may be inconsistent with that in the page table after the upgrade, after obtaining the page table before and after the upgrade, the data in the GPU memory can be adjusted based on the page table before and after the upgrade, thus effectively ensuring the consistency of the data in the GPU memory.
[0058] In this embodiment, by obtaining the pre-upgrade page table corresponding to GPU 100, the data cleanup queue corresponding to GPU 100 is determined. With the data cleanup queue locked, the post-upgrade page table corresponding to GPU 100 is obtained. Then, based on the pre-upgrade page table and the post-upgrade page table, the data in the GPU memory is regulated. This effectively enables GPU driver upgrade operations without the need for memory backup, shutdown, restart, or migration tasks. This not only reduces memory overhead and improves the upgrade speed and memory utilization of GPU drivers, but also helps to improve the actual deployment quality and effect of GPUs, further enhancing the practicality of the method.
[0059] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0060] Figure 2 A flowchart illustrating a video memory control method provided for an exemplary embodiment of this application; see attached diagram. Figure 2 As shown, this embodiment provides a video memory control method. The execution subject of this method is a video memory control device, which can be implemented as software or a combination of software and hardware. When the video memory control device is implemented as hardware, it can be various electronic devices capable of video memory control operations, including but not limited to personal computers, servers, etc. When the video memory control device is implemented as software, it can be installed in the electronic devices listed above. Specifically, the video memory control method provided in this embodiment may include:
[0061] Step S201: In response to the obtained driver upgrade request of the image processing unit (GPU), obtain the page table before upgrade corresponding to the GPU. The page table before upgrade includes the mapping relationship between the physical address and virtual address of the GPU memory.
[0062] Step S202: Determine the data cleanup queue corresponding to the GPU. The data cleanup queue is used to perform global cleanup of the data in the GPU memory.
[0063] Step S203: With the data cleanup queue locked, perform a driver upgrade operation on the GPU based on the driver upgrade request, and obtain the upgraded page table corresponding to the GPU. The upgraded page table includes the mapping relationship between the physical address and virtual address of the GPU memory.
[0064] Step S204: Adjust the data in the GPU memory based on the page table before and after the upgrade.
[0065] The specific implementation methods and principles of each of the above steps are explained in detail below:
[0066] Step S201: In response to the obtained driver upgrade request of the image processing unit (GPU), obtain the page table before upgrade corresponding to the GPU. The page table before upgrade includes the mapping relationship between the physical address and virtual address of the GPU memory.
[0067] A Graphics Processing Unit (GPU) is an electronic computing device specifically designed for handling complex graphics computations and parallel processing tasks, and is widely used in fields such as graphics rendering, scientific computing, and machine learning. When applying GPUs in artificial intelligence (AI) applications, as AI scenarios rapidly evolve, continuous updates are needed to fix vulnerabilities, add new features, or improve overall stability and performance. This requires periodic or ad-hoc driver upgrades. Driver upgrade requests can be automatically generated based on scheduled task triggers, or they can be generated based on human-computer interaction.
[0068] Upon receiving a driver upgrade request, in response to the obtained GPU driver upgrade request, the pre-upgrade page table corresponding to the GPU can be obtained. This pre-upgrade page table can be obtained through direct access to the GPU hardware, or it can be stored in a preset region or server, in which case accessing the preset region or server will retrieve the pre-upgrade page table. The obtained pre-upgrade page table can include the mapping relationship between the physical addresses and virtual addresses of the GPU memory. For example, the pre-upgrade page table can include multiple mapping relationships such as: the mapping relationship between physical address 1 and virtual address 1 of GPU memory, the mapping relationship between physical address 2 and virtual address 2 of GPU memory, the mapping relationship between physical address 3 and virtual address 3 of GPU memory, etc. The above mapping relationship between the physical addresses and virtual addresses of GPU memory is a one-to-one correspondence.
[0069] Step S202: Determine the data cleanup queue corresponding to the GPU. The data cleanup queue is used to perform global cleanup of the data in the GPU memory.
[0070] For GPUs, driver upgrades often require initializing data in the GPU's video memory. After the upgrade, the page tables used for data processing need to be rebuilt, slowing down the upgrade process. To avoid this, upon receiving a driver upgrade request, a corresponding data cleanup queue can be identified. This queue, determined through GPU hardware access, performs global cleanup of the GPU's video memory. Specifically, if the queue is unlocked, the data in the GPU's video memory is initialized during the driver upgrade; if the queue is locked, the data in the video memory will not be initialized even during a driver upgrade.
[0071] Step S203: With the data cleanup queue locked, perform a driver upgrade operation on the GPU based on the driver upgrade request, and obtain the upgraded page table corresponding to the GPU. The upgraded page table includes the mapping relationship between the physical address and virtual address of the GPU memory.
[0072] In order to enable GPU driver upgrade operations without the need for memory backup, shutdown, restart, or migration tasks, since the data cleanup queue is used to perform global cleanup of data in the GPU memory, after determining the data cleanup queue corresponding to the GPU, the data cleanup queue can be locked first. At this time, the method in this embodiment may also include: generating a queue locking instruction based on the driver upgrade request; sending the queue locking instruction to the GPU so that the GPU locks the data cleanup queue based on the queue locking instruction.
[0073] After determining the data cleanup queue corresponding to the GPU and obtaining the GPU driver upgrade request, the driver upgrade request can be analyzed and processed to generate a queue locking instruction corresponding to the data cleanup queue. In some instances, the queue locking instruction can be generated by using a pre-set application to analyze and process the driver upgrade request, or the queue locking instruction can be generated by using a pre-trained locking instruction generation model to analyze and process the driver upgrade request. The generated queue locking instruction corresponds to the data cleanup queue.
[0074] After generating the queue locking instruction, the queue locking instruction can be sent to the GPU. Specifically, the queue locking instruction can be sent to the GPU by writing to the register, so that the GPU can lock the data cleanup queue based on the queue locking instruction. This completes the locking operation of the data cleanup queue before performing driver upgrade operations on the GPU.
[0075] With the data cleanup queue locked, the data cleanup queue can ensure that the data in the GPU memory is not initialized during the GPU driver upgrade process. At this time, the GPU driver upgrade operation can be performed based on the driver upgrade request, and then the upgraded page table corresponding to the GPU can be obtained. The upgraded page table can be obtained by accessing the GPU. The upgraded page table can include the mapping relationship between the physical address and virtual address of the GPU memory. The obtained upgraded page table can include the mapping relationship between the physical address and virtual address of the GPU memory. Furthermore, the mapping relationship included in the page table before the upgrade and the mapping relationship included in the upgraded page table can be the same or different. For example, the upgraded page table can include the following multiple mapping relationships: the mapping relationship between the physical address 1 and virtual address 4 of the GPU memory, the mapping relationship between the physical address 2 and virtual address 6 of the GPU memory, the mapping relationship between the physical address and virtual address of the GPU memory, etc. The above mapping relationship between the physical address and virtual address of the GPU memory is a one-to-one correspondence.
[0076] Step S204: Adjust the data in the GPU memory based on the page table before and after the upgrade.
[0077] Since the mapping relationships included in the page table before the upgrade and those included in the page table after the upgrade may differ, after obtaining the page tables before and after the upgrade, they can be analyzed and processed to enable the adjustment of data in the GPU memory based on the analysis and processing results. The adjustment of data in the GPU memory includes at least one of the following: migrating data with address conflicts (i.e., data at risk of loss) in the GPU memory to a preset temporary cache, or performing address migration operations on data with address conflicts in the GPU memory, etc. This effectively realizes the stable reconstruction of GPU memory data after the GPU driver upgrade operation. In this way, the GPU can perform driver upgrade operations without the need for memory backup, shutdown, restart, or migration tasks, and ensures the accuracy and reliability of data in the GPU memory.
[0078] In some instances, data manipulation in GPU memory can be achieved using a pre-trained manipulation model. In this case, manipulating the data in GPU memory based on the page tables before and after the upgrade can include: determining a pre-trained manipulation model for manipulating the data in GPU memory; inputting the page tables before and after the upgrade into the manipulation model for processing to obtain the manipulation information output by the model; and then manipulating the data in GPU memory based on the manipulation information. This effectively ensures the stability and reliability of data manipulation in GPU memory.
[0079] In some other instances, after adjusting the data in the GPU memory based on the pre-upgrade page table and the post-upgrade page table, a data cleanup queue can be unlocked. In this case, the method in this embodiment can further include: generating an unlock instruction corresponding to the data cleanup queue; and unlocking the data cleanup queue based on the unlock instruction.
[0080] After adjusting the data in the GPU memory based on the page table before and after the upgrade, it indicates that the GPU has completed the driver upgrade operation. At this point, in order to ensure that the GPU can perform normal data processing operations, an unlock instruction corresponding to the data cleanup queue can be generated. This unlock instruction is used to unlock the data cleanup queue. Then, the data cleanup queue can be unlocked based on the generated unlock instruction. This ensures that the GPU can perform normal data processing operations based on the unlocked data cleanup queue, thereby improving the quality and efficiency of the GPU's data processing operations to a certain extent.
[0081] The memory control method provided in this embodiment, in response to a obtained GPU driver upgrade request, obtains the pre-upgrade page table corresponding to the GPU, determines the data cleanup queue corresponding to the GPU, and, with the data cleanup queue locked, performs a driver upgrade operation on the GPU based on the driver upgrade request. It then obtains the post-upgrade page table corresponding to the GPU and adjusts the data in the GPU memory based on the pre-upgrade page table and the post-upgrade page table. This effectively enables the GPU to perform driver upgrade operations without requiring memory backup, shutdown, restart, or migration tasks. This not only reduces memory overhead and improves the GPU driver upgrade speed and memory utilization, but also helps ensure the actual deployment quality and effect of the GPU, further enhancing the practicality of the method.
[0082] Figure 3A flowchart illustrating the process of obtaining the upgraded page table corresponding to the GPU is provided as an exemplary embodiment of this application; based on the above embodiment, refer to the appendix. Figure 3 As shown, after performing a driver upgrade operation on the GPU based on a driver upgrade request, the upgraded page table can be obtained not only through direct access to the GPU hardware but also through GPU replay operations. Therefore, obtaining the upgraded page table corresponding to the GPU can include:
[0083] Step S301: In response to the GPU's replay operation of the user's executed command, determine the first control plane page table and the first data plane page table corresponding to the GPU. The first control plane page table includes the mapping relationship between the physical address and the virtual address corresponding to the control plane data after the driver upgrade. The first data plane page table includes the mapping relationship between the physical address and the virtual address corresponding to the data plane data after the driver upgrade.
[0084] After performing a driver upgrade operation on the GPU based on a driver upgrade request, in order to accurately obtain the upgraded page table corresponding to the GPU, a replay instruction for the GPU to execute user commands can be generated. Then, based on this replay instruction, the GPU can be controlled to replay the user commands. In response to the GPU's replay operation, the first control plane page table and the first data plane page table corresponding to the GPU can be determined. The first control plane page table can include the mapping relationship between the physical addresses and virtual addresses corresponding to the control plane data after the driver upgrade, and the first data plane page table can include the mapping relationship between the physical addresses and virtual addresses corresponding to the data plane data after the driver upgrade.
[0085] Specifically, regarding the first control plane page table and data plane page table corresponding to the GPU, after the GPU driver upgrade operation, they can be stored in the GPU hardware. In this case, the first control plane page table and data plane page table can be obtained by accessing the GPU hardware. Alternatively, the first control plane page table corresponding to the GPU can be obtained through a control plane data reconstruction operation. In this case, determining the first control plane page table corresponding to the GPU may include: determining the control plane data copy queue corresponding to the GPU; and performing a control plane data reconstruction operation based on the control plane data copy queue to obtain the first control plane page table.
[0086] Specifically, after upgrading the GPU driver, in order to accurately obtain the first control plane page table corresponding to the GPU, a control plane data copy queue corresponding to the GPU can be determined first. The control plane data copy queue is used to store the control plane data corresponding to the GPU. Then, a control plane data reconstruction operation is performed on the control plane data copy queue. The control plane data reconstruction operation can be based on a pre-trained reconstruction model to analyze and process the control plane data copy queue to determine the first control plane page table corresponding to the GPU. This effectively ensures the accuracy and reliability of obtaining the first control plane page table.
[0087] For the data plane page table corresponding to the GPU, it can also be obtained through the reconstruction operation of the data plane data. In this case, determining the data plane page table corresponding to the GPU may include: after performing the reconstruction operation of the control plane data based on the control plane data copy queue, determining the data plane data copy queue corresponding to the upgraded GPU; performing the reconstruction operation of the data plane data based on the data plane data copy queue to obtain the first data plane page table.
[0088] The reconstruction operation of the data plane data follows the reconstruction operation of the control plane data. Therefore, after the reconstruction operation of the control plane data based on the control plane data copy queue, the data plane data copy queue corresponding to the upgraded GPU can be determined first. This data plane data copy queue is used to store the data plane data corresponding to the GPU. Then, the reconstruction operation of the data plane data can be performed on the data plane data copy queue. The reconstruction operation of the data plane data can be determined by analyzing and processing the data plane data copy queue based on a pre-trained reconstruction model, thereby obtaining the first data plane page table corresponding to the GPU. This effectively ensures the accuracy and reliability of obtaining the first data plane page table.
[0089] Step S302: Based on the first data page table and the first control page table, determine the upgraded page table corresponding to the GPU.
[0090] After obtaining the first data page table and the first control page table, the first data page table and the first control page table can be analyzed and processed to determine the upgraded page table corresponding to the GPU. In some instances, the first data page table and the first control page table are determined as the upgraded page table corresponding to the GPU. Alternatively, the data in the first data page table and the first control page table can be used to determine the upgraded page table corresponding to the GPU. This upgraded page table includes the mapping relationship between the physical address and virtual address of the GPU memory.
[0091] In this embodiment, after the GPU replays the user's command, the first control page table and the first data page table corresponding to the GPU are determined. Then, the upgraded page table corresponding to the GPU can be determined based on the first data page table and the first control page table. This effectively ensures the accuracy and reliability of determining the upgraded page table.
[0092] Figure 4 This is a flowchart illustrating the manipulation of data in GPU memory based on the pre-upgrade page table and the post-upgrade page table, as provided in an exemplary embodiment of this application. Based on the above embodiment, refer to the appendix... Figure 4 As shown, when the upgraded page table includes a first control page table corresponding to the GPU, address detection operations can be performed to control the data in the GPU memory by detecting whether there is an address conflict between the first control page table corresponding to the GPU and the second data page table corresponding to the GPU. In this case, controlling the data in the GPU memory based on the page tables before and after the upgrade can include:
[0093] Step S401: Determine the second data plane page table corresponding to the GPU in the page table before the upgrade. The second data plane page table includes the mapping relationship between the physical address and virtual address corresponding to the data plane data before the driver upgrade.
[0094] After a GPU driver upgrade, the physical address of the GPU memory corresponding to the newly established first control plane page table may conflict with the physical address of the GPU memory corresponding to the data plane page table before the driver upgrade. In other words, the control plane data stored in the physical address after the driver upgrade is different from the data plane data stored in the same physical address before the driver upgrade. In this case, the physical address of the GPU memory corresponding to the first control plane page table may cause the data plane data corresponding to the conflicting address to be lost or corrupted.
[0095] To avoid the above situation, if the upgraded page table includes a first control page table corresponding to the GPU, the second data page table corresponding to the GPU in the page table before the upgrade can be determined. Since the second data page table is a part of the data in the page table before the upgrade, the second data page table corresponding to the GPU can be obtained by extracting data from the page table before the upgrade. The obtained second data page table can include the mapping relationship between the physical address and virtual address corresponding to the data plane data before the GPU driver upgrade, thereby effectively ensuring the accuracy and reliability of determining the second data page table.
[0096] Step S402: Adjust the data in the GPU memory based on the first control page table and the second data page table.
[0097] After obtaining the first control page table and the second data page table, these tables can be analyzed and processed to adjust the data in the GPU memory based on the analysis results. In some instances, the adjustment of data in the GPU memory can be achieved using a pre-trained adjustment model. In this case, adjusting the data in the GPU memory based on the first control page table and the second data page table can include: determining the pre-trained adjustment model; inputting the first control page table and the second data page table into the adjustment model for analysis and processing to obtain the analysis results; and then adjusting the data in the GPU memory based on the analysis results. This effectively ensures the accuracy and reliability of the adjustment of data in the GPU memory.
[0098] In other instances, the manipulation of data in GPU memory can be achieved not only through a manipulation model, but also through physical address conflict detection of GPU memory. In this case, the manipulation of data in GPU memory based on the first control page table and the second data page table may include: performing physical address conflict detection based on the first control page table and the second data page table to obtain the detection result; and manipulating the data in GPU memory based on the detection result.
[0099] After obtaining the first control page table and the second data page table, a physical address conflict detection operation can be performed on the first control page table and the second data page table. Specifically, the physical address conflict detection operation can be determined by analyzing and processing the first control page table and the second data page table using a pre-trained conflict detection model. At this time, the regulation of data in the GPU memory based on the first control page table and the second data page table can include: determining the pre-trained conflict detection model; inputting the first control page table and the second data page table into the conflict detection model to perform a physical address conflict detection operation, thereby obtaining the detection result. The detection result can include a first result to indicate the existence of address conflicts or a second result to indicate the absence of address conflicts.
[0100] After obtaining the detection results, the data in the GPU memory can be adjusted based on the detection results. At this time, adjusting the data in the GPU memory based on the detection results can include: if the detection results indicate that there is no address conflict between the first control page table and the second data page table, it means that the physical address corresponding to the second data page table will not pose a risk of loss or damage to the data in the physical address corresponding to the second data page table. Therefore, there is no need to adjust the GPU memory data.
[0101] Correspondingly, adjusting the data in the GPU memory based on the detection results may include: when the detection results indicate an address conflict between the first control page table and the second data page table, determining the conflicting address in the second data page table based on the first control page table; determining the conflicting memory data in the GPU memory based on the conflicting address; and storing the conflicting memory data in a preset temporary cache.
[0102] Specifically, if the detection result indicates an address conflict between the first control page table and the second data page table, it means that for the physical address corresponding to the second data page table, the physical address corresponding to the first control page table poses a risk of data loss or corruption. To avoid data loss or corruption, the first control page table can be analyzed to identify the conflicting address in the second data page table. This conflicting address is a physical address that appears in both the first and second control page tables. The conflict addresses in the first table are used to store control plane data, while the conflict addresses in the second data plane page table are used to store data plane data. After determining the conflict addresses in the second data plane page table, the conflicting memory data in the GPU memory can be determined based on the conflict addresses. This conflicting memory data is the data plane data corresponding to the second data plane page table. To avoid the risk of data loss or corruption of conflicting memory data, the conflicting memory data can be stored in a preset temporary cache. The preset temporary cache can be a pre-configured free memory or a free memory area, etc. This effectively realizes the regulation and control of the data in the GPU memory.
[0103] In some other instances, when manipulating data in GPU memory, it is necessary not only to pay attention to the first control page table corresponding to the GPU included in the upgraded page table and perform conflict detection operations on the first control page table, but also to pay attention to the first data page table corresponding to the GPU included in the upgraded page table. In this case, physical address conflict detection operations can be performed on the first data page table to achieve data manipulation operations in GPU memory. Specifically, manipulating data in GPU memory based on the page tables before and after the upgrade can include: performing address update detection on GPU memory data based on the first and second data page tables to obtain the detection results; and manipulating data in GPU memory based on the detection results.
[0104] After obtaining the first and second data page tables, address update detection operations can be performed on the GPU memory data (data plane data) based on the first and second data page tables. Specifically, the address update detection operation can be determined by analyzing and processing the first and second data page tables using a pre-trained update detection model. At this time, regulating the data in the GPU memory based on the first and second data page tables may include: determining the pre-trained update detection model; inputting the first and second data page tables into the update detection model to perform address update detection operations, thereby obtaining detection results. The detection results may include a first result indicating that there is an address update in the GPU memory data or a second result indicating that there is no address update in the GPU memory data.
[0105] After obtaining the detection results, the data in the GPU memory can be adjusted based on the detection results. This adjustment based on the detection results can include: if the detection results indicate that there is no address update in the GPU memory data, it means that there is no data in the GPU memory that needs to be migrated, and the GPU driver upgrade operation will not pose a risk of loss or damage to the data in the GPU memory. Therefore, there is no need to adjust the GPU memory data.
[0106] Correspondingly, adjusting the data in the GPU memory based on the detection results may include: when the detection results indicate that there is an address update in the GPU memory data, determining the address before and after the upgrade of the GPU memory data based on the second data page table and the first data page table; and migrating the GPU memory data from the address before the upgrade to the address after the upgrade.
[0107] Specifically, if the detection result indicates that there is an address update in the GPU memory data, it means that for the same GPU memory data, the address before the GPU driver upgrade operation is different from the address after the GPU driver upgrade operation. In order to avoid data loss or data corruption, the GPU memory data in the GPU memory can be determined based on the address before the upgrade, and then the GPU memory data can be migrated from the address before the upgrade to the address after the upgrade. This effectively realizes the migration operation of data in the GPU memory, thereby ensuring the data consistency in the GPU memory.
[0108] In this embodiment, when the upgraded page table includes a first control page table corresponding to the GPU, the data in the GPU memory is regulated based on the first control page table and the second data page table by determining the second data page table corresponding to the GPU in the page table before the upgrade. This effectively avoids conflicts between the control plane data and the data plane data before the driver upgrade, thus ensuring the safety and reliability of the memory data. Furthermore, when the upgraded page table includes a first data page table corresponding to the GPU, the method effectively achieves stable regulation of the GPU memory data by performing physical address conflict detection on the first and second data page tables, further improving the safety and reliability of the method.
[0109] Figure 5 A flowchart illustrating another memory control method provided as an exemplary embodiment of this application; based on any of the above embodiments, refer to the appendix. Figure 5 As shown, before obtaining the page table corresponding to the GPU before the upgrade, in order to ensure the safety and reliability of the GPU memory data, the GPU can be controlled to pause the execution of user instructions. At this time, the method in this embodiment may also include:
[0110] Step S501: Based on the driver upgrade request, generate a pause execution instruction corresponding to the GPU.
[0111] After receiving a driver upgrade request, in order to perform the GPU driver upgrade operation without performing video memory backup, shutdown, restart, or migration tasks, the driver upgrade request can be analyzed and processed to generate a pause execution instruction corresponding to the GPU. This pause execution instruction is used to pause the user program deployed on the GPU to perform the corresponding data processing operations.
[0112] Step S502: Send a pause execution instruction to the client so that the hijacking module in the client hijacks the user execution command corresponding to the GPU based on the pause execution instruction, and suspends the sending of the user execution command to the GPU for processing.
[0113] After generating the pause execution instruction corresponding to the GPU, the pause execution instruction can be sent to the client. Upon receiving the pause execution instruction, the hijacking module in the client can hijack the user execution command corresponding to the GPU based on the pause execution instruction, and can pause the sending of user execution commands to the GPU for analysis and processing. Specifically, pausing the sending of user execution commands to the GPU for processing can be achieved through a preset queue. This can include: determining the preset queue in the client; sending the user execution command corresponding to the GPU hijacked by the hijacking module to the preset queue, thereby obtaining the queue of unexecuted commands. This achieves the ability to pause the execution of GPU-related user execution commands during GPU driver upgrades, i.e., pausing the execution of GPU-related user programs, thus preventing the received user execution commands from affecting the GPU driver upgrade operation, thereby improving the accuracy and reliability of the GPU driver upgrade operation.
[0114] Furthermore, after adjusting the data in the GPU memory based on the page table before and after the upgrade, the client can also perform a recovery execution operation on the user's execution instructions. In this case, the method in this embodiment can also include: generating a recovery execution instruction corresponding to the GPU; sending the recovery execution instruction to the client, so that the hijacking module in the client can send the hijacked user execution instructions to the GPU for processing based on the recovery execution instruction.
[0115] Since the client has already paused the execution of user commands, after adjusting the data in the GPU memory based on the page tables before and after the upgrade, a corresponding resumption execution command can be generated to ensure the quality and effectiveness of GPU data processing operations. This resumption execution command can be generated through a pre-deployed trigger program and then sent to the client. After receiving the resumption execution command, the hijacking module in the client can send the hijacked user commands to the GPU for processing. Specifically, the hijacked user commands form an unexecuted command queue, and the hijacking module can then send all the hijacked user commands to the GPU sequentially according to the order in the unexecuted command queue. This allows the GPU to perform corresponding processing operations on the received user commands, thus completing the resumption operation. The entire process is imperceptible to the upper-layer application and user data, improving the user's experience with GPU applications.
[0116] In this embodiment, a pause execution instruction corresponding to the GPU is generated based on the driver upgrade request, and then the pause execution instruction is sent to the client. This allows the hijacking module in the client to hijack the user execution command corresponding to the GPU based on the pause execution instruction, and to suspend the sending of the user execution command to the GPU for processing. This effectively avoids the received user execution command from affecting the GPU driver upgrade operation, thereby improving the accuracy and reliability of the GPU driver upgrade operation.
[0117] For specific applications, please refer to the appendix. Figure 6 As shown in the illustration, this application embodiment proposes a rapid hot-upgrade method for GPU drivers with zero memory backup. This method, through an innovative memory management mechanism and driver switching process, enables online hot-upgrades of GPU drivers without interrupting service, migrating memory data, or performing memory backup operations. This not only reduces GPU memory overhead but also improves the speed of GPU driver upgrades, thereby significantly enhancing GPU stability, availability, and operational efficiency. Specifically, this rapid hot-upgrade method may include the following steps:
[0118] Step 1: The container corresponding to the client can run CUDA applications.
[0119] The client communication connection includes a scheduler and one or more GPUs. The scheduler is used to regulate the data in the GPU's video memory. A CUDA application runs in the container corresponding to the client. This CUDA application refers to all GPU-related applications. Specifically, a hijacking module is deployed in the container corresponding to the client. The hijacking module is used to hijack the user execution instructions obtained to trigger the GPU to perform data processing operations. The hijacking module can be implemented as an sGPUCR module. The sGPUCR module is used to record the call implementation status of the CUDA application (such as recording context, user-mode information, etc.) and the recovery operation. It can store the recorded call implementation status of the CUDA application in the preset memory of the hijacking module. It can provide fault tolerance and migration capabilities for GPU tasks to improve GPU utilization, enhance the application's control over the GPU, and achieve true on-demand regulation.
[0120] Step 2: The scheduler obtains the GPU driver upgrade request, then notifies the GPU memory control system to prepare for the driver switching operation, and can also notify the sGPU CR module to pause the execution of user programs.
[0121] The scheduler manages the upgrade operations of containers and GPU drivers, and coordinates the switching between old and new GPU drivers via a hot-upgrade interface. These driver upgrade operations are performed without user-level awareness, interruption, or migration. Specifically, the sGPU CR module can intercept user execution instructions used to trigger GPU data processing operations, but it does not send the intercepted instructions to the GPU hardware for execution.
[0122] Step 3: The scheduler sends the driver upgrade request to the GPU memory control system connected to the communication link, so that the GPU driver upgrade operation can be implemented based on the GPU memory control system.
[0123] The GPU memory control system can include several key modules, such as a memory status control interface, a conflict address detection module, a page table management module, and a GPU queue control module. The memory status control interface is responsible for interacting with the scheduler, driver, and hardware, and can also report the memory status and respond to driver upgrade requests. The conflict address detection module detects and avoids memory address conflicts during driver upgrades to ensure the safety and stability of data plane data. The page table management module directly reads the memory page table to manage the mapping relationship between virtual addresses and physical addresses, and understands the allocation of physical addresses in the user's data plane memory. This mapping relationship can be established by the GPU driver. The GPU queue control module controls the GPU queues (including the control plane data copy queue, global data cleanup queue, and data plane data copy queue) by writing to GPU registers, isolating and scheduling control plane and data plane operations to ensure that various tasks in the upgrade process are performed in an orderly manner according to plan.
[0124] For GPUs, a Graphics Memory Management Unit (GMMU) can be deployed. The GMMU performs address translation between virtual and physical addresses according to page table contents to ensure the correctness of application data read and write operations. GPU memory can be divided into a control plane and a data plane. The data plane stores a large amount of user-requested cache data, model data, and other critical data; the control plane stores data for control operations. Each of these planes has its own independent queues: a control plane data copy queue and a data plane data copy queue. Controlling these queue behaviors ensures the accuracy and reliability of the mapping relationship corresponding to the restored memory data. Furthermore, the GPU can control a global data cleanup queue to avoid cleaning up memory during driver upgrades, thus ensuring the reuse of memory data after a driver upgrade.
[0125] Step 4: After the GPU memory control system receives the driver upgrade request, the GPU queue control module can determine the global data cleanup queue corresponding to the GPU based on the driver upgrade request, and lock the determined global data cleanup queue. This global data cleanup queue is used to perform global cleanup operations on the data in the GPU memory.
[0126] After determining the data cleanup queue corresponding to the GPU, the GPU queue control module can generate a queue locking instruction based on the driver upgrade request. Then, the queue locking instruction can be sent to the GPU by writing to the register through the GPU queue control module, so that the GPU can lock the global data cleanup queue based on the queue locking instruction. This ensures that when the GPU side resource command is cleared, the reference to the GPU driver can be released, and the video memory data used by the user can remain in the GPU hardware.
[0127] Step 5: After the GPU memory control system receives the driver upgrade request, the page table management module can obtain the page table before the upgrade corresponding to the GPU based on the driver upgrade request; and perform the driver upgrade operation on the GPU based on the driver upgrade request, that is, unload the old driver of the GPU and load the new driver of the GPU, thereby obtaining the page table after the upgrade corresponding to the GPU.
[0128] The page table before the upgrade can include the mapping relationship between the physical address and virtual address of the GPU memory before the GPU driver is upgraded, and the page table after the upgrade can include the mapping relationship between the physical address and virtual address of the GPU memory after the GPU driver is upgraded.
[0129] Step 6: After obtaining the page table before and after the upgrade, the page table management module can send the page table before and after the upgrade to the conflict address detection module for address conflict detection, and adjust the data in the GPU memory according to the detection results.
[0130] In some instances, the address conflict detection module's address conflict detection operation based on the pre-upgrade page table and the post-upgrade page table may include: if the post-upgrade page table includes a first control page table corresponding to the GPU, the second data page table corresponding to the GPU in the pre-upgrade page table may be determined first. This second data page table includes the mapping relationship between the physical addresses and virtual addresses corresponding to the data plane data before the driver upgrade. The address conflict detection module performs physical address conflict detection on the first control page table and the second data page table, obtains the detection result, and adjusts the data in the GPU memory based on the detection result.
[0131] Specifically, when the detection result indicates an address conflict between the first control page table and the second data page table, the conflicting address can be determined based on the first control page table and the second data page table, and the conflicting memory data in the GPU memory can be determined based on the conflicting address. Then, the conflicting memory data is stored in a preset temporary cache (which can be free memory or system memory). When the detection result indicates no address conflict between the first control page table and the second data page table, no adjustment operation is required on the conflicting memory data in the GPU memory. This effectively enables the regulation of data in the GPU memory and effectively prevents newly allocated control page data from overwriting the original data page data.
[0132] In other instances, the conflict address detection module's address conflict detection operation based on the pre-upgrade page table and the post-upgrade page table may include: after the control plane data in the application is reconstructed, if the post-upgrade page table includes a first data plane page table corresponding to the GPU, the conflict address detection module may perform address update detection operations on the GPU memory data based on the first data plane page table and the second data plane page table to obtain the detection result, and then perform adjustment operations on the data in the GPU memory based on the detection result.
[0133] Specifically, when the detection result indicates that the GPU memory data has been updated at an address, the addresses of the GPU memory data before and after the upgrade are determined based on the second and first data page tables; and the GPU memory data is then migrated from the address before the upgrade to the address after the upgrade. When the detection result indicates that the GPU memory data has not been updated at an address, no adjustment operations are required on the GPU memory data. This effectively moves the data from the old address to the new address, ensuring data consistency and thus enabling the manipulation of the data in the GPU memory.
[0134] In some other instances, the method in this embodiment may further include: when there is a physical address conflict between the address before and after the upgrade, and the physical address conflict belongs to the ring address conflict type, for example: when there is a ring address conflict between the first data plane page table and the second data plane page table, that is, there is an address conflict between address A and address B, address B and address C, and address C and address A; then the first or a certain conflict address can be determined among all conflict addresses, and the data plane data in the first or a certain conflict address can be migrated to a preset cache, and the data plane data migration operation can be performed on all conflict addresses, thus effectively realizing the control operation of data in GPU memory.
[0135] During GPU driver upgrades, the GPU memory control system monitors and processes the GPU memory status in real time to ensure data consistency after the upgrade. The page table management module and conflict address detection module also ensure data consistency. Furthermore, a user-mode hijacking module assists in recording and restoring the application state during the upgrade process, preventing application interruption. After the upgrade, the new GPU driver can directly take over the existing GPU memory without restoring data, making the GPU driver upgrade process transparent and seamless for the user.
[0136] Furthermore, after completing the GPU driver upgrade, the user-mode recovery operation can be performed through the hijacking module (i.e., the sGPU CR module). This allows the hijacking module to send the hijacked user execution instructions to the GPU hardware, enabling the GPU hardware to continue executing the corresponding operations. The entire process is completely transparent to upper-layer applications and user data.
[0137] The technical solution provided in this application embodiment can achieve the following effects:
[0138] 1) Zero video memory backup and extremely low memory overhead;
[0139] By utilizing the page table management module in the GPU memory control system, the pre-upgrade page table and post-upgrade page table, which contain the mapping relationship of memory addresses, can be directly read. Then, data management operations on GPU memory can be performed based on the pre-upgrade page table and post-upgrade page table. This eliminates the need to back up the data in memory to host memory or disk. Furthermore, during the driver upgrade process, user data (data plane) in memory is retained in place without migration through a queuing mechanism, greatly reducing the pressure on memory and disk. This effectively solves the problem of huge resource consumption and long upgrade time caused by the traditional method of backing up memory data to host memory or disk before and after driver upgrade.
[0140] 2) Fast upgrade speed;
[0141] By using a conflict address detection module to perform conflict detection, the GPU driver upgrade process only involves switching and management operations between the control plane and the data plane. All data plane data and model data remain unchanged, which makes the GPU driver upgrade operation extremely time-consuming. This effectively solves the problem of large time copying overhead for backup data in traditional methods.
[0142] 3) Data consistency and security assurance;
[0143] During GPU memory upgrades, the data in the GPU memory can be dynamically monitored to avoid address conflicts and data overwriting. In addition, the page table management module can ensure the stability of the mapping relationship between virtual addresses and physical addresses. Furthermore, the data queues corresponding to the control plane and data plane in the GPU memory are separated, and critical metadata and user data are managed separately. In this way, during GPU driver upgrades, the data plane and control plane can be maintained independently, which helps improve data consistency and security. This effectively solves the problem of data loss or corruption during backup, migration, and recovery in traditional methods, which poses consistency and security risks.
[0144] Figure 7 A schematic diagram of a video memory control device provided for an exemplary embodiment of this application; see attached diagram. Figure 7 As shown, this embodiment provides a video memory control device, which is used to perform the above-described... Figure 2 The illustrated memory control method, specifically, may include the following memory control device:
[0145] The first acquisition module 11 is used to acquire the pre-upgrade page table corresponding to the GPU in response to the obtained driver upgrade request of the image processing unit GPU. The pre-upgrade page table includes the mapping relationship between the physical address and virtual address of the GPU memory.
[0146] The first determining module 12 is used to determine the data cleanup queue corresponding to the GPU. The data cleanup queue is used to perform global cleanup of the data in the GPU memory.
[0147] The first processing module 13 is used to perform a driver upgrade operation on the GPU based on the driver upgrade request while locking the data cleanup queue, and to obtain the upgraded page table corresponding to the GPU. The upgraded page table includes the mapping relationship between the physical address and the virtual address of the GPU memory.
[0148] The first control module 14 is used to regulate the data in the GPU memory based on the page table before and after the upgrade.
[0149] The memory control device in this embodiment can also perform the above-described... Figures 1-6 The description of the embodiments shown in the illustrations can be found in the detailed descriptions of the embodiments described above, and will not be elaborated upon here.
[0150] Furthermore, in some of the processes described in the above embodiments and accompanying drawings, multiple operations appear in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear herein, or they may be executed in parallel. The operation numbers, such as 11, 12, etc., are merely used to distinguish different operations and do not represent any execution order. Additionally, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should be noted that the descriptions such as "first" and "second" in this document are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types.
[0151] Figure 8 A schematic diagram of the structure of an electronic device provided in an exemplary embodiment of this application; as shown Figure 8 As shown, this embodiment provides an electronic device for performing the above-described... Figure 2 The illustrated memory control method includes an electronic device that may include a memory 24 and a processor 25.
[0152] Memory 24 is used to store computer programs and can be configured to store various other data to support operation on the electronic device. Examples of this data include instructions for any application or method used to operate on the electronic device, data structures, contact data, phone book data, messages, pictures, videos, etc.
[0153] The processor 25, coupled to the memory 24, is used to execute a computer program in the memory 24 for: in response to a received driver upgrade request from the image processing unit (GPU), obtaining a pre-upgrade page table corresponding to the GPU, the pre-upgrade page table including a mapping relationship between the physical addresses and virtual addresses of the GPU memory; determining a data cleanup queue corresponding to the GPU, the data cleanup queue being used to perform global cleanup of data in the GPU memory; with the data cleanup queue locked, performing a driver upgrade operation on the GPU based on the driver upgrade request, obtaining a post-upgrade page table corresponding to the GPU, the post-upgrade page table including a mapping relationship between the physical addresses and virtual addresses of the GPU memory; and regulating the data in the GPU memory based on the pre-upgrade page table and the post-upgrade page table.
[0154] Regarding the processor 25 in this embodiment, it is also used to perform the above-described... Figures 1-6 The description of the embodiments shown is for reference only, and will not be elaborated upon here.
[0155] Furthermore, such as Figure 8 As shown, the electronic device also includes other components such as a communication component 26, a display 27, a power supply component 28, and an audio component 29. Figure 8The diagram only shows some components and does not mean that the electronic device includes only these components. Figure 8 The components shown. Additionally... Figure 8 The components within the center frame are optional, not mandatory, and their specific requirements depend on the product form of the workflow. The workflow in this embodiment can be implemented as a terminal device such as a desktop computer, laptop computer, smartphone, or IoT device, or as a server-side device such as a conventional server, cloud server, or server array. If the workflow in this embodiment is implemented as a terminal device such as a desktop computer, laptop computer, or smartphone, it may include... Figure 8 The components within the center frame; if the working process of this embodiment is implemented as a server-side device such as a conventional server, cloud server, or server array, then it may not include... Figure 8 The component within the center frame.
[0156] Furthermore, such as Figure 8 As shown, the electronic device also includes other components such as a communication component 46, a display 47, a power supply component 48, and an audio component 49. Figure 8 The diagram only shows some components and does not mean that the electronic device includes only these components. Figure 8 The components shown. Additionally... Figure 8 The components within the center frame are optional, not mandatory, and their specific requirements depend on the product form of the workflow. The workflow in this embodiment can be implemented as a terminal device such as a desktop computer, laptop computer, smartphone, or IoT device, or as a server-side device such as a conventional server, cloud server, or server array. If the workflow in this embodiment is implemented as a terminal device such as a desktop computer, laptop computer, or smartphone, it may include... Figure 8 The components within the center frame; if the working process of this embodiment is implemented as a server-side device such as a conventional server, cloud server, or server array, then it may not include... Figure 8 The component within the center frame.
[0157] The aforementioned 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 storage, flash memory, magnetic disk, or optical disk.
[0158] The aforementioned communication component is configured to facilitate wired or wireless communication between the device containing the communication component and other devices. The device containing the communication component can access wireless networks based on communication standards, such as 2G, 3G, 4G / LTE, 5G, or combinations thereof. In one exemplary embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel.
[0159] The aforementioned display includes a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a Touch Panel, the screen can be implemented as a touchscreen to receive input signals from the user. The Touch Panel includes one or more touch sensors to sense touches, swipes, and gestures on the Touch Panel. The touch sensors can sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation.
[0160] The aforementioned power supply components provide power to various components within the device in which they reside. These power supply components may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device in which they reside.
[0161] The aforementioned audio component can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) configured to receive external audio signals when the device containing the audio component is in an operating mode, such as call mode, recording mode, or voice recognition mode. The received audio signals can be further stored in memory or transmitted via a communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals.
[0162] Figure 9 A schematic diagram of a video memory control system provided for an exemplary embodiment of this application; see attached diagram. Figure 9 As shown, this embodiment provides a video memory control system, which is used to execute the above-mentioned... Figure 2 The memory control method shown herein may specifically include: a memory control device 31 and a graphics processing unit (GPU) 32 that is communicatively connected to the memory control device 31;
[0163] The memory control unit 31 is configured to, in response to a received driver upgrade request from the image processing unit GPU 32, obtain a pre-upgrade page table corresponding to the GPU 32, the pre-upgrade page table including the mapping relationship between the physical addresses and virtual addresses of the GPU memory; determine a data cleanup queue corresponding to the GPU 32, the data cleanup queue being used to perform global cleanup of the data in the GPU memory; if the data cleanup queue is locked, perform a driver upgrade operation on the GPU 32 based on the driver upgrade request, obtain a post-upgrade page table corresponding to the GPU 32, the post-upgrade page table including the mapping relationship between the physical addresses and virtual addresses of the GPU memory; generate control instructions based on the pre-upgrade page table and the post-upgrade page table, and send the control instructions to the GPU 32;
[0164] GPU 32 is used to regulate the data in the GPU memory based on control instructions.
[0165] The memory control system in this embodiment can also perform the above-described functions. Figures 1-6 The description of the embodiments shown in the illustrations can be found in the detailed descriptions of the embodiments described above, and will not be elaborated upon here.
[0166] Accordingly, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the steps in the above-described method embodiments. The computer-readable storage medium includes volatile or non-volatile components, or a combination thereof, and can be removable or non-removable. Examples of computer-readable storage media include, but are not limited to, phase-change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random-access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), flash memory or other memory technologies, CD-ROM, Digital Video Disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium.
[0167] Accordingly, this application also provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the processor is able to implement the steps in the above method embodiments. It should be understood that each step or combination of steps in the above method flow can be implemented by the computer program or instructions. In addition, these computer programs or instructions can be applied to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device, so that the processor of the general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device can be implemented as a means to implement the corresponding functions in the above method embodiments.
[0168] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0169] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A video memory control method, characterized in that, include: In response to the obtained driver upgrade request of the image processing unit (GPU), the upgrade front page table corresponding to the GPU is obtained, and the upgrade front page table includes: the mapping relationship between the physical address and virtual address of the GPU memory; A data cleanup queue corresponding to the GPU is determined, and the data cleanup queue is used to perform global cleanup of the data in the GPU's video memory; With the data cleanup queue locked, a driver upgrade operation is performed on the GPU based on the driver upgrade request to obtain the upgraded page table corresponding to the GPU. The upgraded page table includes the mapping relationship between the physical address and virtual address of the GPU memory. Address conflict detection is performed based on the page table before and after the upgrade, and the data in the GPU memory is adjusted based on the detection results. Specifically, the address conflict detection includes physical address conflict detection between the control page table in the post-upgrade page table and the data page table in the pre-upgrade page table, and the adjustment method includes storing conflicting memory data in a preset temporary cache. The address conflict detection also includes address update detection between the data page table in the post-upgrade page table and the data page table in the pre-upgrade page table, and the adjustment method includes migrating GPU memory data that requires address updates.
2. The method according to claim 1, characterized in that, After determining the data cleanup queue corresponding to the GPU, the method further includes: Based on the driver upgrade request, a queue locking instruction is generated; The queue locking instruction is sent to the GPU so that the GPU locks the data cleanup queue based on the queue locking instruction.
3. The method according to claim 1, characterized in that, Obtaining the upgraded page table corresponding to the GPU includes: In response to the GPU's replay operation of the user's executed command, a first control plane page table and a first data plane page table corresponding to the GPU are determined. The first control plane page table includes the mapping relationship between the physical address and the virtual address corresponding to the control plane data after the driver upgrade. The first data plane page table includes the mapping relationship between the physical address and the virtual address corresponding to the data plane data after the driver upgrade. Based on the first data page table and the first control page table, the upgraded page table corresponding to the GPU is determined.
4. The method according to claim 3, characterized in that, Determining the first control facet table corresponding to the GPU includes: Determine the control plane data copy queue corresponding to the GPU; Based on the control plane data copy queue, a control plane data reconstruction operation is performed to obtain the first control plane page table.
5. The method according to claim 4, characterized in that, Determining the first data page table corresponding to the GPU includes: After reconstructing the control plane data based on the control plane data copy queue, determine the data plane data copy queue corresponding to the upgraded GPU; Based on the data plane data copy queue, a data plane data reconstruction operation is performed to obtain the first data plane page table.
6. The method according to claim 1, characterized in that, The upgraded page table includes a first control page table corresponding to the GPU; Based on the pre-upgrade page table and the post-upgrade page table, the data in the GPU memory is manipulated, including: Determine the second data plane page table corresponding to the GPU in the page table before the upgrade. The second data plane page table includes the mapping relationship between the physical address and the virtual address corresponding to the data plane data before the driver upgrade. The data in the GPU memory is regulated based on the first control page table and the second data page table.
7. The method according to claim 6, characterized in that, The data in the GPU memory is regulated based on the first control page table and the second data page table, including: Physical address conflict detection is performed based on the first control page table and the second data page table to obtain the detection result; The data in the GPU memory is adjusted based on the detection results.
8. The method according to claim 7, characterized in that, Based on the detection results, the data in the GPU memory is adjusted, including: If the detection result indicates an address conflict between the first control page table and the second data page table, the conflicting address in the second data page table is determined based on the first control page table. Based on the conflicting address, the conflicting memory data in the GPU memory is determined; The conflicting video memory data is stored in a preset temporary cache.
9. The method according to claim 6, characterized in that, The upgraded page table includes a first data page table corresponding to the GPU; the data in the GPU memory is adjusted based on the pre-upgrade page table and the upgraded page table, including: Based on the first data page table and the second data page table, the GPU memory data address update detection is performed to obtain the detection result; The data in the GPU memory is adjusted based on the detection results.
10. The method according to claim 9, characterized in that, Based on the detection results, the data in the GPU memory is adjusted, including: If the detection result indicates that there is an address update in the GPU memory data, the address before and after the upgrade of the GPU memory data are determined based on the second data page table and the first data page table. The GPU memory data is migrated from the address before the upgrade to the address after the upgrade.
11. The method according to any one of claims 1-10, characterized in that, Before obtaining the pre-upgrade page table corresponding to the GPU, the method further includes: Based on the driver upgrade request, a pause execution instruction corresponding to the GPU is generated; The pause execution instruction is sent to the client so that the hijacking module in the client hijacks the user execution command corresponding to the GPU based on the pause execution instruction, and suspends the sending of the user execution command to the GPU for processing.
12. The method according to claim 11, characterized in that, After adjusting the data in the GPU memory based on the pre-upgrade page table and the post-upgrade page table, the method further includes: Generate the recovery execution instruction corresponding to the GPU; The resumption execution instruction is sent to the client, so that the hijacking module in the client sends the hijacked user execution instructions to the GPU for processing based on the resumption execution instruction.
13. The method according to any one of claims 1-10, characterized in that, After adjusting the data in the GPU memory based on the pre-upgrade page table and the post-upgrade page table, the method further includes: Generate an unlock command corresponding to the data cleanup queue; The data cleanup queue is unlocked based on the unlock command.
14. A video memory control device, characterized in that, include: The first acquisition module is used to acquire the pre-upgrade page table corresponding to the GPU in response to the obtained driver upgrade request of the image processing unit GPU. The pre-upgrade page table includes the mapping relationship between the physical address and virtual address of the GPU memory. The first determining module is used to determine a data cleanup queue corresponding to the GPU, the data cleanup queue being used to perform global cleanup of the data in the GPU's video memory; The first processing module is configured to perform a driver upgrade operation on the GPU based on the driver upgrade request while locking the data cleanup queue, and obtain an upgraded page table corresponding to the GPU. The upgraded page table includes a mapping relationship between the physical address and virtual address of the GPU memory. The first control module is used to perform address conflict detection based on the page table before the upgrade and the page table after the upgrade, and to regulate the data in the GPU memory based on the detection results. The address conflict detection includes physical address conflict detection between the control page table in the page table after the upgrade and the data page table in the page table before the upgrade, and the regulation method includes storing conflicting memory data in a preset temporary cache. The address conflict detection also includes address update detection between the data page table in the page table after the upgrade and the data page table in the page table before the upgrade, and the regulation method includes migrating GPU memory data that needs address updates.
15. A video memory control system, characterized in that, include: A memory control device and a graphics processing unit (GPU) communicatively connected to the memory control device; The memory control device is configured to, in response to a received driver upgrade request from the image processing unit (GPU), acquire a pre-upgrade page table corresponding to the GPU, the pre-upgrade page table including a mapping relationship between the physical addresses and virtual addresses of the GPU memory; determine a data cleanup queue corresponding to the GPU, the data cleanup queue being used to perform global cleanup of data in the GPU memory; and, while locking the data cleanup queue, perform a driver upgrade operation on the GPU based on the driver upgrade request, acquiring a post-upgrade page table corresponding to the GPU, the post-upgrade page table including a mapping relationship between the physical addresses and virtual addresses of the GPU memory. The system performs address conflict detection based on the page tables before and after the upgrade, generates control instructions based on the detection results, and sends the control instructions to the GPU. Specifically, the address conflict detection includes physical address conflict detection between the control page table in the upgraded page table and the data page table in the previous page table; the generated control instructions are used to store conflicting memory data in a preset temporary cache. The address conflict detection also includes address update detection between the data page table in the upgraded page table and the data page table in the previous page table; the generated control instructions are used to migrate GPU memory data requiring address updates. The GPU is used to regulate the data in the GPU memory based on the regulation instructions.
16. An electronic device, characterized in that, include: A memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method of any one of claims 1-11.
17. A computer storage medium, characterized in that, Used to store a computer program that, when executed by a computer, implements the method of any one of claims 1-11.
18. A computer program product, characterized in that, include: A computer program, when executed by a processor of an electronic device, causes the processor to perform the steps of the method of any one of claims 1-11.
Citation Information
Patent Citations
Method and apparatus for supporting self-refreshing display device coupled to graphic controller
CN102841671A
Multi-Channel Flash Module with Plane-Interleaved Sequential ECC Writes and Background Recycling to Restricted-Write Flash Chips
US20080034154A1