Accelerator device and control method for accelerator device

By introducing a status information table and a dynamic binding mechanism into the accelerator device, the problem of low resource utilization caused by fixed binding of acceleration functional units is solved, and efficient time-sharing and resource scheduling of acceleration functional units are realized.

CN121029323BActive Publication Date: 2026-03-03INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511556607.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-29
Publication Date
2026-03-03
Estimated Expiration
2045-10-29

AI Technical Summary

Technical Problem

The static binding of acceleration function units and virtual function devices results in low resource utilization. When not in use, they cannot be shared by other virtual function devices, causing resource waste.

Method used

By dividing the accelerator device into static and dynamic areas, introducing acceleration unit status information tables and virtual function device status information tables, and dynamically binding target acceleration function units and virtual function devices, a single acceleration function unit can serve multiple virtual function tasks in a time-sharing manner.

Benefits of technology

This improves the utilization rate of acceleration function units, avoids resource idleness, and enables efficient sharing of acceleration function units and dynamic scheduling of resources among multiple virtual function devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121029323B_ABST
    Figure CN121029323B_ABST
Patent Text Reader

Abstract

The application discloses an accelerator device and a control method thereof, and relates to the technical field of computers. The accelerator device is divided into a static region and a dynamic region. The static region comprises virtual function device state information and acceleration unit state information, and the dynamic region comprises at least one acceleration function unit. The accelerator is used for determining a target acceleration function unit from the at least one acceleration function unit according to received user demand by traversing an acceleration unit state information table, determining a target virtual function device matched with the target acceleration function unit by traversing virtual function device state information table, and binding the target acceleration function unit and the target virtual function device. Thus, the problem of low utilization rate of the acceleration unit caused by fixed binding of the acceleration function unit and the virtual function unit is solved, and the application can make a single acceleration function unit serve acceleration tasks from multiple virtual functions in time sharing mode, thereby improving the utilization rate of the acceleration function unit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more particularly to accelerator devices and control methods for accelerator devices. Background Technology

[0002] In data centers, accelerator devices are used to accelerate a wide variety of applications. To support a single device being shared by multiple virtual machines while ensuring high performance, it is typically based on SR-IOV (Single Root I / O Virtualization) technology. This allows the accelerator device to create one physical function (PF) and multiple virtual functions (VFs). The VFs are independent of each other and can be assigned to different virtual machines, enabling multiple virtual machines to share the accelerator device.

[0003] In related technologies, the acceleration function unit (AFU) and virtual function device (VF) have a static one-to-one binding relationship, with each AFU serving only one specific VF. However, this technology may result in low utilization of the AFU because when the VF to which the AFU belongs has no acceleration tasks, the AFU will be completely idle. However, due to access path isolation, other VFs cannot use it, thus resulting in low utilization of the AFU. Summary of the Invention

[0004] This invention provides an accelerator device and a control method for the accelerator device, to at least solve the problem that when a virtual function that is fixedly bound to an acceleration function unit has no acceleration task, the corresponding acceleration function unit will be completely idle, resulting in low utilization of the acceleration function unit. This application enables a single acceleration function unit to serve acceleration tasks from multiple virtual functions in a time-sharing manner, avoiding idle acceleration function units and thereby improving overall utilization.

[0005] This invention provides an accelerator device, wherein the field-programmable gate array (FPGA) is divided into a static region and a dynamic region. The static region includes virtual functional device status information and acceleration unit status information, and the dynamic region includes at least one acceleration functional unit.

[0006] The acceleration unit status information table is configured to store the status information of at least one acceleration functional unit within the dynamic region; the virtual functional device status information is configured to store the status information of at least one virtual functional device; wherein...

[0007] The accelerator is used to traverse the acceleration unit status information table according to the received user requirements to determine the target acceleration function unit from the at least one acceleration function unit, and traverse the virtual function device status information table to determine the target virtual function device that matches the target acceleration function unit, and bind the target acceleration function unit and the target virtual function device.

[0008] The present invention also provides a control method for an accelerator device, the method being applied to the accelerator device described above, wherein the method includes the following steps:

[0009] Determine whether the user request has been received;

[0010] If the user request is received, then based on the user request, the target acceleration function unit is determined from the at least one acceleration function unit by traversing the acceleration unit status information table.

[0011] The virtual function device status information table is traversed to determine the target virtual function device that matches the target acceleration function unit, and the target acceleration function unit and the target virtual function device are bound together.

[0012] This invention determines a target acceleration function unit from at least one acceleration function unit by traversing the acceleration unit status information table based on received user requests, and determines a target virtual function device that matches the target acceleration function unit by traversing the virtual function device status information table, and then binds the target acceleration function unit and the target virtual function device. This solves the problem that when a virtual function to which an acceleration function unit is fixedly bound has no acceleration tasks, the corresponding acceleration function unit becomes completely idle, resulting in low utilization of the acceleration function unit. This application allows a single acceleration function unit to serve acceleration tasks from multiple virtual functions in a time-sharing manner, avoiding idle acceleration function units and thus improving overall utilization. Attached Figure Description

[0013] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the 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.

[0014] Figure 1 This is a schematic diagram illustrating the accelerator principle of related technologies;

[0015] Figure 2 A block diagram of an accelerator device provided in an embodiment of the present invention;

[0016] Figure 3 A schematic diagram of an accelerator device provided in one embodiment of the present invention;

[0017] Figure 4 This is a schematic diagram of an acceleration function unit module provided in one embodiment of the present invention;

[0018] Figure 5 A flowchart of a control method for an accelerator device provided in one embodiment of the present invention. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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 of ordinary skill in the art without creative effort are within the protection scope of the present invention.

[0020] It should be noted that, in the description of this invention, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0021] Before introducing the accelerator device of the present invention, let's first describe the system architecture of a conventional accelerator device, such as... Figure 1 As shown, the system architecture is divided into two parts: a static area and a dynamic area. The dynamic area contains acceleration units (AFUs) that implement various functions, such as compression, encryption, and decryption. This area can dynamically update its functions through partial reconfiguration technology. The static area implements SR-IOV technology, creating PFs and multiple VFs, and adding a mapping module to achieve dynamic combination of VFs with different functional acceleration units. In this architecture design, acceleration functional units and VFs are bound together. Because SR-IOV technology requires VFs to be isolated and independent from each other, acceleration functional units can only serve the bound VFs. However, in traditional accelerator devices, when the virtual function to which an acceleration functional unit is fixedly bound has no acceleration task, the corresponding acceleration functional unit will be completely idle, resulting in low utilization of the acceleration functional unit. To solve the above problems, this application provides an accelerator device that supports a single acceleration functional unit (AFU) to be bound to multiple virtual device VFs, and enables a single acceleration functional unit (AFU) to serve acceleration tasks issued by multiple VFs in a time-sharing manner, thereby improving the utilization of AFUs.

[0022] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0023] Embodiments of the present invention provide an accelerator device, Figure 2 This is a block diagram of an accelerator device according to an embodiment of the present invention.

[0024] like Figure 2 As shown, the accelerator device 10 is divided into a static region 100 and a dynamic region 200. The static region 100 includes virtual function device status information and acceleration unit status information, while the dynamic region 200 includes at least one acceleration function unit.

