WO2022041507A1 - 3d rendering method and system - Google Patents

3d rendering method and system Download PDF

Info

Publication number
WO2022041507A1
WO2022041507A1 PCT/CN2020/130407 CN2020130407W WO2022041507A1 WO 2022041507 A1 WO2022041507 A1 WO 2022041507A1 CN 2020130407 W CN2020130407 W CN 2020130407W WO 2022041507 A1 WO2022041507 A1 WO 2022041507A1
Authority
WO
WIPO (PCT)
Prior art keywords
gpu
rendering
virtual
application
target
Prior art date
Application number
PCT/CN2020/130407
Other languages
French (fr)
Chinese (zh)
Inventor
刘威
卢涛
Original Assignee
西安万像电子科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 西安万像电子科技有限公司 filed Critical 西安万像电子科技有限公司
Publication of WO2022041507A1 publication Critical patent/WO2022041507A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources

Definitions

  • the present application relates to the technical field of virtual cloud desktops, and in particular, to a 3D rendering method and system.
  • the first is to install multiple physical GPU (Graphics Processing Unit, graphics processor) graphics cards in the cloud host, and use Passthrough technology to map a single physical GPU graphics card to each customer's virtual machine as the virtual machine's physical graphics card
  • the schematic diagram of the principle can be seen in Figure 1.
  • the virtual machine realizes the rendering of 3D instructions through Passthrough to the physical graphics card of the virtual machine.
  • the second is to install a single physical GPU graphics card in the cloud host, and use vGPU (virtual GPU) technology to virtualize a single physical GPU graphics card into multiple vGPU graphics cards, and map these multiple vGPUs one by one to the guest's virtual machine as The virtual graphics card is used, and its schematic diagram can be seen in Figure 2.
  • the virtual machine realizes the rendering of 3D instructions through the vGPU graphics card.
  • the third is the virtual machine virtual graphics card scheme.
  • Each virtual machine sends a rendering request to the host through its own virtual GPU graphics card, and the host uses the physical GPU graphics card to complete the real rendering.
  • the schematic diagram can be seen in Figure 3.
  • the first solution is simple to implement, but each virtual machine must bind the GPU hardware and use it exclusively when it is started, and the GPU may not be used at all in actual operation, resulting in GPU resources. waste.
  • the technical implementation of the second solution is relatively complex, requiring GPU hardware support, and this function is generally limited to specific models of GPUs from some specific manufacturers, which is expensive and expensive to use.
  • the third solution is the most flexible. The virtual machine does not need to be bound to a fixed GPU hardware during startup and operation, and the host does not need to select a specific type of GPU hardware from a specific manufacturer. It is also optimal from cost considerations. Therefore, the third solution The scheme has been widely used.
  • each 3D application needs to use the virtual GPU exclusively, and inside the virtual GPU, all resources are public , each 3D application initiates a rendering request to the virtual GPU through its own rendering context, and the virtual GPU responds to the rendering request of different applications by identifying different rendering contexts.
  • the virtual GPU needs to frequently perform operations such as rendering context switching, synchronization, and queuing, thereby affecting the performance of the system.
  • the embodiments of the present application provide a 3D rendering method and system, which can solve the problem that the virtual GPU needs to frequently perform operations such as rendering context switching, synchronization, and queuing when multiple 3D rendering tasks access the same common resource, which affects system performance.
  • the technical solution is as follows:
  • a 3D rendering method comprising:
  • the virtual machine obtains a 3D rendering instruction sent by at least one 3D application
  • the virtual machine sends each 3D rendering instruction to a virtual graphics processor GPU corresponding to the 3D application, wherein each 3D application corresponds to an independent virtual GPU;
  • the virtual GPU parses the received 3D rendering instruction, obtains intermediate representation IR data, and sends the IR data to the host;
  • the host computer generates a target rendering instruction according to the IR data, and sends the target rendering instruction to the target physical GPU, so that the target physical GPU executes the target rendering instruction.
  • an independent virtual GPU is set for each 3D application, the virtual machine can send the 3D rendering instruction sent by each 3D application to the virtual GPU uniquely corresponding to the 3D application, and the virtual GPU can receive the The received 3D rendering instruction is parsed, and the obtained IR data is sent to the host.
  • the host generates a target rendering instruction according to the IR data, and sends the target rendering instruction to the target physical GPU, so that the target physical GPU can execute the target rendering. instruction.
  • one virtual GPU is only responsible for managing the rendering context of one 3D application, thereby avoiding the problem that the virtual GPU needs to frequently perform context switching, synchronization, queuing, etc. to affect performance due to the management of multiple rendering contexts by one virtual GPU.
  • the virtual machine sending each 3D rendering instruction to the virtual graphics processor GPU corresponding to the 3D application includes:
  • the virtual machine determines whether a corresponding virtual GPU is created for the 3D application
  • the 3D rendering instruction is sent to the virtual GPU corresponding to the 3D application.
  • the method further includes:
  • the virtual machine after the virtual machine obtains the 3D rendering instruction sent by the 3D application, it first determines whether a corresponding virtual GPU has been created for the 3D application, and if so, sends the 3D rendering instruction to the 3D application.
  • the virtual GPU corresponding to the application if not created, first create the corresponding virtual GPU for the 3D application, and then send the 3D rendering instruction to the virtual GPU corresponding to the 3D application. It is guaranteed that each 3D application has an independent virtual GPU.
  • the method before the sending the target rendering instruction to the target physical GPU, the method further includes:
  • the host computer selects a target physical GPU from at least one physical GPU according to a preset rule.
  • the host computer selects a target physical GPU from at least one physical GPU according to a preset rule, including:
  • the host selects the physical GPU with the lowest utilization rate as the target physical GPU from at least one physical GPU managed by the host.
  • the host can select the physical GPU with the lowest utilization rate from at least one physical GPU managed by it as the target physical GPU, and then send the target rendering instruction to the target physical GPU, so that the target physical GPU can The GPU executes the target rendering instruction.
  • 3D applications can be distinguished as the smallest particles, and the rendering instructions of each 3D can be distributed to different physical GPU hardware, thus avoiding that one virtual machine only corresponds to one physical GPU, and the virtual machine runs multiple 3D applications at the same time.
  • the problem caused by the virtual machine corresponding to the physical GPU is overburdened.
  • a 3D rendering system includes a virtual machine, a host machine, at least one virtual graphics processing unit (GPU), and at least one physical GPU, and at least one physical GPU runs on the virtual machine.
  • 3D applications each 3D application corresponds to an independent virtual GPU, and the host machine includes at least one physical GPU;
  • the virtual machine is configured to obtain a 3D rendering instruction sent by at least one 3D application, and send each 3D rendering instruction to a virtual GPU corresponding to the 3D application;
  • the virtual GPU is used to parse the received 3D rendering instruction, obtain intermediate representation IR data, and send the IR data to the host;
  • the host machine is used to generate a target rendering instruction according to the IR data, and send the target rendering instruction to the target physical GPU;
  • the physical GPU is used to execute the received target rendering instruction.
  • the 3D rendering system includes a virtual machine, a host machine, at least one virtual GPU, and at least one physical GPU. At least one 3D application runs on the virtual machine, each 3D application corresponds to an independent virtual GPU, and the host machine Include at least one physical GPU.
  • the system sets up an independent virtual GPU for each 3D application.
  • the virtual machine can send the 3D rendering instructions sent by each 3D application to the unique virtual GPU corresponding to the 3D application, and the virtual GPU parses the received 3D rendering instructions. , and send the obtained IR data to the host, the host generates a target rendering instruction according to the IR data, and sends the target rendering instruction to the target physical GPU, so that the target physical GPU executes the target rendering instruction.
  • one virtual GPU is only responsible for managing the rendering context of one 3D application, thereby avoiding the problem that the virtual GPU needs to frequently perform context switching, synchronization, queuing, etc. to affect performance due to the management of multiple rendering contexts by one virtual GPU.
  • the virtual machine is specifically configured to acquire a 3D rendering instruction sent by at least one 3D application, determine whether a corresponding virtual GPU has been created for the 3D application, and if so, send the 3D rendering instruction Create a virtual GPU corresponding to the 3D application; if not, create a corresponding virtual GPU for the 3D application, and then send the 3D rendering instruction to the virtual GPU corresponding to the 3D application.
  • the virtual machine determines whether a corresponding virtual GPU has been created for the 3D application.
  • the 3D rendering instruction is sent to the virtual GPU corresponding to the 3D application, which can ensure that each 3D application has an independent virtual GPU.
  • the host is specifically configured to select a physical GPU from the at least one physical GPU according to a preset rule, obtain a target physical GPU, and send the target rendering instruction to the target physical GPU .
  • the host is specifically configured to select a physical GPU with the lowest utilization rate from the at least one physical GPU as a target physical GPU.
  • the rendering instructions of multiple 3D applications of the same virtual machine can be distinguished by taking the 3D application as the smallest particle, and the rendering instructions of each 3D application can be distributed to different physical GPU hardware, which can prevent the virtual machine from running multiple 3D applications at the same time.
  • the virtual machine's corresponding physical GPU is overburdened during rendering tasks for 3D applications.
  • the virtual GPU includes a front-end driver and a back-end driver
  • the front-end driver runs on the virtual machine, and is used to parse the received 3D rendering instruction, obtain intermediate representation IR data, and send the IR data to the back-end driver;
  • the back-end driver runs on the host, and is used for sending the IR data to the host.
  • Fig. 2 is a schematic diagram of performing 3D rendering by virtualizing hardware GPU in the prior art
  • Fig. 3 is a schematic diagram of performing 3D rendering through the solution of virtual machine virtual graphics card in the prior art
  • FIG. 4 is a schematic structural diagram of a 3D rendering system provided by an embodiment of the present application.
  • FIG. 5 is a flowchart of a 3D rendering method provided by an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a specific 3D rendering system provided by an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of another 3D rendering system provided by an embodiment of the present application.
  • FIG. 8 is a flowchart of a specific 3D rendering method provided by an embodiment of the present application.
  • the 3D application running on the virtual machine is used as the minimum rendering particle, and an independent virtual GPU is set for each 3D application, and the virtual GPU can issue the rendering instructions of the 3D application to the selected physical object. GPU to execute.
  • the 3D rendering system 40 may include a virtual machine 401, a host machine 402, at least one virtual GPU 403 and at least one physical GPU 4021, wherein the host machine 402 includes At least one physical GPU 4021, such as M (M is an integer greater than or equal to 1) physical GPUs 4021; at least one 3D application runs on the virtual machine 401, and each 3D application corresponds to an independent virtual GPU, as shown in FIG. 4 for example
  • M is an integer greater than or equal to 1
  • N is an integer greater than or equal to 1
  • 3D application 1 corresponds to virtual GPU1
  • 3D application 2 corresponds to virtual GPU2, ... 3D application N Corresponds to virtual GPU N.
  • the virtual machine 401 is configured to acquire a 3D rendering instruction sent by at least one 3D application, and send each 3D rendering instruction to a virtual GPU corresponding to the 3D application.
  • the virtual machine 401 can obtain the 3D rendering instructions sent by 3D application 1, 3D application 2...
  • the 3D rendering instruction sent by the 3D application N is sent to the virtual GPU2, ..., and so on, the 3D rendering instruction sent by the 3D application N is sent to the virtual GPUN.
  • the virtual GPU 403 is used to parse the received 3D rendering instruction, obtain IR (Intermediate Representation, intermediate representation) data, and send the IR data to the host machine 402.
  • IR Intermediate Representation, intermediate representation
  • the host 402 is configured to generate a target rendering instruction according to the IR data, and send the target rendering instruction to the target physical GPU; the physical GPU is configured to execute the received target rendering instruction.
  • the virtual GPU1 receives the 3D rendering instruction of the 3D application 1 sent by the virtual machine 401, then parses the 3D rendering instruction to obtain IR data, and then sends the IR data to the host machine 402, and the host machine 402 Generate a target rendering instruction according to the IR data, and send the target rendering instruction to the target physical GPU, for example, to the physical GPU1, and the physical GPU1 executes the target rendering instruction.
  • the virtual machine 401 is specifically configured to obtain a 3D rendering instruction sent by at least one 3D application, determine whether a corresponding virtual GPU has been created for the 3D application, and if so, send the 3D rendering instruction of the 3D application.
  • a virtual GPU corresponding to the 3D application is created; if not, a corresponding virtual GPU is created for the 3D application, and then the 3D rendering instruction of the 3D application is sent to the created virtual GPU corresponding to the 3D application.
  • the host 402 is specifically configured to select a physical GPU from at least one physical GPU according to a preset rule, obtain a target physical GPU, and send a target rendering instruction to the target physical GPU.
  • the host 402 may select a physical GPU with the lowest utilization rate as the target physical GPU from at least one physical GPU managed by the host machine 402 .
  • virtual GPU 403 may include front-end drivers and back-end drivers.
  • the front-end driver runs on the virtual machine 401 to parse the received 3D rendering instructions, obtain IR data, and send the IR data to the back-end driver; the back-end driver runs on the host machine 402 and uses to send the received IR data to the host computer 402 .
  • the 3D rendering system includes a virtual machine, a host machine, at least one virtual GPU, and at least one physical GPU. At least one 3D application runs on the virtual machine, each 3D application corresponds to an independent virtual GPU, and the host machine Include at least one physical GPU.
  • the system takes the 3D application of the virtual machine as the minimum rendering particle, and sets up an independent virtual GPU for each 3D application.
  • the virtual machine can send the 3D rendering instructions sent by each 3D application to the unique virtual GPU corresponding to the 3D application.
  • the virtual GPU parses the received 3D rendering instruction, and sends the obtained IR data to the host.
  • the host generates a target rendering instruction according to the IR data, and sends the target rendering instruction to the target physical GPU, so that the target physical GPU can Execute the target rendering instruction.
  • one virtual GPU is only responsible for managing the rendering context of one 3D application, thereby avoiding the problem that the virtual GPU needs to frequently perform context switching, synchronization, queuing, etc. to affect performance due to the management of multiple rendering contexts by one virtual GPU.
  • the virtual GPU can issue the 3D rendering instructions of the 3D application to the selected physical GPU, and the selected physical GPU performs the rendering process, and can select the appropriate physical GPU for each 3D application, no longer a virtual machine. It can only correspond to one physical GPU, thereby avoiding the problem that the physical GPU corresponding to the virtual machine is overburdened when the virtual machine runs 3D rendering of multiple 3D applications at the same time.
  • an embodiment of the present application further provides a 3D rendering method, which can be at least applied to the 3D rendering system of the above embodiment corresponding to FIG. 4 .
  • the method may include the following steps:
  • Step 501 Obtain a 3D rendering instruction sent by at least one 3D application.
  • At least one 3D application may run on the virtual machine, and when the 3D application initiates a 3D rendering instruction, the virtual machine obtains the 3D rendering instruction sent by the at least one 3D application.
  • Step 502 Send each 3D rendering instruction to the virtual GPU corresponding to the 3D application.
  • the virtual machine After acquiring the 3D rendering instruction sent by at least one 3D application, the virtual machine sends each 3D rendering instruction to a virtual GPU corresponding to the 3D application, wherein each 3D application corresponds to an independent virtual GPU.
  • 3D applications running on the virtual machine, namely 3D application 1, 3D application 2 and 3D application 3, and the three 3D applications are in one-to-one correspondence with virtual GPU1, virtual GPU2 and virtual GPU3.
  • These three 3D applications respectively initiate 3D rendering instructions at runtime, and the virtual machine sends the 3D rendering instructions initiated by 3D application 1 to virtual GPU1, and the 3D rendering instructions initiated by 3D application 2 to virtual GPU2, and the 3D application 3
  • the 3D rendering command initiated by 3 is sent to the virtual GPU3.
  • Step 503 Parse the 3D rendering instruction to obtain IR data.
  • the 3D rendering instruction is parsed to obtain IR data, and the IR data is sent to the host computer.
  • the 3D rendering instruction is parsed to obtain IR data, and the IR data is sent to the host computer.
  • Step 504 Generate a target rendering instruction according to the IR data.
  • the host computer After receiving the IR data sent by the virtual GPU, the host computer generates a target rendering instruction according to the IR data. In this way, the IR data can be restored to the data format supported by the host, and the target rendering instruction can be obtained.
  • Step 505 Send the target rendering instruction to the target physical GPU.
  • the host computer After the host computer generates the target rendering instruction according to the IR data, it sends the target rendering instruction to the target physical GPU, so that the target physical GPU executes the target rendering instruction.
  • the host can manage at least one physical GPU, and after generating the target rendering instruction according to the IR data, the host can select the target physical GPU from the at least one physical GPU according to a preset rule.
  • the target physical GPU can be selected from the at least one physical GPU.
  • the physical GPU with the lowest utilization rate is selected as the target physical GPU.
  • each 3D application running on a virtual machine corresponds to an independent virtual GPU, the virtual machine obtains a 3D rendering instruction sent by at least one 3D application, and sends each 3D rendering instruction to a The virtual GPU corresponding to the 3D application; the virtual GPU parses the received 3D rendering instruction, obtains IR data, and sends the IR data to the host; the host generates a target rendering instruction according to the IR data, and renders the target Instructions are sent to the target physical GPU so that the target physical GPU executes the received target rendering instructions.
  • a virtual GPU Since a virtual GPU is only responsible for managing the rendering context of one 3D application, rather than managing multiple rendering contexts, it can avoid the problem that the virtual GPU needs to perform context switching, synchronization, queuing and other operations frequently and affect the system performance, and improves the 3D performance. Rendering system performance.
  • the 3D rendering system 40 includes a virtual machine 401 , a host machine 402 , and at least one virtual machine. GPU 403 and at least one physical GPU 4021.
  • at least one 3D application runs on the virtual machine 401, and each 3D application corresponds to an independent virtual GPU 403.
  • N N is an integer greater than or equal to 1
  • 3D applications are shown: 3D application 1, 3D application 2, ..., 3D application N; 3D application 1 corresponds to virtual GPU1, and 3D application 2 corresponds to virtual GPU 1.
  • GPU2, ..., 3D application N corresponds to virtual GPUN.
  • the host machine 402 may be a server, on which the virtual machine 401 may run, and may be responsible for managing the physical GPU 4021.
  • the virtual machine 401 may include a 3D rendering portal module 4011, and at least one 3D application running on the virtual machine 401 is connected in communication with the 3D rendering portal module 4011.
  • the host 402 may include a 3D rendering intermediate instruction module 4022 , a GPU distribution module 4023 and at least one physical GPU 4021 .
  • the 3D rendering instruction may be a call of an OpenGL (Open Graphics Library) API (Application Programming Interface), then It will be captured by the 3D rendering entry module 4011 of the virtual machine 401 .
  • the capture mode of the 3D rendering entry module 4011 may be presented in the form of a dynamic library of 3D API functions. For example, if the virtual machine 401 runs a Linux system, the capture method of the 3D rendering entry module 4011 can be to replace the libGL.so dynamic library on the Linux system. In this way, all 3D applications developed based on OpenGL API load the libGL.so dynamic library What is actually loaded is the 3D rendering entry module 4011.
  • the 3D rendering entry module 4011 can first determine whether a corresponding virtual GPU has been created for the 3D application, and if so, continue the rendering process, The 3D rendering instruction of the 3D application is sent to the virtual GPU corresponding to the 3D application; otherwise, a new virtual GPU is created for it, and then the 3D rendering instruction of each 3D application is sent to the virtual GPU corresponding to the 3D application.
  • 3D application 1 and 3D application 2 respectively initiate 3D rendering instructions, and the 3D rendering instructions are captured by the 3D rendering entry module 4011.
  • the 3D rendering entry module 4011 determines that it is already 3D application 1.
  • the 3D rendering instruction initiated by the 3D application 1 is sent to the virtual GPU1; the 3D rendering entry module 4011 also determines that the corresponding virtual GPU has not been created for the 3D application 2, and then creates the corresponding virtual GPU for the 3D application 2 first. virtual GPU2, and then send the 3D rendering instruction initiated by 3D application 2 to virtual GPU2.
  • the virtual GPU 403 is a virtual device connected to and running on the virtual machine and the host machine, which may include a front-end driver 4031 and a back-end driver 4032, the front-end driver 4031 runs on the virtual machine 401, and the back-end driver 4032 runs on the host machine 403 superior.
  • the front-end driver 4031 can parse the received 3D rendering instruction, obtain IR data, and send the IR data to the back-end driver 4032; after the back-end driver 4032 receives the IR data sent by the front-end driver 4031, it sends the IR data To the host computer 402 , specifically, it may be the 3D rendering intermediate instruction module 4022 sent to the host computer 402 .
  • the 3D rendering intermediate instruction module 4022 sent to the host computer 402 .
  • the 3D rendering intermediate instruction module 4022 of the host machine 402 can create a corresponding rendering context for each virtual GPU 403, and is responsible for parsing the IR data received from the front-end driver 4031 of the virtual GPU 403 to the target rendering supported by the local physical GPU 4021 instruction, the target rendering instruction can be a 3D API call, such as a Vulkan API call, where Vulkan is a cross-platform 2D and 3D drawing application program interface.
  • the GPU distribution module 4023 is responsible for managing the physical GPU 4021.
  • a suitable physical GPU 4021 can be selected for rendering the target rendering instruction.
  • the strategy for selecting a physical GPU may take the utilization rate of the physical GPU as a reference, and preferentially select a relatively idle physical GPU as the target physical GPU, that is, select the physical GPU with the lowest utilization rate as the target physical GPU. In this way, the rendering of the same rendering context, that is, the rendering of the same 3D application, can be executed on the same physical GPU.
  • the 3D rendering system provided by the embodiments of the present application can take the 3D application running on the virtual machine as the smallest rendering particle, and create a dedicated virtual GPU graphics card for each 3D application, that is, set an independent virtual GPU for each 3D application , the virtual GPU can deliver the rendering instruction of the 3D application to the selected target physical GPU for execution.
  • the rendering instructions of multiple 3D applications of the same virtual machine can be distinguished by taking the 3D application as the smallest particle, and the rendering instructions of each 3D application can be distributed to different physical GPU hardware, thus avoiding that one virtual machine corresponds to only one
  • the physical GPU and the virtual machine running multiple rendering 3D applications at the same time cause the virtual machine's corresponding physical GPU to be overburdened; moreover, in this solution, one virtual GPU is only responsible for managing the rendering context of one 3D application, which can avoid Because one virtual GPU manages multiple rendering contexts, the virtual GPU needs to frequently perform context switching, synchronization, queuing and other issues affecting performance, which improves the rendering performance of the system.
  • one host machine may also correspond to multiple virtual machines.
  • one host machine may correspond to two virtual machines.
  • the two virtual machines can respectively run at least one 3D application, and for each virtual machine, each 3D application running on the virtual machine corresponds to an independent virtual GPU.
  • the host can manage the 3D rendering instructions from the two virtual machines at the same time, and select the target physical GPU for each 3D rendering instruction.
  • the embodiment of the present application further provides a specific 3D rendering method, which can be at least applied to the 3D rendering system of the above embodiment corresponding to FIG. 6 .
  • the method may include the following steps:
  • Step 801 Obtain a 3D rendering instruction sent by at least one 3D application.
  • At least one 3D application can run on the virtual machine 401.
  • the 3D application on the virtual machine initiates a 3D rendering instruction, for example, when a 3D API call is initiated, the 3D rendering entry module 4011 on the virtual machine will capture the 3D rendering instruction.
  • Step 802 Determine whether a corresponding virtual GPU is created for the 3D application.
  • the 3D rendering entry module 4011 determines whether a corresponding virtual GPU node, that is, a virtual GPU graphics card, has been created for the 3D application. If it has been created, execute step 804, otherwise execute step 803 .
  • Step 803 Create a corresponding virtual GPU for the 3D application.
  • step 804 is executed.
  • Step 804 Send the 3D rendering instruction to the virtual GPU corresponding to the 3D application.
  • the 3D rendering entry module 4011 determines that after creating a corresponding virtual GPU for the 3D application, or after creating a new virtual GPU for the 3D application, the 3D rendering instruction is sent to the virtual GPU corresponding to the 3D application.
  • the virtual GPU is a virtual device connected to and running on the virtual machine and the host, which may include a front-end driver and a back-end driver.
  • the front-end driver runs on the virtual machine 401 and the back-end driver runs on the host 403 .
  • the 3D rendering entry module 4011 can send the 3D rendering instruction to the front-end driver of the virtual GPU corresponding to the 3D application.
  • 3D application 1 and 3D application 2 running on the virtual machine 401 respectively initiate a 3D rendering instruction, and after capturing the 3D rendering instruction, the 3D rendering entry module 4011 determines whether the corresponding 3D application 1 and 3D application 2 have been created respectively.
  • Virtual GPU assuming that virtual GPU1 has been created for 3D application 1, but not for 3D application 2, the 3D rendering entry module 4011 will send the 3D rendering command initiated by 3D application 1 to the front-end driver of virtual GPU1, and will After creating the virtual GPU2 for the 3D application 2, the 3D rendering instruction initiated by the 3D application 2 is sent to the front-end driver of the virtual GPU2.
  • Step 805 Parse the 3D rendering instruction to obtain IR data.
  • the 3D rendering instruction is parsed to obtain IR data, and the IR data is sent to the host.
  • the 3D rendering instruction is parsed to obtain IR data, and the IR data is sent to the host.
  • the front-end driver of the virtual GPU parses the 3D rendering instruction sent by the 3D rendering entry module 4011, generates IR data, and then sends the IR data to the back-end driver of the virtual GPU; the back-end driver of the virtual GPU then interprets the IR data.
  • the IR data is sent to the 3D rendering intermediate instruction module 4022 of the host computer 402 .
  • Step 806 Generate a target rendering instruction according to the IR data.
  • the 3D rendering intermediate instruction module 4022 of the host computer 402 After the 3D rendering intermediate instruction module 4022 of the host computer 402 receives the IR data sent by the virtual GPU, it generates a target rendering instruction according to the IR data.
  • the target rendering instruction can be generated by parsing the IR data, so that the IR data can be restored to the host computer. 402 Supported data format, get the target rendering instruction.
  • the 3D rendering intermediate instruction module 4022 sends the target rendering instruction to the GPU distribution module 4023 .
  • Step 807 Select a target physical GPU.
  • the GPU distribution module 4023 After the GPU distribution module 4023 receives the target rendering instruction sent by the 3D rendering intermediate instruction module 4022, it can select a target physical GPU from at least one physical GPU managed by it according to a preset rule. Specifically, the GPU distribution module 4023 may select the physical GPU with the lowest GPU utilization rate as the target physical GPU according to the utilization rate of each physical GPU managed by the host machine 402 .
  • Step 808 Send the target rendering instruction to the target physical GPU.
  • the GPU distribution module 4023 selects the target physical GPU, it sends the target rendering instruction to the selected target physical GPU.
  • Step 809 Execute the target rendering instruction.
  • the target physical GPU After the target physical GPU receives the target rendering instruction, it executes the target rendering instruction.
  • different 3D applications of the same virtual machine can be distributed to different physical GPUs; different 3D applications of different virtual machines can be distributed to the same physical GPU.
  • the selection strategy for distributing the physical GPUs may be to preferentially select the physical GPUs in an idle state, which can solve the problem of uneven busyness and idleness of multiple physical GPUs in the host.
  • the 3D rendering entry module captures the 3D rendering instruction, and determines whether a corresponding virtual GPU has been created for the 3D application, and if so, Then send the 3D rendering instruction to the virtual GPU corresponding to the 3D application; if not, create a corresponding virtual GPU for the 3D application, and then send the 3D rendering instruction to the virtual GPU corresponding to the 3D application; the virtual GPU parses the 3D rendering instruction Obtain IR data and send the IR data to the 3D rendering intermediate instruction module of the host; the 3D rendering intermediate instruction module generates a target rendering instruction according to the IR data, and sends the target rendering instruction to the GPU distribution module; the GPU distribution module selects The physical GPU with the lowest utilization is the target physical GPU, and the target rendering instruction is sent to the target physical GPU, so that the target physical GPU executes the target rendering instruction.
  • the embodiments of the present application further provide a computer-readable storage medium
  • the non-transitory computer-readable storage medium may be a read-only memory (English) : Read Only Memory, ROM), random access memory (English: Random Access Memory, RAM), CD-ROM, magnetic tape, floppy disk and optical data storage devices, etc.
  • the storage medium stores computer instructions for executing the 3D rendering methods described in the embodiments corresponding to FIG. 5 and FIG. 8 , and details are not described herein again.

