Data migration method and device, chip, equipment, medium and product

By dividing the first video memory space in the video memory to store dirty page information, the problem of waste of computing resources caused by frequent dirty page recognition in virtual machine data migration is solved, and the efficiency and accuracy of data migration are improved.

CN119883120AActive Publication Date: 2025-04-25MOORE THREADS TECH CO LTD

Patent Information

Application Number
CN202411959288.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-25
Estimated Expiration
2044-12-27

AI Technical Summary

Technical Problem

In virtualization technology, the virtual machine remains in operation during data migration, resulting in new data writing, and the driver needs to continuously identify dirty pages, resulting in high overhead of computing resources and low efficiency.

Method used

By dividing the first video memory space in the video memory, storing dynamically generated dirty page information, recording changes in data in the video memory in real time, avoiding traversing the page table to identify dirty pages, and improving migration efficiency.

Benefits of technology

It improves the efficiency and accuracy of data migration, reduces resource consumption, and avoids the high computing overhead caused by page table traversal.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883120A_ABST
    Figure CN119883120A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data migration method and device, a chip, equipment, a medium and a product, and relates to the field of data migration. The method comprises the following steps: acquiring a first video memory space; in the data migration process of the video memory, responding to a first writing position where the first data is written into the video memory, and writing address information of the first writing position into the first video memory space to obtain dirty page information. In the data migration process, the dynamically generated address information of the write-in position of the newly written-in data is stored in the first video memory space obtained by dividing the video memory, so that the change condition of data storage in the video memory is dynamically recorded in real time, and the dynamically changed data is generated in the subsequent migration video memory; and the position where the data dynamic change exists in the video memory does not need to be continuously identified by traversing a page table, so that the resource consumption in the data migration process is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of data migration, and in particular, to a data migration method, device, chip, equipment, medium and product. Background Art

[0002] Data migration refers to the process of transferring data from one storage location or system to another. In virtualization technology, data migration can be achieved by migrating data from source host A to destination host B while the virtual machine remains running.

[0003] Since the virtual machine remains running during the migration process, new data may be written. Since the graphics processing unit (GPU) video memory is migrated by the driver in the source host A, the driver needs to continuously identify dirty pages during the data migration process. In the related art, the driver records the video memory pages that are written during the migration process in the form of a page table, and traverses and identifies the video memory pages in the page table multiple times, and performs migration on the video memory pages that are indicated to be written in the page table.

[0004] However, during the data migration process, the dirty page processing method of continuously traversing the page table will generate a large computing resource overhead, and the data migration efficiency is low. Summary of the invention

[0005] The present application provides a data migration method, device, chip, equipment, medium and product. The technical solution is as follows:

[0006] On the one hand, an embodiment of the present application provides a data migration method, the method comprising:

[0007] Acquire a first video memory space, where the first video memory space is used to store dirty page information dynamically generated during video memory data migration;

[0008] In the data migration process of the video memory, in response to the existence of a first write position in the video memory where the first data is written, the address information of the first write position is written into the first video memory space to obtain the dirty page information, wherein the first write position is a position in the video memory other than the first video memory space;

[0009] The dirty page information is used to record write events generated during the data migration process.

[0010] On the one hand, an embodiment of the present application provides a data migration method, the method comprising:

[0011] Acquire a first video memory space, where the first video memory space is used to store dirty page information dynamically generated during video memory data migration;

[0012] In the data migration process of the video memory, in response to the existence of a first write position in the video memory where the first data is written, the address information of the first write position is written into the first video memory space to obtain the dirty page information, wherein the first write position is a position in the video memory other than the first video memory space;

[0013] The first data in the first write position is migrated based on the dirty page information to obtain a data migration result.

[0014] On the other hand, an embodiment of the present application provides a chip, the chip comprising: a video memory and a control circuit;

[0015] The control circuit is used to obtain a first video memory space from the video memory, where the first video memory space is used to store dirty page information dynamically generated by the video memory during data migration;

[0016] The control circuit is further configured to, during the data migration process of the video memory, in response to the existence of a first data written into a first write position in the video memory, write address information of the first write position into the first video memory space to obtain the dirty page information, wherein the first write position is a position in the video memory other than the first video memory space;

[0017] The dirty page information is used to record write events generated during the data migration process.

[0018] On the other hand, an embodiment of the present application provides a data migration device, the device comprising: a first chip and a second chip, the first chip comprising a video memory;

[0019] The first chip is configured to obtain a first video memory space, the first video memory space being used to store dirty page information dynamically generated during data migration of the video memory; during the data migration of the video memory, in response to the existence of first data being written to a first write position in the video memory, write address information of the first write position into the first video memory space to obtain the dirty page information, the first write position being a position in the video memory other than the first video memory space;

[0020] The second chip is configured to read the dirty page information from the first video memory space, and migrate the first data in the first write position based on the dirty page information to obtain a data migration result.

[0021] On the other hand, an embodiment of the present application provides a computer device, which includes a processor and a memory, wherein at least one instruction is stored in the memory, and the at least one instruction is loaded and executed by the processor to implement the data migration method provided in the above-mentioned embodiment of the present application.

[0022] On the other hand, an embodiment of the present application provides a computer-readable storage medium, in which at least one instruction is stored, and the at least one instruction is loaded and executed by a processor to implement the data migration method provided in the above-mentioned embodiment of the present application.

[0023] On the other hand, an embodiment of the present application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the data migration method provided in the above-mentioned embodiment of the present application.

[0024] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:

[0025] During the data migration process, a first video memory space is divided in the video memory, and address information of the write position of dynamically generated new write data is stored in the first video memory space, thereby dynamically recording changes in data storage in the video memory in real time, and generating dynamically changing data in the subsequent migration video memory. There is no need to continuously identify locations where data is dynamically changed in the video memory by traversing the page table, thereby improving data migration efficiency and accuracy and reducing resource consumption during data migration. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0027] Figure 1 It is a schematic diagram of the overall process of a data migration method provided by an exemplary embodiment of the present application;

[0028] Figure 2 is a flow chart of a data migration method provided by an exemplary embodiment of the present application;

[0029] Figure 3 It is a schematic diagram of the overall process of storing dirty page information in the form of a Dirty Ring in the first video memory space provided by an exemplary embodiment of the present application;

[0030] Figure 4 is a flow chart of a data migration method provided by another exemplary embodiment of the present application;

[0031] Figure 5 It is a schematic diagram of a process of generating dirty page information provided by an exemplary embodiment of the present application;

[0032] Figure 6is an interactive flow chart of a data migration method provided by an exemplary embodiment of the present application;

[0033] Figure 7 is an interactive flow chart of a data migration method provided by another exemplary embodiment of the present application;

[0034] Figure 8 is a structural block diagram of a data migration device provided by an exemplary embodiment of the present application;

[0035] Fig. 9 is a schematic diagram of the structure of a chip provided by an exemplary embodiment of the present application;

[0036] Fig.10 It is a structural block diagram of a computer device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0037] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0038] First, the terms involved in the embodiments of the present application are introduced.

[0039] Data migration: refers to the process of moving data from one location or system to another. Data migration may involve many types of data, including files, databases, applications, virtual machines, network storage, etc.

[0040] Among them, the data migration of the virtual machine is the process of migrating the relevant data of the virtual machine, including disk images, configuration files, memory status and video memory data, from one physical host or storage system to another physical host or storage system. In some embodiments, while the virtual machine remains running, the relevant data of the virtual machine operation is migrated from the source host to the destination host. During this data migration process, in order to ensure the continuous operation of the virtual machine, it is now necessary to copy the virtual machine's memory, video memory and other data from the source host to the destination host. Among them, the memory data is completed by the kernel-based virtual machine (KVM), and the video memory used by the GPU needs to be migrated through the device driver of the source host.

[0041] Dirty Page: In the embodiment of the present application, a dirty page refers to a video memory page that has been modified or written in the video memory but has not yet been migrated and synchronized to the destination host.

[0042] In order to ensure that the new data generated by the virtual machine operation during the migration process is synchronized to the destination host, the GPU driver needs to technically monitor the GPU's memory write operation. The memory address written by the GPU is called a dirty page. During the migration of memory data, dirty pages need to be continuously identified.

[0043] In the related art, the migration of video memory data is achieved by designing a page table. A bitmap or flag array corresponding to the video memory page is used to record the dirty page status of each video memory page. When the GPU writes to the video memory page, the flag bit of the corresponding page will be set to a dirty page, such as: the flag bit value is set from 0 to 1, and after the migration is completed, the flag bit value is restored from 1 to 0. When the data migration needs to be updated, it can be determined which pages need to be processed based on the flag bits in the page table. However, during the data migration process, when there is a video memory page write event, after setting the flag bits in the page table, it is necessary to re-traverse the page table to determine the video memory page where the video memory page write event occurs, and then migrate the video memory page with the write event based on the traversal results. The process of repeatedly traversing the page table until there are no dirty pages in the page table has a large data overhead, resulting in low migration efficiency of video memory data.