[0025] Among them, an accelerator device is a device used to accelerate specific types of computing tasks; acceleration function refers to the specific task or function performed by the accelerator, such as compression, encryption, decryption, etc.; the static area is the area where the logical function remains unchanged during the operation of the computing task, and the dynamic area is the area where the logical function can be dynamically changed through partial reconfiguration during the operation of the computing task. The acceleration unit status information table is configured to store the status information of at least one acceleration function unit in the dynamic area; the virtual function device status information is configured to store the status information of at least one virtual function device.

[0026] The accelerator is used to traverse the acceleration unit status information table according to the received user requirements to determine the target acceleration function unit from at least one acceleration function unit, and traverse the virtual function device status information table to determine the target virtual function device that matches the target acceleration function unit, and bind the target acceleration function unit and the target virtual function device.

[0027] It should be noted that the status information of the virtual function device includes at least one of the following: virtual function device identifier, number of interrupts that can be supported, access space capacity of the registers contained in the virtual function device, priority weight, and binding status with the acceleration function unit; the status information of the acceleration function unit includes at least one of the following: acceleration unit index number, acceleration unit function identifier number, occupied space capacity of at least one set of context configuration registers, maximum number of contexts that can be supported, number of contexts that can be allocated, allocated context sequence number, and number of interrupts.

[0028] Specifically, in combination Figure 3As shown, when the system receives a user's acceleration service request, it first iterates through the acceleration unit status information according to the acceleration function type specified in the request, filtering out target acceleration function units that have the corresponding function and still have available resources. Then, the system iterates through the virtual function device status information table, searching for target virtual function devices that are currently idle and not yet bound to any acceleration function unit. After successfully identifying a matching target acceleration function unit and target virtual function device, the system establishes a binding relationship between them. This not only updates the records in both status information tables but also establishes an access path at the hardware level, enabling the target virtual function device (VF) to access and configure the independent context register group allocated to it by the target acceleration function unit (AFU) through its base address register (BAR), thereby achieving exclusive and isolated use of the acceleration function.

[0029] Therefore, in related technologies, a Virtual Function (VF) typically forms a fixed "one-to-one" binding relationship with an AFU. When the VF has no computational tasks, its bound AFU, even if idle, cannot be used by other VFs with needs, leading to long-term idleness and waste of hardware resources. This invention, however, removes the limitation of static binding by introducing two dynamic management tables, "Acceleration Unit Status Information" and "Virtual Function Device Status Information," into the static area. The system can dynamically allocate multiple independent contexts of an AFU to different VFs based on real-time user needs. In other words, an AFU can be time-sharing multiplexed by multiple VFs. For example, when VF1's task is completed, its occupied context is released, and the system can immediately allocate another idle context of that AFU to the newly requesting VF2. Since the hardware resources of the AFU are in a state of being scheduled to execute tasks most of the time, rather than being forced idle due to the binding relationship, the overall hardware resource utilization of the accelerator is fundamentally improved, effectively solving the problem of low utilization caused by static resource allocation in traditional architectures.

[0030] According to one embodiment of the present invention, the above-described accelerator device further includes: a register access interface, an interrupt interface, and a memory access interface.

[0031] The register access interface is configured to receive the first access request from the virtual function device and map it to the configuration module of the corresponding acceleration function unit.

[0032] The interrupt interface is configured to receive interrupt requests from the acceleration function unit and map them to the corresponding virtual function device to send the interrupt request.

[0033] The memory access interface is configured to receive a second access request from the acceleration function unit and map it to the target memory storage space.

[0034] Specifically, in combination Figure 3 and Figure 4 As shown, static region 100 is used to implement SR-IOV technology, creating PF and multiple VF, and adding multiple modules and table structures to support the dynamic combination of acceleration units with multiple VF. Dynamic region 200 contains various implemented acceleration function units, each of which includes three interfaces: register access interface, interrupt interface, and memory access interface (DDR), to enable the host to access the acceleration unit's registers, the acceleration unit to send interrupts to the host, and the acceleration unit to access the device's DDR memory space. To support a single acceleration function unit (AFU) being bound to multiple VFs and to enable a single acceleration function unit (AFU) to time-share acceleration tasks issued by multiple VFs, this patent restructures the architecture of the acceleration function unit, including three modules, such as... Figure 4 As shown.

[0035] During execution, when a VF bound to an AFU needs to configure task parameters, it initiates a register write operation to the address space mapped by its BAR. This operation, as the "first access request," is received via the register access interface. The interface module, based on the current VF-AFU binding relationship (by querying the mapping table in the static region), redirects the request to the target AFU's dedicated context configuration register group in the AFU configuration module, completing the parameter write. When the AFU's execution unit completes its task, it sends an interrupt request to the system via the interrupt interface. This request contains the target VF's identification information, and the interrupt interface precisely delivers the interrupt signal to the VF, notifying it that the task is complete and the results can be read. During task execution, if the AFU needs to read data from host memory or write results back to memory, it initiates a "second access request" via the memory access interface. This interface is responsible for converting the logical address in the request to a physical address and transferring the data to the target memory storage space via DMA (Direct Memory Access) mechanism, achieving efficient data transfer.

[0036] Therefore, in related technologies, the communication path between VF and AFU is single and static, making it difficult to support dynamic binding and multi-VF sharing scenarios. This invention addresses this by introducing three types of dedicated interfaces to achieve decoupling and precise mapping of the communication path. First, the register access interface allows multiple VFs to safely reuse the register resources of the same AFU without configuration conflicts. Second, the interrupt interface ensures that task completion notifications are accurately delivered to the requesting VF, avoiding interrupt confusion and guaranteeing the independence and real-time response of each virtual machine. Finally, the memory access interface provides the AFU with the ability to directly access external memory, avoiding repeated data copying between the CPU and accelerator, significantly reducing processing latency and CPU overhead.

[0037] According to one embodiment of the present invention, the acceleration functional unit includes: a configuration module, a scheduling module, and an execution module.

[0038] The configuration module includes at least one set of context configuration registers, which includes a start command register configured to start a corresponding acceleration task based on a received set signal.

[0039] The scheduling module includes a status register and a scheduling unit. The status register is configured to indicate whether the context configuration register has been configured, and the scheduling unit is configured to execute the corresponding scheduling action based on a preset scheduling policy.

[0040] The execution module includes a context register and an execution unit. The context register is configured to record the context sequence number of the currently scheduled execution, and the execution unit is configured to read the context configuration register information corresponding to the context sequence number from the configuration module and execute the functional task of the corresponding acceleration function unit.

[0041] It should be noted that the preset scheduling strategy includes at least one of the fixed priority scheduling strategy, round-robin scheduling strategy, and weighted round-robin scheduling strategy; the maximum number of context configuration registers is determined according to the maximum number of virtual functional devices that the corresponding acceleration functional unit can support binding.

[0042] According to one embodiment of the present invention, the scheduling module further includes a pointer register.

[0043] The pointer register is configured to record the last scheduling position so that when the preset scheduling strategy is a round-robin scheduling strategy, the last scheduling position recorded in the pointer register can be searched.

