A virtual GPU address translation system

Through the collaborative work between the virtual driver and the hardware driver, the target page table is directly established in the virtual GPU, which solves the problems of complexity of virtual GPU to hardware GPU address translation and high memory usage, and achieves simplified address translation and resource saving. .

CN118138559BActive Publication Date: 2024-09-13MUXI LINGZHI TECHNOLOGY (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410280475.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-12
Publication Date
2024-09-13
Estimated Expiration
2044-03-12

AI Technical Summary

Technical Problem

In a chip virtualization scenario, the address translation complexity and memory occupancy rate of virtual GPU to hardware GPU are high. Existing technology relies on shadow page tables and requires real-time monitoring and maintenance by hardware drivers, resulting in increased system complexity and memory overhead.

Method used

The virtual driver allocates the initial page table when calling the process, sends the physical address to the hardware driver and translates it into the target physical address, and the virtual driver establishes the mapping relationship between the virtual address and the target physical address, avoiding the deployment of shadow page tables and The hardware driver monitors the virtual GPU page table.

Benefits of technology

It reduces the complexity of address translation and hardware memory occupancy, realizes direct mapping from virtual address to physical address, simplifies system design and saves memory resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118138559B
    Figure CN118138559B
Patent Text Reader

Abstract

The present application relates to the field of chip technology, and in particular to a virtual GPU address translation system, the system comprising: a virtual GPU and a hardware GPU, wherein the virtual GPU comprises a virtual driver and a virtual memory, the hardware GPU comprises a hardware driver and a hardware memory, the virtual driver is used to allocate an initial page table for a process when calling a process, the initial page table comprises a mapping relationship between a first virtual address and a first physical address, the first physical address is sent to the hardware driver, a second physical address is received, a target page table comprising a mapping relationship between the first virtual address and the second physical address is established, the hardware driver is used to receive the first physical address, and translate it into a second physical address, and return the second physical address to the virtual driver, when the virtual GPU creates a page table, the first physical address is sent to the hardware driver for translation into the second physical address, so as to establish a target page table in the virtual GPU, without the need to deploy and maintain a shadow page table in the hardware GPU, thereby reducing the complexity of address translation and memory occupancy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of chip technology, and in particular to a virtual GPU address conversion system. Background Art

[0002] In the architecture of the chip using virtualization technology, it usually includes a hardware GPU (Host GPU) and multiple virtual GPUs (Guest GPU). When executing a process, the virtual GPU needs to access the hardware memory. Although the virtual GPU also includes the corresponding virtual memory, there is no memory management unit (IOMMU) to convert the physical address of the virtual GPU to the physical address of the hardware GPU. As a result, the page table in the virtual GPU that points to its physical address from its virtual address cannot be directly used by the address translation unit ATU.

[0003] To address the above problems, the prior art proposes a shadow page table method, which monitors the page table in the virtual GPU in real time through the hardware driver in the hardware GPU, translates the physical address of the virtual GPU in the page table into the physical address of the hardware GPU, and deploys a shadow page table in the hardware GPU that contains the mapping relationship between the virtual address of the virtual GPU and the physical address of the hardware GPU.

[0004] However, the shadow page table method requires the hardware driver to monitor the page table in the virtual GPU in real time and synchronize it, which is very complex. In addition, the hardware driver needs to maintain a set of corresponding shadow page tables for each virtual GPU, which will bring additional hardware memory overhead. Therefore, how to reduce the complexity of address translation and memory usage in the chip virtualization scenario has become an urgent problem to be solved. Summary of the invention

[0005] In view of the above technical problems, the technical solution adopted by the present invention is:

[0006] A virtual GPU address translation system, the system comprising: a virtual GPU and a hardware GPU, wherein the virtual GPU comprises a virtual driver and a virtual memory, and the hardware GPU comprises a hardware driver and a hardware memory;

[0007] The virtual driver is used to call process A i When, it is process A i Allocate initial page table B i , initial page table B i Including the first virtual address b ij and the first physical address c in the virtual memory ij The mapping relationship between them, where A i is the i-th process, i is an integer greater than zero, b ij For B iThe jth first virtual address in B, j is an integer in the range [1, J], and J is i The number of first virtual addresses in .

[0008] The virtual driver is also used to convert the first physical address c ij Sent to the hardware driver.

[0009] The hardware driver is used to receive a first physical address c ij , the first physical address c ij Translated into the second physical address d in the hardware memory ij .

[0010] The hardware driver is also used to convert the second physical address d ij Return to the virtual drive.

[0011] The virtual driver is also used to receive a second physical address d ij , create a first virtual address b ij and the second physical address d ij The target page table of the mapping relationship between them.

[0012] Compared with the prior art, the present invention has obvious beneficial effects. By means of the above technical solution, a virtual GPU address translation system provided by the present invention can achieve considerable technical advancement and practicality, and has wide industrial utilization value, and has at least the following beneficial effects:

[0013] The present invention provides a virtual GPU address translation system, the system comprising: a virtual GPU and a hardware GPU, wherein the virtual GPU comprises a virtual driver and a virtual memory, the hardware GPU comprises a hardware driver and a hardware memory, the virtual driver is used to call a process A i When, it is process A i Allocate initial page table B i , initial page table B i Including the first virtual address b ij and the first physical address c in the virtual memory ij The mapping relationship between them, where A i is the i-th process, i is an integer greater than zero, b ij For B i The jth first virtual address in B, j is an integer in the range [1, J], and J is i The virtual driver is also used to convert the first physical address c ij Sent to the hardware driver, the hardware driver is used to receive the first physical address c ij , the first physical address c ij Translated into the second physical address d in the hardware memoryij The hardware driver is also used to convert the second physical address d ij Returning to the virtual driver, the virtual driver is further configured to receive a second physical address d ij , create a first virtual address b ij and the second physical address d ij The target page table of the mapping relationship between them.

[0014] It can be seen that when the virtual GPU creates a page table, the first physical address is sent to the hardware driver for translation into the second physical address, so that the target page table can be established in the virtual GPU to achieve the mapping from the first virtual address directly to the second physical address. Compared with the prior art, there is no need to deploy additional shadow page tables in the hardware GPU, and there is no need for the hardware driver to monitor the page tables in the virtual GPU and maintain the shadow page tables, thereby reducing the complexity of address conversion and memory occupancy. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0016] Figure 1 A schematic diagram of an address translation process in a virtual GPU address translation system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0017] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0018] This embodiment provides a virtual GPU address translation system, the system comprising: a virtual GPU and a hardware GPU, wherein the virtual GPU comprises a virtual driver and a virtual memory, and the hardware GPU comprises a hardware driver and a hardware memory.