[0044] In an embodiment of the present application, when a video memory page write event occurs during the process of data migration in the video memory, the write position of the write event in the video memory is obtained, and the address information of the write position is recorded in the pre-acquired video memory space, thereby obtaining dirty page information generated during the data migration process, and migrating data based on the dirty page information, thereby improving the efficiency of data migration, eliminating the need to repeatedly traverse the page table, and reducing data overhead.

[0045] Dirty Ring: It is a dirty page marking method based on a ring buffer. In the dirty page marking method of the dirty ring, a ring buffer is used to record the information of the most recently modified video memory page, such as the address of the video memory page. In some embodiments, each video memory page is assigned a unique serial number. When the GPU writes to the video memory page, the serial number of the corresponding video memory page will be written to the slot of the ring buffer, usually to the first unwritten slot. The oldest serial number in the ring buffer can be used to determine the earliest modified video memory page, and the latest serial number indicates the most recently modified video memory page.

[0046] In an embodiment of the present application, write events of the video memory during the data migration process are recorded in the form of a dirty ring, dirty page information is obtained based on the write events recorded in the dirty ring, and the data migration of the video memory is updated based on the dirty page information to obtain the data migration result of the video memory, thereby improving the data migration efficiency and accuracy of the video memory and reducing the computational overhead of data migration.

[0047] Figure 1FIG. 1 is a schematic diagram of the overall process of a data migration method provided by an exemplary embodiment of the present application. Figure 1 As shown, the data migration method mainly involves a central processing unit 120 (CPU) and a GPU 140, wherein the CPU 120 is responsible for running a driver, which is used to drive the migration process of the memory data of the GPU 140. In some embodiments, the driver is also used to drive the operation of the GPU, such as sending a GPU command to the GPU, thereby driving the GPU to complete operations such as calculations or data writing.

[0048] The GPU 140 includes a video memory 142 and a control circuit 144 .

[0049] Video memory 142 is used to store video memory data. Schematically, video memory 142 mainly stores at least one of the following data: 1. Texture data: used for texture sampling during the rendering process to provide more realistic surface details and texture effects; 2. Frame buffer data: used to store the final rendering results, including color buffer data and depth buffer data. The color buffer data is used to indicate the color value of each pixel, and the depth buffer data is used to indicate the depth information of each pixel; 3. Vertex buffer data: used to indicate the vertex data of the three-dimensional model, including vertex coordinates, normals, texture coordinates, etc.; 4. Shader program and constant buffer data: The shader program is a program used to control the graphics rendering process, and the constant buffer is used to store constants and parameter data for use by the shader program; 5. Intermediate calculation results and cache data: During the graphics rendering process, the GPU will also generate some intermediate calculation results and cache data, which will also be stored in the video memory for subsequent rendering and calculation.

[0050] The control circuit 144 is used to control the scheduling and operation between various functional modules in the GPU 140 .

[0051] In the embodiment of the present application, the CPU 120 runs the driver program, and after triggering the data migration task, first applies for a section of video memory space in the video memory 142 of the GPU 140 as the cache space of the dirty ring. When there is a write event in the video memory 142 of the GPU 140 during the data migration process, and the write location of the write event is a location outside the cache space of the dirty ring, the write address information of the write event is written to the cache space of the dirty ring, thereby obtaining the dirty page information during the data migration process.

[0052] The data migration of the video memory 142 is updated according to the dirty page information until the write event of the video memory 142 ends, and the data migration of the video memory 142 is completed.

[0053] In some embodiments, when the GPU commands in the GPU command queue are executed completely, it is determined that the video memory 142 write event is finished.

[0054] The data migration method provided in the embodiment of the present application is completed by a computer device, and the computer device can be implemented as a terminal or a server.

[0055] The computer device is implemented as a source host in a data migration task.

[0056] The terminal may be an electronic device such as a mobile phone, a tablet computer, a vehicle terminal (vehicle computer), a PC (Personal Computer), etc. A driver is installed in the terminal to drive the data migration of the GPU video memory. In addition, this application does not limit the form of the driver, including but not limited to App (Application), applets, etc. installed in the terminal.

[0057] When a computer device is implemented as a server, it can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.

[0058] Figure 2 FIG. 1 is a flow chart of a data migration method provided by an exemplary embodiment of the present application. The method can be executed by a terminal or a server. Figure 2 As shown, the method includes the following steps.

[0059] Step 220 , obtaining a first video memory space, where the first video memory space is used to store dirty page information dynamically generated during video memory data migration.

[0060] In some embodiments, the first video memory space is a preset video memory space; or, the first video memory space is a storage space divided from the video memory in real time.

[0061] When the first video memory space is a preset video memory space, the first video memory space is pre-allocated in the video memory for storing dynamically generated dirty page information during data migration. Optionally, the first video memory space is stored in advance in the running program of the GPU, and the first video memory space does not store data during the normal operation phase of the GPU and is only used during the data migration process of the GPU.

[0062] When the first video memory space is a storage space dynamically divided from the video memory, at least one of the following situations is included:

[0063] First, according to the current data storage state of the video memory, a continuous storage space is divided from the video memory as the first video memory space.

[0064] In some embodiments, when there is a data migration task, a page table of the GPU video memory is obtained, and a bitmap or flag array corresponding to the video memory page is used in the page table to record the dirty page status of each video memory page. When data is written to the video memory page, the flag bit corresponding to the video memory page takes a first value, and when no data is written to the video memory page, the flag bit corresponding to the video memory page takes a second value. A flag bit sequence that continuously takes the second value is obtained from the page table of the GPU video memory, and the video memory page corresponding to the flag bit sequence is determined as the first video memory space for storing dirty page information dynamically generated during the data migration process.

[0065] According to the data storage status of the video memory, a continuous storage space is dynamically divided as the first video memory space, which can improve the utilization rate of the video memory space. The first video memory space is dynamically determined based on the space occupancy of the video memory, avoiding the situation where the video memory space is vacant when it is not in the data migration stage due to reserving the first video memory space in advance, thereby improving the flexibility of video memory utilization.

[0066] Second, obtain the write status of a preset video memory position, which is a preset video memory position that is used as the starting position for writing dirty page information. When the write status of the preset video memory position is written, obtain the write status of the next position of the preset video memory position until an empty video memory position that has not been written is obtained, and obtain continuous video memory positions as the first video memory space from the empty video memory position as the starting position.

[0067] In some embodiments, when continuous video memory positions are obtained as the first video memory space, if there are not enough continuous video memory positions as the first video memory space, the data in the video memory may be sorted first, and continuous video memory positions may be vacated to obtain the first video memory space.

[0068] By determining the first video memory space in a pre-divided manner, the acquisition efficiency of the first video memory space is improved, the computing resources consumed when the first video memory space is obtained by dynamic division are avoided, and the migration efficiency of video memory data is improved.

[0069] It should be noted that the above method of obtaining the first video memory space is only an illustrative example and is not limited in this embodiment.

[0070] In the embodiment of the present application, dynamically obtaining the first video memory space is used as an example to illustrate that a driver is run, and the driver is used to drive the data migration process of the video memory. In response to receiving a data migration request, the first video memory space is obtained through the driver.

[0071] In some embodiments, the CPU runs a driver program, and when there is a data migration task, the driver program sends a space acquisition request to the GPU to request the GPU to divide the first video memory space in the video memory. The GPU divides the first video memory space according to the space acquisition request and caches the information of the first video memory space. In some embodiments, the GPU stores the address information of the first video memory space in a register.

[0072] In some embodiments, when the data migration task is started by running the driver through the CPU, the first video memory space is directly requested from the GPU through the driver; or, when the data migration task is started by running the driver through the CPU, when the driver receives the GPU command sent by the application to instruct the GPU to complete the operation or storage, the first video memory space is requested from the GPU through the driver. In other words, if the GPU command sent by the application is not received during the video memory data migration process, there is no need to request the first video memory space to record the dynamically generated dirty page information. The above-mentioned application includes an application running on a virtual machine, or an application running on a physical host. The above-mentioned application includes an application running on a subject that performs data migration, and the subject includes at least one of a virtual machine or a physical machine.

[0073] In some embodiments, obtaining the first video memory space includes at least one of the following methods:

[0074] 1. Obtaining a video memory start address and a video memory space length, wherein the video memory start address is used to indicate a start address of the first video memory space in the video memory, and the video memory space length is used to indicate the number of continuous storage units occupied by the first video memory space starting from the start address;

[0075] By indicating the video memory starting address and the video memory space length, the writing efficiency when writing data in the first video memory space is improved. It is only necessary to locate the current writing position of the first video memory space according to the video memory starting address and the video memory space length to achieve writing address information in the first video memory space, thereby improving the dynamic migration efficiency of the video memory.

[0076] 2. Obtaining a video memory start address and a video memory end address, wherein the video memory start address is used to indicate the start address of the first video memory space in the video memory, and the video memory end address is used to indicate the end address of the first video memory space in the video memory, and the continuous video memory addresses between the video memory start address and the video memory end address are the occupied addresses of the first video memory space in the video memory;

[0077] By indicating the video memory start address and the video memory end address, the write position of the current first video memory space can be determined after obtaining the video memory start address. When the write position does not exceed the video memory end address, writing to the first video memory space can be achieved, thereby improving the writing efficiency of the video memory.

[0078] 3. Obtain the video memory end address and the video memory space length, wherein the video memory end address is used to indicate the end address of the first video memory space in the video memory, and the video memory space length is used to indicate the number of continuous storage units occupied by the first video memory space starting from the start address.

[0079] It is worth noting that the above-mentioned method of acquiring the first video memory space is only an illustrative example, and the examples of this application are not limited to this.

[0080] In some embodiments, the first video memory space is used to record dirty page information dynamically generated during the data migration process of the video memory in a dirty ring recording manner.

[0081] Step 240 , in the data migration process of the video memory, in response to the existence of first data written into a first write position in the video memory, write address information of the first write position into the first video memory space to obtain dirty page information.

[0082] During data migration in the video memory, a write request is received, where the write request is used to request writing first data in the video memory, wherein the method of writing the first data includes modifying the first data based on the original write data at the first write position, or writing new first data at the first write position.

[0083] In some embodiments, the method of writing the first data to the first write position based on the write request includes at least one of the following: 1. The write request includes the write position of the first data in the video memory, that is, the first write position, which is used to indicate a request to write the first data to the first write position of the video memory; 2. The write request includes the first data, which is used to request to write the first data at any position in the video memory, and the GPU determines the first write position from the video memory according to the write request.

[0084] After the GPU determines the first write position of the first data in the video memory, the address information of the first write position is written into the first video memory space.

[0085] The address information of the first writing position may be recorded before the first data is written into the video memory, may be recorded during the process of writing the first data into the video memory, or may be recorded after the first data is written into the video memory, which is not limited in this embodiment.

[0086] The address information of the first write position includes at least one of the following forms:

[0087] First, the address of the video memory page is expressed in a "row-column" manner, also known as a "row-column address" or "row-column index". In the video memory, data is organized into a two-dimensional matrix consisting of multiple rows and columns. Each element or pixel has a unique row and column index in the matrix, which is used to locate the storage location of the element. A row refers to a row in the video memory, and a column refers to a column in the video memory. The row index and column index can be integers starting from 0, which are used to identify a specific location in the video memory matrix. The first write position can be recorded in the first video memory space using a row-column index.

[0088] The first video memory space may be a continuous storage space in the same row, or a continuous storage space in the same column, or a continuous storage space with a preset row and column size. When the first video memory space is implemented as a continuous storage space with a preset row and column size, the sequential reading relationship of the rows and columns in the first video memory space is preset, such as: taking rows as units, and reading dirty page information row by row.

[0089] By writing the row-column index as the address, the efficiency of address expression is improved. When performing dynamic migration, only the row-column index needs to be obtained to locate the address position of the dynamic write in the video memory, thereby realizing dynamic migration and improving the migration accuracy.

[0090] In the second method, each video memory page corresponds to a preset serial number, and when the first data is written into the first writing position, the serial number of the video memory page corresponding to the first writing position is written into the first video memory space.

[0091] By writing the serial number as the address, the space utilization rate of the first video memory space is improved and the amount of data written into the first video memory space is reduced.

[0092] In some embodiments, in a data migration scheme based on a virtual machine, the address information of the above-mentioned first write position can be implemented as a physical address in the video memory, or as a virtual address in the virtual machine, wherein there is a corresponding relationship between the physical address and the virtual address, and each virtual address corresponds to a physical address. In some embodiments, the address information of the first write position includes the page table base address, virtual address and physical address of the first write position in the video memory. The page table base address is the starting address of the page table in the physical memory. The page table is a special data structure for storing the correspondence between logical pages and physical pages. The video memory includes a page table corresponding to the video memory. The address information of the first write position in the video memory is indicated by the page table base address, physical address and virtual address.

[0093] The address information of the first write position is recorded in the form of a dirty ring in the first video memory space. The first video memory space includes a series of continuous video memory page spaces, and the address information of the write positions of multiple video memory write events are sequentially written into the video memory page positions in the first video memory space, thereby expressing the event generation order of each video memory write event.

[0094] By recording the address information of the write position in the video memory in the form of a dirty ring and expressing the write order between the write positions in the video memory in the form of a dirty ring, the accuracy of dynamic migration of the video memory is improved, the traversal of the page table is avoided, and the resource usage during the video memory migration process is reduced.

[0095] That is, during the data migration process of the video memory, a write request is received, the write request is used to request to write first data in the video memory, determine the first write position of the first data in the video memory, write the address information of the first write position into the first video memory space, and obtain dirty page information.

[0096] In some embodiments, since writing the address information of the first write position into the first video memory space is also implemented as a write video memory operation, the GPU needs to distinguish whether the write video memory operation is a dirty page record operation of writing into the first video memory space or other write operations. In the embodiment of the present application, taking data migration based on a virtual machine as an example, the request source information of the write request is obtained, and the request source information is used to indicate the data source of the request to write the first data. When the data source indicates that the write request is initiated by a specified data source, the address information of the first write position is written into the first video memory space to obtain the dirty page information.

[0097] In the data migration process based on the virtual machine, the virtual machine also performs data calculation synchronously during the data migration process, generating a write memory event during the data calculation process. Schematically, when virtual machine A generates a write memory event during operation, the write request sent by virtual machine A to the GPU includes the virtual machine identifier of virtual machine A, which is a pre-set identifier used to uniquely indicate virtual machine A.

[0098] That is, the write request includes data source information, and the data source information is used to indicate the request subject that initiated the write request. The request subject includes at least one of a virtual machine, a physical host, and a GPU itself. When the request subject includes a virtual machine, the data source information in the write request includes the virtual machine identifier of the virtual machine; when the request subject includes a physical host, the data source information in the write request includes the host identifier of the physical host; when the request subject includes a GPU, the write request is actively initiated by the GPU, and the write request includes its own indication identifier or the write request does not include specific indication information of the data source, thereby indicating that the write request is actively generated by the GPU.

[0099] By indicating data source information, address information is recorded only for write requests initiated by the specified data source, thereby avoiding conflicts between write events in the first video memory space and write events in other video memory locations, and avoiding recording write events in the first video memory space as video memory write events, which would cause a deadlock loop problem in writing to the first video memory space. This improves the accuracy of dynamic migration of video memory.

[0100] In some embodiments, if there are multiple virtual machines executing data migration tasks synchronously, then during the operation phase of the data migration process, the multiple virtual machines may all write data to the video memory. The writing subject corresponding to the writing request is identified based on the data source information in the writing request, and different virtual machines correspond to different virtual machine identifiers.

[0101] When it is identified that the request source of the write request indicates that the write request is initiated by a specified data source, such as: when it is identified that the data source information in the write request is a virtual machine identifier, the address information of the first write location is written into the first video memory space, or when it is identified that the data source information in the write request indicates a host identifier of a physical host, the address information of the first write location is written into the first video memory space.

[0102] Among them, the designated data source refers to the data source corresponding to the data migration process. Schematically, the data migration process is a process started for virtual machine A, that is, data migration is performed for the video memory data of virtual machine A. The designated data source includes virtual machine A. When the write request includes the virtual machine identifier of virtual machine A, it indicates that data is written to the video memory during the operation of virtual machine A, and the data written to the video memory needs to be recorded in dirty pages. If the write request includes the identifier of other virtual machines or hosts, it means that the data requested to be written by the write request is irrelevant to the data migration process, so no dirty page record is performed. In some embodiments, when there is a need to write data to the video memory itself, the GPU sends a write request to the corresponding virtual machine or host, and the virtual machine or host initiates a write request to write data in the GPU video memory, and the write event of the first video memory space does not need to be implemented through a write request. When the write request indicates to write data to the first write position of the video memory, the address information of the first write position is obtained and directly written to the first video memory space.