[0044] According to one embodiment of the present invention, the scheduling module further includes at least one weight register.

[0045] The weight register is configured to characterize the importance of the context configuration register.

[0046] Specifically, the configuration module includes: N sets of context configuration registers, where N is the maximum number of Virtual Functions (VFs) that this AFU can support binding, and the context configuration registers are a list of registers required for the actual execution of this AFU. Each set of context configuration registers has the same number and order, and must contain a startup command register. The application sets the startup command register via a VF to inform the scheduling module that this set of context configuration registers has been configured and meets the conditions for executing the AFU function. When the execution module reads this set of context configuration registers to execute the AFU function, it resets the startup command register to indicate that the task has started and prevents duplicate execution.

[0047] The scheduling module includes at least one status register and one scheduling unit. The status register has at least N bits, which are used to indicate whether a certain group of context configuration registers in the configuration module has been configured and is ready to execute the AFU function. If a bit is 1, it indicates that the corresponding context configuration register has been configured and can be executed; if it is 0, it cannot be executed. The scheduling unit will check the status register to see if there is a bit that is 1. If there is a bit that is 1, the scheduling execution module will execute the AFU task. The scheduling unit can choose a variety of different strategies when scheduling. For example, (1) fixed priority strategy, each time it will check from low bit to high bit to find which bit is 1, at this time the low bit has the highest priority; (2) round-robin scheduling: at this time, a pointer register needs to be added to record the position of the last scheduling, and the next scheduling will start from the position recorded by the pointer register; (3) weighted round-robin: at this time, a weight register needs to be added to the list of each group of context configuration registers in the configuration module. When scheduling, the context with the largest weight register value among all contexts with status register 1 is selected for scheduling.

[0048] The execution module includes at least a context register and an execution unit. The context register records the context number of the currently scheduled task. The execution unit reads the context configuration register information corresponding to the context number from the configuration module and executes the AFU (Active Function Function) task. During execution, data is read through the DDR access interface. When the task finishes execution, it notifies the VF (Vehicle Function Function) module of task completion via the interrupt interface and notifies the scheduling module. Upon receiving the notification, the scheduling module resets the corresponding bits in the status register and then schedules the next task.

[0049] In actual execution, after a virtual function device (VF) completes the writing of parameters to its bound context configuration register, it sets the corresponding start command register. This operation simultaneously triggers the corresponding bit in the status register to be set to "1", indicating that the context is ready for execution. The scheduling unit of the scheduling module continuously polls the status register and determines the next task to be executed based on a preset scheduling strategy (such as fixed priority, round-robin, or weighted round-robin). If a round-robin strategy is used, the scheduling unit starts scanning from the last scheduling position recorded in the pointer register, avoiding repeated checks of already processed items and improving scheduling efficiency. If a weighted round-robin strategy is used, the execution opportunities are allocated according to the weight ratio based on the value in the weight register. After selecting a task, the scheduling unit writes the context number of the task into the context register of the execution module and triggers the execution unit. The execution unit reads all the configuration information corresponding to the context number from the configuration module, executes the corresponding acceleration task, and notifies the corresponding VF through an interrupt mechanism upon completion. At the same time, the scheduling unit clears the ready flag in the status register and releases the context resources for subsequent tasks.

[0050] Therefore, AFUs in related technologies are typically designed for single task flows, unable to detect or handle concurrent requests from multiple VFs, necessitating the allocation of an independent AFU instance for each VF, resulting in resource waste. This invention enables a single AFU to manage N independent context configurations simultaneously, with each context corresponding to an independent task environment of a VF. When tasks from multiple VFs become ready sequentially, the status registers uniformly mark the ready state, and the scheduling unit arbitrates and schedules according to a strategy. For example, under a round-robin strategy, a pointer register is used to implement cyclic scanning, ensuring that each VF task receives a fair execution opportunity; under weighted round-robin, critical business VFs can be configured with higher weights to receive more frequent scheduling, meeting differentiated needs. Since the execution unit can quickly switch contexts and execute tasks from different VFs under the control of the scheduling unit, the utilization efficiency of the AFU can be improved. Therefore, this invention, through an internal time-division multiplexing mechanism, enables the physical resources of the AFU to be efficiently shared by multiple VFs, significantly improving the processing capacity of unit hardware resources and the overall accelerator utilization.

[0051] Here, we will explain the various modules in the static area 100.

[0052] (1) The status information of virtual functional devices can be shown in Table 1. The status information of virtual functional devices stores the status information of all virtual functional devices VF contained in static area 100. Table 1 is the status information table of virtual functional devices.

[0053] Table 1

[0054]

[0055] Each line represents the status information of a Virtual Functional Device (VF), specifically including: (1) VF identifier, used to identify the corresponding VF; (2) The number of MSI-X interrupts supported by this VF. In this embodiment of the invention, considering the number of interrupts that can be supported, the interrupt type supported by the VF is required to be MSI-X. (3) The size of the register access space contained in this VF. The host's request to access this space will be routed to the register access interface of a certain acceleration unit contained in this VF, and then access the register of that acceleration unit; therefore, the size of this space should not be less than the size of the context register of the acceleration functional unit bound to this VF. (4) Priority weight, optional. If VF priority is supported, different priority weights are set for different VFs. The larger the weight value, the higher the priority. (5) Whether this VF is bound to an acceleration functional unit. 0 represents not bound, and 1 represents bound.

[0056] (2) The acceleration unit status information can be as shown in Table 2. The acceleration unit status information stores the status information of all acceleration function units contained in the dynamic area 200. Table 2 is the acceleration unit status information table.

[0057] Table 2

[0058]

[0059] Each line represents the status information of an acceleration unit, specifically including: (1) Acceleration unit index number, which identifies the number of this acceleration unit in the dynamic area; (2) Acceleration unit function identifier number, which identifies the function of this acceleration unit, using UUID format; (3) Space size occupied by each group of context configuration registers, which indicates the space size occupied by the registers required when this acceleration unit performs its function; (4) Maximum number of supported contexts, which indicates the number of groups of context configuration registers contained in this acceleration unit configuration module, that is, the maximum number of VFs that can be bound; (5) Number of allocable contexts, which indicates how many VFs can still be bound; (6) Allocated context sequence number, which indicates the context sequence number that has been bound to a VF, represented by a bitmap, where each bit represents a sequence number, such as 10101010b, which indicates that context sequence numbers 1, 3, 5, and 7 have been bound to a VF, and sequence numbers 0, 2, 4, and 6 are to be allocated; (7) Number of interrupts, which indicates the number of interrupts required by this acceleration unit.

[0060] This section describes the binding process between the Virtual Function (VF) and the Acceleration Function Unit.

[0061] After receiving a user's request for accelerator equipment, for example, if the user requests that the accelerator equipment include function A, the data center can iterate through the two tables mentioned above—the VF status information table and the acceleration functional unit status information table—to determine whether a particular accelerator equipment meets the requirements. The specific determination process is as follows:

[0062] Query the acceleration unit status information table to determine if this device contains the required function A and if there is any available context. If not, this acceleration device does not meet the requirements, and the next acceleration device is queried. Otherwise, proceed to the next step.

