A device virtualization management method, device, medium and program product
By equally abstracting and dividing the physical resources of computing acceleration devices and managing them using combined templates, the problems of high cost and inflexible resource configuration in virtualization schemes for computing acceleration devices are solved, enabling flexible resource configuration and efficient utilization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING SUIYUAN INTELLIGENT TECH CO LTD
- Filing Date
- 2026-04-20
- Publication Date
- 2026-07-21
AI Technical Summary
Virtualization solutions for computing acceleration devices are costly, complex to implement, and lack flexible resource allocation, thus failing to fully utilize computing power.
By equally abstracting and dividing the physical resources of computing acceleration devices, creating resource slice combination templates, creating target virtual instances based on virtual instance creation requests, and executing computing tasks based on the target virtual instances mapped to physical resources, flexible resource configuration is achieved.
It implements resource sharding at the software level, reduces costs, improves resource utilization, is applicable to various computing acceleration devices, and meets the flexible configuration needs of different workloads.
Smart Images

Figure CN122431791A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of resource management technology, and in particular to a device virtualization management method, device, medium, and program product. Background Technology
[0002] With the rapid development of artificial intelligence and deep learning technologies, computing acceleration devices such as GPUs (Graphics Processing Units) and NPUs (Neural Processing Units) are widely used in data centers and cloud computing environments.
[0003] A single workload often cannot fully utilize the computing power of a compute acceleration device, resulting in a large number of idle memory resources in the compute cores of the device. However, the virtualization resources of current compute acceleration devices cannot be flexibly configured according to workload needs. Furthermore, the virtualization solutions of compute acceleration devices rely on hardware virtualization features, requiring dedicated hardware support, which is complex and costly to implement. Summary of the Invention
[0004] This invention provides a device virtualization management method, device, medium, and program product to solve the problems of high cost, complex implementation, and inflexible resource allocation in the implementation of computing acceleration device virtualization.
[0005] According to one aspect of the present invention, a device virtualization management method is provided, comprising: The physical resources of the computing acceleration device are equally abstracted and divided according to the preset number of slices to obtain the initial resource slices; Determine the resource slice combination template based on the required number of slices and the initialized resource slices; Create the target virtual instance based on the virtual instance creation request of the computing acceleration device and the resource slice combination template; Execute computational tasks based on physical resources mapped from the target virtual instance.
[0006] According to another aspect of the present invention, a device virtualization management apparatus is provided, comprising: The resource partitioning module is used to equally abstractly partition the physical resources of the computing acceleration device according to the preset number of slices to obtain the initial resource slices. The slice combination template determination module is used to determine the resource slice combination template according to the required number of slices and the initialized resource slices; The virtual instance creation module is used to create a target virtual instance based on the virtual instance creation request of the computing acceleration device and the resource slice combination template. The computation task execution module is used to execute computation tasks based on the physical resources mapped to the target virtual instance.
[0007] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: At least one processor; and a memory communicatively connected to said at least one processor; The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the device virtualization management method according to any embodiment of the present invention.
[0008] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the device virtualization management method according to any embodiment of the present invention.
[0009] According to another aspect of the present invention, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, implements the device virtualization management method according to any embodiment of the present invention.
[0010] The technical solution of this invention involves equally abstracting and dividing the physical resources of a computing acceleration device according to a preset number of slices to obtain initial resource slices. Then, based on the required number of slices and the initial resource slices, a resource slice combination template is determined. Subsequently, a target virtual instance is created based on the virtual instance creation request of the computing acceleration device and the resource slice combination template, and computing tasks are executed based on the physical resources mapped to the target virtual instance. This solution implements resource sharding at the software level, without relying on hardware virtualization features. It is simple to implement, low in cost, and highly flexible, applicable to various computing acceleration devices. Furthermore, the different resource combinations in the resource slice combination template can meet the flexible configuration needs of users according to workload requirements, enabling a single computing acceleration device to run multiple independent workloads simultaneously, significantly improving resource utilization. This solves the problems of high cost, complex implementation, and inflexible resource configuration in computing acceleration device virtualization, enabling flexible configuration of virtualized resources without relying on hardware virtualization features.
[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 A flowchart of a device virtualization management method provided in Embodiment 1 of the present invention; Figure 2 This is a flowchart of a device virtualization management method provided in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of the initial resource slice partitioning result provided in Embodiment 3 of the present invention; Figure 4 This is a schematic diagram of the creation process of a target virtual instance provided in Embodiment 3 of the present invention; Figure 5 This is a logical schematic diagram of a multi-process shared virtual instance within a container provided in Embodiment 3 of the present invention; Figure 6 A schematic diagram of a system architecture for software-based device virtualization management; Figure 7 This is a schematic diagram of the structure of a device virtualization management device provided in Embodiment 4 of the present invention; Figure 8 A schematic diagram of an electronic device that can be used to implement embodiments of the present invention is shown. Detailed Implementation
[0014] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0015] It should be noted that the terms "current," "target," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0016] Example 1 Figure 1 This is a flowchart of a device virtualization management method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations where virtualization resources of computing acceleration devices can be flexibly configured. This method can be executed by a device virtualization management device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes: Step 110: Divide the physical resources of the computing acceleration device into equal abstract portions according to the preset number of slices to obtain the initial resource slices.
[0017] The preset number of slices can be a pre-set number of partitions for physical resources. Physical resources can include, but are not limited to, the cores, memory, and cache of the computing acceleration device. Equal abstract partitioning can be an abstract, equal partitioning operation of physical resources. Initialized resource slices can be resource slices obtained by equally abstract partitioning the physical resources of the computing acceleration device. Each initialized resource slice includes the same number of cores, memory size, and cache size, and each initialized resource slice also has a corresponding resource slice status, such as available or allocated.
[0018] In this embodiment of the invention, a preset number of slices can be obtained as needed, and then the physical resources of the computing acceleration device can be equally abstracted and divided according to the preset number of slices, that is, the logical resources corresponding to the physical resources can be equally divided according to the preset number of slices to obtain the initial resource slices.
[0019] Step 120: Determine the resource slice combination template according to the required number of slices and the initialized resource slices.
[0020] The required number of slices can be determined by a factor of the preset number of slices. For example, assuming the preset number of slices is 6, the required number of slices could be 1, 2, 3, or 6. The resource slice combination template can be a table recording relevant data for initializing resource slices under different combinations. The resource slice combination template can include fields such as template identifier (resource slice combination identifier), required number of slices, number of cores, memory size, and maximum number of available virtual instances. Each required number of slices in the same resource slice combination template corresponds to one template identifier.
[0021] In this embodiment of the invention, the required number of slices can be determined according to the possible combination granularity of resource slices, and the initial resource slices can be combined according to the required number of slices, thereby summarizing the relevant data of the resource slice combination corresponding to the required number of slices and obtaining the resource slice combination template.
[0022] Step 130: Create the target virtual instance based on the virtual instance creation request of the computing acceleration device and the resource slice combination template.
[0023] The virtual instance creation request can be a structured instruction issued by the user to create a virtual instance. The target virtual instance can be a virtualized computing acceleration device created based on the virtual instance creation request; it can be understood as a virtual, independent computing acceleration device.
[0024] In this embodiment of the invention, the virtual instance creation request of the computing acceleration device can be parsed to determine the logical resources required to be allocated to the virtual instance to be created. When the logical resources required to be allocated to the virtual instance to be created are successfully matched with the resource slice combination template, the target virtual instance is created according to the resource slice combination that is successfully matched in the resource slice combination template.
[0025] Step 140: Execute computation tasks based on the physical resources mapped to the target virtual instance.
[0026] In this embodiment of the invention, a mapping between a target virtual instance and its corresponding physical resources can be established through the mapping relationship between the logical resources of the target virtual instance and the physical resources of the computing acceleration device, thereby executing computing tasks based on the physical resources mapped by the target virtual instance.
[0027] The technical solution of this invention involves equally abstracting and dividing the physical resources of a computing acceleration device according to a preset number of slices to obtain initial resource slices. Then, based on the required number of slices and the initial resource slices, a resource slice combination template is determined. Subsequently, a target virtual instance is created based on the virtual instance creation request of the computing acceleration device and the resource slice combination template, and computing tasks are executed based on the physical resources mapped to the target virtual instance. This solution implements resource sharding at the software level, without relying on hardware virtualization features. It is simple to implement, low in cost, and highly flexible, applicable to various computing acceleration devices. Furthermore, the different resource combinations in the resource slice combination template can meet the flexible configuration needs of users according to workload requirements, enabling a single computing acceleration device to run multiple independent workloads simultaneously, significantly improving resource utilization. This solves the problems of high cost, complex implementation, and inflexible resource configuration in computing acceleration device virtualization, enabling flexible configuration of virtualized resources without relying on hardware virtualization features.
[0028] Example 2 Figure 2 This is a flowchart of a device virtualization management method provided in Embodiment 2 of the present invention. This embodiment is based on the above embodiment and provides a specific optional implementation method for determining the resource slice combination template according to the required number of slices and the initialized resource slices. Figure 2 As shown, the method includes: Step 210: Divide the physical resources of the computing acceleration device into equal abstract portions according to the preset number of slices to obtain the initial resource slices.
[0029] Step 220: Calculate the number of virtual instances corresponding to the required number of slices based on the required number of slices and the preset number of slices.
[0030] The number of virtual instances can be the number of virtual, independent computing acceleration devices.
[0031] In this embodiment of the invention, the quotient of the preset number of slices and the required number of slices can be calculated, and the calculated quotient can be used as the number of virtual instances corresponding to the required number of slices, that is, the product of the required number of slices and the number of virtual instances corresponding to the required number of slices, which is the preset number of slices.
[0032] Step 230: Generate a template configuration array based on the required number of slices, the number of virtual instances corresponding to the required number of slices, and the logical resource quantity for initializing resource slices.
[0033] Here, logical resource quantity can be the resource quota of logical resources. Template configuration array can be the configuration data of field values in the resource slice combination template.
[0034] In this embodiment of the invention, the number of virtual instances corresponding to the required number of slices can be determined based on the required number of slices, and the logical resource quantity corresponding to the resource slice combination corresponding to the required number of slices can be calculated according to the required number of slices and the logical resource quantity of the initialized resource slices. Thus, the required number of slices, the number of virtual instances corresponding to the required number of slices, and the logical resource quantity corresponding to the resource slice combination corresponding to the required number of slices are used as a template configuration array.
[0035] Step 240: Create a resource slice combination template based on the template configuration array.
[0036] In this embodiment of the invention, a resource slice combination template can be obtained by filling the fields in the resource slice combination template with corresponding values through a template configuration array.
[0037] Step 250: Create the target virtual instance based on the virtual instance creation request of the computing acceleration device and the resource slice combination template.
[0038] In an optional embodiment of the present invention, creating a target virtual instance based on a virtual instance creation request for a computing acceleration device and a resource slice combination template may include: parsing the virtual instance creation request for the computing acceleration device to obtain an identity identifier for the computing acceleration device and a target resource slice combination identifier; and creating a target virtual instance when the device verification is passed based on the identity identifier for the computing acceleration device and the target resource slice combination is determined to be valid based on the target resource slice combination identifier.
[0039] The computing acceleration device identifier can be an identification code for the computing acceleration device. The target resource slice combination identifier can be an identifier for a resource slice combination that satisfies the virtual instance creation request. The target resource slice combination is the resource slice combination corresponding to the target resource slice combination identifier, that is, the resource slice combination that satisfies the virtual instance creation request.
[0040] In this embodiment of the invention, the virtual instance creation request of the computing acceleration device can be parsed to obtain the identity identifier of the computing acceleration device and the target resource slice combination identifier. Based on the identity identifier of the computing acceleration device, it is verified whether to create a virtual instance for the current computing acceleration device. If a virtual instance is created for the current computing acceleration device, it indicates that the identity identifier of the computing acceleration device has passed the device verification. Then, if the target resource slice combination identifier exists in the resource slice combination template, it is determined that the target resource slice combination is valid, thereby creating a target virtual instance that meets the virtual instance creation request.
[0041] In an optional embodiment of the present invention, determining that a target resource slice combination is valid based on the target resource slice combination identifier may include: matching the target resource slice combination identifier with a resource slice combination template; and determining that the target resource slice combination is valid when the target resource slice combination identifier exists in the resource slice combination template and the resource slice to be allocated meets the resource slice allocation conditions.
[0042] The resource slice to be allocated can be a resource slice from the remaining unallocated virtual resources of the computing acceleration device, i.e., an initialization resource slice. The resource slice allocation condition can be that the virtual resources of the computing acceleration device are not fully allocated, and that the remaining unallocated virtual resources of the computing acceleration device can be used to allocate a resource slice combination corresponding to the target resource slice combination identifier.
[0043] In this embodiment of the invention, the target resource slice combination identifier can be matched with the resource slice combination template. If the target resource slice combination identifier exists in the resource slice combination template, the resource slice combination template is considered a valid template. Then, it is determined whether the resource slice to be allocated meets the resource slice allocation conditions. If the resource slice to be allocated meets the resource slice allocation conditions, the target resource slice combination is considered valid, and a virtual instance can be created according to the target resource slice combination.
[0044] In an optional embodiment of the present invention, creating a target virtual instance may include: determining a resource slice combination corresponding to a target resource slice combination identifier, and creating a target virtual instance based on the resource slice combination.
[0045] The resource slice combination can be a combination of the initial resource slices of the required number of slices.
[0046] In this embodiment of the invention, the required number of slices corresponding to the target resource slice combination identifier can be queried from the resource slice combination template, and then a target virtual instance can be created according to the required number of slices corresponding to the target resource slice combination identifier and the logical resource quantity of the initialized resource slice.
[0047] Optionally, when creating a target virtual instance, a corresponding virtual instance identifier, resource slice list, and slice mask can be created simultaneously. The virtual instance identifier can be the identity identifier of the virtual instance. Different virtual instances have different virtual instance identifiers. The resource slice list can be used to record metadata for initializing resource slices. Metadata may include, but is not limited to, slice identity identifier, resource quota, lifecycle status, and bound business type. The slice mask can be used to quickly filter resource slices of a specific type. The slice mask can be represented by a bitmap.
[0048] Step 260: Execute computation tasks based on the physical resources mapped from the target virtual instance.
[0049] In an optional embodiment of the present invention, before executing the computing task based on the physical resources mapped to the target virtual instance, the method may further include: isolating the target virtual instance based on resource isolation configuration data; updating the resource slice status of the target resource slice combination corresponding to the target virtual instance; and registering the target virtual instance to the global instance list; wherein the resource isolation configuration data includes scheduling isolation configuration data, memory isolation configuration data, and cache isolation configuration data.
[0050] The global instance list can be a data table used to record virtual instances created by the computing acceleration device. The scheduling isolation configuration data can be configuration data for scheduling isolation of virtual instances. The memory isolation configuration data can be configuration data for memory isolation of virtual instances. The cache isolation configuration data can be configuration data for cache isolation of virtual instances.
[0051] In this embodiment of the invention, at least one of the following resource isolation methods—scheduling isolation, memory isolation, and cache isolation—can be applied to the target virtual instance based on resource isolation configuration data. The resource slice status of the target resource slice combination corresponding to the target virtual instance is updated in real time. Furthermore, the created target virtual instance can be registered to the global instance list for easy access. Each virtual instance has its own exclusive resource slice, and through multi-level isolation mechanisms (scheduling, memory, cache), process-level error isolation and resource isolation can be achieved.
[0052] In an optional embodiment of the present invention, before performing computational tasks based on physical resources mapped to the target virtual instance, the method may further include: binding the target virtual instance to the target container context, and updating the instance reference count and the state of the target virtual instance; wherein all processes in the target container inherit the binding relationship between the target virtual instance and the target container context.
[0053] The target container context can be the container context to which the target virtual instance needs to be bound. The instance reference count can be the reference count of the virtual instance on the compute acceleration device. The target virtual instance state can be the virtual instance state of the target virtual instance.
[0054] In this embodiment of the invention, the target virtual instance can be bound to the target container context. After the target virtual instance is bound to the target container context, the instance reference count is incremented by one. When the instance reference count of the target virtual instance is updated to 1, it indicates that the target virtual instance needs to occupy the corresponding resource slice and cannot release the space. The state of the target virtual instance also needs to be adjusted in real time for subsequent scheduling and state query.
[0055] The technical solution of this invention involves equally abstracting and dividing the physical resources of a computing acceleration device according to a preset number of slices to obtain initial resource slices. Then, based on the required number of slices and the preset number of slices, the number of virtual instances corresponding to the required number of slices is calculated. Next, based on the required number of slices, the number of virtual instances corresponding to the required number of slices, and the logical resource quantity of the initial resource slices, a template configuration array is generated. Based on the template configuration array, a resource slice combination template is created. Finally, based on the virtual instance creation request of the computing acceleration device and the resource slice combination template, a target virtual instance is created to execute computing tasks based on the physical resources mapped to the target virtual instance. This solution implements resource sharding at the software level, without relying on hardware virtualization features. It is simple to implement, low in cost, and highly flexible, suitable for various computing acceleration devices. Furthermore, the different resource combinations in the resource slice combination template can meet the flexible configuration needs of users according to workload requirements, allowing a single computing acceleration device to run multiple independent workloads simultaneously, significantly improving resource utilization. This solves the problems of high cost, complex implementation, and inflexible resource configuration in computing acceleration device virtualization, enabling flexible configuration of virtualization resources without relying on hardware virtualization features.
[0056] Example 3 Embodiment 3 of the present invention provides an optional embodiment of a software-implemented device virtualization management method, the specific implementation of which can be found in the following embodiments. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here.
[0057] The method for implementing device virtualization management software includes the following steps: 1) During the driver initialization phase, the physical resources of the computing acceleration device are abstractly and equally divided according to a preset number of slices. Specifically, the total number of processing cores, total memory capacity, total cache capacity, and preset number of slices of the computing acceleration device are validated for validity. After passing the parameter validity validation, the resource quotas for the initialization resource slices are calculated as follows: Initialization resource slice core count = Total number of processing cores / Preset number of slices; Initialization resource slice memory quota = Total memory capacity / Preset number of slices; Initialization resource slice cache quota = Total cache capacity / Preset number of slices. An initialization resource slice array is created to record the logical resource quantities of the initialization resource slices, i.e., the number of cores, cache quota, memory quota, and resource usage status of an initialization resource slice, and a mapping relationship between physical resources and initialization resource slices is established.
[0058] For example, a computing acceleration device has 24 processing cores and 36GB of memory. If it is configured with 6 slices, then each initial resource slice includes 4 cores and 6GB of memory. See [link to initial resource slice allocation results for the computing acceleration device's physical resources] for details. Figure 3.
[0059] 2) Several resource slice combination templates are predefined, each specifying a different number of resource slice combinations. Examples of resource slice combination templates can be found in Table 1.
[0060] Table 1 Resource Slice Combination Template 3) When a user requests the creation of a target virtual instance, resource slices are allocated and the target virtual instance is created based on the specified resource slice combination template. Specifically: the validity of the device and resource slice combination template is verified; the availability of resource slices meets the requirements, i.e., the resource slices to be allocated are assessed for allocation conditions, and virtual resources are allocated (preferably consecutive resource slices). After allocating virtual resources, a target virtual instance object is created. The target virtual instance object includes a virtual instance identifier, a UUID (Universally Unique Identifier), a list of resource slices, and a slice mask. After creating the target virtual instance, resource isolation (scheduling, memory, caching) can be configured, the resource slice status can be updated to allocated, and the virtual instance identifier of the target virtual instance is returned. The creation process of the target virtual instance can be found in [reference needed]. Figure 4 .
[0061] Resource isolation is crucial for ensuring the independence and performance predictability of virtual instances, and it comprises three layers: a) Scheduling isolation: Creating independent scheduling queues for virtual instances and configuring core affinity so that tasks can only execute on the allocated cores. b) Memory isolation: Creating independent memory managers for virtual instances, restricting virtual instances to accessing only their own memory regions. c) Cache isolation: Allocating independent L2 cache partitions for virtual instances.
[0062] 4) Locate the target virtual instance and the target container context, establish a binding relationship, increment the instance reference count after creating the target virtual instance, and update the target virtual instance state. It should be noted that the container binds to the virtual instance upon startup, and all processes within the container automatically inherit this binding relationship. Multiple processes share virtual instance resources, which are scheduled by the operating system. For the logic of multiple processes sharing a virtual instance within a container, see [link to relevant documentation]. Figure 5 .
[0063] 5) Virtual instance management provides functions for querying, destroying, and dynamically adjusting virtual instances. Virtual instance management includes instance querying, instance creation, and instance destruction. Instance querying supports retrieving virtual instance information by compute acceleration device identity, virtual instance identifier, virtual instance UUID, etc. Instance creation queries resource slice combination templates and creates the target virtual instance based on the selected template identifier. Instance destruction checks the instance reference count; when the instance reference count returns to 0, resource slices are released and the instance is removed from the global instance list.
[0064] Figure 6 A schematic diagram of a system architecture for software-based device virtualization management. (Example) Figure 6 As shown, the architecture includes an application layer, a runtime layer, a driver layer, and compute acceleration devices. The driver layer interface (via ioctl system calls) allows for device mode settings (enabling or disabling virtualization mode); configuration template queries (querying available resource slice combination templates); instance creation / destruction (creating or destroying virtual instances); instance queries (querying virtual instance status and information); and instance binding (binding instances to container contexts). The runtime layer interface supports device enumeration (enumerating available devices based on environment variables); context creation (creating device contexts); memory management (allocating and releasing memory); and task submission (submitting compute tasks). The driver layer includes a virtualization manager, a memory manager, and a task manager. The virtualization manager includes functions such as slice management, instance management, resource allocation, isolation configuration, status monitoring, and lifecycle management.
[0065] In a specific example, the system usage flow for software-implemented device virtualization management is as follows: the application / container starts, reads environment variables to obtain the virtual instance identifier, calls the runtime interface to enumerate devices, queries instance information through iocll, creates a container context, binds the virtual instance to the container context, configures resource limits, and finally the application uses the virtual instance resources.
[0066] This solution utilizes virtualization partitioning to enable a single physical device to run multiple independent workloads simultaneously, significantly improving resource utilization. Each virtual instance has a dedicated resource slice, achieving process-level error isolation and resource isolation through multi-layered isolation mechanisms (scheduling, memory, caching). The resource isolation mechanism ensures predictable throughput and latency for each virtual instance, meeting the service quality requirements of production environments. Implementing resource partitioning at the software level eliminates reliance on hardware virtualization features (such as SR-IOV), resulting in simple implementation, low cost, high flexibility, and applicability to various computing acceleration devices. A predefined template mechanism supports different resource combinations (from single slices to the entire device) and dynamic allocation, allowing users to flexibly configure according to workload requirements. It supports multiple processes within a container sharing the same virtual instance, without the processes being aware of the underlying virtualization, improving deployment convenience. Dynamic creation, destruction, and adjustment of instances are supported, enabling dynamic resource allocation and reclamation, enhancing resource management flexibility. This technical solution is not dependent on any specific hardware platform and is applicable to various computing acceleration devices such as GPUs and NPUs, exhibiting good versatility and portability.
[0067] Example 4 Figure 7 This is a schematic diagram of a device virtualization management device provided in Embodiment 4 of the present invention. Figure 7 As shown, the device includes: The resource partitioning module 310 is used to equally abstractly partition the physical resources of the computing acceleration device according to the preset number of slices to obtain the initial resource slices. The slice combination template determination module 320 is used to determine the resource slice combination template according to the required number of slices and the initialized resource slices; The virtual instance creation module 330 is used to create a target virtual instance based on the virtual instance creation request of the computing acceleration device and the resource slice combination template; The computation task execution module 340 is used to execute computation tasks based on the physical resources mapped to the target virtual instance.
[0068] The technical solution of this invention involves equally abstracting and dividing the physical resources of a computing acceleration device according to a preset number of slices to obtain initial resource slices. Then, based on the required number of slices and the initial resource slices, a resource slice combination template is determined. Subsequently, a target virtual instance is created based on the virtual instance creation request of the computing acceleration device and the resource slice combination template, and computing tasks are executed based on the physical resources mapped to the target virtual instance. This solution implements resource sharding at the software level, without relying on hardware virtualization features. It is simple to implement, low in cost, and highly flexible, applicable to various computing acceleration devices. Furthermore, the different resource combinations in the resource slice combination template can meet the flexible configuration needs of users according to workload requirements, enabling a single computing acceleration device to run multiple independent workloads simultaneously, significantly improving resource utilization. This solves the problems of high cost, complex implementation, and inflexible resource configuration in computing acceleration device virtualization, enabling flexible configuration of virtualized resources without relying on hardware virtualization features.
[0069] Optionally, the slice combination template determination module 320 is used to calculate the number of virtual instances corresponding to the required number of slices based on the required number of slices and the preset number of slices; generate a template configuration array based on the required number of slices, the number of virtual instances corresponding to the required number of slices, and the logical resource quantity of the initialized resource slices; and create the resource slice combination template based on the template configuration array.
[0070] Optionally, the virtual instance creation module 330 is used to parse the virtual instance creation request of the computing acceleration device to obtain the computing acceleration device identity identifier and the target resource slice combination identifier; when the device verification is passed based on the computing acceleration device identity identifier and the target resource slice combination is determined to be valid based on the target resource slice combination identifier, the target virtual instance is created.
[0071] Optionally, the virtual instance creation module 330 includes a validity verification unit, used to match the target resource slice combination identifier with the resource slice combination template; when the target resource slice combination identifier exists in the resource slice combination template and the resource slice to be allocated meets the resource slice allocation conditions, the target resource slice combination is determined to be valid.
[0072] Optionally, the virtual instance creation module 330 includes a virtual instance creation unit, used to determine a resource slice combination corresponding to the target resource slice combination identifier, and create the target virtual instance according to the resource slice combination; wherein, the target virtual instance includes a virtual instance identifier, a resource slice list, and a slice mask.
[0073] Optionally, the device virtualization management device further includes a resource isolation module, used to perform resource isolation on the target virtual instance based on resource isolation configuration data; update the resource slice status of the target resource slice combination corresponding to the target virtual instance; and register the target virtual instance to the global instance list; wherein, the resource isolation configuration data includes scheduling isolation configuration data, memory isolation configuration data, and cache isolation configuration data.
[0074] Optionally, the device virtualization management device further includes an instance binding and usage module, used to bind the target virtual instance to the target container context, and update the instance reference count and the target virtual instance status of the target virtual instance; wherein, all processes in the target container inherit the binding relationship between the target virtual instance and the target container context.
[0075] The device virtualization management device provided in the embodiments of the present invention can execute the device virtualization management method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0076] Example 5 Figure 8 A schematic diagram of an electronic device that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0077] like Figure 8 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as ROM 12, RAM 13, etc., communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded into the RAM 13 from the storage unit 18. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An I / O interface 15 is also connected to the bus 14. The ROM 12 is a read-only memory, the RAM 13 is a random access memory, and the I / O interface 15 is an input / output interface.
[0078] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0079] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as device virtualization management methods.
[0080] In some embodiments, the device virtualization management method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the device virtualization management method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the device virtualization management method by any other suitable means (e.g., by means of firmware).
[0081] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0082] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0083] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0084] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0085] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0086] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS servers, such as high management difficulty and weak business scalability.
[0087] This application also discloses a computer program product, which includes a computer program that, when executed by a processor, implements the device virtualization management method provided in any embodiment of this application. This program product shares the same inventive concept as the device virtualization management method disclosed in the embodiments of this application, and therefore will not be described in detail here.
[0088] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0089] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for virtualizing and managing devices, characterized in that, include: The physical resources of the computing acceleration device are equally abstracted and divided according to the preset number of slices to obtain the initial resource slices; Determine the resource slice combination template based on the required number of slices and the initialized resource slices; Create a target virtual instance based on the virtual instance creation request of the computing acceleration device and the resource slice combination template; Execute computational tasks based on the physical resources mapped to the target virtual instance.
2. The method according to claim 1, characterized in that, Based on the required number of slices and the initialized resource slices, determine the resource slice combination template, including: Calculate the number of virtual instances corresponding to the required number of slices based on the required number of slices and the preset number of slices; A template configuration array is generated based on the required number of slices, the number of virtual instances corresponding to the required number of slices, and the logical resource quantity of the initialized resource slices; Based on the template configuration array, create the resource slice combination template.
3. The method according to claim 1, characterized in that, Based on the virtual instance creation request of the computing acceleration device and the resource slice combination template, create a target virtual instance, including: Parse the virtual instance creation request of the computing acceleration device to obtain the identity identifier of the computing acceleration device and the target resource slice combination identifier; The target virtual instance is created when the device verification is passed based on the identity of the computing acceleration device and the target resource slice combination is determined to be valid based on the target resource slice combination identifier.
4. The method according to claim 3, characterized in that, Determining the validity of a target resource slice combination based on the target resource slice combination identifier includes: The target resource slice combination identifier is matched with the resource slice combination template; If the target resource slice combination identifier exists in the resource slice combination template, and the resource slice to be allocated meets the resource slice allocation conditions, then the target resource slice combination is determined to be valid.
5. The method according to claim 4, characterized in that, Creating the target virtual instance includes: Determine the resource slice combination corresponding to the target resource slice combination identifier, and create the target virtual instance based on the resource slice combination; The target virtual instance includes a virtual instance identifier, a resource slice list, and a slice mask.
6. The method according to claim 1, characterized in that, Before performing computational tasks based on the physical resources mapped to the target virtual instance, the process also includes: Resource isolation is performed on the target virtual instance based on resource isolation configuration data; Update the resource slice status of the target resource slice combination corresponding to the target virtual instance, and register the target virtual instance to the global instance list; The resource isolation configuration data includes scheduling isolation configuration data, memory isolation configuration data, and cache isolation configuration data.
7. The method according to claim 1, characterized in that, Before performing computational tasks based on the physical resources mapped to the target virtual instance, the process also includes: Bind the target virtual instance to the target container context, and update the instance reference count and the target virtual instance state; All processes within the target container inherit the binding relationship between the target virtual instance and the target container context.
8. An electronic device, characterized in that, The electronic device includes: At least one processor, and a memory communicatively connected to said at least one processor; The memory stores a computer program that can be executed by the at least one processor, which is then executed by the at least one processor to enable the at least one processor to perform the device virtualization management method according to any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the device virtualization management method according to any one of claims 1-7.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the device virtualization management method according to any one of claims 1-7.