Abstract

A 3D rendering method and system, which relate to the field of a virtual cloud desktop technology, and can solve the problem that system performance is affected due to the fact that a virtual GPU needs to frequently perform operations such as rendering context switching, synchronization and queuing when a plurality of 3D rendering tasks access the same public resource. The specific technical solution comprises: a virtual machine (401) acquiring 3D rendering instructions sent by at least one 3D application, and sending each 3D rendering instruction to a virtual GPU (403) corresponding to the 3D application, wherein each 3D application corresponds to one independent virtual GPU (403); the virtual GPUs (403) parsing the received 3D rendering instructions to obtain IR data, and sending the IR data to a host computer (402); and the host computer (402) generating a target rendering instruction according to the IR data, and sending the target rendering instruction to a target physical GPU (4021), so that the target physical GPU (4021) executes the target rendering instruction. The present invention is used for 3D rendering.

Description

3D渲染方法及系统3D rendering method and system 技术领域technical field
本申请涉及虚拟云桌面技术领域,尤其涉及3D渲染方法及系统。The present application relates to the technical field of virtual cloud desktops, and in particular, to a 3D rendering method and system.
背景技术Background technique
随着云端虚拟化技术的迅速发展,公有云平台和私有云平台得到了进一步的发展,这便对虚拟桌面云平台提出了进一步的细分需求。当前,根据用户的使用行为,虚拟云桌面逐步细化出了云桌面办公用户、2D/3D设计开发用户以及3D游戏娱乐用户。在当前的技术条件下,针对云桌面办公用户的需求,桌面云提出了许多解决方案,比如QEMU(虚拟操作系统模拟器)结合spice协议开源项目。而对于2D/3D设计开发以及3D游戏娱乐这两类用户,则需要云端虚拟出来能够渲染3D应用的虚拟显卡。With the rapid development of cloud virtualization technology, public cloud platforms and private cloud platforms have been further developed, which puts forward further segmentation requirements for virtual desktop cloud platforms. At present, according to the user's usage behavior, the virtual cloud desktop is gradually refined into cloud desktop office users, 2D/3D design and development users, and 3D game entertainment users. Under the current technical conditions, in response to the needs of cloud desktop office users, the desktop cloud has proposed many solutions, such as QEMU (virtual operating system simulator) combined with the spice protocol open source project. For 2D/3D design and development and 3D game entertainment users, virtual graphics cards that can render 3D applications need to be virtualized from the cloud.
目前,针对虚拟机的3D渲染需求一般有如下的三种解决方案:At present, there are generally three solutions for the 3D rendering requirements of virtual machines:
第一种是在云端宿主机中安装多个物理GPU(Graphics Processing Unit,图形处理器)显卡,并借助Passthrough技术将单个物理GPU显卡映射到每个客户的虚拟机中作为该虚拟机的物理显卡来使用,其原理示意图可参见图1,虚拟机通过Passthrough到虚拟机的物理显卡实现对3D指令的渲染。The first is to install multiple physical GPU (Graphics Processing Unit, graphics processor) graphics cards in the cloud host, and use Passthrough technology to map a single physical GPU graphics card to each customer's virtual machine as the virtual machine's physical graphics card The schematic diagram of the principle can be seen in Figure 1. The virtual machine realizes the rendering of 3D instructions through Passthrough to the physical graphics card of the virtual machine.
第二种是在云端宿主机中安装单个物理GPU显卡,并借助vGPU(虚拟GPU)技术将单个物理GPU显卡虚拟成多张vGPU显卡,并将这多张vGPU逐个映射到客户的虚拟机中作为虚拟显卡来使用,其原理示意图可参见图2,虚拟机通过vGPU显卡实现对3D指令的渲染。The second is to install a single physical GPU graphics card in the cloud host, and use vGPU (virtual GPU) technology to virtualize a single physical GPU graphics card into multiple vGPU graphics cards, and map these multiple vGPUs one by one to the guest's virtual machine as The virtual graphics card is used, and its schematic diagram can be seen in Figure 2. The virtual machine realizes the rendering of 3D instructions through the vGPU graphics card.
第三种是虚拟机虚拟显卡方案,每个虚拟机通过各自的虚拟GPU显卡将渲染请求发送给宿主机,宿主机利用物理GPU显卡完成真正的渲染,其原理示意图可参见图3。The third is the virtual machine virtual graphics card scheme. Each virtual machine sends a rendering request to the host through its own virtual GPU graphics card, and the host uses the physical GPU graphics card to complete the real rendering. The schematic diagram can be seen in Figure 3.
在上述的解决方案中,第一种方案实现简单,但每个虚拟机在启动时就要绑定好GPU硬件并独占使用,而实际运行当中可能根本不需要使用到 GPU,从而造成GPU资源的浪费。第二种方案的技术实现相对复杂,需要GPU硬件支持,而且该功能一般限定在某些特定厂家的特定型号的GPU,价格昂贵,使用成本高。第三种方案最为灵活,虚拟机启动和运行中都不需要绑定至固定的GPU硬件,宿主机也不需要选择特定厂家特定型号的GPU硬件,从成本考虑也最优,因此,第三种方案得到了广泛的应用。In the above solutions, the first solution is simple to implement, but each virtual machine must bind the GPU hardware and use it exclusively when it is started, and the GPU may not be used at all in actual operation, resulting in GPU resources. waste. The technical implementation of the second solution is relatively complex, requiring GPU hardware support, and this function is generally limited to specific models of GPUs from some specific manufacturers, which is expensive and expensive to use. The third solution is the most flexible. The virtual machine does not need to be bound to a fixed GPU hardware during startup and operation, and the host does not need to select a specific type of GPU hardware from a specific manufacturer. It is also optimal from cost considerations. Therefore, the third solution The scheme has been widely used.
但对于第三种方案,虚拟机同时运行多个3D应用时,虚拟GPU要管理多个渲染上下文环境,每个3D应用都需要独占使用虚拟GPU,而在虚拟GPU内部,所有资源都是公共的,每个3D应用通过各自的渲染上下文向虚拟GPU发起渲染请求,虚拟GPU通过识别不同的渲染上下文环境,响应不同应用的渲染请求。这样,多个渲染任务在访问同一公共资源时,虚拟GPU就需要频繁地进行渲染上下文切换、同步、排队等操作,从而影响系统的性能。But for the third solution, when the virtual machine runs multiple 3D applications at the same time, the virtual GPU needs to manage multiple rendering contexts, each 3D application needs to use the virtual GPU exclusively, and inside the virtual GPU, all resources are public , each 3D application initiates a rendering request to the virtual GPU through its own rendering context, and the virtual GPU responds to the rendering request of different applications by identifying different rendering contexts. In this way, when multiple rendering tasks access the same common resource, the virtual GPU needs to frequently perform operations such as rendering context switching, synchronization, and queuing, thereby affecting the performance of the system.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供一种3D渲染方法及系统,能够解决多个3D渲染任务访问同一公共资源时因虚拟GPU需要频繁地进行渲染上下文切换、同步、排队等操作而影响系统性能的问题。所述技术方案如下:The embodiments of the present application provide a 3D rendering method and system, which can solve the problem that the virtual GPU needs to frequently perform operations such as rendering context switching, synchronization, and queuing when multiple 3D rendering tasks access the same common resource, which affects system performance. The technical solution is as follows:
根据本申请实施例的第一方面,提供一种3D渲染方法,该方法包括:According to a first aspect of the embodiments of the present application, a 3D rendering method is provided, the method comprising:
虚拟机获取至少一个3D应用发送的3D渲染指令;The virtual machine obtains a 3D rendering instruction sent by at least one 3D application;
所述虚拟机将每个3D渲染指令发送给与所述3D应用对应的虚拟图形处理器GPU,其中,每个所述3D应用对应有一个独立的虚拟GPU;The virtual machine sends each 3D rendering instruction to a virtual graphics processor GPU corresponding to the 3D application, wherein each 3D application corresponds to an independent virtual GPU;
虚拟GPU对接收到的3D渲染指令进行解析,得到中间表示IR数据,并将所述IR数据发送给宿主机;The virtual GPU parses the received 3D rendering instruction, obtains intermediate representation IR data, and sends the IR data to the host;
宿主机根据所述IR数据生成目标渲染指令,并将所述目标渲染指令发送给目标物理GPU,以便所述目标物理GPU执行所述目标渲染指令。The host computer generates a target rendering instruction according to the IR data, and sends the target rendering instruction to the target physical GPU, so that the target physical GPU executes the target rendering instruction.
本申请实施例提供的3D渲染方法,为每个3D应用设置一个独立的虚拟GPU,虚拟机可以将每个3D应用发送的3D渲染指令发送给该3D应用唯一对应的虚拟GPU,虚拟GPU对接收到的3D渲染指令进行解析,并将得到的IR数据发送给宿主机,宿主机根据该IR数据生成目标渲染指令,并将该目标渲染指令发送给目标物理GPU,以便目标物理GPU执行该目标渲染指令。 这样,一个虚拟GPU只负责管理一个3D应用的渲染上下文,从而避免了一个虚拟GPU管理多个渲染上下文环境而导致虚拟GPU需要频繁地进行上下文切换、同步、排队等影响性能的问题。In the 3D rendering method provided by the embodiment of the present application, an independent virtual GPU is set for each 3D application, the virtual machine can send the 3D rendering instruction sent by each 3D application to the virtual GPU uniquely corresponding to the 3D application, and the virtual GPU can receive the The received 3D rendering instruction is parsed, and the obtained IR data is sent to the host. The host generates a target rendering instruction according to the IR data, and sends the target rendering instruction to the target physical GPU, so that the target physical GPU can execute the target rendering. instruction. In this way, one virtual GPU is only responsible for managing the rendering context of one 3D application, thereby avoiding the problem that the virtual GPU needs to frequently perform context switching, synchronization, queuing, etc. to affect performance due to the management of multiple rendering contexts by one virtual GPU.
在一个实施例中,所述虚拟机将每个3D渲染指令发送给与所述3D应用对应的虚拟图形处理器GPU包括:In one embodiment, the virtual machine sending each 3D rendering instruction to the virtual graphics processor GPU corresponding to the 3D application includes:
所述虚拟机判断是否为所述3D应用创建了对应的虚拟GPU;The virtual machine determines whether a corresponding virtual GPU is created for the 3D application;
若已创建,则将所述3D渲染指令发送给所述3D应用对应的虚拟GPU。If it has been created, the 3D rendering instruction is sent to the virtual GPU corresponding to the 3D application.
在一个实施例中,所述虚拟机在判断是否为所述3D应用创建了对应的虚拟GPU之后,所述方法还包括:In one embodiment, after the virtual machine determines whether a corresponding virtual GPU is created for the 3D application, the method further includes:
若未为所述3D应用创建对应的虚拟GPU,则为所述3D应用创建对应的虚拟GPU;If the corresponding virtual GPU is not created for the 3D application, create a corresponding virtual GPU for the 3D application;
将所述3D渲染指令发送给所述3D应用对应的虚拟GPU。Send the 3D rendering instruction to the virtual GPU corresponding to the 3D application.
本申请实施例提供的3D渲染方法,虚拟机在获取到3D应用发送的3D渲染指令后,先判断是否为该3D应用创建了对应的虚拟GPU,若已创建,则将3D渲染指令发送给3D应用对应的虚拟GPU,若未创建,则先为该3D应用创建对应的虚拟GPU,然后将3D渲染指令发送给3D应用对应的虚拟GPU。可以保证每个3D应用都有一个独立的虚拟GPU。In the 3D rendering method provided by the embodiment of the present application, after the virtual machine obtains the 3D rendering instruction sent by the 3D application, it first determines whether a corresponding virtual GPU has been created for the 3D application, and if so, sends the 3D rendering instruction to the 3D application. The virtual GPU corresponding to the application, if not created, first create the corresponding virtual GPU for the 3D application, and then send the 3D rendering instruction to the virtual GPU corresponding to the 3D application. It is guaranteed that each 3D application has an independent virtual GPU.
在一个实施例中,所述将所述目标渲染指令发送给目标物理GPU之前,所述方法还包括:In one embodiment, before the sending the target rendering instruction to the target physical GPU, the method further includes:
宿主机根据预设规则从至少一个物理GPU中选定目标物理GPU。The host computer selects a target physical GPU from at least one physical GPU according to a preset rule.
在一个实施例中,所述宿主机根据预设规则从至少一个物理GPU中选定目标物理GPU包括:In one embodiment, the host computer selects a target physical GPU from at least one physical GPU according to a preset rule, including:
宿主机从其管理的至少一个物理GPU中选择利用率最低的物理GPU作为目标物理GPU。The host selects the physical GPU with the lowest utilization rate as the target physical GPU from at least one physical GPU managed by the host.
本申请实施例提供的3D渲染方法,宿主机能够从其管理的至少一个物理GPU中选择利用率最低的物理GPU作为目标物理GPU,然后将目标渲染指令发送给该目标物理GPU,以便该目标物理GPU执行该目标渲染指令。这样,能够以3D应用为最小颗粒进行区分,并将各3D的渲染指令分发至不 同的物理GPU硬件,从而避免了一个虚拟机仅对应一个物理GPU,且该虚拟机同时运行多个3D应用时造成的该虚拟机对应物理GPU负担过重的问题。In the 3D rendering method provided by the embodiment of the present application, the host can select the physical GPU with the lowest utilization rate from at least one physical GPU managed by it as the target physical GPU, and then send the target rendering instruction to the target physical GPU, so that the target physical GPU can The GPU executes the target rendering instruction. In this way, 3D applications can be distinguished as the smallest particles, and the rendering instructions of each 3D can be distributed to different physical GPU hardware, thus avoiding that one virtual machine only corresponds to one physical GPU, and the virtual machine runs multiple 3D applications at the same time. The problem caused by the virtual machine corresponding to the physical GPU is overburdened.
根据本申请实施例的第二方面,提供一种3D渲染系统,该3D渲染系统包括虚拟机、宿主机、至少一个虚拟图形处理器GPU和至少一个物理GPU,所述虚拟机上运行有至少一个3D应用,每个3D应用对应一个独立的虚拟GPU,所述宿主机包括至少一个物理GPU;According to a second aspect of the embodiments of the present application, a 3D rendering system is provided, the 3D rendering system includes a virtual machine, a host machine, at least one virtual graphics processing unit (GPU), and at least one physical GPU, and at least one physical GPU runs on the virtual machine. 3D applications, each 3D application corresponds to an independent virtual GPU, and the host machine includes at least one physical GPU;
所述虚拟机,用于获取至少一个3D应用发送的3D渲染指令,将每个3D渲染指令发送给与所述3D应用对应的虚拟GPU;The virtual machine is configured to obtain a 3D rendering instruction sent by at least one 3D application, and send each 3D rendering instruction to a virtual GPU corresponding to the 3D application;
所述虚拟GPU,用于对接收到的3D渲染指令进行解析,得到中间表示IR数据,并将所述IR数据发送给所述宿主机;The virtual GPU is used to parse the received 3D rendering instruction, obtain intermediate representation IR data, and send the IR data to the host;
所述宿主机,用于根据所述IR数据生成目标渲染指令,并将所述目标渲染指令发送给目标物理GPU;The host machine is used to generate a target rendering instruction according to the IR data, and send the target rendering instruction to the target physical GPU;
所述物理GPU,用于执行接收到的目标渲染指令。The physical GPU is used to execute the received target rendering instruction.
本申请实施例提供的3D渲染系统,包括虚拟机、宿主机、至少一个虚拟GPU和至少一个物理GPU,虚拟机上运行有至少一个3D应用,每个3D应用对应一个独立的虚拟GPU,宿主机包括至少一个物理GPU。该系统为每个3D应用设置了一个独立的虚拟GPU,虚拟机可以将每个3D应用发送的3D渲染指令发送给该3D应用唯一对应的虚拟GPU,虚拟GPU对接收到的3D渲染指令进行解析,并将得到的IR数据发送给宿主机,宿主机根据该IR数据生成目标渲染指令,并将该目标渲染指令发送给目标物理GPU,以便目标物理GPU执行该目标渲染指令。这样,一个虚拟GPU只负责管理一个3D应用的渲染上下文,从而避免了一个虚拟GPU管理多个渲染上下文环境而导致虚拟GPU需要频繁地进行上下文切换、同步、排队等影响性能的问题。The 3D rendering system provided by the embodiments of the present application includes a virtual machine, a host machine, at least one virtual GPU, and at least one physical GPU. At least one 3D application runs on the virtual machine, each 3D application corresponds to an independent virtual GPU, and the host machine Include at least one physical GPU. The system sets up an independent virtual GPU for each 3D application. The virtual machine can send the 3D rendering instructions sent by each 3D application to the unique virtual GPU corresponding to the 3D application, and the virtual GPU parses the received 3D rendering instructions. , and send the obtained IR data to the host, the host generates a target rendering instruction according to the IR data, and sends the target rendering instruction to the target physical GPU, so that the target physical GPU executes the target rendering instruction. In this way, one virtual GPU is only responsible for managing the rendering context of one 3D application, thereby avoiding the problem that the virtual GPU needs to frequently perform context switching, synchronization, queuing, etc. to affect performance due to the management of multiple rendering contexts by one virtual GPU.
在一个实施例中,所述虚拟机具体用于获取至少一个3D应用发送的3D渲染指令,判断是否为所述3D应用创建了对应的虚拟GPU,若已创建,则将所述3D渲染指令发送给所述3D应用对应的虚拟GPU;若未创建,则为所述3D应用创建对应的虚拟GPU,然后将所述3D渲染指令发送给所述3D应用对应的虚拟GPU。In one embodiment, the virtual machine is specifically configured to acquire a 3D rendering instruction sent by at least one 3D application, determine whether a corresponding virtual GPU has been created for the 3D application, and if so, send the 3D rendering instruction Create a virtual GPU corresponding to the 3D application; if not, create a corresponding virtual GPU for the 3D application, and then send the 3D rendering instruction to the virtual GPU corresponding to the 3D application.
这样,虚拟机在获取到3D应用发送的3D渲染指令之后,通过判断是否为所述3D应用创建了对应的虚拟GPU,若未创建,则先为该3D应用创建对应的虚拟GPU,然后再将3D渲染指令发送给该3D应用对应的虚拟GPU,能够保证每个3D应用都有一个独立的虚拟GPU。In this way, after obtaining the 3D rendering instruction sent by the 3D application, the virtual machine determines whether a corresponding virtual GPU has been created for the 3D application. The 3D rendering instruction is sent to the virtual GPU corresponding to the 3D application, which can ensure that each 3D application has an independent virtual GPU.
在一个实施例中,所述宿主机具体用于根据预设规则从所述至少一个物理GPU中选定一个物理GPU,得到目标物理GPU,并将所述目标渲染指令发送给所述目标物理GPU。In one embodiment, the host is specifically configured to select a physical GPU from the at least one physical GPU according to a preset rule, obtain a target physical GPU, and send the target rendering instruction to the target physical GPU .
在一个实施例中,所述宿主机具体用于从所述至少一个物理GPU中选择利用率最低的一个物理GPU作为目标物理GPU。In one embodiment, the host is specifically configured to select a physical GPU with the lowest utilization rate from the at least one physical GPU as a target physical GPU.
这样,可以将同一个虚拟机的多个3D应用的渲染指令,以3D应用为最小颗粒进行区分,并将各3D应用的渲染指令分发至不同的物理GPU硬件,能够避免虚拟机同时运行多个3D应用的渲染任务时造成该虚拟机对应物理GPU负担过重的问题。In this way, the rendering instructions of multiple 3D applications of the same virtual machine can be distinguished by taking the 3D application as the smallest particle, and the rendering instructions of each 3D application can be distributed to different physical GPU hardware, which can prevent the virtual machine from running multiple 3D applications at the same time. The virtual machine's corresponding physical GPU is overburdened during rendering tasks for 3D applications.
在一个实施例中,所述虚拟GPU包括前端驱动和后端驱动;In one embodiment, the virtual GPU includes a front-end driver and a back-end driver;
所述前端驱动运行在所述虚拟机上,用于对接收到的3D渲染指令进行解析,得到中间表示IR数据,并将所述IR数据发送给所述后端驱动;The front-end driver runs on the virtual machine, and is used to parse the received 3D rendering instruction, obtain intermediate representation IR data, and send the IR data to the back-end driver;
所述后端驱动运行在所述宿主机上,用于将所述IR数据发送给所述宿主机。The back-end driver runs on the host, and is used for sending the IR data to the host.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本申请。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not limiting of the present application.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description serve to explain the principles of the application.
图1是现有技术中通过Passthrough技术进行3D渲染的原理图;1 is a schematic diagram of 3D rendering by Passthrough technology in the prior art;
图2是现有技术中通过将硬件GPU虚拟化来进行3D渲染的原理图;Fig. 2 is a schematic diagram of performing 3D rendering by virtualizing hardware GPU in the prior art;
图3是现有技术中通过虚拟机虚拟显卡的方案进行3D渲染的原理图;Fig. 3 is a schematic diagram of performing 3D rendering through the solution of virtual machine virtual graphics card in the prior art;
图4是本申请实施例提供的一种3D渲染系统的结构示意图;4 is a schematic structural diagram of a 3D rendering system provided by an embodiment of the present application;
图5是本申请实施例提供的一种3D渲染方法的流程图;5 is a flowchart of a 3D rendering method provided by an embodiment of the present application;
图6是本申请实施例提供的一种具体的3D渲染系统的结构示意图;6 is a schematic structural diagram of a specific 3D rendering system provided by an embodiment of the present application;
图7是本申请实施例提供的另一种3D渲染系统的结构示意图;7 is a schematic structural diagram of another 3D rendering system provided by an embodiment of the present application;
图8是本申请实施例提供的一种具体的3D渲染方法的流程图。FIG. 8 is a flowchart of a specific 3D rendering method provided by an embodiment of the present application.
具体实施方式detailed description
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. Where the following description refers to the drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the illustrative examples below are not intended to represent all implementations consistent with this application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as recited in the appended claims.
在本申请实施例中,以虚拟机上运行的3D应用为最小渲染颗粒,为每一个3D应用设置一个独立的虚拟GPU,该虚拟GPU可以将该3D应用的渲染指令下发至选定的物理GPU进行执行。In this embodiment of the present application, the 3D application running on the virtual machine is used as the minimum rendering particle, and an independent virtual GPU is set for each 3D application, and the virtual GPU can issue the rendering instructions of the 3D application to the selected physical object. GPU to execute.
本申请实施例提供一种3D渲染系统,如图4所示,该3D渲染系统40可以包括虚拟机401、宿主机402、至少一个虚拟GPU 403和至少一个物理GPU 4021,其中,宿主机402包括至少一个物理GPU 4021,比如M(M为大于等于1的整数)个物理GPU 4021;虚拟机401上运行有至少一个3D应用,每个3D应用对应一个独立的虚拟GPU,例如在图4中示出了N(N为大于等于1的整数)个3D应用:3D应用1、3D应用2……3D应用N,3D应用1与虚拟GPU1对应,3D应用2与虚拟GPU2对应,……3D应用N与虚拟GPU N对应。An embodiment of the present application provides a 3D rendering system. As shown in FIG. 4 , the 3D rendering system 40 may include a virtual machine 401, a host machine 402, at least one virtual GPU 403 and at least one physical GPU 4021, wherein the host machine 402 includes At least one physical GPU 4021, such as M (M is an integer greater than or equal to 1) physical GPUs 4021; at least one 3D application runs on the virtual machine 401, and each 3D application corresponds to an independent virtual GPU, as shown in FIG. 4 for example There are N (N is an integer greater than or equal to 1) 3D applications: 3D application 1, 3D application 2... 3D application N, 3D application 1 corresponds to virtual GPU1, 3D application 2 corresponds to virtual GPU2, ... 3D application N Corresponds to virtual GPU N.
具体的,虚拟机401用于获取至少一个3D应用发送的3D渲染指令,将每个3D渲染指令发送给与该3D应用对应的虚拟GPU。比如,在图4中,虚拟机401可以获取3D应用1、3D应用2……3D应用N分别发送的3D渲染指令,将3D应用1发送的3D渲染指令发送给虚拟GPU1,将3D应用2发送的3D渲染指令发送给虚拟GPU2,……,以此类推,将3D应用N发送的3D渲染指令发送给虚拟GPUN。Specifically, the virtual machine 401 is configured to acquire a 3D rendering instruction sent by at least one 3D application, and send each 3D rendering instruction to a virtual GPU corresponding to the 3D application. For example, in FIG. 4 , the virtual machine 401 can obtain the 3D rendering instructions sent by 3D application 1, 3D application 2... The 3D rendering instruction sent by the 3D application N is sent to the virtual GPU2, ..., and so on, the 3D rendering instruction sent by the 3D application N is sent to the virtual GPUN.
虚拟GPU 403用于对接收到的3D渲染指令进行解析,得到IR (Intermediate Representation,中间表示)数据,并将该IR数据发送给宿主机402。The virtual GPU 403 is used to parse the received 3D rendering instruction, obtain IR (Intermediate Representation, intermediate representation) data, and send the IR data to the host machine 402.
宿主机402用于根据IR数据生成目标渲染指令,并将该目标渲染指令发送给目标物理GPU;物理GPU用于执行接收到的目标渲染指令。The host 402 is configured to generate a target rendering instruction according to the IR data, and send the target rendering instruction to the target physical GPU; the physical GPU is configured to execute the received target rendering instruction.
例如,在图4中,虚拟GPU1接收到虚拟机401发送的3D应用1的3D渲染指令,然后对该3D渲染指令进行解析,得到IR数据,然后将该IR数据发送给宿主机402,宿主机402根据该IR数据生成目标渲染指令,并将该目标渲染指令发送给目标物理GPU,比如发送给物理GPU1,由物理GPU1执行该目标渲染指令。For example, in FIG. 4, the virtual GPU1 receives the 3D rendering instruction of the 3D application 1 sent by the virtual machine 401, then parses the 3D rendering instruction to obtain IR data, and then sends the IR data to the host machine 402, and the host machine 402 Generate a target rendering instruction according to the IR data, and send the target rendering instruction to the target physical GPU, for example, to the physical GPU1, and the physical GPU1 executes the target rendering instruction.
在一个实施例中,虚拟机401具体用于获取至少一个3D应用发送的3D渲染指令,判断是否为该3D应用创建了对应的虚拟GPU,若已创建,则将该3D应用的3D渲染指令发送给该3D应用对应的虚拟GPU;若未创建,则为该3D应用创建对应的虚拟GPU,然后将该3D应用的3D渲染指令发送给创建的该3D应用对应的虚拟GPU。In one embodiment, the virtual machine 401 is specifically configured to obtain a 3D rendering instruction sent by at least one 3D application, determine whether a corresponding virtual GPU has been created for the 3D application, and if so, send the 3D rendering instruction of the 3D application. A virtual GPU corresponding to the 3D application is created; if not, a corresponding virtual GPU is created for the 3D application, and then the 3D rendering instruction of the 3D application is sent to the created virtual GPU corresponding to the 3D application.
在一个实施例中,宿主机402具体用于根据预设规则从至少一个物理GPU中选定一个物理GPU,得到目标物理GPU,并将目标渲染指令发送给该目标物理GPU。In one embodiment, the host 402 is specifically configured to select a physical GPU from at least one physical GPU according to a preset rule, obtain a target physical GPU, and send a target rendering instruction to the target physical GPU.
在一个实施例中,宿主机402可以从其管理的至少一个物理GPU中选择利用率最低的一个物理GPU作为目标物理GPU。In one embodiment, the host 402 may select a physical GPU with the lowest utilization rate as the target physical GPU from at least one physical GPU managed by the host machine 402 .
在一个实施例中,虚拟GPU 403可以包括前端驱动和后端驱动。其中,前端驱动运行在虚拟机401上,用于对接收到的3D渲染指令进行解析,得到IR数据,并将该IR数据发送给后端驱动;该后端驱动运行在宿主机402上,用于将接收到的IR数据发送给宿主机402。In one embodiment, virtual GPU 403 may include front-end drivers and back-end drivers. The front-end driver runs on the virtual machine 401 to parse the received 3D rendering instructions, obtain IR data, and send the IR data to the back-end driver; the back-end driver runs on the host machine 402 and uses to send the received IR data to the host computer 402 .
本申请实施例提供的3D渲染系统,包括虚拟机、宿主机、至少一个虚拟GPU和至少一个物理GPU,虚拟机上运行有至少一个3D应用,每个3D应用对应一个独立的虚拟GPU,宿主机包括至少一个物理GPU。该系统以虚拟机的3D应用为最小渲染颗粒,为每个3D应用设置了一个独立的虚拟GPU,虚拟机可以将每个3D应用发送的3D渲染指令发送给该3D应用唯一对应的虚拟GPU,虚拟GPU对接收到的3D渲染指令进行解析,并将得到的 IR数据发送给宿主机,宿主机根据该IR数据生成目标渲染指令,并将该目标渲染指令发送给目标物理GPU,以便目标物理GPU执行该目标渲染指令。这样,一个虚拟GPU只负责管理一个3D应用的渲染上下文,从而避免了一个虚拟GPU管理多个渲染上下文环境而导致虚拟GPU需要频繁地进行上下文切换、同步、排队等影响性能的问题。进一步的,虚拟GPU可以将3D应用的3D渲染指令下发至选定的物理GPU,由选定的物理GPU执行渲染过程,能够为每一个3D应用选择合适的物理GPU,不再是一个虚拟机仅能对应一个物理GPU,从而可以避免虚拟机同时运行多个3D应用的3D渲染时造成该虚拟机对应的物理GPU负担过重的问题。The 3D rendering system provided by the embodiments of the present application includes a virtual machine, a host machine, at least one virtual GPU, and at least one physical GPU. At least one 3D application runs on the virtual machine, each 3D application corresponds to an independent virtual GPU, and the host machine Include at least one physical GPU. The system takes the 3D application of the virtual machine as the minimum rendering particle, and sets up an independent virtual GPU for each 3D application. The virtual machine can send the 3D rendering instructions sent by each 3D application to the unique virtual GPU corresponding to the 3D application. The virtual GPU parses the received 3D rendering instruction, and sends the obtained IR data to the host. The host generates a target rendering instruction according to the IR data, and sends the target rendering instruction to the target physical GPU, so that the target physical GPU can Execute the target rendering instruction. In this way, one virtual GPU is only responsible for managing the rendering context of one 3D application, thereby avoiding the problem that the virtual GPU needs to frequently perform context switching, synchronization, queuing, etc. to affect performance due to the management of multiple rendering contexts by one virtual GPU. Further, the virtual GPU can issue the 3D rendering instructions of the 3D application to the selected physical GPU, and the selected physical GPU performs the rendering process, and can select the appropriate physical GPU for each 3D application, no longer a virtual machine. It can only correspond to one physical GPU, thereby avoiding the problem that the physical GPU corresponding to the virtual machine is overburdened when the virtual machine runs 3D rendering of multiple 3D applications at the same time.
基于上述图1对应实施例的3D渲染系统,本申请实施例还提供一种3D渲染方法,至少可以应用于上述图4对应实施例的3D渲染系统。如图5所示,该方法可以包括如下步骤:Based on the 3D rendering system of the above embodiment corresponding to FIG. 1 , an embodiment of the present application further provides a 3D rendering method, which can be at least applied to the 3D rendering system of the above embodiment corresponding to FIG. 4 . As shown in Figure 5, the method may include the following steps:
步骤501:获取至少一个3D应用发送的3D渲染指令。Step 501: Obtain a 3D rendering instruction sent by at least one 3D application.
虚拟机上可以运行至少一个3D应用,当该3D应用发起3D渲染指令时,虚拟机获取这至少一个3D应用发送的3D渲染指令。At least one 3D application may run on the virtual machine, and when the 3D application initiates a 3D rendering instruction, the virtual machine obtains the 3D rendering instruction sent by the at least one 3D application.
步骤502:将每个3D渲染指令发送给与3D应用对应的虚拟GPU。Step 502: Send each 3D rendering instruction to the virtual GPU corresponding to the 3D application.
虚拟机获取到至少一个3D应用发送的3D渲染指令之后,将每个3D渲染指令发送给与3D应用对应的虚拟GPU,其中,每个3D应用对应有一个独立的虚拟GPU。After acquiring the 3D rendering instruction sent by at least one 3D application, the virtual machine sends each 3D rendering instruction to a virtual GPU corresponding to the 3D application, wherein each 3D application corresponds to an independent virtual GPU.
比如,虚拟机上运行有3个3D应用,分别为3D应用1、3D应用2和3D应用3,这3个3D应用分别与虚拟GPU1、虚拟GPU2和虚拟GPU3一一对应。这3个3D应用在运行时分别发起了3D渲染指令,虚拟机则会将3D应用1发起的3D渲染指令发送给虚拟GPU1,将3D应用2发起的3D渲染指令发送给虚拟GPU2,将3D应用3发起的3D渲染指令发送给虚拟GPU3。For example, there are three 3D applications running on the virtual machine, namely 3D application 1, 3D application 2 and 3D application 3, and the three 3D applications are in one-to-one correspondence with virtual GPU1, virtual GPU2 and virtual GPU3. These three 3D applications respectively initiate 3D rendering instructions at runtime, and the virtual machine sends the 3D rendering instructions initiated by 3D application 1 to virtual GPU1, and the 3D rendering instructions initiated by 3D application 2 to virtual GPU2, and the 3D application 3 The 3D rendering command initiated by 3 is sent to the virtual GPU3.
步骤503:对3D渲染指令进行解析得到IR数据。Step 503: Parse the 3D rendering instruction to obtain IR data.
对于每个虚拟GPU,在接收到虚拟机发送的3D渲染指令之后,对该3D渲染指令进行解析,得到IR数据,并将该IR数据发送给宿主机。通过将3D渲染指令解析为IR数据,可以屏蔽虚拟机和宿主机之间的操作系统和渲染环境的差异。For each virtual GPU, after receiving the 3D rendering instruction sent by the virtual machine, the 3D rendering instruction is parsed to obtain IR data, and the IR data is sent to the host computer. By parsing 3D rendering instructions into IR data, differences in operating systems and rendering environments between the virtual machine and the host can be shielded.
步骤504:根据IR数据生成目标渲染指令。Step 504: Generate a target rendering instruction according to the IR data.
宿主机接收到虚拟GPU发送的IR数据之后,根据该IR数据生成目标渲染指令。这样可以将IR数据还原为宿主机支持的数据格式,得到目标渲染指令。After receiving the IR data sent by the virtual GPU, the host computer generates a target rendering instruction according to the IR data. In this way, the IR data can be restored to the data format supported by the host, and the target rendering instruction can be obtained.
步骤505:将目标渲染指令发送给目标物理GPU。Step 505: Send the target rendering instruction to the target physical GPU.
宿主机根据IR数据生成目标渲染指令之后,将该目标渲染指令发送给目标物理GPU,以便目标物理GPU执行目标渲染指令。After the host computer generates the target rendering instruction according to the IR data, it sends the target rendering instruction to the target physical GPU, so that the target physical GPU executes the target rendering instruction.
具体的,宿主机可以管理至少一个物理GPU,宿主机在根据IR数据生成目标渲染指令之后,可以根据预设规则从这至少一个物理GPU中选定目标物理GPU,比如,可以从这至少一个物理GPU中选择利用率最低的物理GPU作为目标物理GPU。这样,可以将同一个虚拟机的多个3D应用的渲染指令发至不同的物理GPU,一个虚拟机不再仅对应一个物理GPU,可以避免虚拟机同时运行多个重度渲染的3D应用时造成的该虚拟机对应物理GPU负担过重的问题。Specifically, the host can manage at least one physical GPU, and after generating the target rendering instruction according to the IR data, the host can select the target physical GPU from the at least one physical GPU according to a preset rule. For example, the target physical GPU can be selected from the at least one physical GPU. Among the GPUs, the physical GPU with the lowest utilization rate is selected as the target physical GPU. In this way, the rendering instructions of multiple 3D applications of the same virtual machine can be sent to different physical GPUs, and a virtual machine no longer corresponds to only one physical GPU, which can avoid the virtual machine running multiple heavily rendered 3D applications at the same time. This virtual machine corresponds to the problem that the physical GPU is overburdened.
本申请实施例提供的3D渲染方法,虚拟机上运行的每个3D应用对应有一个独立的虚拟GPU,虚拟机获取至少一个3D应用发送的3D渲染指令,并将每个3D渲染指令发送给与该3D应用对应的虚拟GPU;虚拟GPU对接收到的3D渲染指令进行解析,得到IR数据,并将该IR数据发送给宿主机;宿主机根据该IR数据生成目标渲染指令,并将该目标渲染指令发送给目标物理GPU,以便该目标物理GPU执行接收到的目标渲染指令。由于一个虚拟GPU只负责管理一个3D应用的渲染上下文,而不是管理多个渲染上下文环境,因而可以避免虚拟GPU需要频繁地进行上下文切换、同步、排队等操作而影响系统性能的问题,提高了3D渲染的系统性能。In the 3D rendering method provided by the embodiment of the present application, each 3D application running on a virtual machine corresponds to an independent virtual GPU, the virtual machine obtains a 3D rendering instruction sent by at least one 3D application, and sends each 3D rendering instruction to a The virtual GPU corresponding to the 3D application; the virtual GPU parses the received 3D rendering instruction, obtains IR data, and sends the IR data to the host; the host generates a target rendering instruction according to the IR data, and renders the target Instructions are sent to the target physical GPU so that the target physical GPU executes the received target rendering instructions. Since a virtual GPU is only responsible for managing the rendering context of one 3D application, rather than managing multiple rendering contexts, it can avoid the problem that the virtual GPU needs to perform context switching, synchronization, queuing and other operations frequently and affect the system performance, and improves the 3D performance. Rendering system performance.
为了更加清楚地体现出本申请的目的,在上述实施例的基础上作进一步的举例说明。In order to more clearly reflect the purpose of the present application, further examples are given on the basis of the above embodiments.
基于上述图4对应实施例的3D渲染系统,本申请另一实施例提供一种具体的3D渲染系统,如图6所示,该3D渲染系统40包括虚拟机401、宿主机402、至少一个虚拟GPU 403和至少一个物理GPU 4021。其中,虚拟机401上运行有至少一个3D应用,每个3D应用对应一个独立的虚拟GPU 403。 例如,在图6中示出了N(N为大于等于1的整数)个3D应用:3D应用1,3D应用2,……,3D应用N;3D应用1对应虚拟GPU1,3D应用2对应虚拟GPU2,……,3D应用N对应虚拟GPUN。实际应用中,宿主机402可以是服务器,该服务器上可以运行虚拟机401,可以负责管理物理GPU 4021。Based on the 3D rendering system of the embodiment corresponding to FIG. 4 , another embodiment of the present application provides a specific 3D rendering system. As shown in FIG. 6 , the 3D rendering system 40 includes a virtual machine 401 , a host machine 402 , and at least one virtual machine. GPU 403 and at least one physical GPU 4021. Wherein, at least one 3D application runs on the virtual machine 401, and each 3D application corresponds to an independent virtual GPU 403. For example, in FIG. 6, N (N is an integer greater than or equal to 1) 3D applications are shown: 3D application 1, 3D application 2, ..., 3D application N; 3D application 1 corresponds to virtual GPU1, and 3D application 2 corresponds to virtual GPU 1. GPU2, ..., 3D application N corresponds to virtual GPUN. In practical applications, the host machine 402 may be a server, on which the virtual machine 401 may run, and may be responsible for managing the physical GPU 4021.
其中,虚拟机401可以包括3D渲染入口模块4011,虚拟机401上运行的至少一个3D应用与该3D渲染入口模块4011通信连接。宿主机402可以包括3D渲染中间指令模块4022、GPU分发模块4023和至少一个物理GPU4021。例如,宿主机402可以包括M=4个物理GPU 4021:物理GPU1、物理GPU2、物理GPU3和物理GPU4,这里仅是举例说明,并不用于限定本申请,实际应用中可以是任意多个物理GPU 4021。The virtual machine 401 may include a 3D rendering portal module 4011, and at least one 3D application running on the virtual machine 401 is connected in communication with the 3D rendering portal module 4011. The host 402 may include a 3D rendering intermediate instruction module 4022 , a GPU distribution module 4023 and at least one physical GPU 4021 . For example, the host machine 402 may include M=4 physical GPUs 4021: physical GPU1, physical GPU2, physical GPU3, and physical GPU4. This is only an example and is not used to limit the application. In practical applications, it can be any number of physical GPUs. 4021.
当虚拟机401上的每个3D应用运行时,若发起3D渲染指令,该3D渲染指令比如可以是OpenGL(Open Graphics Library,开放图形库)API(Application Programming Interface,应用程序接口)的调用,则会被虚拟机401的3D渲染入口模块4011捕获。具体的,3D渲染入口模块4011的捕获方式可以是以3D API函数动态库的方式呈现。比如,虚拟机401运行的是linux系统,则3D渲染入口模块4011的捕获方式可以是替换linux系统上的libGL.so动态库,这样,所有基于OpenGL API开发的3D应用在加载libGL.so动态库时实际加载的便是3D渲染入口模块4011。When each 3D application on the virtual machine 401 is running, if a 3D rendering instruction is initiated, for example, the 3D rendering instruction may be a call of an OpenGL (Open Graphics Library) API (Application Programming Interface), then It will be captured by the 3D rendering entry module 4011 of the virtual machine 401 . Specifically, the capture mode of the 3D rendering entry module 4011 may be presented in the form of a dynamic library of 3D API functions. For example, if the virtual machine 401 runs a Linux system, the capture method of the 3D rendering entry module 4011 can be to replace the libGL.so dynamic library on the Linux system. In this way, all 3D applications developed based on OpenGL API load the libGL.so dynamic library What is actually loaded is the 3D rendering entry module 4011.
进一步的,3D渲染入口模块4011在获取到至少一个3D应用发送的3D渲染指令之后,可以先判断是否已经为该3D应用创建了对应的虚拟GPU,如果已经创建,则继续走渲染流程,将各3D应用的3D渲染指令发送给该3D应用对应的虚拟GPU;否则,为之新建虚拟GPU,然后再各3D应用的3D渲染指令发送给该3D应用对应的虚拟GPU。Further, after acquiring the 3D rendering instruction sent by at least one 3D application, the 3D rendering entry module 4011 can first determine whether a corresponding virtual GPU has been created for the 3D application, and if so, continue the rendering process, The 3D rendering instruction of the 3D application is sent to the virtual GPU corresponding to the 3D application; otherwise, a new virtual GPU is created for it, and then the 3D rendering instruction of each 3D application is sent to the virtual GPU corresponding to the 3D application.
例如,如图6所示,假设3D应用1和3D应用2分别发起了3D渲染指令,该3D渲染指令被3D渲染入口模块4011捕获,这时,3D渲染入口模块4011判断出已经为3D应用1创建了对应的虚拟GPU1,则将3D应用1发起的3D渲染指令发送给虚拟GPU1;3D渲染入口模块4011同时判断出还未为3D应用2创建对应的虚拟GPU,则先为3D应用2创建对应的虚拟GPU2,然后将3D应用2发起的3D渲染指令发送给虚拟GPU2。For example, as shown in FIG. 6 , it is assumed that 3D application 1 and 3D application 2 respectively initiate 3D rendering instructions, and the 3D rendering instructions are captured by the 3D rendering entry module 4011. At this time, the 3D rendering entry module 4011 determines that it is already 3D application 1. When the corresponding virtual GPU1 is created, the 3D rendering instruction initiated by the 3D application 1 is sent to the virtual GPU1; the 3D rendering entry module 4011 also determines that the corresponding virtual GPU has not been created for the 3D application 2, and then creates the corresponding virtual GPU for the 3D application 2 first. virtual GPU2, and then send the 3D rendering instruction initiated by 3D application 2 to virtual GPU2.
虚拟GPU 403是一个连接并运行在虚拟机和宿主机上的虚拟设备,其可 以包括前端驱动4031和后端驱动4032,前端驱动4031运行在虚拟机401上,后端驱动4032运行在宿主机403上。前端驱动4031可以将接收到的3D渲染指令进行解析,得到IR数据,并将该IR数据发送给后端驱动4032;后端驱动4032接收到前端驱动4031发送的IR数据后,将该IR数据发送给宿主机402,具体的,可以是发给宿主机402的3D渲染中间指令模块4022。通过将3D渲染指令解析成IR数据,可以屏蔽虚拟机401和宿主机402之间的操作系统和渲染环境的差异。The virtual GPU 403 is a virtual device connected to and running on the virtual machine and the host machine, which may include a front-end driver 4031 and a back-end driver 4032, the front-end driver 4031 runs on the virtual machine 401, and the back-end driver 4032 runs on the host machine 403 superior. The front-end driver 4031 can parse the received 3D rendering instruction, obtain IR data, and send the IR data to the back-end driver 4032; after the back-end driver 4032 receives the IR data sent by the front-end driver 4031, it sends the IR data To the host computer 402 , specifically, it may be the 3D rendering intermediate instruction module 4022 sent to the host computer 402 . By parsing the 3D rendering instructions into IR data, differences in operating systems and rendering environments between the virtual machine 401 and the host machine 402 can be shielded.
宿主机402的3D渲染中间指令模块4022可以为每一路虚拟GPU 403创建对应的渲染上下文,并负责将从虚拟GPU 403的前端驱动4031接收到的IR数据解析为本机物理GPU 4021支持的目标渲染指令,该目标渲染指令可以为3D API调用,比如可以是Vulkan API的调用,其中的Vulkan是一个跨平台的2D和3D绘图应用程序接口。The 3D rendering intermediate instruction module 4022 of the host machine 402 can create a corresponding rendering context for each virtual GPU 403, and is responsible for parsing the IR data received from the front-end driver 4031 of the virtual GPU 403 to the target rendering supported by the local physical GPU 4021 instruction, the target rendering instruction can be a 3D API call, such as a Vulkan API call, where Vulkan is a cross-platform 2D and 3D drawing application program interface.
GPU分发模块4023负责管理物理GPU 4021。当3D渲染中间指令模块4022发送的目标渲染指令到达时,能够为该目标渲染指令选择一个合适的物理GPU 4021进行渲染。一种实施例中,选择物理GPU的策略可以是以物理GPU的利用率为参考,优先选择相对闲置的物理GPU作为目标物理GPU,即选择利用率最低的物理GPU作为目标物理GPU。这样,同一渲染上下文,也即同一3D应用的渲染便可以在同一个物理GPU上执行。The GPU distribution module 4023 is responsible for managing the physical GPU 4021. When the target rendering instruction sent by the 3D rendering intermediate instruction module 4022 arrives, a suitable physical GPU 4021 can be selected for rendering the target rendering instruction. In one embodiment, the strategy for selecting a physical GPU may take the utilization rate of the physical GPU as a reference, and preferentially select a relatively idle physical GPU as the target physical GPU, that is, select the physical GPU with the lowest utilization rate as the target physical GPU. In this way, the rendering of the same rendering context, that is, the rendering of the same 3D application, can be executed on the same physical GPU.
本申请实施例提供的3D渲染系统,能够以虚拟机上运行的3D应用为最小渲染颗粒,并为每个3D应用创建专有的虚拟GPU显卡,即为每一个3D应用设置一个独立的虚拟GPU,该虚拟GPU可以将该3D应用的渲染指令下发至选定的目标物理GPU进行执行。这样,可以将同一个虚拟机的多个3D应用的渲染指令以3D应用为最小颗粒进行区分,并将各3D应用的渲染指令分发至不同的物理GPU硬件,从而避免了一个虚拟机仅对应一个物理GPU且该虚拟机同时运行多个渲染3D应用时造成的该虚拟机对应物理GPU负担过重的问题;而且,在该方案中,一个虚拟GPU只负责管理一个3D应用的渲染上下文,可以避免因一个虚拟GPU管理多个渲染上下文环境而导致的虚拟GPU需要频繁地进行上下文切换、同步、排队等影响性能的问题,提高了系统的渲染性能。The 3D rendering system provided by the embodiments of the present application can take the 3D application running on the virtual machine as the smallest rendering particle, and create a dedicated virtual GPU graphics card for each 3D application, that is, set an independent virtual GPU for each 3D application , the virtual GPU can deliver the rendering instruction of the 3D application to the selected target physical GPU for execution. In this way, the rendering instructions of multiple 3D applications of the same virtual machine can be distinguished by taking the 3D application as the smallest particle, and the rendering instructions of each 3D application can be distributed to different physical GPU hardware, thus avoiding that one virtual machine corresponds to only one The physical GPU and the virtual machine running multiple rendering 3D applications at the same time cause the virtual machine's corresponding physical GPU to be overburdened; moreover, in this solution, one virtual GPU is only responsible for managing the rendering context of one 3D application, which can avoid Because one virtual GPU manages multiple rendering contexts, the virtual GPU needs to frequently perform context switching, synchronization, queuing and other issues affecting performance, which improves the rendering performance of the system.
上述实施例以一个宿主机对应一个虚拟机为例来进行说明,实际应用中 也可以是一个宿主机对应多个虚拟机,比如,如图7所示,一个宿主机可以对应两个虚拟机,这两个虚拟机可以分别运行至少一个3D应用,对于每一个虚拟机,其上运行的每个3D应用都对应一个独立的虚拟GPU。宿主机可以对来自这两个虚拟机的3D渲染指令同时进行管理,为每一个3D渲染指令选定目标物理GPU。The above embodiment is described by taking one host machine corresponding to one virtual machine as an example. In practical applications, one host machine may also correspond to multiple virtual machines. For example, as shown in FIG. 7 , one host machine may correspond to two virtual machines. The two virtual machines can respectively run at least one 3D application, and for each virtual machine, each 3D application running on the virtual machine corresponds to an independent virtual GPU. The host can manage the 3D rendering instructions from the two virtual machines at the same time, and select the target physical GPU for each 3D rendering instruction.
基于上述图6对应实施例的3D渲染系统,本申请实施例还提供一种具体的3D渲染方法,至少可以应用于上述图6对应实施例的3D渲染系统。如图8所示,该方法可以包括如下步骤:Based on the 3D rendering system of the above embodiment corresponding to FIG. 6 , the embodiment of the present application further provides a specific 3D rendering method, which can be at least applied to the 3D rendering system of the above embodiment corresponding to FIG. 6 . As shown in Figure 8, the method may include the following steps:
步骤801:获取至少一个3D应用发送的3D渲染指令。Step 801: Obtain a 3D rendering instruction sent by at least one 3D application.
虚拟机401上可以运行至少一个3D应用,当虚拟机上的3D应用发起3D渲染指令时,比如发起3D API调用时,虚拟机上的3D渲染入口模块4011会捕获该3D渲染指令。At least one 3D application can run on the virtual machine 401. When the 3D application on the virtual machine initiates a 3D rendering instruction, for example, when a 3D API call is initiated, the 3D rendering entry module 4011 on the virtual machine will capture the 3D rendering instruction.
步骤802:判断是否为3D应用创建了对应的虚拟GPU。Step 802: Determine whether a corresponding virtual GPU is created for the 3D application.
3D渲染入口模块4011获取到至少一个3D应用发送的3D渲染指令之后,判断是否为该3D应用创建了对应的虚拟GPU节点,即虚拟GPU显卡,若已创建,则执行步骤804,否则执行步骤803。After obtaining the 3D rendering instruction sent by at least one 3D application, the 3D rendering entry module 4011 determines whether a corresponding virtual GPU node, that is, a virtual GPU graphics card, has been created for the 3D application. If it has been created, execute step 804, otherwise execute step 803 .
步骤803:为3D应用创建对应的虚拟GPU。Step 803: Create a corresponding virtual GPU for the 3D application.
3D渲染入口模块4011若判断出未为3D应用创建对应的虚拟GPU,则为该3D应用新建一个虚拟GPU节点,然后执行步骤804。If the 3D rendering entry module 4011 determines that the corresponding virtual GPU has not been created for the 3D application, it will create a new virtual GPU node for the 3D application, and then step 804 is executed.
步骤804:将3D渲染指令发送给3D应用对应的虚拟GPU。Step 804: Send the 3D rendering instruction to the virtual GPU corresponding to the 3D application.
3D渲染入口模块4011判断出为3D应用创建了对应的虚拟GPU之后,或者为3D应用新建一个虚拟GPU之后,将3D渲染指令发送给3D应用对应的虚拟GPU。The 3D rendering entry module 4011 determines that after creating a corresponding virtual GPU for the 3D application, or after creating a new virtual GPU for the 3D application, the 3D rendering instruction is sent to the virtual GPU corresponding to the 3D application.
其中,虚拟GPU是一个连接并运行在虚拟机和宿主机上的虚拟设备,其可以包括前端驱动和后端驱动,前端驱动运行在虚拟机401上,后端驱动运行在宿主机403上。具体的,3D渲染入口模块4011可以将3D渲染指令发送给3D应用对应的虚拟GPU的前端驱动。The virtual GPU is a virtual device connected to and running on the virtual machine and the host, which may include a front-end driver and a back-end driver. The front-end driver runs on the virtual machine 401 and the back-end driver runs on the host 403 . Specifically, the 3D rendering entry module 4011 can send the 3D rendering instruction to the front-end driver of the virtual GPU corresponding to the 3D application.
比如,虚拟机401上运行的3D应用1和3D应用2分别发起了3D渲染 指令,3D渲染入口模块4011捕获到该3D渲染指令之后,判断是否为3D应用1和3D应用2分别创建了对应的虚拟GPU,假设已经为3D应用1创建了虚拟GPU1,而未为3D应用2创建虚拟GPU,则3D渲染入口模块4011会将3D应用1发起的3D渲染指令发送给虚拟GPU1的前端驱动,同时会为3D应用2创建虚拟GPU2后再将3D应用2发起的3D渲染指令发送给虚拟GPU2的前端驱动。For example, 3D application 1 and 3D application 2 running on the virtual machine 401 respectively initiate a 3D rendering instruction, and after capturing the 3D rendering instruction, the 3D rendering entry module 4011 determines whether the corresponding 3D application 1 and 3D application 2 have been created respectively. Virtual GPU, assuming that virtual GPU1 has been created for 3D application 1, but not for 3D application 2, the 3D rendering entry module 4011 will send the 3D rendering command initiated by 3D application 1 to the front-end driver of virtual GPU1, and will After creating the virtual GPU2 for the 3D application 2, the 3D rendering instruction initiated by the 3D application 2 is sent to the front-end driver of the virtual GPU2.
步骤805:对3D渲染指令进行解析得到IR数据。Step 805: Parse the 3D rendering instruction to obtain IR data.
对于每个虚拟GPU,在接收到3D渲染入口模块4011发送的3D渲染指令之后,对该3D渲染指令进行解析,得到IR数据,并将该IR数据发送给宿主机。通过将3D渲染指令解析为IR数据,可以屏蔽虚拟机和宿主机之间的操作系统和渲染环境的差异。For each virtual GPU, after receiving the 3D rendering instruction sent by the 3D rendering entry module 4011, the 3D rendering instruction is parsed to obtain IR data, and the IR data is sent to the host. By parsing 3D rendering instructions into IR data, differences in operating systems and rendering environments between the virtual machine and the host can be shielded.
具体的,由虚拟GPU的前端驱动对3D渲染入口模块4011发送的3D渲染指令进行解析,生成IR数据,然后将该IR数据发送给虚拟GPU的后端驱动;虚拟GPU的后端驱动再将该IR数据发送给宿主机402的3D渲染中间指令模块4022。Specifically, the front-end driver of the virtual GPU parses the 3D rendering instruction sent by the 3D rendering entry module 4011, generates IR data, and then sends the IR data to the back-end driver of the virtual GPU; the back-end driver of the virtual GPU then interprets the IR data. The IR data is sent to the 3D rendering intermediate instruction module 4022 of the host computer 402 .
步骤806:根据IR数据生成目标渲染指令。Step 806: Generate a target rendering instruction according to the IR data.
宿主机402的3D渲染中间指令模块4022接收到虚拟GPU发送的IR数据之后,根据该IR数据生成目标渲染指令,比如可以通过解析IR数据生成目标渲染指令,这样便可以将IR数据还原为宿主机402支持的数据格式,得到目标渲染指令。然后,3D渲染中间指令模块4022将该目标渲染指令发送给GPU分发模块4023。After the 3D rendering intermediate instruction module 4022 of the host computer 402 receives the IR data sent by the virtual GPU, it generates a target rendering instruction according to the IR data. For example, the target rendering instruction can be generated by parsing the IR data, so that the IR data can be restored to the host computer. 402 Supported data format, get the target rendering instruction. Then, the 3D rendering intermediate instruction module 4022 sends the target rendering instruction to the GPU distribution module 4023 .
步骤807:选定目标物理GPU。Step 807: Select a target physical GPU.
GPU分发模块4023接收到3D渲染中间指令模块4022发送的目标渲染指令之后,可以根据预设规则从其管理的至少一个物理GPU中选定目标物理GPU。具体的,GPU分发模块4023可以根据宿主机402所管理的各物理GPU的利用率,选择GPU利用率最低的物理GPU作为目标物理GPU。After the GPU distribution module 4023 receives the target rendering instruction sent by the 3D rendering intermediate instruction module 4022, it can select a target physical GPU from at least one physical GPU managed by it according to a preset rule. Specifically, the GPU distribution module 4023 may select the physical GPU with the lowest GPU utilization rate as the target physical GPU according to the utilization rate of each physical GPU managed by the host machine 402 .
步骤808:将目标渲染指令发送给目标物理GPU。Step 808: Send the target rendering instruction to the target physical GPU.
GPU分发模块4023选定目标物理GPU之后,将目标渲染指令发送给选定的目标物理GPU。After the GPU distribution module 4023 selects the target physical GPU, it sends the target rendering instruction to the selected target physical GPU.
步骤809:执行目标渲染指令。Step 809: Execute the target rendering instruction.
目标物理GPU接收到目标渲染指令之后,执行该目标渲染指令。After the target physical GPU receives the target rendering instruction, it executes the target rendering instruction.
在本申请中,同一虚拟机的不同3D应用,可以被分发至不同的物理GPU;不同虚拟机的不同3D应用,可以被分发至相同的物理GPU。具体的,分发物理GPU的选择策略可以为优先选择处于闲置状态的物理GPU,这样可以解决宿主机中多个物理GPU忙闲不均的问题。In this application, different 3D applications of the same virtual machine can be distributed to different physical GPUs; different 3D applications of different virtual machines can be distributed to the same physical GPU. Specifically, the selection strategy for distributing the physical GPUs may be to preferentially select the physical GPUs in an idle state, which can solve the problem of uneven busyness and idleness of multiple physical GPUs in the host.
可以理解的,从渲染数据流角度来看,一个虚拟机运行的3D应用的所有渲染指令,始终发送至宿主机的一个物理GPU,直到该3D应用退出时渲染流程结束,对应的虚拟GPU和物理GPU被释放。可以避免虚拟GPU驱动和物理GPU驱动频繁地进行上下文切换、同步、排队等影响性能的操作,提高了渲染效率。Understandably, from the perspective of rendering data flow, all rendering instructions of a 3D application run by a virtual machine are always sent to a physical GPU of the host machine, until the rendering process ends when the 3D application exits, and the corresponding virtual GPU and physical GPU is released. The virtual GPU driver and the physical GPU driver can avoid frequently performing context switching, synchronization, queuing and other operations that affect performance, thereby improving rendering efficiency.
本申请实施例提供的3D渲染方法,当虚拟机上的3D应用发起3D渲染指令时,3D渲染入口模块捕获该3D渲染指令,判断是否为该3D应用创建了对应的虚拟GPU,若已创建,则将3D渲染指令发送给3D应用对应的虚拟GPU;若未创建,则为3D应用创建对应的虚拟GPU,然后将3D渲染指令发送给3D应用对应的虚拟GPU;虚拟GPU对3D渲染指令进行解析得到IR数据并将该IR数据发生给宿主机的3D渲染中间指令模块;的3D渲染中间指令模块根据IR数据生成目标渲染指令,并将该目标渲染指令发送给GPU分发模块;GPU分发模块选定利用率最低的物理GPU为目标物理GPU,将目标渲染指令发送给目标物理GPU,以使目标物理GPU执行目标渲染指令。能够将同一个虚拟机的多个3D应用的3D渲染指令以3D应用为最小颗粒进行区分,并将各3D应用的3D渲染指令分发至不同的物理GPU硬件,不再是一个虚拟机仅对应一个物理GPU,这样,当虚拟机同时运行多个重度渲染的3D应用时,便可以避免该虚拟机对应的物理GPU负担过重的问题。同时,一个虚拟GPU只负责管理一个3D应用的渲染上下文,可以避免一个虚拟GPU因管理多个渲染上下文环境而导致虚拟GPU驱动需要频繁地进行上下文切换、同步、排队等影响性能的问题,提高了3D渲染的效率。In the 3D rendering method provided by the embodiment of the present application, when a 3D application on a virtual machine initiates a 3D rendering instruction, the 3D rendering entry module captures the 3D rendering instruction, and determines whether a corresponding virtual GPU has been created for the 3D application, and if so, Then send the 3D rendering instruction to the virtual GPU corresponding to the 3D application; if not, create a corresponding virtual GPU for the 3D application, and then send the 3D rendering instruction to the virtual GPU corresponding to the 3D application; the virtual GPU parses the 3D rendering instruction Obtain IR data and send the IR data to the 3D rendering intermediate instruction module of the host; the 3D rendering intermediate instruction module generates a target rendering instruction according to the IR data, and sends the target rendering instruction to the GPU distribution module; the GPU distribution module selects The physical GPU with the lowest utilization is the target physical GPU, and the target rendering instruction is sent to the target physical GPU, so that the target physical GPU executes the target rendering instruction. It can distinguish the 3D rendering instructions of multiple 3D applications of the same virtual machine with the 3D application as the smallest particle, and distribute the 3D rendering instructions of each 3D application to different physical GPU hardware, no longer a virtual machine only corresponds to one In this way, when the virtual machine runs multiple 3D applications with heavy rendering at the same time, the problem that the physical GPU corresponding to the virtual machine is overburdened can be avoided. At the same time, a virtual GPU is only responsible for managing the rendering context of one 3D application, which can avoid the problem that the virtual GPU driver needs to frequently perform context switching, synchronization, queuing, etc. due to the management of multiple rendering contexts by one virtual GPU, which affects performance. Efficiency of 3D rendering.
基于上述图5和图8对应的实施例中所描述的3D渲染方法,本申请实施例还提供一种计算机可读存储介质,例如,非临时性计算机可读存储介质可以是只读存储器(英文:Read Only Memory,ROM)、随机存取存储器(英 文:Random Access Memory,RAM)、CD-ROM、磁带、软盘和光数据存储装置等。该存储介质上存储有计算机指令,用于执行上述图5和图8对应的实施例中所描述的3D渲染方法,此处不再赘述。Based on the 3D rendering methods described in the embodiments corresponding to FIG. 5 and FIG. 8 , the embodiments of the present application further provide a computer-readable storage medium, for example, the non-transitory computer-readable storage medium may be a read-only memory (English) : Read Only Memory, ROM), random access memory (English: Random Access Memory, RAM), CD-ROM, magnetic tape, floppy disk and optical data storage devices, etc. The storage medium stores computer instructions for executing the 3D rendering methods described in the embodiments corresponding to FIG. 5 and FIG. 8 , and details are not described herein again.
本领域技术人员在考虑说明书及实践这里公开的内容后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由所附的权利要求指出。Other embodiments of the present application will readily occur to those skilled in the art upon consideration of the specification and practice of what is disclosed herein. This application is intended to cover any variations, uses or adaptations of this application that follow the general principles of this application and include common knowledge or conventional techniques in the technical field not disclosed in this application . The specification and examples are to be regarded as exemplary only, with the true scope and spirit of the application being indicated by the appended claims.
应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本申请的范围仅由所附的权利要求来限制。It is to be understood that the present application is not limited to the precise structures described above and illustrated in the accompanying drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

  1. 一种3D渲染方法,其特征在于,所述方法包括:A 3D rendering method, characterized in that the method comprises:
    虚拟机获取至少一个3D应用发送的3D渲染指令;The virtual machine obtains a 3D rendering instruction sent by at least one 3D application;
    所述虚拟机将每个3D渲染指令发送给与所述3D应用对应的虚拟图形处理器GPU,其中,每个所述3D应用对应有一个独立的虚拟GPU;The virtual machine sends each 3D rendering instruction to a virtual graphics processor GPU corresponding to the 3D application, wherein each 3D application corresponds to an independent virtual GPU;
    虚拟GPU对接收到的3D渲染指令进行解析,得到中间表示IR数据,并将所述IR数据发送给宿主机;The virtual GPU parses the received 3D rendering instruction, obtains intermediate representation IR data, and sends the IR data to the host;
    宿主机根据所述IR数据生成目标渲染指令,并将所述目标渲染指令发送给目标物理GPU,以便所述目标物理GPU执行所述目标渲染指令。The host computer generates a target rendering instruction according to the IR data, and sends the target rendering instruction to the target physical GPU, so that the target physical GPU executes the target rendering instruction.
  2. 根据权利要求1所述的3D渲染方法,其特征在于,所述虚拟机将每个3D渲染指令发送给与所述3D应用对应的虚拟图形处理器GPU包括:The 3D rendering method according to claim 1, wherein the virtual machine sending each 3D rendering instruction to a virtual graphics processor (GPU) corresponding to the 3D application comprises:
    所述虚拟机判断是否为所述3D应用创建了对应的虚拟GPU;The virtual machine determines whether a corresponding virtual GPU is created for the 3D application;
    若已创建,则将所述3D渲染指令发送给所述3D应用对应的虚拟GPU。If it has been created, the 3D rendering instruction is sent to the virtual GPU corresponding to the 3D application.
  3. 根据权利要求2所述的3D渲染方法,其特征在于,所述虚拟机在判断是否为所述3D应用创建了对应的虚拟GPU之后,所述方法还包括:The 3D rendering method according to claim 2, wherein after the virtual machine determines whether a corresponding virtual GPU is created for the 3D application, the method further comprises:
    若未为所述3D应用创建对应的虚拟GPU,则为所述3D应用创建对应的虚拟GPU;If the corresponding virtual GPU is not created for the 3D application, create a corresponding virtual GPU for the 3D application;
    将所述3D渲染指令发送给所述3D应用对应的虚拟GPU。Send the 3D rendering instruction to the virtual GPU corresponding to the 3D application.
  4. 根据权利要求1所述的3D渲染方法,其特征在于,所述将所述目标渲染指令发送给目标物理GPU之前,所述方法还包括:The 3D rendering method according to claim 1, wherein before the sending the target rendering instruction to the target physical GPU, the method further comprises:
    宿主机根据预设规则从至少一个物理GPU中选定目标物理GPU。The host computer selects a target physical GPU from at least one physical GPU according to a preset rule.
  5. 根据权利要求4所述的3D渲染方法,其特征在于,所述宿主机根据预设规则从至少一个物理GPU中选定目标物理GPU包括:The 3D rendering method according to claim 4, wherein the host computer selects a target physical GPU from at least one physical GPU according to a preset rule, comprising:
    宿主机从其管理的至少一个物理GPU中选择利用率最低的物理GPU作为目标物理GPU。The host selects the physical GPU with the lowest utilization rate as the target physical GPU from at least one physical GPU managed by the host.
  6. 一种3D渲染系统,其特征在于,包括虚拟机、宿主机、至少一个虚拟图形处理器GPU和至少一个物理GPU,所述虚拟机上运行有至少一个3D应用,每个3D应用对应一个独立的虚拟GPU,所述宿主机包括至少一个物理GPU;A 3D rendering system, characterized in that it includes a virtual machine, a host machine, at least one virtual graphics processing unit (GPU) and at least one physical GPU, wherein at least one 3D application runs on the virtual machine, and each 3D application corresponds to an independent a virtual GPU, the host machine includes at least one physical GPU;
    所述虚拟机,用于获取至少一个3D应用发送的3D渲染指令,将每个3D渲染指令发送给与所述3D应用对应的虚拟GPU;The virtual machine is configured to obtain a 3D rendering instruction sent by at least one 3D application, and send each 3D rendering instruction to a virtual GPU corresponding to the 3D application;
    所述虚拟GPU,用于对接收到的3D渲染指令进行解析,得到中间表示IR数据,并将所述IR数据发送给所述宿主机;The virtual GPU is used to parse the received 3D rendering instruction, obtain intermediate representation IR data, and send the IR data to the host;
    所述宿主机,用于根据所述IR数据生成目标渲染指令,并将所述目标渲染指令发送给目标物理GPU;The host machine is used to generate a target rendering instruction according to the IR data, and send the target rendering instruction to the target physical GPU;
    所述物理GPU,用于执行接收到的目标渲染指令。The physical GPU is used to execute the received target rendering instruction.
  7. 根据权利要求6所述的3D渲染系统,其特征在于,所述虚拟机具体用于获取至少一个3D应用发送的3D渲染指令,判断是否为所述3D应用创建了对应的虚拟GPU,若已创建,则将所述3D渲染指令发送给所述3D应用对应的虚拟GPU;若未创建,则为所述3D应用创建对应的虚拟GPU,然后将所述3D渲染指令发送给所述3D应用对应的虚拟GPU。The 3D rendering system according to claim 6, wherein the virtual machine is specifically configured to obtain a 3D rendering instruction sent by at least one 3D application, and determine whether a corresponding virtual GPU has been created for the 3D application, and if a virtual GPU has been created , then send the 3D rendering instruction to the virtual GPU corresponding to the 3D application; if not, create a corresponding virtual GPU for the 3D application, and then send the 3D rendering instruction to the corresponding virtual GPU of the 3D application Virtual GPU.
  8. 根据权利要求6所述的3D渲染系统,其特征在于,所述宿主机具体用于根据预设规则从所述至少一个物理GPU中选定一个物理GPU,得到目标物理GPU,并将所述目标渲染指令发送给所述目标物理GPU。The 3D rendering system according to claim 6, wherein the host is specifically configured to select a physical GPU from the at least one physical GPU according to a preset rule, obtain a target physical GPU, and convert the target physical GPU to the target physical GPU. Rendering instructions are sent to the target physical GPU.
  9. 根据权利要求8所述的渲染系统,其特征在于,所述宿主机具体用于从所述至少一个物理GPU中选择利用率最低的一个物理GPU作为目标物理GPU。The rendering system according to claim 8, wherein the host is specifically configured to select a physical GPU with the lowest utilization rate from the at least one physical GPU as the target physical GPU.
  10. 根据权利要求6所述的3D渲染系统,其特征在于,所述虚拟GPU包括前端驱动和后端驱动;The 3D rendering system according to claim 6, wherein the virtual GPU comprises a front-end driver and a back-end driver;
    所述前端驱动运行在所述虚拟机上,用于对接收到的3D渲染指令进行解析,得到中间表示IR数据,并将所述IR数据发送给所述后端驱动;The front-end driver runs on the virtual machine, and is used to parse the received 3D rendering instruction, obtain intermediate representation IR data, and send the IR data to the back-end driver;
    所述后端驱动运行在所述宿主机上,用于将所述IR数据发送给所述宿主机。The back-end driver runs on the host, and is used for sending the IR data to the host.