[0063] Query the virtual function status information table to determine if there is a virtual function whose status matches the acceleration function unit, i.e., (1) the virtual function VF is not yet bound to the acceleration unit function; (2) the register access space contained in the virtual function VF is not less than the context configuration register space of the acceleration function unit; (3) the number of MSI-X interrupts supported by the virtual function VF is not less than the number of interrupts of the acceleration function unit. If all conditions are met, the acceleration device meets the requirements; otherwise, the acceleration device does not meet the requirements, and the next acceleration device is queried.

[0064] According to one embodiment of the present invention, the static area further includes: a virtual functional device and acceleration functional unit mapping table.

[0065] The virtual function device to acceleration function unit mapping table is configured to store the mapping relationship between the target acceleration function unit and the target virtual function device.

[0066] Specifically, after matching and binding target AFUs and VFs according to user requirements, specific mapping entries can be written into the Virtual Functional Device and Accelerated Functional Unit Mapping Table. During subsequent operation, the Virtual Functional Device and Accelerated Functional Unit Mapping Table serves as the core basis for hardware access path redirection. For example, when a VF initiates a register access request, the register access routing module first queries this mapping table, finds the bound AFU identifier and context sequence number based on the VF identifier, and then redirects the original access request to the configuration register group of the specified context within that AFU. Similarly, when an AFU needs to send an interrupt after completing a task, the interrupt interface also queries this mapping table to determine the target VF that should receive the interrupt, ensuring that the interrupt signal is accurately delivered. The contents of this table are dynamically updated as VFs are unbound or rebound, serving as the hub for dynamic scheduling and multi-tenant sharing of AFU resources.

[0067] In actual implementation, after finding an accelerator device that meets the user's needs, the accelerator management program allocates an allocatable context number for an accelerator unit through the configuration interface provided by the accelerator's PF, thus binding the VF to the accelerator unit. Specifically, this involves configuring a mapping table between the VF and the accelerator unit.

[0068] The mapping table between VF and acceleration unit is shown in Table 3. The mapping table stores information about each VF and the acceleration function unit bound to it. Table 3 is the mapping table between VF and acceleration unit.

[0069] Table 3

[0070]

[0071] Each line specifically includes: (1) VF identifier number, which identifies the corresponding VF; (2) Acceleration unit index number, which identifies the number of this acceleration function unit in the dynamic area; (3) Assigned context number, which indicates which context configuration register of the acceleration function unit corresponds to the VF; (4) ddr_start and ddr_size, which indicate the DDR range accessible to this VF and the acceleration function unit.

[0072] After configuring the mapping table between VF and acceleration unit, the binding between VF and acceleration function unit is achieved.

[0073] Therefore, in related technologies, the binding relationship between VF and AFU is static and hard-wired, lacking a programmable intermediate layer to manage this relationship, resulting in the inability to reuse resources. This invention, through a dynamically configurable virtual function device and acceleration function unit mapping table, can flexibly allocate idle AFU contexts to any idle VF with demand based on real-time load conditions. Furthermore, the virtual function device and acceleration function unit mapping table provides a unified addressing basis for all cross-functional communication, ensuring that in a resource-sharing environment, each VF's request and response can be accurately routed to the corresponding context, achieving isolation.

[0074] According to one embodiment of the present invention, the static region further includes: a register access routing module and a register access arbitration module.

[0075] The register access routing module is configured to query the mapping table between the virtual function device and the acceleration function unit based on the first access issued by the virtual function device, determine the corresponding acceleration function unit number and context register group number, generate a new access request based on the corresponding acceleration function unit number, context register group number and the target context register address in the first access request, and pass the new access request to the register access arbitration module.

[0076] The register access arbitration module is configured to determine the corresponding acceleration function unit based on the corresponding acceleration function unit number in the new access request, and send the context register group number and target context register address in the new access request to the configuration module of the corresponding acceleration function unit through the register access interface of the corresponding acceleration function unit to perform register access.

[0077] Specifically, when a Virtual Function (VF) needs to configure its bound AFU, it initiates a register write or read operation. This operation, as the "first access request," enters the register access routing module. The routing module first queries the "Virtual Functional Device and Accelerated Functional Unit Mapping Table" based on the VF identifier in the request to obtain the corresponding AFU number and context register group number. Then, the routing module combines the target register address from the original request to generate a new access request containing the target AFU number, context register group number, and target address. This new request is sent to the register access arbitration module. The arbitration module identifies the target AFU based on the AFU number in the new request and, when multiple concurrent requests exist, determines the processing order according to preset rules (such as priority or round-robin). Finally, the arbitration module passes the context register group number and target address to the AFU's configuration module through the target AFU's register access interface, completing the register access.

[0078] In actual execution, after configuring the mapping table between the Virtual Function (VF) and the acceleration unit, the binding between the VF and the acceleration functional unit is achieved. This VF is then allocated to the user's virtual machine and delivered for user use.

[0079] The following details how to configure a specific set of context registers for an accelerated function unit via VF, trigger the execution of the accelerated function unit, and send an interrupt to VF upon completion of the accelerated function unit's execution. The specific process is as follows:

[0080] (1) Configure a set of context registers of the acceleration function unit through VF:

[0081] 1. Assuming the context register address to be configured is Addr, the user generates a PCIe access request to the accelerator device by accessing the address with offset Addr in the VF device BAR space.

[0082] 2. This access request is passed to the register access routing module in the static area. The register access routing module first indexes the VF-acceleration unit mapping table based on the requested VF identifier number to find the content corresponding to this VF, namely the acceleration unit number bound to this VF and the corresponding context register group number. Then, based on the obtained acceleration unit number, context register group number, and specific context register address Addr, a new register access request is formed.

[0083] 3. The request is passed to the register access arbitration module. The register access arbitration module determines the order of register access. When this request is executed, the acceleration unit is first selected based on the acceleration function unit number. Then, the context register group number and the specific context register address Addr are passed to the configuration module of the acceleration function unit through the register access interface of the acceleration unit, thereby completing the access to the specific register.

[0084] (2) Trigger the execution of the acceleration function unit:

[0085] 1. First, according to the register access process described above, complete the write operation to the start command register contained in the corresponding context register group.

[0086] 2. Subsequently, the configuration module notifies the scheduling module to set the corresponding bit in the status register of the scheduling module to 1.

[0087] 3. If the AFU is not currently executing a task, the scheduling unit in the scheduling module executes the scheduling policy and schedules the task to be executed according to the status register.

[0088] Therefore, in traditional architectures without routing and arbitration mechanisms, if multiple Virtual Functions (VFs) share a single AFU, their register access paths will conflict, leading to configuration errors or system crashes. This invention introduces a "register access routing module" to achieve precise redirection of access requests, ensuring that each VF's request is correctly mapped to its dedicated context register group within the AFU, guaranteeing configuration isolation and preventing unauthorized cross-context access. Furthermore, the introduction of a "register access arbitration module" solves the resource contention problem when multiple VFs concurrently access the same AFU. When multiple VF task configuration requests arrive simultaneously, the arbitration module, through orderly scheduling, avoids hardware bus conflicts and data corruption, ensuring that the AFU configuration module can stably and reliably receive and process each request.