[0103] In some embodiments, first data at a first write location is migrated based on the dirty page information to obtain a data migration result.

[0104] In some embodiments, dirty page information expresses the storage location of the unmigrated data dynamically generated during the data migration process in the video memory. Therefore, after obtaining the dirty page information, the first data newly written to the first write location during the data migration process is migrated according to the dirty page information to obtain the data migration result.

[0105] To summarize, the data migration method provided in the embodiment of the present application, during the data migration process, stores the address information of the write position of the newly written data dynamically generated in the first video memory space obtained by dividing in the video memory, thereby dynamically recording the changes in the data storage in the video memory in real time, and generating dynamically changing data in the subsequent migration video memory, and there is no need to continuously identify the locations where the data dynamically changes in the video memory by traversing the page table, thereby improving the data migration efficiency and accuracy, and reducing resource consumption during the data migration process.

[0106] In an optional embodiment, when the data in the first video memory space is full, a set of dirty page information is generated and the first video memory space is cleared to re-store the dirty page information, or when the data in the first video memory space is full, a set of dirty page information is generated and the second video memory space is obtained to re-store the dirty page information. Figure 3 As shown, it shows a schematic diagram of the overall process of storing dirty page information in the form of a Dirty Ring in the first video memory space provided by an exemplary embodiment of the present application.

[0107] like Figure 3 As shown, during the data migration process, when the virtual machine continues to run and sends a write request to the GPU's video memory, the write position corresponding to the write request in the video memory is determined, and the address information of the write position is written into the first video memory space 310. The first video memory space 310 includes multiple write positions. When the first video memory space 310 is full, the data in the first video memory space 310 is taken out as dirty page information, and the first video memory space 310 is cleared, and the dirty page data is continued to be written to obtain new dirty page information. Alternatively, when the first video memory space 310 is full, the data in the first video memory space 310 is taken out as dirty page information, and a request is made to obtain the second video memory space 320, and the dirty page data is continued to be written to obtain new dirty page information.

[0108] Finally, the data migration is updated according to all the dirty page information obtained to obtain the data migration result.

[0109] Based on the above illustrative description, Figure 4 FIG. 1 is a flowchart of a data migration method provided by another exemplary embodiment of the present application. The method can be executed by a terminal or a server. Figure 4 As shown, the method further includes the following step 420. In addition, the above step 240 may further include the following step 262.

[0110] Step 220 , obtaining a first video memory space, where the first video memory space is used to store dirty page information dynamically generated during video memory data migration.

[0111] In some embodiments, the first video memory space is a preset video memory space; or, the first video memory space is a storage space divided from the video memory in real time.

[0112] When the first video memory space is a preset video memory space, the first video memory space is pre-allocated in the video memory for storing dynamically generated dirty page information during data migration. Optionally, the first video memory space is stored in advance in the running program of the GPU, and the first video memory space does not store data during the normal operation phase of the GPU and is only used during the data migration process of the GPU.

[0113] Step 240 , in the data migration process of the video memory, in response to the existence of first data written into a first write position in the video memory, write address information of the first write position into the first video memory space to obtain dirty page information.

[0114] During data migration in the video memory, a write request is received, where the write request is used to request writing first data in the video memory, wherein the method of writing the first data includes modifying the first data based on the original write data at the first write position, or writing new first data at the first write position.

[0115] Step 420 , in response to the first video memory space being full, the dirty page information written in the first video memory space is transferred to a preset storage space as the i-th group of dirty page information.

[0116] The i-th group of dirty page information includes address information of the first write position, and i is a positive integer.

[0117] The first video memory space is a pre-acquired video memory space, and the first video memory space has a space capacity. When the dirty page information written in the first video memory space reaches the space capacity, the dirty page information in the first video memory space is transferred to the preset storage space as the i-th group of dirty page information. The preset storage space may be a memory space determined by a CPU in a computer device.

[0118] In some embodiments, when the first video memory space is full, the GPU sends an interrupt notification (Interrupt Request, IRQ) to the CPU. After receiving the IRQ, the CPU pulls the stored dirty page information from the first video memory space as the i-th group of dirty page information based on the driving logic of the running driver.

[0119] When the GPU writes data to the video memory, it obtains the write position of the write data in the video memory, and after obtaining the address information of the write position, it controls writing the address information into the first video memory space, and before or after writing into the first video memory space, obtains the remaining space capacity of the first video memory space.

[0120] In some embodiments, before writing the address information into the first video memory space, the remaining space capacity of the first video memory space is obtained, that is, before the GPU writes the address information into the first video memory space, the remaining space capacity of the first video memory space is first checked to ensure that the remaining space capacity of the first video memory space can accommodate the writing of the address information. In some embodiments, each address information occupies a preset space capacity of the first video memory space, or each address information occupies a random space capacity of the first video memory space, and then it is identified whether the remaining space capacity of the first video memory space reaches the preset space capacity. When the remaining space capacity of the first video memory space reaches the preset space capacity, the address information is written into the first video memory space; when the remaining space capacity of the first video memory space does not reach the preset space capacity, the control circuit of the GPU first sends an interrupt notification to the CPU, thereby instructing the CPU to run the driver program to read the stored dirty page information from the first video memory space as the i-th group of dirty page information, and transfer the i-th group of dirty page information to the preset storage space, such as: transfer to the preset memory space. After the CPU reads the dirty page information stored in the first video memory space, the first video memory space is cleared to store the address information currently to be written; or, after the CPU reads the dirty page information stored in the first video memory space, the second video memory space is obtained to store the address information currently to be written.

[0121] By clearing the first video memory space, the space resources of the first video memory space are released, so that the write address information of the subsequently generated write events can continue to be stored, thereby improving the space utilization efficiency of the video memory.

[0122] By requesting the second video memory space, data loss stored in the first video memory space is avoided, resulting in loss of address information of video memory write events recorded in the first video memory space, thereby improving the accuracy of video memory dynamic data migration and reducing the error rate of dynamic migration.

[0123] Before writing the address information into the first video memory space, the remaining space capacity of the first video memory space is obtained. Before writing into the first video memory space, the space capacity of the first video memory space is first calibrated. When determining the amount of information of the address information to be written, the relationship between the remaining space capacity and the amount of information is compared to ensure that the remaining space capacity can write the address information, thereby improving the accuracy of video memory data migration.

[0124] In other embodiments, after writing the address information into the first video memory space, the remaining space capacity of the first video memory space is obtained, that is, after the GPU writes the address information into the first video memory space, it is determined whether the remaining space capacity of the first video memory space is sufficient to store the next address information. In some embodiments, each address information occupies a preset space capacity of the first video memory space, and then it is identified whether the remaining space capacity of the first video memory space after storing the address information is sufficient to store the next address information, that is, it is identified whether the remaining space capacity of the first video memory space is greater than or equal to the preset space capacity. If the remaining space capacity of the first video memory space is greater than or equal to the preset space capacity, the first video memory space is sufficient to store the next address information. If the remaining space capacity of the first video memory space is less than the preset capacity, the control circuit of the GPU sends an interrupt notification to the CPU, thereby instructing the CPU to run the driver program to read the stored dirty page information from the first video memory space as the i-th group of dirty page information, and transfer the i-th group of dirty page information to the preset storage space.

[0125] Indicatively, the first video memory space includes n address writing locations, where n is a positive integer. The address information is written into the n address writing locations in sequence, and the writing order of the address information is the same as the writing order of the data into the video memory locations corresponding to the address information. When the n address writing locations are full, the GPU sends an interrupt notification to the CPU, instructing the CPU to read the stored address information from the first video memory space as the i-th group of dirty page information through the driver.

[0126] After the address information is written into the first video memory space, the remaining space capacity of the first video memory space is obtained. When the address information occupies the preset data bits, the remaining space capacity of the first video memory space is calibrated before the next address information is written, thereby avoiding the problem of inefficiency caused by first calibrating the remaining capacity when writing the address information next time, improving the accuracy and efficiency of video memory data migration, and improving the recording accuracy of dynamic write events.

[0127] Among them, after the address information stored in the first video memory space is stored in the preset storage space as the i-th group of dirty page information, the data in the first video memory space is cleared, and when there is second data written to the second write position in the video memory, the address information of the second write position is written to the first video memory space, and when the first video memory space is full, the i+1-th group of dirty page information is obtained until the video memory is finished writing; or, after the address information stored in the first video memory space is stored in the preset storage space as the i-th group of dirty page information, a request is made to obtain the second video memory space, and when there is second data written to the second write position in the video memory, the address information of the second write position is written to the second video memory space, and when the second space is full, the i+1-th group of dirty page information is obtained, and the third video memory space is continued to be obtained until the video memory is finished writing.