PCT/CN2020/130407 2020-08-28 2020-11-20 3d rendering method and system WO2022041507A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010885789.9A CN112102457A (en) 2020-08-28 2020-08-28 3D rendering method and system
CN202010885789.9 2020-08-28

Publications (1)

Publication Number Publication Date
WO2022041507A1 true WO2022041507A1 (en) 2022-03-03

Family

ID=73758303

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/130407 WO2022041507A1 (en) 2020-08-28 2020-11-20 3d rendering method and system

Country Status (2)

Country Link
CN (1) CN112102457A (en)
WO (1) WO2022041507A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112991505B (en) * 2021-04-16 2022-02-18 辽宁向日葵教育科技有限公司 Online 3D rendering method
CN113240571A (en) * 2021-05-07 2021-08-10 西安万像电子科技有限公司 Image processing system, method and program
CN113485773A (en) * 2021-06-24 2021-10-08 锐捷网络(苏州)有限公司 Data processing method, device and system
CN115686758B (en) * 2023-01-03 2023-03-21 麒麟软件有限公司 VirtIO-GPU performance controllable method based on frame statistics

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102819460A (en) * 2012-08-07 2012-12-12 清华大学 Budget power guidance-based high-energy-efficiency GPU (Graphics Processing Unit) cluster system scheduling algorithm
CN103631634A (en) * 2012-08-24 2014-03-12 中国电信股份有限公司 Graphics processor virtualization achieving method and device
US20180373546A1 (en) * 2017-06-22 2018-12-27 Vmware, Inc. Hybrid software and gpu encoding for ui remoting
CN111488196A (en) * 2020-04-13 2020-08-04 西安万像电子科技有限公司 Rendering method and device, storage medium and processor

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102819460A (en) * 2012-08-07 2012-12-12 清华大学 Budget power guidance-based high-energy-efficiency GPU (Graphics Processing Unit) cluster system scheduling algorithm
CN103631634A (en) * 2012-08-24 2014-03-12 中国电信股份有限公司 Graphics processor virtualization achieving method and device
US20180373546A1 (en) * 2017-06-22 2018-12-27 Vmware, Inc. Hybrid software and gpu encoding for ui remoting
CN111488196A (en) * 2020-04-13 2020-08-04 西安万像电子科技有限公司 Rendering method and device, storage medium and processor