[0089] According to one embodiment of the present invention, the static region further includes: an interrupt interface arbitration module and an interrupt routing module.

[0090] The interrupt interface arbitration module is configured to add the corresponding acceleration function unit number to the received interrupt request and then pass the interrupt request with the added acceleration function unit number to the interrupt routing module.

[0091] The interrupt routing module is configured to query the mapping table between virtual functional devices and acceleration functional units based on the interrupt request after adding the acceleration functional unit number, determine the corresponding virtual functional device, and send the interrupt request to the corresponding virtual functional device.

[0092] Specifically, when an AFU completes a task and needs to notify its bound VF, it sends an interrupt request to the interrupt interface arbitration module. The arbitration module first arbitrates interrupt requests that may be issued simultaneously by multiple AFUs to ensure no system bus conflicts occur, and embeds the AFU number of the request's origin into the arbitrated interrupt request. The interrupt request carrying the AFU number is then passed to the interrupt routing module. Based on the AFU number and the context sequence number provided by the AFU's internal execution module, the interrupt routing module queries the "Virtual Functional Device and Accelerated Functional Unit Mapping Table" to locate the original VF that initiated the task.

[0093] In actual execution, the acceleration function unit sends an interrupt to VF when it finishes execution:

[0094] 1. After the acceleration function unit finishes execution, an interrupt request is created. This request contains the context number stored in the execution module context register.

[0095] 2. The interrupt request is passed to the interrupt interface arbitration module through the interrupt interface of the acceleration function unit. The interrupt interface arbitration module adds the acceleration function unit number to the interrupt request and passes the request to the interrupt routing module.

[0096] 3. The interrupt routing module queries the VF-acceleration unit mapping table based on the acceleration function unit number and context sequence number to determine the corresponding VF number, and finally passes the interrupt to the corresponding VF.

[0097] Therefore, in related technologies, each VF typically occupies a dedicated AFU, with a fixed interrupt path and no need for complex routing. In the embodiments of this invention, tasks from multiple VFs may be completed and interrupts issued by the same AFU. Without an effective mechanism, the system will be unable to distinguish the source of the interrupt, leading to incorrect notifications or interrupt loss. This solution first solves the bus contention problem of concurrent interrupts from multiple AFUs through the "Interrupt Interface Arbitration Module," avoiding interrupt signal loss or system blocking, and improving system stability and real-time response capabilities. In addition, the "Interrupt Routing Module," combined with the "Virtual Functional Device and Accelerated Functional Unit Mapping Table," achieves accurate reverse mapping of interrupts.

[0098] Additionally, after the virtual machine is shut down and the VF device is released, the accelerator management program uses the configuration interface provided by the accelerator's PF to unbind the VF from the accelerator unit. The specific steps are as follows:

[0099] 1. Query the VF status information table based on the VF identifier and set its binding status with the acceleration function unit to 0, indicating that it is in an unbound state.

[0100] 2. Query the VF-to-acceleration unit mapping table based on the VF identifier to obtain the included acceleration function unit number and allocated context number. Then update the available_contexts and allocated_contexts_number of the corresponding acceleration function unit in the acceleration unit status information table.

[0101] 3. Finally, delete the corresponding content of this VF in the VF-acceleration unit mapping table.

[0102] According to one embodiment of the present invention, the static region further includes: a memory access arbitration module and a memory access module.

[0103] The memory access arbitration module is configured to add a corresponding acceleration function unit number to the received second access request and then pass the second access request with the added acceleration function unit number to the memory access module.

[0104] The memory access module is configured to query the virtual function device and acceleration function unit mapping table based on the second access request after adding the acceleration function unit number, determine the memory space start address and memory space address length of the target memory storage space, and access the target memory storage space based on the memory space start address and memory space address length.

[0105] Specifically, when an AFU needs to read input data from an external DDR or write back results during task execution, it initiates a second access request. This request first enters the memory access arbitration module, which prioritizes or round-robins concurrent requests from multiple AFUs to avoid bus conflicts and embeds the source AFU number into the arbitrated request. The request carrying the AFU number is then sent to the memory access module. This module queries the "Virtual Functional Device and Accelerated Functional Unit Mapping Table" based on the AFU number to determine the VF currently served by the AFU and its binding context. Based on the VF's identity, the memory access module looks up its pre-allocated memory region configuration to obtain the starting address and allowed address length of the corresponding target DDR memory space. Finally, the memory access module generates read / write commands conforming to the DDR protocol, accesses the specified physical address range through the DDR controller, and completes the data transfer.

[0106] Therefore, in an architecture without unified management, multiple AFUs directly accessing DDR may lead to bus contention, request loss, or data overwriting. This embodiment of the invention resolves physical layer concurrent access conflicts through a "memory access arbitration module," ensuring that requests on the DDR bus are processed in order, thus improving the reliability and bandwidth utilization of memory access. Furthermore, the "memory access module," combined with a "virtual function device and acceleration function unit mapping table," implements logical layer access control and address mapping, ensuring that AFUs can only access the memory range authorized by their bound VFs, achieving isolation and protection of storage resources.

[0107] To enable those skilled in the art to further understand the accelerator devices of the embodiments of this application, detailed descriptions are provided below in conjunction with specific embodiments.

[0108] Suppose that the VF state information table and acceleration unit state information table of an accelerator in the static region are shown in Table 4. Table 4 is the acceleration unit state information table and Table 5 is the VF state information table.

[0109] Table 4

[0110]

[0111] Table 5

[0112]

[0113] Suppose that both users need a device with compression as its acceleration function, and the UUID (Universally Unique Identifier) ​​for the compression function is 4C3A8ECC-0940-6B0A-C2E3-1570822F090C.

[0114] The acceleration unit status information table shows that the current accelerator includes compression functionality, specifically acceleration function unit number 1, and has 4 assignable contexts. The VF status information table shows that VF1 and VF3 are not yet bound to acceleration function units, so VF1 and VF3 can be bound to acceleration function unit number 1.

[0115] From the allocated context sequence number entry (10101010b) of acceleration function unit 1, we know that context sequences 1, 3, 5, and 7 are already bound to VFs, while sequences 0, 2, 4, and 6 are pending allocation. Assuming sequence 0 is assigned to VF1 and sequence 2 to VF3, after binding is complete, the allocated context sequence number content of acceleration function unit 1 will be updated to 10101111b.

[0116] The configuration of the VF and acceleration unit mapping table is shown in Table 6. It indicates that VF1 and VF3 are both bound to acceleration function unit 1, and the assigned context numbers are 0 and 2 respectively. Table 6 is the VF and acceleration unit mapping table.

[0117] Table 6

[0118]

[0119] Taking the example of a user writing data 0x1000 to register at address 0x10 via VF3, the register access process is introduced as follows:

[0120] (1) First, the user initiates a write request to the address with an offset of 0x10 in the BAR space of VF3.

[0121] (2) The write request is passed to the register access routing module in the static area. This module queries the mapping table between VF and acceleration unit based on VF identifier 3, determines that the register access address belongs to acceleration function unit 1 and the context number is 2, and thus constructs a new register access request.