[0128] In some embodiments, in response to the completion of the execution of the write request in the write request queue, the GPU sends an interrupt notification to the driver, receives a data read request generated by the driver, and sends the dirty page information written in the first video memory space to the driver based on the data read request, and the driver is used to drive the dirty page information to be transferred to a preset storage space as the last set of dirty page information. Optionally, when the GPU command in the GPU command queue is executed, it is determined that the video memory is finished writing.

[0129] That is, when the write event of the video memory does not stop, the address information of the position of the write event in the write video memory is continuously written into the first video memory space, and dirty page information is continuously generated until the write event in the video memory ends, and multiple sets of dirty page information are obtained. Each set of dirty page information includes one address information or each set of dirty page information includes multiple address information. Each address information corresponds to a video memory write event.

[0130] For illustration, please refer to Figure 5 , which shows a schematic diagram of the process of generating dirty page information provided by an exemplary embodiment of the present application. Figure 5 As shown, when there is a write event in the video memory, the address information of the write position of the write event in the video memory is obtained, and the address information is written into the first video memory space 500. When the first video memory space 500 is full, the data written into the first video memory space 500 is read out and transferred to the preset storage space 510 as the i-th group of dirty page information, and the first i groups of dirty page information are obtained.

[0131] In some embodiments, when writing data to the video memory space stops, the address information stored in the first video memory space is transferred to the preset storage space as the last set of dirty page information. Indicatively, when the data processing process of the video memory ends, an interrupt notification or a preset stop notification is sent to the CPU through the GPU, thereby notifying the CPU to run the driver program to obtain the stored address information from the first video memory space. At this time, the GPU no longer runs and modifies data, and no new address information is written to the first video memory space.

[0132] Alternatively, a termination notification sent by a user through a termination operation is received, the termination notification is used to instruct the GPU to terminate the operation and stop writing data to the video memory, so that the GPU sends an interrupt notification to the CPU based on the termination notification, instructing the CPU to read the address information written in the first video memory space. In some embodiments, when the GPU command in the GPU command queue is executed, it is determined that the video memory is finished writing.

[0133] In some embodiments, in response to the first video memory space being full, an interrupt notification is sent to a driver, the driver is used to drive the data migration process of the video memory, and the interrupt notification is used to indicate the data writing status of the first video memory space. A data read request generated by the driver is received, the data read request is used to request to read the data written in the first video memory space, and dirty page information written in the first video memory space is sent to the driver based on the data read request, and the driver is used to drive the dirty page information to be transferred to a preset storage space as the i-th group of dirty page information.

[0134] In some embodiments, the GPU sends an interrupt notification to the driver in response to the completion of the write request in the write request queue; the CPU reads the dirty page information from the first video memory space and transfers the read dirty page information to the preset storage space as the last set of dirty page information. Optionally, the CPU reads n sets of dirty page information stored in the preset storage space, where n is a positive integer; and performs data migration on the video memory locations corresponding to the address information recorded in the n sets of dirty page information.

[0135] Step 262, obtaining at least one set of dirty page information stored in the preset storage space, and migrating the write data of at least one write location in the video memory based on the at least one set of dirty page information to obtain a data migration result.

[0136] In some embodiments, dirty page information expresses the storage location of the unmigrated data dynamically generated during the data migration process in the video memory. Therefore, after obtaining the dirty page information, the first data newly written to the first write location during the data migration process is migrated according to the dirty page information to obtain the data migration result.

[0137] Data migration in video memory includes static migration phase and dynamic migration phase.

[0138] The static migration phase refers to reading the data storage status of each memory page when the data migration task is started, and recording the memory pages with data written as the memory pages to be migrated in the page table. The process of performing data migration based on the memory pages recorded in the page table is the static migration phase.

[0139] The dynamic migration stage refers to the process of data migration in the video memory. When there is a new data write event written to the video memory page, the address information corresponding to the write position of the new video memory page is obtained, and the address information is written into the first video memory space. After the dirty page information is obtained, the data migration process performed based on the dirty page information is the dynamic migration stage.

[0140] The dynamic migration phase is executed after the static migration phase is completed, or the dynamic migration phase is executed during the migration process of the static migration phase. The execution process of the static migration phase and the dynamic migration phase is described in detail. That is, at least one set of dirty page information in the preset storage space includes at least one of the following reading methods:

[0141] 1. In the migration process of the static migration phase, when the address information stored in the first video memory space is full and read out as a set of dirty page information and transferred to the preset storage space, the dynamic migration process is performed based on the transferred dirty page information, and after the dynamic migration is completed, the static migration process is continued to be performed until both the dynamic migration process and the static migration process are completed, and the data migration result is obtained;

[0142] Indicatively, after the data migration task is started, the page table of the video memory page corresponding to the static migration phase is obtained, and the static migration phase is started based on the page table. When the first video memory space is full and the first set of dirty page information is generated and transferred to the preset storage space, the static migration phase is suspended, and the dynamic migration phase is started based on the first set of dirty page information. When the dynamic migration phase corresponding to the first set of dirty page information ends, the static migration phase is continued until the second set of dirty page information is generated and transferred to the preset storage space, the static migration phase is suspended again, and the dynamic migration phase is started based on the second set of dirty page information.

[0143] The migration process of the dynamic migration phase is coordinated with the static migration phase, which improves the flexibility between the static migration phase and the dynamic migration phase and improves the migration efficiency of the video memory data migration.

[0144] 2. After the migration process of the static migration phase is completed, at least one set of dirty page information stored in the preset storage space is read, and the dynamic migration phase is performed based on the dirty page information until the dirty pages corresponding to all the dirty page information complete the data migration and obtain the data migration result.

[0145] Schematically, after the data migration task is started, the page table of the video memory page corresponding to the static migration stage is obtained, and the static migration stage is started based on the page table. During the data migration process in the static migration stage, when data is written to the video memory, the address information corresponding to the write position is obtained, and the address information is written into the first video memory space to obtain at least one set of dirty page information, which is stored in the preset storage space. After the static migration stage ends, when the data write event ends in the video memory, at least one set of dirty page information that has been generated and stored is obtained from the preset storage space, and the dynamic migration stage is started based on at least one set of dirty page information until the dynamic migration stage ends.

[0146] After the static migration phase is completed, the dynamic migration phase is executed. First, the video memory pages to be migrated recorded in the page table in the static migration phase are completed, and then the dirty page information recorded in the Dirty Ring is completed, which improves the accuracy of video memory data migration.

[0147] It is worth noting that the execution process of the above-mentioned static migration stage and dynamic migration stage is only an illustrative example, and the embodiments of the present application are not limited to this.

[0148] Among them, in the dynamic migration stage, at least one set of dirty page information is obtained, and based on the address information recorded in the dirty page information, the data updated by the video memory page after the write event is obtained from the corresponding address position in the video memory, and the updated data is re-migrated to the destination, such as: migrating the data updated by the video memory page to the destination host or the destination virtual machine, which is not limited to the embodiments of the present application.

[0149] In summary, the method provided in this embodiment, during the process of data migration, stores the address information of the write position of the newly written data dynamically generated in the first video memory space obtained by dividing in the video memory, thereby dynamically recording the changes in the data storage in the video memory in real time, and generating dynamically changing data in the subsequent migration video memory, and there is no need to continuously identify the locations where the data dynamically changes in the video memory by traversing the page table, thereby improving the efficiency and accuracy of data migration and reducing resource consumption during the data migration process.

[0150] The method provided in this embodiment reduces the resource overhead of identifying dirty pages in video memory pages during video memory data migration, improves the efficiency of identifying dirty pages, and avoids the identification process of dirty pages by actively recording dirty pages when write events occur, thereby improving the accuracy of dirty page identification.

[0151] The method provided in this embodiment reduces the time consumption of video memory data migration, and during the video memory data migration process, the virtual machine can run normally, reducing the impact of the operation of the virtual machine on the identification of dirty pages during the data migration process.

[0152] The method provided in this embodiment reduces the overhead of identifying dirty pages through the Dirty Ring, improves the accuracy of identification, and improves the efficiency and performance of migration.

[0153] In some embodiments, the above data migration method is completed by the cooperation of the first chip and the second chip. The first chip includes a video memory, and the data migration process of the video memory needs to be completed by a driver. In this embodiment, the first chip is implemented as a GPU chip and the second chip is implemented as a CPU chip as an example for explanation.

[0154] Figure 6FIG. 1 is an interactive flow chart of a data migration method provided by an exemplary embodiment of the present application. Figure 6 As shown, the process includes the following steps.