Also Published As

Publication number Publication date
CN112102457A (en) 2020-12-18

Similar Documents

Publication Publication Date Title
WO2022041507A1 (en) 3d rendering method and system
CN111488196B (en) Rendering method and device, storage medium and processor
JP5902175B2 (en) GPU load balancing technique for virtual machines
JP4921384B2 (en) Method, apparatus and system for dynamically reallocating memory from one virtual machine to another
US20120054740A1 (en) Techniques For Selectively Enabling Or Disabling Virtual Devices In Virtual Environments
CN110192182B (en) Dynamic and dedicated virtualized graphics processing
US9798565B2 (en) Data processing system and method having an operating system that communicates with an accelerator independently of a hypervisor
US8872835B2 (en) Prevention of DoS attack by a rogue graphics application
WO2021008183A1 (en) Data transmission method and apparatus, and server
JP2006190281A (en) System and method for virtualizing graphic subsystem
CN102495769A (en) Dynamic virtual device failure recovery
JP2022516486A (en) Resource management methods and equipment, electronic devices, and recording media
US9104452B2 (en) Hybrid remote sessions
CN113312142A (en) Virtualization processing system, method, device and equipment
CN110659103A (en) Resource allocation method and device
WO2021008185A1 (en) Data transmission method and apparatus, and server
CN112000439A (en) Method for realizing cloud native application management virtual machine
CN115526770A (en) Scaling for virtualized graphics processing
KR102001641B1 (en) Method and apparatus for managing gpu resource in virtualization environment
CN112506646A (en) Video memory allocation method and device
US20150381766A1 (en) Application transfer system, application transfer method, terminal, and program
CN107766122B (en) Method and device for setting available memory space of host machine
CN109271179B (en) Virtual machine application program management method, device, equipment and readable storage medium
CN115546008B (en) GPU (graphics processing Unit) virtualization management system and method
CN111752673A (en) Image processing method, first server and system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20951175

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20951175

Country of ref document: EP

Kind code of ref document: A1