[0122] (3) The new register access request is passed to the register access arbitration module. When the request is executed, acceleration unit 1 is selected, and then the context register group number 2 and the specific context register address 0x10 are passed to the configuration module of the acceleration function unit through the register access interface of acceleration unit 1, thereby completing the write operation of the register at address 0x10 in context register group 2.

[0123] Therefore, the accelerator device based on SR-IOV technology in this embodiment of the invention has been redesigned so that a single acceleration function unit can be dynamically bound to multiple VFs according to user needs. This breaks through the previous one-to-one binding relationship between VFs and acceleration units, allowing the acceleration function unit to serve multiple VFs, avoiding the idleness of the acceleration function unit, and thus improving the utilization rate of the acceleration function unit.

[0124] The accelerator device proposed in this embodiment of the invention determines a target acceleration function unit from at least one acceleration function unit by traversing the acceleration unit status information table according to received user requests, and determines a target virtual function device that matches the target acceleration function unit by traversing the virtual function device status information table, and then binds the target acceleration function unit and the target virtual function device. This solves the problem that when a virtual function to which an acceleration function unit is fixedly bound has no acceleration task, the corresponding acceleration function unit becomes completely idle, resulting in low utilization of the acceleration function unit. This application enables a single acceleration function unit to serve acceleration tasks from multiple virtual functions in a time-sharing manner, avoiding idle acceleration function units and thus improving overall utilization.

[0125] Embodiments of the present invention provide a control method for an accelerator device, applicable to the accelerator device described above.

[0126] like Figure 5 As shown, the control method of the accelerator device includes the following steps:

[0127] In step S101, it is determined whether a user request has been received.

[0128] In step S102, if a user request is received, the target acceleration function unit is determined from at least one acceleration function unit by traversing the acceleration unit status information table based on the user request.

[0129] Specifically, during system operation, the system continuously listens for and determines whether any acceleration service requests from users arrive. If the determination is negative, the process pauses or waits in a loop; if the determination is positive, i.e., a user request has been received, the process proceeds to step S102. In this step, the system parses the user request and extracts the specified acceleration function type (e.g., by UUID matching). Subsequently, the system iterates through all entries in the "Acceleration Unit Status Information Table," comparing the function UUID of each AFU with the request one by one, and checks whether its "Number of Allocated Contexts" is less than the "Total Number of Contexts" to confirm whether there are any idle contexts. When the first AFU that meets the function matching and has available resources is found, it is determined as the target acceleration function unit, preparing for subsequent binding with the Virtual Function Device (VF).

[0130] Therefore, in related technologies, the binding relationship between AFU and VF is pre-configured and fixed, and cannot be adjusted according to actual functional requirements and real-time resource status. This results in the system being unable to utilize even functionally matched and idle AFUs due to binding mismatch, leading to resource waste. This invention introduces a dynamic decision-making mechanism by judging user needs, traversing the status table, and then matching functions and resources. Because the system actively queries the real-time status of all AFUs before each allocation, it can accurately locate the target AFU that is "functionally matched and resource-available," ensuring the accuracy and efficiency of resource allocation.

[0131] According to one embodiment of the present invention, determining a target acceleration function unit from at least one acceleration function unit by traversing an acceleration unit status information table based on user requirements includes: determining a current acceleration function unit from at least one acceleration function unit based on the acceleration unit status information table; determining whether the current acceleration function unit meets user requirements and whether the current acceleration function unit has an allocatable context; if the current acceleration function unit meets user requirements and the current acceleration function unit has an allocatable context, then the current acceleration function unit is taken as the target acceleration function unit.

[0132] Specifically, in this embodiment of the invention, an entry is selected from the acceleration unit status information table as the current acceleration functional unit for inspection. The system compares the function UUID of the current acceleration functional unit with the function UUID specified in the user requirements to determine whether its function meets the requirements. Simultaneously, the system calculates whether the number of allocated contexts for the AFU is less than the total number of contexts. If this is true, it indicates that at least one allocatable context exists. When the current acceleration functional unit meets the user requirements and has an allocatable context, the current acceleration functional unit is identified as the target acceleration functional unit, and the traversal process terminates. If any condition is not met, the system continues traversing the next entry in the table until a target AFU that meets the conditions is found or the entire table is traversed.

[0133] Therefore, this embodiment of the invention ensures that only AFUs that possess both the required functionality and available resources can be selected, fundamentally eliminating incorrect allocation. Furthermore, this sequential traversal mechanism stops when the first AFU meeting the conditions is found, reducing scheduling overhead, avoiding waiting or retries due to resource mismatch, and shortening service response time.

[0134] According to one embodiment of the present invention, after determining whether the current acceleration function unit meets the user's needs and whether the current acceleration function unit has an allocable context, the method further includes: if the current acceleration function unit does not meet the user's needs or the current acceleration function unit does not have an allocable context, then a new acceleration function unit is determined from at least one acceleration function unit based on the acceleration unit status information table; the new acceleration function unit is taken as the current acceleration function unit, and the steps of determining whether the current acceleration function unit meets the user's needs and whether the current acceleration function unit has an allocable context are re-executed until the target acceleration function unit is obtained.

[0135] Specifically, after the current acceleration functional unit performs function matching and resource availability judgment, if either condition is not met, the system will not immediately terminate the allocation process. Based on the acceleration unit status information table, the next unchecked AFU is selected as the new acceleration functional unit and assigned as the new current acceleration functional unit. Subsequently, the system re-executes the steps of judging whether the function matches and whether an allocable context exists. This process continues to iterate, sequentially traversing all AFU entries in the table until the first AFU that simultaneously meets the functional requirements and resource availability conditions is found. At this point, it is determined as the target acceleration functional unit, and the loop exits. If no AFU that meets the conditions is found after traversing the entire table, it can be determined that there are insufficient resources, and the allocation fails.

[0136] Therefore, this embodiment of the invention introduces a loop traversal mechanism to check each AFU until a usable target is found, avoiding resource discovery omissions caused by the order of checks, realizing load balancing across multiple AFU instances, preventing the imbalance phenomenon of local resource overload and global resource idleness, and providing reliable resource guarantee for high concurrency and dynamically changing user load.

[0137] In step S103, the virtual function device status information table is traversed to determine the target virtual function device that matches the target acceleration function unit, and the target acceleration function unit and the target virtual function device are bound together.

[0138] According to one embodiment of the present invention, traversing a virtual functional device status information table to determine a target virtual functional device that matches a target acceleration functional unit includes: determining a current virtual functional device from at least one virtual functional device based on the virtual functional device status information table; determining whether the current virtual functional device is not bound to an acceleration unit function, and whether the register access space capacity of the current virtual functional device is greater than or equal to the space capacity occupied by the context configuration register of the target acceleration functional unit, and whether the number of interrupts supported by the current virtual functional device is greater than or equal to the number of interrupts of the target acceleration functional unit; if the current virtual functional device is not bound to an acceleration unit function, and the register access space capacity of the current virtual functional device is greater than or equal to the space capacity occupied by the context configuration register of the target acceleration functional unit, and the number of interrupts supported by the current virtual functional device is greater than or equal to the number of interrupts of the target acceleration functional unit, then the current virtual functional device is selected as the target virtual functional device.