[0155] Step 610: The first chip obtains a first video memory space, where the first video memory space is used to store dirty page information dynamically generated during video memory data migration.

[0156] In some embodiments, a driver is run by the CPU, and the driver is used to drive the data migration process of the video memory. The CPU receives a data migration request, and after starting the data migration task based on the data migration request, first obtains the first video memory space through the driver. Among them, a space acquisition request is sent to the GPU, and after receiving the space acquisition request, the GPU obtains the first video memory space based on the space acquisition request, and sends space indication information to the CPU, and the space indication information is used to indicate the space address of the first video memory space. In addition, after obtaining the first video memory space, the GPU stores the space address of the first video memory space. Optionally, the GPU stores the space address of the first video memory space in a register.

[0157] After receiving the space acquisition request, the GPU acquires a continuous storage space from the video memory as the first video memory space, and sends the video memory start address and video memory space length of the first video memory space to the CPU, and stores the video memory start address and video memory space length of the first video memory space in the register. The video memory start address is used to indicate the start address of the first video memory space in the video memory, and the video memory space length is used to indicate the number of continuous storage units occupied by the first video memory space starting from the start address.

[0158] It is worth noting that the above-mentioned CPU refers to the control circuit in the CPU, and the above-mentioned GPU refers to the control circuit in the GPU.

[0159] Step 620: During the data migration process of the video memory, in response to the existence of first data written into a first write position in the video memory, the first chip writes address information of the first write position into the first video memory space to obtain dirty page information.

[0160] During the data migration process of the video memory, when there is first data written to the first write position in the video memory, it indicates that the data in the video memory page in the video memory is dynamically updated, so the address information of the first write position is written to the first video memory space to obtain the dynamically generated dirty page information. The address information of the first write position is written to the first video memory space in the form of a dirty ring.

[0161] In some embodiments, when the video memory page in the first video memory space is full, an interrupt notification is sent to the CPU, and the interrupt notification is used to indicate the data writing status of the first video memory space, so that the CPU reads the written dirty page information from the first video memory space of the GPU through the driver and stores it in the preset storage space. After the data in the first video memory space is read out, the first video memory space is cleared, and the dirty page information is continued to be written until the video memory write event ends; or, after the data in the first video memory space is read out, a request is made to obtain the second video memory space, and the dirty page information is continued to be written until the video memory write event ends.

[0162] When writing to the first video memory space in the form of a dirty ring, the address information is written in sequence according to the order of the video memory pages. Schematically, the first video memory space includes m video memory pages with consecutive addresses, where m is a positive integer. When a new video memory write event is generated, the address of the historical video memory page most recently written in the first video memory space is obtained, and the address information of the current new video memory write event is written to the video memory page address next to the historical video memory page address, thereby forming a dirty ring.

[0163] During the data migration process of the video memory, the GPU receives a write request, which is used to request to write first data in the video memory. The GPU determines a first write position of the first data in the video memory and writes the address information of the first write position into the first video memory space to obtain dirty page information.

[0164] In some embodiments, the GPU obtains request source information in a write request, where the request source information is used to indicate a data source for requesting to write the first data. When the data source indicates that the write request is initiated by a specified data source, the address information of the first write location is written into the first video memory space to obtain dirty page information.

[0165] Step 630: The second chip reads dirty page information from the first video memory space, and migrates the first data in the first write position based on the dirty page information to obtain a data migration result.

[0166] In some embodiments, when the first video memory space is full, or the video memory write event ends, the GPU sends an interrupt notification to the CPU, so that the CPU reads the written address information from the first video memory space through the driver, and writes the address information into the preset storage space as dirty page information. When obtaining the dirty page information, the CPU obtains at least one set of dirty page information stored in the preset storage space, and migrates the written data of at least one write location in the video memory based on the at least one set of dirty page information to obtain a data migration result.

[0167] In summary, the method provided in this embodiment, during the process of data migration, stores the address information of the write position of the newly written data dynamically generated in the first video memory space obtained by dividing in the video memory, thereby dynamically recording the changes in the data storage in the video memory in real time, and generating dynamically changing data in the subsequent migration video memory, and there is no need to continuously identify the locations where the data dynamically changes in the video memory by traversing the page table, thereby improving the efficiency and accuracy of data migration and reducing resource consumption during the data migration process.

[0168] Figure 7 FIG. 1 is an interactive flow chart of a data migration method provided by another exemplary embodiment of the present application. Figure 7 As shown, the interaction process mainly involves a driver 710 , a GPU display memory 720 and a GPU control circuit 730 .

[0169] like Figure 7 Taking the interactive process shown as an example, the interactive process includes the following steps.

[0170] First, the driver 710 waits for the application to send a GPU command, where the GPU command is used to instruct the GPU to complete data calculation and storage.

[0171] When the data migration task is started, or when the driver 710 receives a GPU command during the memory migration process, the driver 710 applies for a section of memory space in the GPU memory 720 as the storage space of the dirty ring. After obtaining the storage space of the dirty ring, the driver 710 writes the memory start address and memory space length of the dirty ring into the GPU register through the GPU control circuit 730.

[0172] In some embodiments, if after the data migration task is started, no GPU command is received to instruct the GPU to complete data calculation and storage, the driver does not need to apply for a section of video memory space in the GPU video memory 720 as storage space for the Dirty Ring.

[0173] After writing the storage space of the Dirty Ring into the GPU register, the driver 710 sends the GPU command to the GPU control circuit 730 for execution, and waits for an interrupt notification sent by the GPU control circuit 730 .

[0174] The GPU control circuit 730 reads the storage space address of the Dirty Ring through the register.

[0175] The GPU control circuit 730 reads the GPU command and starts executing it. During the execution of the GPU command, if there is a write operation, the write address information corresponding to the write operation is written into the storage space of the Dirty Ring. Optionally, there is a special logic unit in the GPU control circuit 730, which writes the relevant address information into the storage space of the Dirty Ring when a write operation to the video memory occurs.

[0176] If the storage space of the Dirty Ring is not full, the write address information of the write operation continues to be written to the storage space of the Dirty Ring. If the storage space of the Dirty Ring is full, the GPU control circuit 730 sends an interrupt notification to the driver 710 running on the CPU. When the storage space of the Dirty Ring is full, the GPU control circuit 730 sends an interrupt notification to the driver and stops the operation of the GPU.

[0177] After receiving the interrupt notification, the driver 710 reads the dirty page information from the storage space of the Dirty Ring of the GPU display memory 720 and stores it in the preset storage space.

[0178] The driver 710 applies for the storage space of the Dirty Ring of the GPU video memory 720 again, and drives the GPU to continue running again.

[0179] In some embodiments, if the storage space of the Dirty Ring is not full, or the storage space of the Dirty Ring is full and the commands in the GPU command queue are executed, the GPU control circuit 730 sends an interrupt notification to the driver 710. Optionally, the interrupt notification includes a command completion interrupt. The driver 710 reads the dirty page information stored in the storage space of the Dirty Ring of the GPU video memory 720 and stores it in a preset storage space.

[0180] Finally, the driver program 710 obtains all dirty page information stored in the preset storage space as dirty page data, and performs video memory migration based on the dirty page data to obtain a data migration result.

[0181] In summary, the method provided in this embodiment, during the process of data migration, stores the address information of the write position of the newly written data dynamically generated in the first video memory space obtained by dividing in the video memory, thereby dynamically recording the changes in the data storage in the video memory in real time, and generating dynamically changing data in the subsequent migration video memory, and there is no need to continuously identify the locations where the data dynamically changes in the video memory by traversing the page table, thereby improving the efficiency and accuracy of data migration and reducing resource consumption during the data migration process.

[0182] Figure 8FIG. 1 is a structural block diagram of a data migration device provided by an exemplary embodiment of the present application. Figure 8 As shown, the device includes: a first chip 810 and a second chip 820, wherein the first chip 810 includes a video memory;

[0183] The first chip 810 is configured to obtain a first video memory space, the first video memory space being used to store dirty page information dynamically generated during data migration of the video memory; during the data migration of the video memory, in response to the existence of first data being written to a first write position in the video memory, write address information of the first write position into the first video memory space to obtain the dirty page information, the first write position being a position in the video memory other than the first video memory space;

[0184] The second chip 820 is configured to read the dirty page information from the first video memory space, and migrate the first data in the first write position based on the dirty page information to obtain a data migration result.

[0185] In an optional embodiment, the second chip 820 is further configured to run a driver program, the driver program is used to drive the data migration process of the video memory; in response to receiving a data migration request, send a space acquisition request to the first chip 810 through the driver program;

[0186] The first chip 810 is further configured to obtain the first video memory space based on the space acquisition request; send space indication information to the second chip 820, where the space indication information is used to indicate the space address of the first video memory space; and store the space address of the first video memory space.

