Chip virtualization method and device and chip
Virtualizing the cloud computing acceleration chip through pure software realizes the isolation of chip resources, solves the problems of high complexity and unstable performance in the existing technology, and achieves efficient and reliable chip virtualization.
Patent Information
- Application Number
- CN202410947545.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-10-22
AI Technical Summary
Existing cloud computing acceleration chip virtualization technology has the problems of high hardware implementation complexity, high performance loss and failure risk, and uneven and unstable computing power distribution in software implementation.
The hardware resources in the chip are configured through pure software, the chip is virtualized into multiple isolated chip instances, and the isolation of task queues and storage space is used to achieve complete isolation of computing resources and storage space.
It reduces the complexity of virtualization operations, reduces the workload and failure risk of chip testing, realizes simple and reliable chip virtualization, and ensures computing efficiency and stability as well as the security of user data.
Smart Images

Figure CN118819852A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, in particular to the field of AI (Artificial Intelligence) chip technology, and specifically to a chip virtualization method and device, a chip, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] Cloud computing acceleration chips refer to processor chips deployed in cloud servers that are specifically used to handle certain computing tasks, such as AI chips (also known as AI accelerators or computing cards), encryption and decryption algorithm acceleration chips, video codec acceleration chips, etc.
[0003] Cloud computing acceleration chips usually require virtualization, that is, virtualizing a chip into multiple chip instances for independent use by multiple user processes. By virtualizing a chip into multiple chip instances, multiple users or workloads can run in parallel on the same physical device (i.e., chip) without interfering with each other, thereby improving chip utilization.
[0004] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention
[0005] The present disclosure provides a chip virtualization method and device, a chip, an electronic device, a computer-readable storage medium, and a computer program product.
[0006] According to one aspect of the present disclosure, a chip virtualization method is provided, wherein the chip includes a memory and a plurality of computing units, the method comprising: creating a plurality of task queues in a first area of the memory, wherein the plurality of task queues correspond to a plurality of chip instances virtualized from the chip, respectively, and each of the plurality of task queues is used to store computing tasks executed by a corresponding chip instance; and for each of the plurality of task queues: associating at least one computing unit of the plurality of computing units to the task queue, wherein different task queues are associated with different computing units; dividing a storage space corresponding to the task queue from a second area of the memory, wherein the storage spaces corresponding to different task queues do not overlap; and associating the storage space to the at least one computing unit, respectively, to obtain a chip instance corresponding to the task queue, including the storage space and the at least one computing unit.
[0007] According to another aspect of the present disclosure, a chip virtualization device is provided, wherein the chip includes a memory and multiple computing units, and the device includes: a queue creation module, configured to create multiple task queues in a first area of the memory, wherein the multiple task queues correspond to multiple chip instances virtualized from the chip, respectively, and each of the multiple task queues is used to store computing tasks performed by the corresponding chip instance; and a resource partitioning module, configured to, for each task queue in the multiple task queues: associate at least one computing unit of the multiple computing units to the task queue, wherein different task queues are associated with different computing units; partition a storage space corresponding to the task queue from a second area of the memory, wherein the storage spaces corresponding to different task queues do not overlap; and associate the storage space to the at least one computing unit, respectively, to obtain a chip instance corresponding to the task queue, including the storage space and the at least one computing unit.
[0008] According to another aspect of the present disclosure, a chip is provided, including: a firmware execution processor, a memory, and a plurality of computing units, wherein the firmware execution processor is configured to implement the above virtualization method by running firmware.
[0009] According to another aspect of the present disclosure, an electronic device is provided, comprising the above chip.
[0010] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the above method.
[0011] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program can implement the above method when executed by a processor.
[0012] According to one or more embodiments of the present disclosure, simple and reliable chip virtualization is achieved.
[0013] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0015] Figure 1 A schematic diagram showing an exemplary system in which various methods described herein may be implemented according to some embodiments of the present disclosure;
[0016] Figure 2 A flowchart of a chip virtualization method according to some embodiments of the present disclosure is shown;
[0017] Figure 3 A schematic diagram showing memory area division according to some embodiments of the present disclosure is shown;
[0018] Figure 4 A schematic diagram of a double buffer according to some embodiments of the present disclosure is shown;
[0019] Figure 5 shows a structural diagram of a chip according to some embodiments of the present disclosure;
[0020] Figure 6 A schematic diagram of a software-based virtualization solution according to some embodiments of the present disclosure is shown;
[0021] Figure 7 A flowchart of a firmware execution processor of a chip according to some embodiments of the present disclosure is shown;
[0022] Fig. 8A , 8B A flowchart of a host according to some embodiments of the present disclosure is shown;
[0023] Fig. 9 A schematic diagram showing a task execution process according to some embodiments of the present disclosure is shown;
[0024] Fig.10 A structural block diagram of a chip virtualization device according to some embodiments of the present disclosure is shown; and
[0025] Fig.11 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0026] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0027] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, timing relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.
[0028] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations. "Multiple" refers to two or more.
[0029] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are all subject to the provisions of relevant laws and regulations and do not violate public order and good morals.
[0030] Cloud computing acceleration chips usually have a need for virtualization. There are two types of chip virtualization solutions in related technologies. One is a virtualization solution implemented by hardware. For example, PCIE (Peripheral Component Interconnect Express) chips (such as graphics processor chips) are virtualized through SR-IOV (Single-Root I / O Virtualization) technology. This solution uses hardware to isolate computing power and memory, and has a good virtualization effect, but it relies on the PCIE communication interface and requires the design or adjustment of the chip's hardware structure, which increases the complexity of the hardware and the workload and failure risk of chip testing. In addition, this solution uses hardware-implemented time slice scheduling to achieve computing power isolation, and there is performance loss in the scheduling part.
[0031] The other is a virtualization solution implemented through software scheduling, for example, virtualizing chips (such as graphics processor chips) through Graphics Virtualization Technology (GVT). This solution implements device simulation and task scheduling through software, and executes various computing tasks in turn by dividing time slices, which makes the CPU load higher. Due to the different complexity and execution time of different computing tasks, the computing power distribution is uneven and unstable.
[0032] To solve the above problems, the embodiments of the present disclosure provide a virtualization method, which configures the hardware resources (including computing units and memory) in the chip by pure software, and virtualizes the chip into multiple isolated chip instances for use by different users.
[0033] The virtualization method of the disclosed embodiment does not require the design or modification of the hardware structure of the chip, reduces the complexity of the virtualization operation, reduces the workload and failure risk of chip testing, and realizes simple and reliable chip virtualization. The computing resources and storage space of different chip instances are completely isolated, which can ensure the computing efficiency and stability of different chip instances.
[0034] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0035] Figure 1 FIG. 1 is a schematic diagram of an exemplary system 100 in which various methods and apparatuses described herein may be implemented according to an embodiment of the present disclosure. Figure 1 , the system 100 includes one or more client devices 101, 102, 103, 104, 105, and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105, and 106 may be configured to execute one or more applications.
[0036] In an embodiment of the present disclosure, the server 120 may run one or more services or software applications that enable execution of a virtualization method of a chip.
[0037] In some embodiments, server 120 may also provide other services or software applications, which may include non-virtualized environments and virtualized environments. In some embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 101, 102, 103, 104, 105, and / or 106 under a software as a service (SaaS) model.
[0038] exist Figure 1 In the configuration shown, the server 120 may include one or more components that implement the functions performed by the server 120. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 may in turn utilize one or more client applications to interact with the server 120 to utilize the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from the system 100. Therefore, Figure 1is one example of a system for implementing the various methods described herein and is not intended to be limiting.
[0039] The user may use client devices 101, 102, 103, 104, 105 and / or 106 to send the initial instruction. The client device may provide an interface that enables the user of the client device to interact with the client device. The client device may also output information to the user via the interface. Figure 1 Only six client devices are depicted, but one skilled in the art will appreciate that the present disclosure may support any number of client devices.
[0040] Client devices 101, 102, 103, 104, 105 and / or 106 may include various categories of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, game systems, thin clients, various messaging devices, sensors or other sensing devices, etc. These computer devices may run various categories and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as GOOGLE Chrome OS); or include various mobile operating systems, such as MICROSOFT Windows Mobile OS, iOS, Windows Phone, Android. Portable handheld devices may include cellular phones, smart phones, tablet computers, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Game systems may include various handheld game devices, Internet-enabled game devices, etc. The client device is capable of executing a variety of different applications, such as various Internet-related applications, communication applications (eg, email applications), short message service (SMS) applications, and may use various communication protocols.
[0041] The network 110 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP / IP, SNA, IPX, etc. By way of example only, the one or more networks 110 may be a local area network (LAN), an Ethernet-based network, a token ring, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a blockchain network, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, Wi-Fi), and / or any combination of these and / or other networks.
[0042] Server 120 may include one or more general purpose computers, dedicated server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.
[0043] The computing units in the server 120 may run one or more operating systems including any of the above operating systems and any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and / or middle-tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.
[0044] In some implementations, server 120 may include one or more applications to analyze and consolidate data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and 106.
[0045] In some embodiments, the server 120 may be a server of a distributed system, or a server combined with a blockchain. The server 120 may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in a cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.
[0046] The system 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. The databases 130 may reside in various locations. For example, the database used by the server 120 may be local to the server 120, or may be remote from the server 120 and may communicate with the server 120 via a network-based or dedicated connection. The databases 130 may be of different categories. In some embodiments, the databases used by the server 120 may be, for example, relational databases. One or more of these databases may store, update, and retrieve data to and from the databases in response to commands.
[0047] In some embodiments, one or more of the databases 130 may also be used by applications to store application data. The databases used by the applications may be different categories of databases, such as a key-value store, an object store, or a conventional store backed by a file system.
[0048] Figure 1 The system 100 may be configured and operated in various ways to enable the application of various methods and apparatuses described in the present disclosure.
[0049] According to some embodiments, a chip according to an embodiment of the present disclosure is deployed in the server 120. The chip is virtualized into multiple chip instances according to the virtualization method of the embodiment of the present disclosure. Each chip instance can be assigned to a specific user for use. The chip instances of different users are isolated from each other and do not affect each other, thereby ensuring the security of user data and the computing efficiency of the chip instance. The server 120 responds to the computing request initiated by the user through the client device 101-106, determines the chip instance corresponding to the user, and sends the computing task corresponding to the computing request to the chip instance for execution.
[0050] The chip according to the embodiment of the present disclosure deployed in the server 120 may be, for example, an AI chip. The AI chip, also known as an AI accelerator or computing card, is a chip specifically used to process AI computing tasks. Compared with traditional computer chips, AI accelerator chips have higher performance and efficiency in processing complex AI algorithms and large-scale data. The AI accelerator chip may, for example, adopt hardware architectures such as GPU (Graphics Processing Unit), FPGA (Field Programmable Gate Array), and ASIC (Application Specific Integrated Circuit).
[0051] Figure 2 FIG. 2 is a flowchart of a chip virtualization method 200 according to an embodiment of the present disclosure. The method 200 is performed by a computing device (eg, Figure 1 More specifically, the method 200 may be executed by the chip itself or by an external device (such as a CPU) that is in communication with the chip. The chip to be virtualized includes a memory and a plurality of computing units. Figure 2 As shown, method 200 includes steps S210 - S240 .
[0052] In step S210, multiple task queues are created in the first area of the memory. The multiple task queues correspond to multiple chip instances virtualized from the chip. Each task queue in the multiple task queues is used to store computing tasks executed by the corresponding chip instance.
[0053] In step S220, for each task queue in the plurality of task queues, at least one computing unit in the plurality of computing units is associated with the task queue. Different task queues are associated with different computing units.
[0054] In step S230, a storage space corresponding to the task queue is divided from the second area of the memory. The storage spaces corresponding to different task queues do not overlap.
[0055] In step S240, the storage space is associated with the at least one computing unit to obtain a chip instance corresponding to the task queue and including the storage space and the at least one computing unit.
[0056] According to an embodiment of the present disclosure, the hardware resources (including computing units and memories) in the chip are configured in a pure software manner, and the chip is virtualized into multiple mutually isolated chip instances for use by different users.
[0057] The virtualization method of the disclosed embodiment does not require the design or modification of the hardware structure of the chip, reduces the complexity of the virtualization operation, reduces the workload and failure risk of chip testing, and realizes simple and reliable chip virtualization. The computing resources and storage space of different chip instances are completely isolated, which can ensure the computing efficiency and stability of different chip instances and the security of user data.
[0058] In the embodiments of the present disclosure, a chip instance refers to a set of physical resources used to perform computing tasks, including computing resources (i.e., computing units) and storage resources (i.e., storage space in a memory). The computing resources included in the chip instance can be referred to as a computing instance, and the included storage resources can be recorded as a storage instance. That is, each chip instance includes a computing instance and a storage instance.
[0059] According to some embodiments, the chip includes a main processor in addition to a memory and a plurality of computing units. The main processor is used to manage and schedule the plurality of computing units. Accordingly, the plurality of computing units can be considered as coprocessors of the main processor.
[0060] In the above embodiment, the main processor can implement the method 200 of the embodiment of the present disclosure by running a preset firmware, thereby dividing the chip into multiple chip instances. Accordingly, the main processor can also be called a firmware execution processor.
[0061] In step S210, multiple task queues are created in the first area of the memory. The number of task queues is the same as the number of chip instances to be virtualized. Each task queue corresponds to a chip instance and is used to store computing tasks executed by the chip instance.
[0062] In an embodiment of the present disclosure, the first area of the memory is used to store virtualized configuration items, including task queues, as well as buffers, page tables, etc. described below. The second area of the memory is used to store user data, that is, data related to computing tasks submitted by users. The first area and the second area are isolated from each other (i.e., they do not overlap), so that the virtualized configuration items and user data do not affect each other, thereby ensuring the reliability of the virtualization configuration and the security of the user data.
[0063] According to some embodiments, the first area of the memory may be a reserved area of the memory. The reserved area cannot be read or written by the user, thereby ensuring the stability and reliability of the virtualization configuration. The second area may be a dynamic area of the memory, which can be read and written by the user.
[0064] Figure 3 FIG. 4 is a schematic diagram showing the area division of the memory 300 according to some embodiments of the present disclosure. Figure 3 As shown, the memory 300 includes a reserved area 310 and a dynamic area 320. The reserved area 310 is used to store virtualized configuration items, including task queues, buffers of task queues, page tables, etc. The dynamic area 320 is divided into N storage spaces, namely domain 0, domain 1, ..., domain N-1. Storage space domain i (i = 0, 1, ..., N-1) is a storage instance of chip instance i and corresponds to task queue i.
[0065] According to some embodiments, the chip further comprises a communication unit for communicating with a host. The host may be, for example, a CPU of a computing device (eg, a server) in which the chip is deployed.
[0066] According to some embodiments, the communication unit communicates with the host via a high-speed serial computer expansion bus standard (PCIE). Accordingly, the method 200 further includes: mapping the physical address of the task queue in the memory to the bus address space, obtaining the bus address corresponding to the physical address, so that in response to the communication unit receiving a computing task containing the bus address sent by the host, the bus address is mapped to the physical address of the memory, and the computing task is added to the task queue corresponding to the physical address.
[0067] The bus address space refers to the address space shared by all PCIE devices (including the host, chips to be virtualized, etc.) connected to the PCIE bus. Different PCIE devices correspond to different address spaces in the bus address space. The bus address space corresponding to the chip can be recorded as the PCIE BAR (Base Address Register) space domain.
[0068] The memory address space of the chip is an independent address space inside the chip, which is independent of the address space of other devices connected to the bus. It can be understood that the memory address space is different from the bus address space. The host cannot directly access the physical address in the memory address space, but needs to specify the bus address corresponding to the physical address. The chip maps the bus address to the physical address according to the mapping relationship between the configured bus address and the memory physical address, and then adds the computing task to the task queue at the physical address.
[0069] According to some embodiments, method 200 further includes: for any task queue among the multiple task queues, creating two buffers corresponding to the task queue in the first area of the memory, the two buffers being used to alternately store execution parameters of the computing tasks to be executed of the corresponding chip instance. The execution parameters at least indicate the storage address of the relevant data of the computing tasks to be executed in the corresponding storage space.
[0070] According to the above embodiment, using two buffers to alternately prepare computing tasks can improve the efficiency of task preparation and improve the waiting time for preparing tasks. For example, a task queue includes task0, task1, task2, ... to be executed. The task queue is configured with two buffers, buffer0 and buffer1. First, buffer0 is used to prepare the execution parameters of task0. After the execution parameters of task0 are prepared, the computing device executes task0 based on the execution parameters. While executing task0 using the execution parameters in buffer0, buffer1 is used to prepare the execution parameters of the next task task1, so that task0 and the execution and preparation of task1 can be carried out in parallel. After task0 in buffer0 is executed, it can be directly switched to buffer1 through a pointer to continue executing task1 in buffer1 without stopping to prepare the execution parameters of task1. Similarly, while executing task1 in buffer1, buffer0 is used to prepare the execution parameters of the next task task2, so that task1 and the execution and preparation of task2 can be carried out in parallel. The two buffers buffer0 and buffer1 alternately prepare execution parameters of each computing task to be executed, which can improve task preparation efficiency and reduce the waiting time for preparing tasks.
[0071] According to some embodiments, the execution parameters of the computing task include parameter segment address, code segment address, execution status, exception code area, etc. The parameter segment address indicates the address pointer of the input data and output data of the computing task. The code segment address indicates the address pointer of the code of the computing task. The execution status includes, for example, preparing, prepared, executing, exception, etc. The exception code area can indicate the address pointer of the code where the exception occurs, the type of exception, etc.
[0072] Figure 4 A schematic diagram of a double buffer according to some embodiments of the present disclosure is shown. Figure 4 The domain i (i=0, 1, ..., N-1) in refers to the space domain of the task queue i of chip instance i in the bus address space. Each task queue i is configured with two buffers. For example, Figure 4 As shown, task queue 0 located in domain 0 is configured with two buffers 410 and 420. Buffers 410 and 420 store the same type of execution parameters. Specifically, buffer 410 stores parameter segment address 411, code segment address 412, execution status 413, and exception code area 414 of the computing task; buffer 420 stores parameter segment address 421, code segment address 422, execution status 423, and exception code area 424 of the computing task.
[0073] According to some embodiments, the method 200 further includes: starting a plurality of queue threads. The plurality of queue threads correspond to the plurality of task queues respectively, and each queue thread is configured to dispatch computing tasks in a corresponding task queue to any computing unit corresponding to the task queue.
[0074] According to the above embodiment, multiple threads are started to process multiple task queues respectively, so that multiple chip instances can run in parallel on the same chip without interfering with each other, thereby improving chip utilization and processing performance.
[0075] According to some embodiments, a plurality of threads may be started by a firmware execution processor of a chip. Each thread is used to obtain a computing task in a corresponding task queue, and dispatch the computing task to the computing unit by configuring a register of any computing unit of the task queue. The dispatch of tasks may adopt a round-robin strategy, that is, looping through each computing unit of the task queue and dispatching tasks to idle computing units.
[0076] In step S220, for each task queue in the plurality of task queues, at least one computing unit in the plurality of computing units is associated with the task queue. Different task queues are associated with different computing units, that is, computing resources of different chip instances are isolated from each other.
[0077] According to some embodiments, the number of computing units included in each chip instance, that is, the number of computing units associated with the task queue corresponding to the chip instance, can be determined by configuring the firmware code. The number of computing units included in each chip instance can be the same or different.
[0078] In step S230, a storage space corresponding to the task queue is divided from the second area of the memory. The storage spaces corresponding to different task queues do not overlap, that is, the storage resources of different chip instances are isolated from each other.
[0079] The second area may be, for example, a dynamic area of the memory, which can be read and written by a user.
[0080] According to some embodiments, the size of the storage space corresponding to each chip instance can be determined by configuring the firmware code. Then, based on the sizes of the configured storage spaces, the dynamic area of the chip is divided to obtain the storage space corresponding to each chip instance. The size of the storage space of each chip instance can be the same or different.
[0081] In step S240, the storage space is associated with the at least one computing unit to obtain a chip instance corresponding to the task queue and including the storage space and the at least one computing unit.
[0082] According to some embodiments, the chip further includes a memory management unit. Accordingly, step S240 may include steps S241 - S244 .
[0083] In step S241, the virtual address and physical address of the storage space are obtained.
[0084] In step S242, a page table recording a mapping relationship between a virtual address and the physical address is created in a first area of the memory.
[0085] In step S243, the identifier of the storage space and the identifier of the page table are configured in a memory management unit in association with each other.
[0086] In step S244, the identifier of the storage space is respectively configured to the at least one computing unit, so that the at least one computing unit only has access rights to the storage space.
[0087] According to the above embodiment, the virtual address spaces of different chip instances are isolated by using the memory management unit.
[0088] According to some embodiments, the memory management unit may be, for example, an SMMU (System Memory Management Units). The identifier of the storage space corresponds to a stream identifier (streamID) in the SMMU. The identifier of the page table may be a storage address (physical address or virtual address) of the page table in the memory. In step S243, a stream table may be constructed in the first area of the memory, and the identifier of the storage space and the identifier of the page table may be associated and stored in the stream table. The storage address (physical address or virtual address) of the stream table in the memory is written into the register of the SMMU to complete the configuration.
[0089] In step S244, the identifier of the storage space (streamID) may be written into the register of each computing unit respectively, thereby completing the configuration of the access rights of each computing unit.
[0090] According to some embodiments, method 200 further includes steps S250 and S260.
[0091] In step S250, a first computing task to be executed in a target task queue is obtained. The target task queue is any non-empty task queue.
[0092] In step S260, the first computing task is dispatched to a first computing unit corresponding to the target task queue for execution. The first computing unit is any idle computing unit corresponding to the target task queue.
[0093] According to some embodiments, corresponding to the configuration of two buffers for each task queue in the above embodiment, step S250 may include: obtaining the first execution parameter of the first computing task from the first buffer whose execution status is prepared in the target task queue. Step S260 may include steps S261-S263.
[0094] In step S261, the execution status of the first buffer is changed to being executed.
[0095] In step S262, the first execution parameter is configured to the first computing unit so that the first computing unit executes the first computing task based on the first execution parameter. The first execution parameter includes, for example, a parameter segment address, a code segment address, an execution state, an abnormal code area, and the like.
[0096] In step S263, a second execution parameter of a second computing task is prepared using the second buffer, and the second computing task is the next computing task of the first computing task.
[0097] It can be understood that the above steps S262 and S263 can be executed in parallel, thereby saving task processing time.
[0098] In step S263, when the second execution parameter is not ready, the execution state of the second buffer is "preparing". When the second execution parameter is ready, the execution state of the second buffer is "ready".
[0099] According to some embodiments, method 200 further includes steps S270 - S290 .
[0100] In step S270, in response to the first computing task being completed and the execution state of the second buffer being prepared, a second execution parameter is obtained from the second buffer. The second execution parameter includes, for example, a parameter segment address, a code segment address, an execution state, an abnormal code area, etc. In addition, the execution state of the first buffer is modified to preparing, and the first buffer is used to prepare the next computing task.
[0101] In step S280, the execution status of the second buffer is changed to being executed.
[0102] In step S290, the second execution parameter is configured to the second computing unit corresponding to the target task queue for execution. The second computing unit is any idle computing unit corresponding to the target task queue.
[0103] In order to better understand the present disclosure, the virtualization solution of the present disclosure is described below in combination with the chip structure and task execution process.
[0104] Figure 5 FIG. 5 shows a structural diagram of a chip 500 according to some embodiments of the present disclosure. Figure 5As shown, the chip 500 includes a firmware execution processor (main processor) 510 , multiple computing units (coprocessors) 520 , a memory 530 , a memory management unit 540 , a communication unit 550 , and an on-chip bus 560 .
[0105] The firmware execution processor 510 may be, for example, an ARM (Advanced RISC Machines) CPU, which is used to execute software code logic.
[0106] The computing unit 520 is used to perform computing tasks, such as AI computing tasks, data encryption and decryption tasks, video encoding and decoding tasks, etc. The hardware configuration of each computing unit 520 is the same, and each computing unit 520 independently completes its own computing tasks.
[0107] The memory 530 may be, for example, a double data rate memory (DDR), a high bandwidth memory (HBM), a static random access memory (SRAM), or the like.
[0108] The memory management unit 540 may be, for example, an SMMU, which is used to perform mapping management from virtual memory space to physical memory space.
[0109] The communication unit 550 may be, for example, a PCIE EP (EndPoint) module, which communicates with a host 580 via a PCIE bus 570 and can send or receive a PCIE interface request.
[0110] The on-chip bus 560 is used to implement communication between various units inside the chip 500 .
[0111] According to some embodiments, the firmware execution processor 510 implements the virtualization method of the embodiment of the present disclosure by running the firmware, and virtualizes the chip 500 into multiple chip instances. It can be understood that the firmware is written into the read-only memory ( Figure 5 Therefore, the virtualization method of the embodiment of the present disclosure is implemented by pure software, which can be applied to any chip structure without redesigning or modifying the hardware structure of the chip.
[0112] Figure 6 FIG. 4 is a schematic diagram showing a virtualization solution of a chip 500 implemented by pure software according to some embodiments of the present disclosure.
[0113] like Figure 6As shown, the chip 500 is divided into N chip instances, each chip instance includes a computing instance (including one or more computing units 520) and a storage instance (i.e., the spatial domain i of the memory 530, i=0, 1, ..., N-1). It should be noted that Figure 6 The domains 0, 1, ..., and N-1 on the left refer to the PCIR BAR space domain, i.e., the bus address space domain; the domains 0, 1, ..., and N-1 on the lower right refer to the memory space domain. It can be understood that the addresses of the two sets of space domains have a mapping relationship and are one-to-one corresponding.
[0114] The virtualization process of the computing instance is as follows: First, in the initialization phase of the firmware (i.e., the firmware execution processor 510 starts running the firmware), N task queues are created, each task queue occupies a storage space in the reserved area of the memory 530, and each task queue is mapped to the PCIR BAR space domain. In this way, the host driver can configure the task queue by configuring different PCIR BAR domains. The firmware execution processor 510 maintains N queue threads to be responsible for obtaining the computing tasks in the task queue, and dispatches the computing tasks to the corresponding computing instance (including one or more computing units 520) by configuring the registers of the computing unit. The computing unit dispatching strategy in the computing instance is a round-robin strategy, that is, traversing each computing unit in the computing instance and dispatching the computing tasks sequentially to the idle computing units.
[0115] The virtualization process of the storage instance is as follows: the dynamic area of the memory 530 is divided into N parts by the firmware, each part constructs an independent virtual memory context, maps the corresponding physical address, constructs the correspondence between the virtual memory and the physical memory into a page table for storage, and generates a stream identifier streamID (i.e., the number identifier of the virtual memory context). In this way, N streamIDs and corresponding N page tables can be obtained. By configuring the register of the memory management unit 540, the correspondence between the streamID and the page table is configured in the memory management unit 540. For each computing unit 520, the streamID of the memory space domain corresponding to the computing unit 520 is written into the register of the computing unit 520, so that the computing unit 520 has access rights to the specified streamID. When the computing unit 520 initiates a memory access, the memory access request will carry the streamID, thereby determining which page table storage space to use. Thus, the isolation of the virtual address space is achieved. It can be understood that each storage instance has an independent virtual storage space and a dedicated streamID. The page table is stored in the reserved area of the memory 530.
[0116] It should be noted that the storage address corresponding to streamID is a legal virtual address applied for by the firmware (represented as a base address), but the user may access it by offsetting the legal address. If the offset is too large, the address may be out of bounds (indicating that the current user wants to use excessive memory), and the memory management unit 540 will report a page fault exception. Alternatively, the user may directly access with a custom illegal address, in which case the address may be out of bounds, and the memory management unit 540 will report a page fault exception.
[0117] Figure 7 FIG. 7 is a schematic diagram showing a workflow 700 of a firmware execution processor 510 of a chip according to some embodiments of the present disclosure. Figure 7 As shown, process 700 includes steps S710-S760.
[0118] In step S710, the PCIE BAR domain is initialized, that is, the PCIE bus address space corresponding to the chip is determined.
[0119] In step S720, a task queue for each chip instance is created in a reserved area of the memory, and a storage address of the task queue is mapped to a PCIE BAR domain.
[0120] In step S730, the memory domain page table of each chip instance is determined, and the page table (corresponding streamID) is configured into the register of the corresponding computing unit.
[0121] In step S740, the computing task in the task queue is obtained through the corresponding queue thread, and the task is configured to be executed in the idle computing unit of the corresponding chip instance.
[0122] In step S750, the task execution status is polled.
[0123] In step S760, the buffer of the queue is updated based on the execution status of the task.
[0124] In the virtualization scheme of the disclosed embodiment, the host receives the computing task of the upper-layer software, and configures the computing task to the corresponding task queue by accessing the corresponding address in the PCIE BAR space domain according to the chip instance identifier specified by the upper-layer software, and polls the completed flag of the task queue. Among them, the input data of the computing task is copied to the memory of the chip by the host driver through PCIE DMA (Direct Memory Access), and the address pointers of the input data and output data are stored in the parameter section of the buffer. After the computing task is completed, the output data of the task is copied to the host's memory by PCIE DMA.
[0125] Fig. 8A ,8B Schematic diagrams of host workflows 800A and 800B according to some embodiments of the present disclosure are shown. 800A and 800B are respectively the host workflows when the task execution is normal and abnormal.
[0126] like Fig. 8A As shown, process 800A includes steps S810-S830.
[0127] In step S810, the host driver configures the computing task, and after the configuration is completed, updates the execution status of the computing task in the buffer to ready.
[0128] In step S820, the host driver polls the PCIE BAR space domain to obtain the task completion status.
[0129] In step S830, in response to polling the task completion status, the task calculation result (ie, output data) is copied to the host memory by PCIEDMA.
[0130] like Figure 8B As shown, process 800B includes steps S840-S860.
[0131] In step S840, the host driver configures the computing task, and after the configuration is completed, updates the execution status of the computing task in the buffer to ready.
[0132] In step S850, the host driver polls the PCIE BAR space domain to obtain the task abnormality status.
[0133] In step S860, in response to polling the task abnormal state, the abnormal code of the task is obtained from the buffer.
[0134] Fig. 9 FIG. 9 is a schematic diagram showing a task execution process 900 according to some embodiments of the present disclosure. Fig. 9 As shown, process 900 includes steps S910-S970.
[0135] In step S910, the host driver configures the computing task through the PCIE BAR space domain, and updates the execution status of the computing task in the buffer to ready after the configuration is completed.
[0136] In step S920, the chip firmware polls and finds that the task status is ready, and updates the execution status of the task to running.
[0137] In step S930 , the firmware configures the computing task to an idle computing unit of the specified chip instance for execution.
[0138] In step S940 , the firmware polls the task execution status of the computing unit.
[0139] In step S950 , the firmware updates the polled task execution status into the buffer.
[0140] In step S960 , the host driver polls the execution status in the buffer.
[0141] In step S970, if the host polls to a completion status, the task calculation result is obtained; if the host polls to an abnormal status, the abnormal code is obtained.
[0142] The conversion process of the execution status in the buffer may be, for example: prepared-executing-completed / abnormal-idle-preparing-prepared.
[0143] According to the above embodiment, different page tables are configured using mature on-chip SMMU software to achieve virtual address isolation (each virtual space context is a storage instance). When the virtual memory is accessed out of bounds, a hardware SMMU page fault exception occurs, thereby achieving reliable memory isolation. Multiple computing unit groups are configured by constructing task queues (each computing unit group is a computing instance, including one or more computing units). Since the task queue is bound to one or more physical computing units, effective physical computing power isolation is achieved (rather than computing power isolation of time slices). After the firmware completes initialization, each task queue is directly used by the upper-level software, does not bear the distribution function, and has no software scheduling loss. This solution does not require modifying the hardware structure of the chip, and implements a thorough division of the chip's physical resources through software, thereby achieving simple and reliable chip virtualization.
[0144] Fig.10 FIG. 1 shows a block diagram of a chip virtualization device 1000 according to an embodiment of the present disclosure. The chip includes a memory and a plurality of computing units. Fig.10 As shown, the apparatus 1000 includes a queue creation module 1010 and a resource partitioning module 1020 .
[0145] The queue creation module 1010 is configured to create multiple task queues in the first area of the memory, wherein the multiple task queues correspond to multiple chip instances virtualized from the chip respectively, and each task queue in the multiple task queues is used to store computing tasks executed by the corresponding chip instance.
[0146] The resource partitioning module 1020 is configured to, for each task queue in the multiple task queues: associate at least one computing unit among the multiple computing units to the task queue, wherein different task queues are associated with different computing units; partition a storage space corresponding to the task queue from the second area of the memory, wherein the storage spaces corresponding to different task queues do not overlap; and associate the storage space to the at least one computing unit, respectively, to obtain a chip instance corresponding to the task queue, including the storage space and the at least one computing unit.
[0147] According to an embodiment of the present disclosure, the hardware resources (including computing units and memories) in the chip are configured in a pure software manner, and the chip is virtualized into multiple mutually isolated chip instances for use by different users.
[0148] The virtualization method of the disclosed embodiment does not require the design or modification of the hardware structure of the chip, reduces the complexity of the virtualization operation, reduces the workload and failure risk of chip testing, and realizes simple and reliable chip virtualization. The computing resources and storage space of different chip instances are completely isolated, which can ensure the computing efficiency and stability of different chip instances and the security of user data.
[0149] According to some embodiments, the chip also includes a communication unit, which communicates with the host through a high-speed serial computer expansion bus standard. The device 1000 also includes: a mapping module, which is configured to map the physical address of the task queue in the memory to a bus address space, and obtain a bus address corresponding to the physical address, so that in response to the communication unit receiving a computing task containing the bus address sent by the host, the bus address is mapped to the physical address, and the computing task is added to the task queue corresponding to the physical address.
[0150] According to some embodiments, the chip also includes a memory management unit, and wherein the resource partitioning module includes: a determination submodule, configured to obtain the virtual address and the physical address of the storage space; a creation submodule, configured to create a page table recording the mapping relationship between the virtual address and the physical address in the first area of the memory; a first configuration submodule, configured to configure the identifier of the storage space and the identifier of the page table in association with each other into the memory management unit; and a second configuration submodule, configured to configure the identifier of the storage space to the at least one computing unit respectively, so that the at least one computing unit only has access rights to the storage space.
[0151] According to some embodiments, the device 1000 also includes: a buffer creation module, configured to create two buffers corresponding to any task queue among the multiple task queues in the first area, wherein the two buffers are used to alternately store execution parameters of the computing tasks to be executed of the corresponding chip instance, and the execution parameters at least indicate the storage address of the relevant data of the computing tasks to be executed in the corresponding storage space.
[0152] According to some embodiments, the first area is a reserved area of the memory, and the second area is a dynamic area of the memory.
[0153] According to some embodiments, the device 1000 also includes: a thread starting module, configured to start multiple queue threads, wherein the multiple queue threads correspond to the multiple task queues respectively, and each queue thread in the multiple queue threads is configured to dispatch computing tasks in the corresponding task queue to any computing unit corresponding to the task queue.
[0154] According to some embodiments, the device 1000 also includes: a first acquisition module, configured to acquire a first computing task to be executed in a target task queue, wherein the target task queue is any non-empty task queue; and a dispatching module, configured to dispatch the first computing task to a first computing unit corresponding to the target task queue for execution, wherein the first computing unit is any idle computing unit corresponding to the target task queue.
[0155] According to some embodiments, the first acquisition module is further configured to: obtain the first execution parameter of the first computing task from the first buffer whose execution status is prepared in the target task queue, and wherein the dispatch module includes: a state modification submodule, configured to modify the execution status of the first buffer to executing; a third configuration submodule, configured to configure the first execution parameter to the first computing unit, so that the first computing unit executes the first computing task based on the first execution parameter; and a preparation submodule, configured to prepare the second execution parameter of the second computing task using the second buffer, wherein the second computing task is the next computing task of the first computing task.
[0156] According to some embodiments, the device 1000 also includes: a second acquisition module, configured to acquire the second execution parameter from the second buffer in response to the completion of the first computing task and the execution status of the second buffer being prepared; a state modification module, configured to modify the execution status of the second buffer to executing; and a configuration module, configured to configure the second execution parameter to the second computing unit corresponding to the target task queue for execution, wherein the second computing unit is any idle computing unit corresponding to the target task queue.
[0157] It should be understood that Fig.10 The various modules of the apparatus 1000 shown in FIG. Figure 2 Therefore, the operations, features and advantages of the various steps described above for method 200 are also applicable to the various modules of device 1000. For the sake of brevity, some operations, features and advantages are not repeated here.
[0158] According to another aspect of the present disclosure, a chip is also provided. The chip includes a firmware execution processor, a memory, and a plurality of computing units. The firmware execution processor is configured to implement the virtualization method 200 by running firmware.
[0159] According to another aspect of the present disclosure, an electronic device is also provided, comprising the above chip.
[0160] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is also provided. The computer instructions are used to enable the computer to execute the virtualization method 200 described above.
[0161] According to another aspect of the present disclosure, a computer program product is further provided, comprising computer program instructions, which implement the above virtualization method 200 when executed by a processor.
[0162] refer to Fig.11 , a block diagram of an electronic device 1100 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0163] like Fig.11 As shown, the device 1100 includes a computing unit 1101, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1102 or a computer program loaded from a storage unit 1108 into a random access memory (RAM) 1103. In the RAM 1103, various programs and data required for the operation of the device 1100 can also be stored. The computing unit 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0164] Multiple components in the device 1100 are connected to the I / O interface 1105, including: an input unit 1106, an output unit 1107, a storage unit 1108, and a communication unit 1109. The input unit 1106 can be any type of device that can input information to the device 1100. The input unit 1106 can receive input digital or character information, and generate key signal input related to user settings and / or function control of the electronic device, and can include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and / or a remote controller. The output unit 1107 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 1108 can include but is not limited to a disk and an optical disk. The communication unit 1109 allows the device 1100 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver and / or a chipset, such as a Bluetooth device, an 802.11 device, a Wi-Fi device, a WiMAX device, a cellular communication device, and / or the like.
[0165] The computing unit 1101 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1101 performs the various methods and processes described above, such as the chip virtualization method 200. For example, in some embodiments, the chip virtualization method 200 may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 1108. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1100 via the ROM 1102 and / or the communication unit 1109. When the computer program is loaded into the RAM 1103 and executed by the computing unit 1101, one or more steps of the chip virtualization method 200 described above may be performed. Alternatively, in other embodiments, the computing unit 1101 may be configured to execute the chip virtualization method 200 in any other appropriate manner (eg, by means of firmware).
[0166] Various implementations 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 chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0167] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0168] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0169] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer 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 can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the 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 acoustic input, voice input, or tactile input).
[0170] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.
[0171] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0172] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0173] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present disclosure is not limited by these embodiments or examples. Various elements in the embodiments or examples may be omitted or may be replaced by their equivalent elements. In addition, each step may be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples may be combined in various ways. It is important that with the evolution of technology, many elements described herein may be replaced by equivalent elements that appear after the present disclosure.
Claims
1. A chip virtualization method, wherein: The chip includes a memory and a plurality of computing units, and the method includes: Creating a plurality of task queues in the first area of the memory, wherein the plurality of task queues respectively correspond to a plurality of chip instances virtualized from the chip, and each of the plurality of task queues is used to store computing tasks executed by a corresponding chip instance; and For each task queue in the plurality of task queues: Associating at least one computing unit among the plurality of computing units with the task queue, wherein different task queues are associated with different computing units; dividing a storage space corresponding to the task queue from the second area of the memory, wherein the storage spaces corresponding to different task queues do not overlap; and The storage space is associated with the at least one computing unit respectively to obtain a chip instance corresponding to the task queue and including the storage space and the at least one computing unit.
2. The method according to claim 1, wherein: The chip further includes a communication unit, and the communication unit communicates with the host through a high-speed serial computer expansion bus standard. The method further includes: The physical address of the task queue in the memory is mapped to the bus address space to obtain the bus address corresponding to the physical address, so that in response to the communication unit receiving a computing task containing the bus address sent by the host, the bus address is mapped to the physical address and the computing task is added to the task queue corresponding to the physical address.
3. The method according to claim 1 or 2, wherein: The chip further includes a memory management unit, and wherein associating the storage space to the at least one computing unit respectively includes: Obtaining a virtual address and a physical address of the storage space; Creating a page table recording a mapping relationship between the virtual address and the physical address in a first area of the memory; Associatively configuring the identifier of the storage space and the identifier of the page table into the memory management unit; and The identifier of the storage space is respectively configured to the at least one computing unit, so that the at least one computing unit only has access rights to the storage space.
4. The method according to any one of claims 1 to 3, further comprising: For any task queue among the multiple task queues, two buffers corresponding to the task queue are created in the first area, wherein the two buffers are used to alternately store execution parameters of the computing tasks to be executed of the corresponding chip instance, and the execution parameters at least indicate the storage address of the relevant data of the computing tasks to be executed in the corresponding storage space.
5. The method according to any one of claims 1 to 4, wherein: The first area is a reserved area of the memory, and the second area is a dynamic area of the memory.
6. The method according to any one of claims 1 to 5, further comprising: A plurality of queue threads are started, wherein the plurality of queue threads correspond to the plurality of task queues respectively, and each of the plurality of queue threads is configured to dispatch computing tasks in a corresponding task queue to any computing unit corresponding to the task queue.
7. The method according to any one of claims 1 to 6, further comprising: Obtaining a first computing task to be executed in a target task queue, wherein the target task queue is any non-empty task queue; and The first computing task is dispatched to a first computing unit corresponding to the target task queue for execution, wherein the first computing unit is any idle computing unit corresponding to the target task queue.
8. The method according to claim 7, wherein: The step of obtaining a first computing task to be executed in the target task queue comprises: Acquire a first execution parameter of the first computing task from a first buffer whose execution status is prepared in the target task queue, And wherein, dispatching the first computing task to the first computing unit corresponding to the target task queue for execution includes: Modify the execution status of the first buffer to being executed; configuring the first execution parameter to the first computing unit so that the first computing unit executes the first computing task based on the first execution parameter; and A second execution parameter of a second computing task is prepared using a second buffer, wherein the second computing task is a next computing task of the first computing task.
9. The method according to claim 8, further comprising: In response to the first computing task being completed and the execution status of the second buffer being prepared, acquiring the second execution parameter from the second buffer; Modify the execution status of the second buffer to being executed; as well as The second execution parameter is configured to a second computing unit corresponding to the target task queue for execution, wherein the second computing unit is any idle computing unit corresponding to the target task queue.
10. A chip virtualization device, wherein: The chip includes a memory and a plurality of computing units, and the device includes: a queue creation module configured to create a plurality of task queues in the first area of the memory, wherein the plurality of task queues respectively correspond to a plurality of chip instances virtualized from the chip, and each of the plurality of task queues is used to store computing tasks executed by a corresponding chip instance; and The resource partitioning module is configured to: for each task queue in the plurality of task queues: Associating at least one computing unit among the plurality of computing units with the task queue, wherein different task queues are associated with different computing units; dividing a storage space corresponding to the task queue from the second area of the memory, wherein the storage spaces corresponding to different task queues do not overlap; and The storage space is associated with the at least one computing unit respectively to obtain a chip instance corresponding to the task queue and including the storage space and the at least one computing unit.
11. The device according to claim 10, wherein: The chip also includes a communication unit, which communicates with the host through a high-speed serial computer expansion bus standard, and the device also includes: A mapping module is configured to map the physical address of the task queue in the memory to a bus address space to obtain a bus address corresponding to the physical address, so as to map the bus address to the physical address in response to the communication unit receiving a computing task containing the bus address sent by the host, and add the computing task to the task queue corresponding to the physical address.
12. The device according to claim 10 or 11, wherein: The chip further includes a memory management unit, and wherein the resource partitioning module includes: A determination submodule is configured to obtain a virtual address and a physical address of the storage space; A creation submodule, configured to create a page table recording a mapping relationship between the virtual address and the physical address in a first area of the memory; a first configuration submodule configured to configure the identifier of the storage space and the identifier of the page table in association with each other into the memory management unit; and The second configuration submodule is configured to respectively configure the identifier of the storage space to the at least one computing unit so that the at least one computing unit only has access rights to the storage space.
13. The device according to any one of claims 10 to 12, further comprising: A buffer creation module is configured to create two buffers corresponding to any task queue among the multiple task queues in the first area, wherein the two buffers are used to alternately store execution parameters of the computing tasks to be executed of the corresponding chip instance, and the execution parameters at least indicate the storage address of the relevant data of the computing tasks to be executed in the corresponding storage space.
14. The device according to any one of claims 10 to 13, wherein: The first area is a reserved area of the memory, and the second area is a dynamic area of the memory.
15. The apparatus according to any one of claims 10 to 14, further comprising: The thread startup module is configured to start multiple queue threads, wherein the multiple queue threads correspond to the multiple task queues respectively, and each queue thread in the multiple queue threads is configured to dispatch the computing tasks in the corresponding task queue to any computing unit corresponding to the task queue.
16. The apparatus according to any one of claims 10 to 15, further comprising: A first acquisition module is configured to acquire a first computing task to be executed in a target task queue, wherein the target task queue is any non-empty task queue; and The dispatching module is configured to dispatch the first computing task to a first computing unit corresponding to the target task queue for execution, wherein the first computing unit is any idle computing unit corresponding to the target task queue.
17. The device according to claim 16, wherein: The first acquisition module is further configured to: Acquire a first execution parameter of the first computing task from a first buffer whose execution status is prepared in the target task queue, And wherein, the distribution module includes: a state modification submodule, configured to modify the execution state of the first buffer to being executed; a third configuration submodule, configured to configure the first execution parameter to the first computing unit, so that the first computing unit executes the first computing task based on the first execution parameter; and The preparation submodule is configured to prepare a second execution parameter of a second computing task using a second buffer, wherein the second computing task is a next computing task of the first computing task.
18. The apparatus according to claim 17, further comprising: a second acquisition module, configured to acquire the second execution parameter from the second buffer in response to the first computing task being completed and the execution status of the second buffer being prepared; A state modification module, configured to modify the execution state of the second buffer to being executed; as well as The configuration module is configured to configure the second execution parameter to the second computing unit corresponding to the target task queue for execution, wherein the second computing unit is any idle computing unit corresponding to the target task queue.
19. A chip, comprising: A firmware execution processor, a memory and a plurality of computing units, wherein the firmware execution processor is configured to implement the method according to any one of claims 1 to 9 by running firmware.
20. An electronic device comprising the chip according to claim 19.
21. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1-9.
22. A computer program product comprising computer program instructions, wherein: The computer program instructions, when executed by a processor, implement the method according to any one of claims 1-9.