[0139] Specifically, after identifying the target AFU, the system begins traversing the Virtual Function Device Status Information Table to find a matching VF. The system first selects a VF as the current virtual function device for evaluation. The evaluation process involves judging three parallel conditions: First, checking whether the VF is not bound to an acceleration unit function to ensure it can be allocated; second, comparing whether the VF's register access space capacity is greater than or equal to the occupied space capacity of the target AFU's context configuration register to ensure the VF has sufficient address space to map the AFU's configuration register; third, checking whether the number of interrupts supported by the VF is greater than or equal to the number of interrupts required by the target AFU to ensure interrupt communication capabilities match. When all three conditions are met, the system identifies the current virtual function device as the target virtual function device. If any condition is not met, the system continues to check the next VF in the table until a target VF that meets all conditions is found.

[0140] Therefore, different Virtual Functions (VFs) may have different hardware resource configurations. If only the binding status is checked while ignoring register space and interrupt capabilities, it may lead to malfunctions after binding. For example, if the VF's BAR space is insufficient, the AFU's configuration registers cannot be fully mapped, resulting in configuration failure; if the VF's interrupt support count is insufficient, the AFU's task completion interrupt cannot be delivered, causing task blocking. This embodiment of the invention avoids runtime errors caused by resource mismatch by introducing two conditions: register space capacity and interrupt count. This not only improves system stability and avoids faults caused by configuration errors but also increases the utilization rate of VFs.

[0141] According to one embodiment of the present invention, after determining whether the current virtual functional device is not bound to the acceleration unit function, whether the register access space capacity of the current virtual functional device is greater than or equal to the space capacity occupied by the context configuration register of the target acceleration functional unit, and whether the number of interrupts supported by the current virtual functional device is greater than or equal to the number of interrupts of the target acceleration functional unit, the method further includes: if the current virtual functional device is bound to the acceleration unit function, or the register access space capacity of the current virtual functional device is less than the space capacity occupied by the context configuration register of the target acceleration functional unit, or the number of interrupts supported by the current virtual functional device is less than the number of interrupts of the target acceleration functional unit, then a new virtual functional device is determined from at least one acceleration functional unit based on the acceleration unit status information table; the new virtual functional device is taken as the current virtual functional device, and the steps of determining whether the current virtual functional device is not bound to the acceleration unit function, whether the register access space capacity of the current virtual functional device is greater than or equal to the space capacity occupied by the context configuration register of the target acceleration functional unit, and whether the number of interrupts supported by the current virtual functional device is greater than or equal to the number of interrupts of the target acceleration functional unit are re-executed, until the target virtual functional device is obtained.

[0142] Specifically, if the current virtual function device (VF) is already bound to an acceleration unit function, or if the register access space capacity of the current VF is less than the space capacity occupied by the context configuration register of the target acceleration unit, or if the number of interrupts supported by the current VF is less than the number of interrupts supported by the target acceleration unit, the system will select the next unchecked VF from the VF status information table as the new VF and assign it as the new current VF. Subsequently, the system will re-execute the judgment process, which iterates continuously, sequentially traversing all VF entries in the table until a VF meeting the judgment conditions is found. At this point, it is determined as the target VF, and the loop exits. If no VF meeting the conditions is found after traversing the entire table, it is determined that there is no resource to bind, and allocation failure is returned.

[0143] Therefore, by introducing a loop traversal mechanism, this embodiment of the invention checks each VF until a usable target is found, avoiding omissions due to the order of checks, preventing global service interruptions due to local resource mismatches, and providing reliable resource allocation guarantees.

[0144] According to one embodiment of the present invention, binding a target acceleration function unit and a target virtual function device includes: storing the mapping relationship between the target acceleration function unit and the target virtual function device in a mapping table between virtual function devices and acceleration function units.

[0145] Specifically, after determining the target AFU and target VF, a binding operation is performed, and the association information of this binding is written into the virtual function device and acceleration function unit mapping table. Specifically, the system generates a new mapping entry, which includes: the target VF's identifier (vf_index), the target AFU's identifier (afu_index), and the context number (context_number) assigned to the VF within the target AFU. This entry is stored in the corresponding position in the mapping table. Updating this table allows subsequent hardware access paths (such as register access, interrupt sending, and memory access) to be precisely routed based on this mapping relationship, thereby achieving exclusive and isolated access of the VF to the AFU.

[0146] Therefore, in the static binding architecture of related technologies, the connection between VF and AFU is hardwired or preset in firmware, lacking flexibility and making it difficult to support resource sharing. This invention, by "storing" the binding relationship in a mapping table, transforms it from a static configuration to a dynamically modifiable state, improving resource utilization and enhancing system security, stability, and maintainability.

[0147] The control method for an accelerator device proposed in this embodiment of the invention determines whether a user request has been received. If a user request is received, based on the user request, the method iterates through the acceleration unit status information table to determine a target acceleration function unit from at least one acceleration function unit, and iterates through the virtual function device status information table to determine a target virtual function device that matches the target acceleration function unit. The method then binds the target acceleration function unit and the target virtual function device. This solves the problem that when a virtual function to which an acceleration function unit is fixedly bound has no acceleration task, the corresponding acceleration function unit becomes completely idle, resulting in low utilization of the acceleration function unit. This application enables a single acceleration function unit to serve acceleration tasks from multiple virtual functions in a time-sharing manner, avoiding idle acceleration function units and thus improving overall utilization.

[0148] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0149] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0150] The control method for an accelerator device provided by the present invention has been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. It should be noted that those skilled in the art can make several improvements and modifications to the present invention without departing from the principles of the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.

Claims

1. An accelerator device, characterized in that, The accelerator device is divided into a static region and a dynamic region. The static region includes virtual functional device status information and acceleration unit status information, while the dynamic region includes at least one acceleration functional unit. The acceleration unit status information table is configured to store the status information of at least one acceleration functional unit within the dynamic region; the virtual functional device status information is configured to store the status information of at least one virtual functional device; wherein... The accelerator is used to traverse the acceleration unit status information table according to the received user request to determine a target acceleration function unit from the at least one acceleration function unit, and traverse the virtual function device status information table to determine a target virtual function device that matches the target acceleration function unit, and bind the target acceleration function unit and the target virtual function device, wherein... The acceleration function unit includes: a configuration module, which includes at least one set of context configuration registers, each set including a start command register configured to start a corresponding acceleration task based on a received set signal; a scheduling module, which includes a status register and a scheduling unit, the status register being configured to indicate whether the context configuration registers have been configured, and the scheduling unit being configured to execute a corresponding scheduling action based on a preset scheduling strategy; and an execution module, which includes a context register and an execution unit, the context register being configured to record the context sequence number currently scheduled for execution, and the execution unit being configured to read the context configuration register information corresponding to the context sequence number from the configuration module and execute the corresponding acceleration function unit's function task. The preset scheduling strategy includes at least one of a fixed priority scheduling strategy, a round-robin scheduling strategy, and a weighted round-robin scheduling strategy; the maximum number of groups of context configuration registers is determined according to the maximum number of virtual function devices that the corresponding acceleration function unit can support binding. The scheduling module further includes a pointer register, which is configured to record the last scheduling position so that when the preset scheduling strategy is a round-robin scheduling strategy, the last scheduling position recorded in the pointer register can be searched.