[0187] In an optional embodiment, the first chip 810 is further configured to receive a write request during data migration of the video memory, wherein the write request is used to request writing of the first data in the video memory; determine the first write position of the first data in the video memory; write the address information of the first write position into the first video memory space to obtain the dirty page information.

[0188] In an optional embodiment, the first chip 810 is further configured to obtain request source information of the write request, wherein the request source information is used to indicate a data source for requesting to write the first data; when the data source indicates that the write request is initiated by a specified data source, the address information of the first write address is written into the first video memory space to obtain the dirty page information.

[0189] In an optional embodiment, the second chip 820 is further configured to, in response to the first video memory space being full, transfer the dirty page information written in the first video memory space to a preset storage space as an i-th group of dirty page information, including the address information of the first write position, where i is a positive integer;

[0190] The second chip 820 is further configured to obtain at least one set of dirty page information stored in the preset storage space, and migrate the write data of at least one write location in the video memory based on the at least one set of dirty page information to obtain the data migration result.

[0191] In an optional embodiment, the first chip 810 is also configured to send an interrupt notification to a driver in response to the first video memory space being full, the driver being used to drive the data migration process of the video memory, and the interrupt notification being used to indicate the data writing status of the first video memory space; receive a data read request generated by the driver, the data read request being used to request to read the data written in the first video memory space; and send dirty page information written in the first video memory space to the driver based on the data read request, the driver being used to drive the dirty page information to be transferred to a preset storage space as the i-th group of dirty page information.

[0192] In an optional embodiment, the second chip 820 is further configured to clear the data in the first video memory space, and when there is second data written to a second write position in the video memory, write the address information of the second write position into the first video memory space, and when the first video memory space is full, obtain the i+1th group of dirty page information until the video memory finishes writing; or,

[0193] The second chip 820 is further configured to obtain a second video memory space, and when there is second data written to a second write position in the video memory, write the address information of the second write position into the second video memory space, and when the second video memory space is full, obtain the i+1th group of dirty page information, and obtain the third video memory space again until the video memory finishes writing.

[0194] In an optional embodiment, the first chip 810 is further configured to send the interrupt notification to the driver in response to the write request in the write request queue being executed;

[0195] The second chip 820 is further configured to read dirty page information from the first video memory space and transfer the read dirty page information to the preset storage space as the last set of dirty page information.

[0196] In an optional embodiment, the second chip 820 is further configured to read n sets of dirty page information stored in the preset storage space, where n is a positive integer; and perform data migration on video memory locations corresponding to the address information recorded in the n sets of dirty page information.

[0197] In an optional embodiment, the second chip 820 is further configured to obtain a video memory starting address and a video memory space length, wherein the video memory starting address is used to indicate a starting address of the first video memory space in the video memory, and the video memory space length is used to indicate the number of continuous storage units occupied by the first video memory space starting from the starting address.

[0198] In an optional embodiment, the first video memory space is used to record dirty page information dynamically generated by the video memory during data migration in a dirty ring recording manner.

[0199] To summarize, the system provided in this embodiment stores the address information of the write position of dynamically generated new write data in the first video memory space divided in the video memory during data migration, thereby dynamically recording the changes in data storage in the video memory in real time, and generating dynamically changing data in the subsequent migration video memory. There is no need to continuously identify the locations where data is dynamically changed in the video memory by traversing the page table, thereby improving the efficiency and accuracy of data migration and reducing resource consumption during data migration.

[0200] It should be noted that the data migration device provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the data migration device provided in the above embodiment is based on the same concept as the data migration method embodiment. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0201] Fig. 9 is a schematic diagram of a chip structure provided by an exemplary embodiment of the present application, such as Fig. 9 As shown, the chip 900 includes a video memory 910 and a control circuit 920;

[0202] The control circuit 920 is configured to obtain a first video memory space from the video memory 910, where the first video memory space is used to store dirty page information dynamically generated by the video memory 910 during data migration;

[0203] The control circuit 920 is further configured to, in response to the existence of first data written into a first write position in the video memory 910 during the data migration process of the video memory 910, write address information of the first write position into the first video memory space to obtain the dirty page information, wherein the first write position is a position in the video memory 910 other than the first video memory space;

[0204] The dirty page information is used to record write events generated during the data migration process.

[0205] In an optional embodiment, the control circuit 920 is further configured to receive a write request during the data migration process of the video memory 910, wherein the write request is used to request to write the first data into the video memory 910;

[0206] The control circuit 920 is further configured to determine the first writing position of the first data in the video memory 910;

[0207] The control circuit 920 is further configured to write the address information of the first write position into the first video memory space to obtain the dirty page information.

[0208] In an optional embodiment, the control circuit 920 is further configured to obtain request source information of the write request, wherein the request source information is used to indicate a data source for requesting to write the first data; when the data source indicates that the write request is initiated by a specified data source, the address information of the first write address is written into the first video memory space to obtain the dirty page information.

[0209] In an optional embodiment, the control circuit 920 is further configured to receive a space acquisition request, wherein the space acquisition request is used to request to obtain space from the video memory 910 for recording write events during data migration; and to obtain the first video memory space based on the space acquisition request.

[0210] In an optional embodiment, the control circuit 920 is further configured to send an interrupt notification to a driver in response to the first video memory space being full, the driver being used to drive the data migration process of the video memory 910, and the interrupt notification being used to indicate the data writing status of the first video memory space;

[0211] The control circuit 920 is further configured to receive a data read request generated by the driver, wherein the data read request is used to request to read the data written in the first video memory space;

[0212] The control circuit 920 is further configured to send the dirty page information written in the first video memory space to the driver based on the data read request, and the driver is used to drive the dirty page information to be transferred to a preset storage space as the i-th group of dirty page information.

[0213] In an optional embodiment, the control circuit 920 is further configured to clear the data in the first video memory space, and when there is second data written to a second write position in the video memory, write the address information of the second write position into the first video memory space, and when the first video memory space is full, obtain the i+1th group of dirty page information until the video memory finishes writing; or,

[0214] The control circuit 920 is further configured to obtain a second video memory space, and when there is a second write position in the video memory where second data is written, write the address information of the second write position into the second video memory space, and when the second video memory space is full, obtain the i+1th group of dirty page information, and obtain the third video memory space again until the video memory finishes writing.

[0215] In an optional embodiment, the control circuit 920 is also configured to send the interrupt notification to the driver in response to the completion of the execution of the write request in the write request queue; receive the data read request generated by the driver; and send the dirty page information written in the first video memory space to the driver based on the data read request, and the driver is used to drive the dirty page information to be transferred to a preset storage space as the last set of dirty page information.

[0216] In an optional embodiment, the control circuit 920 is further configured to obtain a video memory starting address and a video memory space length, wherein the video memory starting address is used to indicate a starting address of the first video memory space in the video memory 910, and the video memory space length is used to indicate the number of continuous storage units occupied by the first video memory space starting from the starting address.

[0217] In an optional embodiment, the first video memory space is used to record dirty page information dynamically generated by the video memory 910 during data migration in a dirty ring recording manner.

[0218] The present application also provides a computer device, which includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the data migration method provided by each of the above method embodiments. It should be noted that the computer device can be as follows Fig.10 Computer equipment provided.

[0219] Please refer to Fig.10, which shows a schematic diagram of the structure of a computer device provided by an exemplary embodiment of the present application. Specifically, the computer device 1000 includes a central processing unit (CPU) 1001, a system memory 1004 including a random access memory (RAM) 1002 and a read-only memory (ROM) 1003, and a system bus 1005 connecting the system memory 1004 and the central processing unit 1001. The computer device 1000 also includes a basic input / output system (I / O system) 1006 that helps transmit information between various devices in the computer, and a large-capacity storage device 1007 for storing an operating system 1013, an application program 1014 and other program modules 1015.

[0220] The basic input / output system 1006 includes a display 1008 for displaying information and an input device 1009 such as a mouse and a keyboard for user inputting information. The display 1008 and the input device 1009 are connected to the central processing unit 1001 through an input / output controller 1010 connected to the system bus 1005. The basic input / output system 1006 may also include an input / output controller 1010 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 1010 also provides output to a display screen, a printer, or other types of output devices.

[0221] The mass storage device 1007 is connected to the central processing unit 1001 through a mass storage controller (not shown) connected to the system bus 1005. The mass storage device 1007 and its associated computer readable medium provide non-volatile storage for the computer device 1000. That is, the mass storage device 1007 may include a computer readable medium (not shown) such as a hard disk or a CD-ROM drive.