[0019] The virtual driver is used to call process A i When, it is process A i Allocate initial page table B i , initial page table B i Including the first virtual address b ij and the first physical address c in the virtual memoryij The mapping relationship between them, where A i is the i-th process, i is an integer greater than zero, b ij For B i The jth first virtual address in B, j is an integer in the range [1, J], and J is i The number of first virtual addresses in .

[0020] The virtual driver is also used to convert the first physical address c ij Sent to the hardware driver.

[0021] The hardware driver is used to receive a first physical address c ij , the first physical address c ij Translated into the second physical address d in the hardware memory ij .

[0022] The hardware driver is also used to convert the second physical address d ij Return to the virtual drive.

[0023] The virtual driver is also used to receive a second physical address d ij , create a first virtual address b ij and the second physical address d ij The target page table of the mapping relationship between them.

[0024] Among them, the virtual driver calls process A i When, it is process A i Allocate the corresponding virtual memory space, initial page table B i That includes process A i The mapping relationship between the corresponding first virtual addresses and the first physical addresses in the virtual memory. It should be noted that in the chip virtualization scenario, a single hardware GPU can correspond to multiple virtual GPUs, and a single virtual GPU can also execute multiple processes. Therefore, each process has its corresponding page table.

[0025] Specifically, in this embodiment, the virtual driver sends the first physical address to the hardware driver to request translation. Compared with the prior art, there is no need for real-time monitoring by the hardware driver, which reduces the complexity of the system. Moreover, by returning the second physical address obtained by the hardware driver translating the first physical address to the virtual driver, the virtual driver directly establishes a target page table in the virtual GPU that can directly point to the second physical address of the hardware memory from the first virtual address. There is no need to retain and maintain the shadow page table corresponding to each process in the hardware GPU, which can save hardware memory overhead and reduce the occupancy rate of the hardware memory.