2. The accelerator device according to claim 1, characterized in that, Also includes: A register access interface is configured to receive a first access request from a virtual function device and map it to the configuration module of the corresponding acceleration function unit. An interrupt interface is configured to receive interrupt requests from the acceleration function unit and map them to the corresponding virtual function device to send the interrupt requests. A memory access interface is configured to receive a second access request from the acceleration function unit and map it to a target memory storage space.

3. The accelerator device according to claim 1, characterized in that, The maximum number of groups in the context configuration register is determined based on the maximum number of virtual function devices that the corresponding acceleration function unit can support binding.

4. The accelerator device according to claim 1, characterized in that, The static area also includes: A virtual function device to acceleration function unit mapping table is configured to store the mapping relationship between the target acceleration function unit and the target virtual function device.

5. The accelerator device according to claim 4, characterized in that, The static region further includes: a register access routing module and a register access arbitration module, wherein, The register access routing module is configured to query the mapping table between the virtual function device and the acceleration function unit according to the first access request issued by the virtual function device, determine the corresponding acceleration function unit number and context register group number, generate a new access request according to the corresponding acceleration function unit number and context register group number and the target context register address in the first access request, and pass the new access request to the register access arbitration module. The register access arbitration module is configured to determine the corresponding acceleration function unit based on the corresponding acceleration function unit number in the new access request, and send the context register group number and target context register address in the new access request to the configuration module of the corresponding acceleration function unit through the register access interface of the corresponding acceleration function unit to perform register access.

6. The accelerator device according to claim 5, characterized in that, The static area further includes: an interrupt interface arbitration module and an interrupt routing module, wherein, The interrupt interface arbitration module is configured to add a corresponding acceleration function unit number to the received interrupt request and then pass the interrupt request with the added acceleration function unit number to the interrupt routing module. The interrupt routing module is configured to query the mapping table between virtual functional devices and acceleration functional units based on the interrupt request after adding the acceleration functional unit number, determine the corresponding virtual functional device, and send the interrupt request to the corresponding virtual functional device.

7. The accelerator device according to claim 6, characterized in that, The static area further includes: a memory access arbitration module and a memory access module, wherein, The memory access arbitration module is configured to add a corresponding acceleration function unit number to the received second access request, and then pass the second access request with the added acceleration function unit number to the memory access module. The memory access module is configured to query the virtual function device and acceleration function unit mapping table according to the second access request after adding the acceleration function unit number, determine the memory space start address and memory space address length of the target memory storage space, and access the target memory storage space according to the memory space start address and memory space address length.

8. The accelerator device according to claim 1, characterized in that, The status information of the virtual functional device includes at least one of the following: virtual functional device identifier, number of interrupts that can be supported, access space capacity of registers contained in the virtual functional device, priority weight, and binding status with acceleration functional unit.

9. The accelerator device according to claim 8, characterized in that, The status information of the acceleration function unit includes at least one of the following: acceleration unit index number, acceleration unit function identifier number, space capacity of at least one set of context configuration registers, maximum number of supported contexts, number of allocable contexts, allocated context sequence number, and number of interrupts.

10. A control method for an accelerator device, characterized in that, The method is applied to the accelerator device as described in any one of claims 1-9, wherein the method comprises the following steps: Determine whether the user request has been received; If the user request is received, then based on the user request, the target acceleration function unit is determined from the at least one acceleration function unit by traversing the acceleration unit status information table. The virtual function device status information table is traversed to determine the target virtual function device that matches the target acceleration function unit, and the target acceleration function unit and the target virtual function device are bound together.

11. The method according to claim 10, characterized in that, The step of determining the target acceleration function unit from the at least one acceleration function unit by traversing the acceleration unit status information table based on the user requirements includes: Based on the acceleration unit status information table, the current acceleration function unit is determined from the at least one acceleration function unit; Determine whether the current acceleration function unit meets the user's needs, and whether the current acceleration function unit has an allocable context; If the current acceleration function unit meets the user's needs and the current acceleration function unit has an allocatable context, then the current acceleration function unit is used as the target acceleration function unit.

12. The method according to claim 11, characterized in that, After determining whether the current acceleration function unit meets the user's needs and whether the current acceleration function unit has an allocable context, the method further includes: If the current acceleration function unit does not meet the user's needs, or if the current acceleration function unit does not have an allocable context, then a new acceleration function unit is determined from the at least one acceleration function unit based on the acceleration unit status information table. The new acceleration function unit is used as the current acceleration function unit, and the steps of determining whether the current acceleration function unit meets the user's needs and whether the current acceleration function unit has an assignable context are re-executed until the target acceleration function unit is obtained.

13. The method according to claim 11, characterized in that, The step of traversing the virtual functional device status information table to determine the target virtual functional device that matches the target acceleration functional unit includes: Based on the virtual functional device status information table, determine the current virtual functional device from at least one virtual functional device; Determine whether the current virtual function device is not bound to the acceleration unit function, whether the register access space capacity of the current virtual function device is greater than or equal to the space capacity occupied by the context configuration register of the target acceleration function unit, and whether the number of interrupts that the current virtual function device can support is greater than or equal to the number of interrupts of the target acceleration function unit. If the current virtual function device is not bound to the acceleration unit function, and the register access space capacity of the current virtual function device is greater than or equal to the space capacity occupied by the context configuration register of the target acceleration function unit, and the number of interrupts that the current virtual function device can support is greater than or equal to the number of interrupts of the target acceleration function unit, then the current virtual function device is used as the target virtual function device.

14. The method according to claim 13, characterized in that, After determining whether the current virtual function device is not bound to an acceleration unit function, whether the register access space capacity of the current virtual function device is greater than or equal to the occupied space capacity of the context configuration register of the target acceleration function unit, and whether the number of interrupts supported by the current virtual function device is greater than or equal to the number of interrupts of the target acceleration function unit, the method further includes: If the current virtual function device is already bound to an acceleration unit function, or the register access space capacity of the current virtual function device is less than the space capacity occupied by the context configuration register of the target acceleration unit, or the number of interrupts that the current virtual function device can support is less than the number of interrupts of the target acceleration unit, then a new virtual function device is determined from the at least one acceleration unit based on the acceleration unit status information table. The new virtual functional device is used as the current virtual functional device, and the steps of determining whether the current virtual functional device is not bound to the acceleration unit function, whether the register access space capacity of the current virtual functional device is greater than or equal to the space capacity occupied by the context configuration register of the target acceleration functional unit, and whether the number of interrupts supported by the current virtual functional device is greater than or equal to the number of interrupts of the target acceleration functional unit are re-executed until the target virtual functional device is obtained.

Citation Information

Patent Citations

  • Accelerator device and implementation method thereof, electronic device and storage medium

    CN118897818A