[0222] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, EPROM, EEPROM, flash memory or other solid-state storage technologies, CD-ROM, DVD or other optical storage, tape cassettes, magnetic tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the above. The above-mentioned system memory 1004 and mass storage device 1007 can be collectively referred to as memory.

[0223] The memory stores one or more programs, and the one or more programs are configured to be executed by one or more central processing units 1001. The one or more programs contain instructions for implementing the operating method of the above-mentioned model prediction task or the translation method based on the machine translation model. The central processing unit 1001 executes the one or more programs to implement the operating method of the model prediction task or the translation method based on the machine translation model provided by the above-mentioned various method embodiments.

[0224] According to various embodiments of the present application, the computer device 1000 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 1000 can be connected to the network 1012 through the network interface unit 1011 connected to the system bus 1005, or the network interface unit 1011 can be used to connect to other types of networks or remote computer systems (not shown).

[0225] The memory also includes one or more programs, which are stored in the memory, and the one or more programs include steps executed by a computer device in the operating method for performing the model prediction task provided in the embodiment of the present application.

[0226] On the other hand, an embodiment of the present application provides a computer device, which includes a processor and a memory, wherein at least one instruction is stored in the memory, and the at least one instruction is loaded and executed by the processor to implement the data migration method provided in the above-mentioned embodiment of the present application.

[0227] On the other hand, an embodiment of the present application provides a computer-readable storage medium, in which at least one instruction is stored, and the at least one instruction is loaded and executed by a processor to implement the data migration method provided in the above-mentioned embodiment of the present application.

[0228] On the other hand, an embodiment of the present application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the data migration method provided in the above-mentioned embodiment of the present application.

[0229] On the other hand, an embodiment of the present application provides a computer device, the computer device comprising a processor as described above. Optionally, the processor comprises at least one of a CPU and a GPU. The computer device may be at least one of a portable computer, a desktop computer, a server, a server cluster, an artificial intelligence (AI) computing cluster, and a cloud computing cluster. Among them, the AI ​​computing cluster may also be referred to as an intelligent computing cluster or a smart computing cluster.

[0230] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A data migration method, characterized in that: The method comprises: Acquire a first video memory space, where the first video memory space is used to store dirty page information dynamically generated during video memory data migration; In the data migration process of the video memory, in response to the existence of a first write position in the video memory where the first data is written, the address information of the first write position is written into the first video memory space to obtain the dirty page information, wherein the first write position is a position in the video memory other than the first video memory space; The dirty page information is used to record write events generated during the data migration process.

2. The method according to claim 1, characterized in that In the data migration process of the video memory, in response to the existence of first data written into a first write position in the video memory, writing address information of the first write position into the first video memory space to obtain the dirty page information includes: During the data migration process of the video memory, receiving a write request, the write request being used to request writing the first data into the video memory; Determine the first write position of the first data in the video memory; The address information of the first write position is written into the first video memory space to obtain the dirty page information.

3. The method according to claim 2, characterized in that The step of writing the address information of the first write position into the first video memory space to obtain the dirty page information includes: Obtaining request source information of the write request, where the request source information is used to indicate a data source of a request to write the first data; When the data source indicates that the write request is initiated by a designated data source, the address information of the first write address is written into the first video memory space to obtain the dirty page information.

4. The method according to any one of claims 1 to 3, characterized in that: The obtaining of the first video memory space includes: receiving a space acquisition request, wherein the space acquisition request is used to request to obtain space from the video memory for recording write events during data migration; The first video memory space is acquired based on the space acquisition request.

5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: In response to the first video memory space being full, sending an interrupt notification to a driver, the driver being used to drive data migration of the video memory, the interrupt notification being used to indicate a data writing status of the first video memory space; receiving a data read request generated by the driver, wherein the data read request is used to request to read the data written in the first video memory space; The dirty page information written in the first video memory space is sent to the driver based on the data read request, and the driver is used to drive the dirty page information to be transferred to a preset storage space as the i-th group of dirty page information.

6. The method according to claim 5, characterized in that In response to the first video memory space being full, the dirty page information written in the first video memory space is transferred to a preset storage space as the i-th group of dirty page information, and further includes: Clear the data in the first video memory space, and when there is second data written to the second write position in the video memory, write the address information of the second write position into the first video memory space, and when the first video memory space is full, obtain the i+1th group of dirty page information until the video memory finishes writing; or A second video memory space is obtained, and when there is a second write position in the video memory where second data is written, the address information of the second write position is written into the second video memory space. When the second video memory space is full, the i+1th group of dirty page information is obtained, and the third video memory space is obtained again until the video memory finishes writing.

7. The method according to claim 6, characterized in that The method further comprises: In response to the write request in the write request queue being executed, sending the interrupt notification to the driver; receiving the data read request generated by the driver; The dirty page information written in the first video memory space is sent to the driver based on the data read request, and the driver is used to drive the dirty page information to be transferred to a preset storage space as a last set of dirty page information.

8. The method according to any one of claims 1 to 3, characterized in that: The obtaining of the first video memory space includes: Obtain a video memory start address and a video memory space length, wherein the video memory start address is used to indicate a start address of the first video memory space in the video memory, and the video memory space length is used to indicate the number of continuous storage units occupied by the first video memory space starting from the start address.

9. The method according to any one of claims 1 to 3, characterized in that: The first video memory space is used to record dirty page information dynamically generated by the video memory during data migration in a dirty ring recording manner.

10. A data migration device, characterized in that: The device comprises a first chip and a second chip, wherein the first chip comprises a video memory; The first chip is configured to obtain a first video memory space, where the first video memory space is used to store dirty page information dynamically generated during video memory data migration; The first chip is further configured to, during the data migration process of the video memory, in response to the existence of a first write position in the video memory where the first data is written, write address information of the first write position into the first video memory space to obtain the dirty page information, wherein the first write position is a position in the video memory other than the first video memory space; The second chip is configured to migrate the first data in the first write position based on the dirty page information to obtain a data migration result.

11. The device according to claim 10, characterized in that The first chip is further configured to send an interrupt notification to a driver in response to the first video memory space being full, wherein the driver is used to drive data migration of the video memory, and the interrupt notification is used to indicate the data writing status of the first video memory space; The first chip is further configured to receive a data read request generated by the driver, wherein the data read request is used to request to read the data written in the first video memory space; The first chip is further configured to send the dirty page information written in the first video memory space to the driver based on the data read request, and the driver is used to drive the dirty page information to be transferred to a preset storage space as the i-th group of dirty page information.

12. The device according to claim 11, characterized in that The first chip is further configured to clear the data in the first video memory space, and when there is second data written to a second write position in the video memory, write the address information of the second write position into the first video memory space, and when the first video memory space is full, obtain the i+1th group of dirty page information until the video memory finishes writing; or, The first chip is also configured to obtain a second video memory space, and when there is second data written to a second write position in the video memory, write the address information of the second write position into the second video memory space, and when the second video memory space is full, obtain the i+1th group of dirty page information, and obtain the third video memory space again until the video memory finishes writing.

13. The device according to claim 12, characterized in that The first chip is further configured to send the interrupt notification to the driver in response to the write request in the write request queue being executed; The second chip is further configured to read dirty page information from the first video memory space and transfer the read dirty page information to the preset storage space as the last set of dirty page information.

14. The device according to claim 13, characterized in that The second chip is further configured to read n sets of dirty page information stored in the preset storage space, where n is a positive integer; and perform data migration on video memory locations corresponding to the address information recorded in the n sets of dirty page information.

15. A chip, characterized in that: The chip includes: video memory and control circuit; The control circuit is configured to obtain a first video memory space from the video memory, where the first video memory space is used to store dirty page information dynamically generated by the video memory during data migration; The control circuit is further configured to, during the data migration process of the video memory, in response to the existence of a first data written into a first write position in the video memory, write address information of the first write position into the first video memory space to obtain the dirty page information, wherein the first write position is a position in the video memory other than the first video memory space; The dirty page information is used to record write events generated during the data migration process.

16. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the data migration method according to any one of claims 1 to 9.

17. A computer-readable storage medium, characterized in that: The readable storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the data migration method according to any one of claims 1 to 9.

18. A computer program product, characterized in that It comprises a computer program or an instruction, which, when executed by a processor, implements the data migration method as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Dirty page recording method and device, electronic equipment and computer readable medium

    CN113032088A

  • Graphic processing unit GPU scheduling method and device and storage medium

    CN117331704A

  • Methods and systems for tracking a virtual memory of a virtual machine

    US10592271B1

  • Background Migration of Virtual Storage

    US20110197039A1

  • Method For Migrating Virtual Machine And Apparatus

    US20220121473A1

Cited By

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

    CN121996347A