[0026] Optionally, when process A i Request access to base address e fWhen the base address e is set in the virtual GPU f Convert to the first virtual address b if , and then determine the first virtual address b through the target page table if The corresponding second physical address d if , through the second physical address d if Accessing the hardware memory.

[0027] Among them, the process can directly access the hardware memory through the target page table, thereby achieving the same function as the shadow page table, but there is no need to save and maintain the shadow page table.

[0028] Optionally, the virtual driver communicates with the hardware driver through a memory management framework interface to convert the first physical address c ij Sent to the hardware driver.

[0029] Among them, the memory management framework interface can adopt the relevant interfaces of frameworks such as the ttm framework and the GEM framework.

[0030] Optionally, J is set to 512.

[0031] Optionally, the initial page table is set to 4KB.

[0032] Optionally, the first physical address is set to 8 Bytes.

[0033] In this embodiment, a single address space adopts 64 bits, the first physical address and the second physical address are both 8 bytes, the initial page table is set to 4KB, and the page table can contain the mapping relationship between 512 addresses. The implementer can adjust the size of the address space and the page table space according to the actual situation, for example, set the initial page table to 16KB, or set the address space to 4Byte, wherein the value of J is determined according to the space of the initial page table and the address space.

[0034] Optionally, the initial page table includes an N-level page table.

[0035] Optionally, N is set to 4.

[0036] It should be noted that the method of this embodiment can be applied to simple page tables and multi-level page tables. The 4-level one package provided in this embodiment is only an example. The implementer should be aware that no matter what form of page table is used, it is within the protection scope of the present invention.

[0037] In this embodiment, when the virtual GPU creates a page table, the first physical address is sent to the hardware driver for translation into the second physical address, so that a target page table can be established in the virtual GPU to achieve a mapping from the first virtual address directly to the second physical address. Compared with the prior art, there is no need to deploy additional shadow page tables in the hardware GPU, and there is no need for the hardware driver to monitor the page tables in the virtual GPU and maintain the shadow page tables, thereby reducing the complexity of address conversion and memory occupancy.

[0038] Although some specific embodiments of the present invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will also be appreciated by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.

Claims

1. A virtual GPU address translation system, characterized in that: The system includes: a virtual GPU and a hardware GPU, wherein the virtual GPU includes a virtual driver and a virtual memory, and the hardware GPU includes a hardware driver and a hardware memory; The virtual driver is used to call process A i When, it is process A i Allocate initial page table B i , initial page table B i Including the first virtual address b ij and the first physical address c in the virtual memory ij The mapping relationship between them, where A i is the i-th process, i is an integer greater than zero, b ij For B i The jth first virtual address in B, j is an integer in the range [1, J], and J is i The number of first virtual addresses in; The virtual driver is also used to convert the first physical address c ij Sending to the hardware driver; The hardware driver is used to receive a first physical address c ij , the first physical address c ij Translated into the second physical address d in the hardware memory ij ; The hardware driver is also used to convert the second physical address d ij Return to the virtual drive; The virtual driver is also used to receive a second physical address d ij , create a first virtual address b ij and the second physical address d ij The target page table of the mapping relationship between them.

2. The virtual GPU address translation system according to claim 1, characterized in that: When process A i Request access to base address e f When the base address e is set in the virtual GPU f Convert to the first virtual address b if , and then determine the first virtual address b through the target page table if The corresponding second physical address d if , through the second physical address d if Accessing the hardware memory.

3. The virtual GPU address translation system according to claim 1, characterized in that: The virtual driver communicates with the hardware driver through the memory management framework interface and sends the first physical address c ij Sent to the hardware driver.

4. The virtual GPU address translation system according to claim 1, characterized in that: J is set to 512.

5. The virtual GPU address translation system according to claim 4, characterized in that: The initial page table is set to 4KB.

6. The virtual GPU address translation system according to claim 5, characterized in that: The first physical address is set to 8 Bytes.

7. The virtual GPU address translation system according to claim 1, wherein: The initial page table includes an N-level page table.

8. The virtual GPU address translation system according to claim 7, characterized in that: N is set to 4.