CN116841731A - An FPGA virtualized resource scheduling system and method - Google Patents
An FPGA virtualized resource scheduling system and method Download PDFInfo
- Publication number
- CN116841731A CN116841731A CN202310616927.7A CN202310616927A CN116841731A CN 116841731 A CN116841731 A CN 116841731A CN 202310616927 A CN202310616927 A CN 202310616927A CN 116841731 A CN116841731 A CN 116841731A
- Authority
- CN
- China
- Prior art keywords
- fpga
- resource scheduling
- module
- vfpga
- resource
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5061—Partitioning or combining of resources
- G06F9/5077—Logical partitioning of resources; Management or configuration of virtualized resources
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
Description
技术领域Technical field
本发明属于计算机技术领域,具体涉及一种FPGA虚拟化资源调度系统及方法。The invention belongs to the field of computer technology, and specifically relates to an FPGA virtualized resource scheduling system and method.
背景技术Background technique
随着当今社会,信息化、数字化、网络化、智能化趋势不断加深,数据计算量和信息处理规模呈爆发式增长,对平台的计算和控制能力均提出了更高的要求,以星载计算机为例,星载计算机是一种嵌入式系统,通常由微处理器、存储、通信、采集等模块组成,星载计算机是卫星的大脑,其主要负责星上数据管理、通信管理、能源管理、姿轨管理以及载荷管理等任务。随着卫星空间任务日益复杂,其对星载计算机的性能也提出了越来越高的要求。与此同时,另一方面随着半导体工艺进步的放缓以及芯片密度提高所带来的热问题,单颗芯片集成晶体管数量增长速度也在进一步降低,这使得单颗芯片的计算力增长速度难以适应当前复杂的生产环境以及海量数据处理的需求。因此如何提高芯片的资源利用率是当前面临的主要挑战。With today's society, the trend of informatization, digitization, networking, and intelligence continues to deepen. The amount of data calculation and the scale of information processing are growing explosively. This puts forward higher requirements for the computing and control capabilities of the platform. With space-borne computers, For example, a satellite computer is an embedded system, usually composed of microprocessor, storage, communication, acquisition and other modules. The satellite computer is the brain of the satellite and is mainly responsible for on-board data management, communication management, energy management, Attitude and orbit management and load management tasks. As satellite space missions become increasingly complex, they also place higher and higher requirements on the performance of on-board computers. At the same time, on the other hand, with the slowdown of semiconductor process progress and thermal problems caused by the increase in chip density, the growth rate of the number of integrated transistors on a single chip is also further decreasing, which makes it difficult to increase the computing power of a single chip. Adapt to the current complex production environment and massive data processing needs. Therefore, how to improve chip resource utilization is the main challenge currently faced.
对于传统星载计算机,其“算力”被封闭在独立的星载计算机内,各计算机的资源不能彼此共享,产生资源浪费,现有的功能独立的封闭式的星载计算系统已经不能满足航天器智能计算需求。因此,有必要在设法提高单点计算能力的同时,采用“云”化计算架构,由若干异构计算机互相配合完成一个目标计算任务,共享(稀有)计算资源,提升计算效率,平衡计算负载,提升星载计算系统的计算能力,满足智能化计算的需求。For traditional spaceborne computers, their "computing power" is enclosed in independent spaceborne computers. The resources of each computer cannot be shared with each other, resulting in a waste of resources. The existing closed spaceborne computing systems with independent functions can no longer meet the needs of aerospace. intelligent computing needs. Therefore, it is necessary to adopt a "cloud" computing architecture while trying to improve single-point computing capabilities. Several heterogeneous computers cooperate with each other to complete a target computing task, share (rare) computing resources, improve computing efficiency, and balance computing loads. Improve the computing capabilities of spaceborne computing systems to meet the needs of intelligent computing.
因此,对于FPGA此类高性能计算设备,借助虚拟化技术,实现任务驱动的器件功能的动态加载与资源管理。虚拟化技术可在一个物理平台上虚拟出更多的虚拟平台,而其中的每一个虚拟平台则可以作为独立的部分来使用。比起直接使用物理平台,虚拟化在资源的有效利用、动态调配和高可靠性方面有着巨大的优势。Therefore, for high-performance computing devices such as FPGA, virtualization technology is used to realize dynamic loading and resource management of task-driven device functions. Virtualization technology can virtualize more virtual platforms on one physical platform, and each virtual platform can be used as an independent part. Compared with directly using physical platforms, virtualization has huge advantages in effective utilization of resources, dynamic allocation and high reliability.
FPGA由于其硬件灵活性、优越的计算吞吐量和低能耗,在云计算和边缘计算中都得到了越来越多的关注。尽管FPGA比CPU和GPU有很大的优势,但这些优势来自于设计和可用性的权衡。在传统的FPGA开发模型中,使用者通常使用硬件描述语言(HDL)对应用场景进行建模,然后通过特定的FPGA开发工具将硬件模型映射到FPGA上,最终生成可以运行的FPGA映像。这种开发模式的主要缺点是FPGA只能由单一用户开发和使用,而与应用场景、FPGA的产品种类等无关。比如对于一个对资源需求不大、而且不需要连续运行的应用而言,大部分FPGA的硬件资源在大部分时间内都会闲置。很显然,这样很难在时空范围内对FPGA进行充分利用。FPGA has received increasing attention in both cloud computing and edge computing due to its hardware flexibility, superior computing throughput and low energy consumption. Although FPGAs have significant advantages over CPUs and GPUs, these advantages come from design and usability trade-offs. In the traditional FPGA development model, users usually use a hardware description language (HDL) to model application scenarios, and then map the hardware model to the FPGA through specific FPGA development tools, and finally generate a FPGA image that can be run. The main disadvantage of this development model is that FPGA can only be developed and used by a single user, regardless of the application scenario, FPGA product type, etc. For example, for an application that has low resource requirements and does not need to run continuously, most FPGA hardware resources will be idle most of the time. Obviously, it is difficult to fully utilize the FPGA in the space and time range.
为了提高FPGA的开发效率、更好的利用FPGA的逻辑资源、方便FPGA的大规模部署和应用,需要将FPGA进行一定程度的逻辑抽象,使顶层用户不必太多关注于FPGA硬件逻辑的实现方式与细节。由此,FPGA资源虚拟化技术被提出。FPGA虚拟化技术打破了时间和空间维度的限制,使用户能够轻松的在不同时间,对多个FPGA的各类资源进行充分的调度与使用。In order to improve the development efficiency of FPGA, better utilize the logic resources of FPGA, and facilitate the large-scale deployment and application of FPGA, it is necessary to perform a certain degree of logic abstraction on FPGA so that top-level users do not need to pay too much attention to the implementation method and implementation of FPGA hardware logic. detail. As a result, FPGA resource virtualization technology was proposed. FPGA virtualization technology breaks the limitations of time and space dimensions, allowing users to easily fully schedule and use various resources of multiple FPGAs at different times.
当前主流的FPGA虚拟化技术包括FPGAOverlay技术,部分可重构与虚拟化管理器技术。The current mainstream FPGA virtualization technology includes FPGAOverlay technology, partially reconfigurable and virtualization manager technology.
FPGA Overlay技术通过增加Overlay层为上层用户提供一个他们更为熟悉的编程架构与接口,用户可以只需要关心上层应用实现,而不需要担心具体的硬件电路实现,由此实现了对FPGA底层硬件资源的抽象和虚拟化。FPGA Overlay technology provides upper-layer users with a programming architecture and interface that they are more familiar with by adding an Overlay layer. Users only need to care about the implementation of upper-layer applications without worrying about specific hardware circuit implementation, thus realizing the control of the underlying hardware resources of FPGA. abstraction and virtualization.
Overlay技术主要是对底层硬件资源进行抽象和虚拟化,为上层用户提供一个更为熟悉的编程架构和接口,极大的简化了上层用户对硬件资源的使用,起到了对硬件资源抽象的作用。但是,通过Overlay技术实现的FPGA虚拟化存在一个明显的缺陷,就是无法实现多租户同时使用FPGA资源,因此通过该技术实现的FPGA虚拟化,无法充分的使用和调度FPGA资源。Overlay technology mainly abstracts and virtualizes underlying hardware resources, provides upper-level users with a more familiar programming architecture and interface, greatly simplifies the use of hardware resources by upper-level users, and plays a role in abstracting hardware resources. However, there is an obvious flaw in FPGA virtualization implemented through Overlay technology, which is that it cannot allow multiple tenants to use FPGA resources at the same time. Therefore, FPGA virtualization implemented through this technology cannot fully use and schedule FPGA resources.
部分可重构是指可以将FPGA内部划分出一个或多个区域,并在FPGA运行过程中单独对这些区域进行编程和配置,以改变区域内电路的逻辑,但并不影响FPGA其他电路的正常运行。Partial reconfigurability means that the FPGA can be divided into one or more areas, and these areas can be programmed and configured separately during the operation of the FPGA to change the logic of the circuits in the area, but it does not affect the normal operation of other circuits in the FPGA. run.
部分可重构使得FPGA可以在时间和空间两个维度,由硬件直接进行多任务的切换,其中vFPGA本质上就是一个或多个可以动态重构的FPGA区域,它们可以共同属于一个用户,或分属多个用户,运行着相同或不同的应用。在一个vFPGA进行动态重构时,其他vFPGA的运行不会受到影响。Partial reconfigurability allows FPGA to switch between multiple tasks directly by hardware in both dimensions of time and space. vFPGA is essentially one or more FPGA areas that can be dynamically reconfigured. They can belong to one user together or separately. Belongs to multiple users, running the same or different applications. When one vFPGA is dynamically reconfigured, the operation of other vFPGAs will not be affected.
使用部分可重构技术,可以将FPGA划分成若干个子区域,作为虚拟FPGA供单个或多个用户使用,同时保留一部分逻辑资源作为不可重配置区域,用来实现必要的基础架构,如内存管理与网络通信等。使用部分可重构技与虚拟化管理技术实现的FPGA虚拟化可以实现多租户共享FPGA资源,能够提高FPGA的资源利用率,但是该技术无法像Overlay技术一样对硬件资源进行抽象进而简化用户应用开发难度。Using partially reconfigurable technology, the FPGA can be divided into several sub-areas and used as virtual FPGAs for single or multiple users, while retaining some logical resources as non-reconfigurable areas to implement necessary infrastructure, such as memory management and Network communications, etc. FPGA virtualization implemented using partial reconfiguration technology and virtualization management technology can realize multi-tenant sharing of FPGA resources and improve FPGA resource utilization. However, this technology cannot abstract hardware resources and simplify user application development like Overlay technology. Difficulty.
发明内容Contents of the invention
本发明的目的在于提供一种FPGA虚拟化资源调度系统及方法,通过FPGA虚拟化实现多用户对单FPGA资源的并发使用,同时对FPGA硬件资源进行抽象、管理,用户可通过自动化部署UI界面自动化完成任务部署,并针对多节点情况设计资源调度策略,可将用户任务自动化调度到合适的节点的运行,降低用户对FPGA资源的使用复杂度,同时有效提高FPGA资源使用的灵活性以及资源利用率。The purpose of the present invention is to provide an FPGA virtualization resource scheduling system and method, which enables multiple users to concurrently use a single FPGA resource through FPGA virtualization, and simultaneously abstracts and manages FPGA hardware resources. Users can automatically deploy UI interfaces through automatic deployment. Complete task deployment and design resource scheduling strategies for multi-node situations, which can automatically schedule user tasks to run on appropriate nodes, reduce the complexity of users' use of FPGA resources, and effectively improve the flexibility of FPGA resource use and resource utilization. .
为实现以上目的,本发明采用以下技术方案:In order to achieve the above objectives, the present invention adopts the following technical solutions:
本发明实施例第一方面提供一种FPGA虚拟化资源调度系统,包括资源调度管理模块以及多个资源处理节点,每个资源处理节点均包括通信连接的FPGA虚拟化模块、上层控制器模块,上层控制器模块与资源调度管理模块通信连接;The first aspect of the embodiment of the present invention provides an FPGA virtualized resource scheduling system, which includes a resource scheduling management module and a plurality of resource processing nodes. Each resource processing node includes a FPGA virtualization module and an upper layer controller module that are communicated with each other. The controller module communicates with the resource scheduling management module;
FPGA虚拟化模块包括采用局部动态重构技术将物理FPGA划分为一个静态区域、一个或多个动态可重构区域,每个动态可重构区域用于部署并实现FPGA资源调度任务;The FPGA virtualization module includes the use of local dynamic reconfiguration technology to divide the physical FPGA into a static area and one or more dynamic reconfigurable areas. Each dynamic reconfigurable area is used to deploy and implement FPGA resource scheduling tasks;
上层控制器模块用于监管FPGA虚拟化模块中动态可重构区域的FPGA资源使用情况;The upper controller module is used to supervise the usage of FPGA resources in the dynamic reconfigurable area in the FPGA virtualization module;
资源调度管理模块,用于接收资源调度需求,并根据各FPGA虚拟化模块中动态可重构区域的FPGA资源使用情况,对所有节点中的动态可重构区域的PFGA资源进行调度管理。The resource scheduling management module is used to receive resource scheduling requirements and schedule and manage the PFGA resources of the dynamic reconfigurable areas in all nodes according to the FPGA resource usage of the dynamic reconfigurable areas in each FPGA virtualization module.
作为优选方案,每个动态可重构区域均包括一个用于部署并实现FPGA资源调度任务的vFPGA,以及对vFPGA进行管理的vFPGA控制器;每个vFPGA通过AXI4 Master接口、AXI4Slave接口与系统AXI-Interconnect相连;As a preferred solution, each dynamically reconfigurable area includes a vFPGA used to deploy and implement FPGA resource scheduling tasks, and a vFPGA controller that manages the vFPGA; each vFPGA communicates with the system AXI- Interconnect connected;
vFPGA控制器包括离合器、内存管理单元、DMA模块、AXI4-AXIS桥;离合器通过AXI4接口、AXIS接口与vFPGA相连;内存管理单元通过AXI4接口分别与离合器和AXI-Interconnect相连;DMA模块通过AXI4接口分别与离合器和AXI-Interconnect相连,同时与内存管理单元相连;AXI4-AXIS桥通过AXIS接口分别与离合器和AXI-Interconnect相连;The vFPGA controller includes a clutch, memory management unit, DMA module, and AXI4-AXIS bridge; the clutch is connected to the vFPGA through the AXI4 interface and AXIS interface; the memory management unit is connected to the clutch and AXI-Interconnect through the AXI4 interface respectively; the DMA module is respectively connected through the AXI4 interface Connected to the clutch and AXI-Interconnect, and at the same time connected to the memory management unit; the AXI4-AXIS bridge is connected to the clutch and AXI-Interconnect respectively through the AXIS interface;
离合器,用于隔离vFPGA与静态逻辑之间的信号连接;Clutch, used to isolate the signal connection between vFPGA and static logic;
内存管理单元,通过页表将虚地址空间映射到相应的物理地址上;The memory management unit maps the virtual address space to the corresponding physical address through the page table;
DMA模块,用于实现直接内存访问;DMA module, used to implement direct memory access;
AXI4-AXIS桥,用于实现vFPGA控制器内部的数据传输,以及各vFPGA之间数据传输。AXI4-AXIS bridge is used to realize data transmission within the vFPGA controller and data transmission between vFPGAs.
作为优选方案,FPGA虚拟化模块中还包括一个PICE协议栈单元,PICE协议栈单元用于维护PICE协议栈,还用于FPGA虚拟化子模块中的vFPGA与上层控制器模块进行通信;As a preferred solution, the FPGA virtualization module also includes a PICE protocol stack unit. The PICE protocol stack unit is used to maintain the PICE protocol stack and is also used to communicate between the vFPGA in the FPGA virtualization sub-module and the upper-layer controller module;
PICE协议栈单元包括依次连接的应用层、事务层、数据链层、物理层;The PICE protocol stack unit includes the application layer, transaction layer, data link layer, and physical layer that are connected in sequence;
应用层,与上层控制器模块通过PCIe接口连接,将获取的FPGA资源调度任务需求转换为数据发送给事务层;The application layer is connected to the upper-layer controller module through the PCIe interface, and converts the obtained FPGA resource scheduling task requirements into data and sends it to the transaction layer;
事务层,接收来自应用层的数据并将其封装成数据包发向数据链层,也可以从数据链层接收数据报文并转发到应用层;The transaction layer receives data from the application layer and encapsulates it into data packets and sends them to the data link layer. It can also receive data packets from the data link layer and forward them to the application layer;
数据链层,接收来自事务层的数据报文,并添加Sequence Number前缀和CRC后缀,并使用ACK/NAK以保证数据报文传递的可靠性;The data link layer receives data packets from the transaction layer, adds Sequence Number prefix and CRC suffix, and uses ACK/NAK to ensure the reliability of data packet delivery;
物理层,用于接收、转发各种数据包,还用于创建和解码用于同步、管理每个动态可重构区域的FPGA链路的专门序列。The physical layer is used to receive and forward various data packets, and is also used to create and decode specialized sequences for synchronizing and managing FPGA links in each dynamically reconfigurable area.
作为优选方案,每个上层控制器子模块包括vFPGA控制器驱动、系统管理器、系统监视器、FPGA硬件管理器、硬件资源池;As a preferred solution, each upper-layer controller sub-module includes a vFPGA controller driver, system manager, system monitor, FPGA hardware manager, and hardware resource pool;
vFPGA控制器驱动,用于对vFPGA控制器进行操纵;vFPGA controller driver, used to control the vFPGA controller;
系统管理器,用于与资源调度管理模块进行通信,受资源调度管理模块调度管理,负责vFPGA的创建与销毁;The system manager is used to communicate with the resource scheduling management module, is scheduled and managed by the resource scheduling management module, and is responsible for the creation and destruction of vFPGA;
系统监视器,用于周期性监测FPGA的工作状态、各vFPGA的运行情况、FPGA虚拟化资源使用情况以及PCIE协议栈模块的流量统计情况,并将监测的数据信息持久化记录到数据库中;The system monitor is used to periodically monitor the working status of the FPGA, the operation of each vFPGA, the usage of FPGA virtualization resources, and the traffic statistics of the PCIE protocol stack module, and persistently record the monitored data information into the database;
硬件资源池,包括vFPGA资源池、FPGA内存池,用于管理记录FPGA硬件资源的使用;Hardware resource pools, including vFPGA resource pools and FPGA memory pools, are used to manage and record the use of FPGA hardware resources;
FPGA硬件管理器,将相关的操作与FPGA虚拟化模块进行沟通,将分配的硬件资源通过驱动实施于具体FPGA硬件上。The FPGA hardware manager communicates relevant operations with the FPGA virtualization module, and implements the allocated hardware resources on specific FPGA hardware through drivers.
作为优选方案,系统管理器与资源调度管理模块进行网络通信,将本计算节点的FPGA虚拟化资源信息传输至资源调度管理模块;As a preferred solution, the system manager conducts network communication with the resource scheduling management module and transmits the FPGA virtualized resource information of the computing node to the resource scheduling management module;
接收资源调度管理模块的调度请求,根据不同请求做出对应的处理,并交由下游的各类管理器进行实施;Receive scheduling requests from the resource scheduling management module, make corresponding processing according to different requests, and hand them over to various downstream managers for implementation;
接收资源调度管理模块的资源信息监控请求,将系统监视器检测到的信息上传给资源调度管理模块。Receive resource information monitoring requests from the resource scheduling management module, and upload the information detected by the system monitor to the resource scheduling management module.
作为优选方案,资源调度管理模块还包括自动化部署UI;As a preferred solution, the resource scheduling management module also includes an automated deployment UI;
所述自动化部署UI,用于接收FPGA资源调度需求,并与资源调度管理模块进行网络通信;The automated deployment UI is used to receive FPGA resource scheduling requirements and conduct network communication with the resource scheduling management module;
所述资源调度管理模块包括对外接口、节点管理单元,资源调度单元;The resource scheduling management module includes an external interface, a node management unit, and a resource scheduling unit;
对外接口,用于根据自动化部署UI获取的FPGA资源调度任务需求提供FPGA资源调度任务自动化部署接口;The external interface is used to provide an automated deployment interface for FPGA resource scheduling tasks based on the FPGA resource scheduling task requirements obtained by the automated deployment UI;
节点管理单元,用于监控各节点中动态可重构区域的FPGA资源使用情况;The node management unit is used to monitor the FPGA resource usage of the dynamically reconfigurable area in each node;
资源调度单元,用于根据各节点中动态可重构区域的FPGA资源使用情况,将接收的FPGA资源调度任务调度到合适的动态可重构区域上运行。The resource scheduling unit is used to schedule the received FPGA resource scheduling task to the appropriate dynamic reconfigurable area according to the FPGA resource usage in the dynamic reconfigurable area in each node.
本发明实施例第二方面提供一种FPGA虚拟化资源调度方法,包括:The second aspect of the embodiment of the present invention provides an FPGA virtualization resource scheduling method, including:
资源调度管理模块接收FPGA资源调度任务,并根据FPGA资源调度任务的需求以及各节点FPGA资源的占用情况,将FPGA资源调度任务调度部署到合适的动态可重构区域上运行;The resource scheduling management module receives the FPGA resource scheduling task, and schedules and deploys the FPGA resource scheduling task to the appropriate dynamic reconfigurable area according to the needs of the FPGA resource scheduling task and the occupancy of FPGA resources of each node;
用于部署FPGA资源调度任务的动态可重构区域根据FPGA资源调度任务的需求,创建用于运行FPGA资源调度任务的vFPGA。The dynamically reconfigurable area used to deploy FPGA resource scheduling tasks creates a vFPGA for running FPGA resource scheduling tasks according to the needs of the FPGA resource scheduling tasks.
作为优选方案,资源调度管理模块获取各节点FPGA资源的占用情况的步骤包括:As a preferred solution, the steps for the resource scheduling management module to obtain the occupancy status of each node's FPGA resources include:
资源调度管理模块运行后,节点管理单元通过组播发布服务,服务中携带IP和端口信息;After the resource scheduling management module is run, the node management unit publishes services through multicast, and the services carry IP and port information;
各上层节点控制器的系统管理器接收组播消息,并与组播内的IP、端口建立网络连接;The system manager of each upper-layer node controller receives the multicast message and establishes a network connection with the IP and port in the multicast;
连接建立成功之后,各上层节点控制器的系统管理器会主动发起注册请求,节点管理单元接收到注册请求之后,将该节点的资源纳入管理以完成注册;After the connection is successfully established, the system manager of each upper-layer node controller will actively initiate a registration request. After receiving the registration request, the node management unit will include the resources of the node into management to complete the registration;
完成注册后,各上层节点控制器的系统管理器将各自节点的FPGA资源使用情况周期上报给节点管理单元。After completing the registration, the system manager of each upper-layer node controller periodically reports the FPGA resource usage of the respective node to the node management unit.
作为优选方案,用于部署FPGA资源调度任务的的动态可重构区域根据FPGA资源调度任务的需求,创建用于运行FPGA资源调度任务的vFPGA的步骤包括:As a preferred solution, the dynamic reconfigurable area used to deploy FPGA resource scheduling tasks. According to the needs of the FPGA resource scheduling tasks, the steps of creating a vFPGA for running FPGA resource scheduling tasks include:
动态可重构区域的vFPGA控制器中的离合器开启,复位可重构模块并下载重构相应的比特流,配置内存管理单元,并配置IO_LUT;The clutch in the vFPGA controller in the dynamic reconfigurable area is turned on, the reconfigurable module is reset and the corresponding bit stream is downloaded for reconstruction, the memory management unit is configured, and the IO_LUT is configured;
解复位可重构模块并关闭离合器,完成vFPGA的创建工作,以将接收的FPGA资源调度任务加载到vFPGA中运行。Unreset the reconfigurable module and close the clutch to complete the creation of vFPGA to load the received FPGA resource scheduling task into the vFPGA for running.
作为优选方案,为动态可重构区域配置内存管理单元的流程为:As a preferred solution, the process of configuring the memory management unit for the dynamic reconfigurable area is:
S1、判断已映射地址空间是否小于所需映射空间N,若否则结束配置流程,若是则执行步骤S2;S1. Determine whether the mapped address space is smaller than the required mapping space N. If not, end the configuration process. If so, perform step S2;
S2、从FPGA内存池中取出一个内存资源,通过驱动向该vFPGA的内存管理管理单元添加一条映射记录;S2. Take out a memory resource from the FPGA memory pool and add a mapping record to the memory management unit of the vFPGA through the driver;
S3、重复执行步骤S1~S2,直到已映射地址空间大于或等于所需映射空间N时,结束配置流程。S3. Repeat steps S1 to S2 until the mapped address space is greater than or equal to the required mapped space N, then end the configuration process.
本发明的有益效果是:The beneficial effects of the present invention are:
1、本发明通过FPGA虚拟化方法实现多用户对单FPGA资源的并发使用,解决FPGA只能由单一用户开发和使用的问题,达到提升FPGA资源利用率的目的。能更充分的利用FPGA资源,只要剩余的FPGA资源能够满足用户任务的运行要求,则该用户任务可以在vFPGA中运行,不会出现仅有一个用户任务运行在FPGA上,且存在大量FPGA资源处于空闲状态,造成资源利用率低的问题。1. The present invention realizes the concurrent use of single FPGA resources by multiple users through the FPGA virtualization method, solves the problem that FPGA can only be developed and used by a single user, and achieves the purpose of improving FPGA resource utilization. It can make full use of FPGA resources. As long as the remaining FPGA resources can meet the running requirements of the user task, the user task can be run in the vFPGA. There will not be only one user task running on the FPGA, and there will be a large number of FPGA resources in the vFPGA. The idle state causes the problem of low resource utilization.
2、上层控制器模块能够响应资源调度管理模块的FPGA资源状态请求,并将记录在数据库中的资源信息响应给资源调度管理服务。同时上层控制器模块支持对FPGA资源的管理,响应资源调度管理模块的FPGA资源请求,如果资源满足资源调度管理服务需求,将用户任务调度到合适位置运行。2. The upper controller module can respond to the FPGA resource status request of the resource scheduling management module, and respond to the resource information recorded in the database to the resource scheduling management service. At the same time, the upper controller module supports the management of FPGA resources and responds to FPGA resource requests from the resource scheduling management module. If the resources meet the resource scheduling management service requirements, the user tasks will be scheduled to run at appropriate locations.
3、降低了对FPGA资源的使用难度,传统方法中FPGA的使用是将FPGA作为一个整体,将FPGA程序通过仿真器加载到FPGA中运行,本发明使用者只需要和上层控制器建立网络连接,通过请求应答模式进行资源的申请以及FPGA任务的创建等操作,降低了对FPGA的使用门槛。3. Reduces the difficulty of using FPGA resources. In the traditional method, the FPGA is used as a whole, and the FPGA program is loaded into the FPGA through the emulator to run. In the present invention, the user only needs to establish a network connection with the upper-layer controller. Operations such as resource application and FPGA task creation are performed through the request response mode, which lowers the threshold for using FPGA.
4.从资源虚拟化到资源管理再到资源调度整个链条全部使用C/C++自研开发,无需部署K8S,资源占用小,部署简单、轻量化、灵活程度高。4. The entire chain from resource virtualization to resource management to resource scheduling is all self-developed using C/C++. There is no need to deploy K8S. It occupies small resources, is simple to deploy, lightweight and highly flexible.
附图说明Description of the drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are only These are some embodiments of the invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without exerting creative efforts.
图1是实施例一提供的一种FPGA虚拟化资源调度系统的结构示意图。Figure 1 is a schematic structural diagram of an FPGA virtualized resource scheduling system provided in Embodiment 1.
图2是FPGA虚拟化模块的结构示意图。Figure 2 is a schematic structural diagram of the FPGA virtualization module.
图3是vFPGA控制器的结构示意图。Figure 3 is a schematic structural diagram of the vFPGA controller.
图4是PCIE协议栈单元的结构示意图。Figure 4 is a schematic structural diagram of the PCIE protocol stack unit.
图5是上层控制器模块的结构示意图。Figure 5 is a schematic structural diagram of the upper controller module.
图6是系统管理器的工作流程图。Figure 6 is a workflow diagram of the system manager.
图7是资源调度管理模块的结构示意图。Figure 7 is a schematic structural diagram of the resource scheduling management module.
图8是在动态可重构区域创建vFPGA的流程图。Figure 8 is a flow chart for creating vFPGA in a dynamically reconfigurable area.
具体实施方式Detailed ways
以下通过特定的具体实施例说明本发明的实施方式,本领域技术人员可由本说明书所揭露的内容轻易地了解本发明的其他优点与功效。本发明还可以通过另外不同的具体实施方式加以实施或应用,本说明书中的各项细节也可以基于不同观点与应用,在没有背离本发明的精神下进行各种修饰或改变。需说明的是,在不冲突的情况下,以下实施例及实施例中的特征可以相互组合。The following describes the implementation of the present invention through specific specific examples. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. Various details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, as long as there is no conflict, the following embodiments and the features in the embodiments can be combined with each other.
实施例一:Example 1:
参照图1,本实施例提供一种FPGA虚拟化资源调度系统,包括资源调度管理模块以及多个资源处理节点,每个资源处理节点均包括通信连接的FPGA虚拟化模块、上层控制器模块,上层控制器模块与资源调度管理模块通信连接;Referring to Figure 1, this embodiment provides an FPGA virtualized resource scheduling system, which includes a resource scheduling management module and multiple resource processing nodes. Each resource processing node includes a FPGA virtualization module and an upper layer controller module that are communicated with each other. The controller module communicates with the resource scheduling management module;
FPGA虚拟化模块包括采用局部动态重构技术将物理FPGA划分为一个静态区域、一个或多个动态可重构区域,每个动态可重构区域用于部署并实现FPGA资源调度任务。FPGA虚拟化模块会被划分为静态区域和动态可重构区域,整个FPGA的硬件资源包括dsp、pcie、lut、ff、bram、pblock等,具体每一个FPGA虚拟化模块的硬件资源的多少由实际硬件决定,除去静态区固化程序使用的一些硬件资源外(其中静态区程序所占资源比例较小,占FPGA总资源的5%以内)其余硬件资源全部归动态区使用。The FPGA virtualization module uses local dynamic reconfiguration technology to divide the physical FPGA into a static area and one or more dynamic reconfigurable areas. Each dynamic reconfigurable area is used to deploy and implement FPGA resource scheduling tasks. The FPGA virtualization module will be divided into static areas and dynamic reconfigurable areas. The hardware resources of the entire FPGA include dsp, pcie, lut, ff, bram, pblock, etc. The specific hardware resources of each FPGA virtualization module are determined by the actual Determined by hardware, except for some hardware resources used by the static area firmware program (the static area program accounts for a small proportion of resources, accounting for less than 5% of the total FPGA resources), all other hardware resources are used by the dynamic area.
静态区域即FGPA上划分出来运行固化程序的区域,该区域不可进行动态重配置,在实际应用过程中可将静态区域对应的mcs文件固化于flash中。动态可重构区域包括Microblaze(嵌入式软核)、HWICAP IP核、Pcie接口。通过SDK对Microblaze进行软件编程实现FPGA的局部动态配置功能;HWICAP IP核用于实现FPGA通过AXI总线对配置空间的读写操作,用户在创建FPGA虚拟化任务时,通过HWICAP IP核完成bit流写入到vFPGA上的操作。FPGA虚拟化模块的内部结构参照图2所示。The static area is the area divided on the FGPA to run the firmware program. This area cannot be dynamically reconfigured. In the actual application process, the mcs file corresponding to the static area can be solidified in flash. The dynamic reconfigurable area includes Microblaze (embedded soft core), HWICAP IP core, and Pcie interface. Microblaze is software programmed through SDK to realize the local dynamic configuration function of FPGA; the HWICAP IP core is used to realize the read and write operations of the configuration space by the FPGA through the AXI bus. When the user creates an FPGA virtualization task, the HWICAP IP core is used to complete the bit stream writing. into operations on the vFPGA. The internal structure of the FPGA virtualization module is shown in Figure 2.
上层控制器模块用于监管FPGA虚拟化模块中动态可重构区域的FPGA资源使用情况;The upper controller module is used to supervise the usage of FPGA resources in the dynamic reconfigurable area in the FPGA virtualization module;
资源调度管理模块,使用C/C++自主实现,用于接收资源调度需求,并根据各FPGA虚拟化模块中动态可重构区域的FPGA资源使用情况,对所有节点中的动态可重构区域的PFGA资源进行调度管理。The resource scheduling management module is independently implemented using C/C++. It is used to receive resource scheduling requirements and, based on the FPGA resource usage of the dynamic reconfigurable area in each FPGA virtualization module, adjust the PFGA of the dynamic reconfigurable area in all nodes. Resources are scheduled and managed.
进一步,每个动态可重构区域均包括一个用于部署并实现FPGA资源调度任务的vFPGA,以及对vFPGA进行管理的vFPGA控制器;每个vFPGA通过AXI4 Master接口、AXI4Slave接口与系统AXI-Interconnect相连;Furthermore, each dynamically reconfigurable area includes a vFPGA used to deploy and implement FPGA resource scheduling tasks, and a vFPGA controller that manages the vFPGA; each vFPGA is connected to the system AXI-Interconnect through the AXI4 Master interface and AXI4Slave interface. ;
参照图3,vFPGA控制器包括离合器、内存管理单元、DMA模块、AXI4-AXIS桥;离合器通过AXI4接口、AXIS接口与vFPGA相连;内存管理单元通过AXI4接口分别与离合器和AXI-Interconnect相连;DMA模块通过AXI4接口分别与离合器和AXI-Interconnect相连,同时与内存管理单元相连;AXI4-AXIS桥通过AXIS接口分别与离合器和AXI-Interconnect相连;Referring to Figure 3, the vFPGA controller includes a clutch, a memory management unit, a DMA module, and an AXI4-AXIS bridge; the clutch is connected to the vFPGA through the AXI4 interface and the AXIS interface; the memory management unit is connected to the clutch and AXI-Interconnect through the AXI4 interface; the DMA module It is connected to the clutch and AXI-Interconnect respectively through the AXI4 interface, and is connected to the memory management unit; the AXI4-AXIS bridge is connected to the clutch and AXI-Interconnect respectively through the AXIS interface;
离合器,用于隔离vFPGA与静态逻辑之间的信号连接,接口主要包括AXI4、AXIS以及时钟信号;Clutch, used to isolate the signal connection between vFPGA and static logic. The interface mainly includes AXI4, AXIS and clock signals;
内存管理单元,通过页表将虚地址空间映射到相应的物理地址上;The memory management unit maps the virtual address space to the corresponding physical address through the page table;
DMA模块,用于实现直接内存访问;DMA module, used to implement direct memory access;
AXI4-AXIS桥,用于实现vFPGA控制器内部的数据传输,以及各vFPGA之间数据传输。AXI4-AXIS bridge is used to realize data transmission within the vFPGA controller and data transmission between vFPGAs.
具体的:specific:
vFPGA通过AXI4接口对内存进行访问,AXIS接口有一发一收两组,用于模块之间的数据传输。上层控制器与FPGA之间的数据传输,则通过PCIE协议栈完成,FPGA虚拟化模块内的两个vFPGA之间的数据传输,则直接通过模块内的AXI4-Interconnect实现数据交换。vFPGA accesses the memory through the AXI4 interface. The AXIS interface has two groups, one transmitting and one receiving, used for data transmission between modules. The data transmission between the upper controller and FPGA is completed through the PCIE protocol stack. The data transmission between the two vFPGAs in the FPGA virtualization module is directly exchanged through the AXI4-Interconnect in the module.
vFPGA间的数据交换使用AXIS接口进行,而系统交换结构采用AXI4实现,需设计相关组件完成协议的转换。当发送一个AXIS包时,DMA模块通过TDEST信号值从IO LUT查询写入的目的地址,从而通过AXI4接口将AXIS包写入该地址。而对于接收接口而言,则需要AXI4-AXIS桥将AXI4写入操作流式化为AXIS协议,根据被写入的地址偏移来判断TDEST的值。Data exchange between vFPGAs is performed using the AXIS interface, while the system switching structure is implemented using AXI4, and relevant components need to be designed to complete the protocol conversion. When sending an AXIS packet, the DMA module queries the written destination address from the IO LUT through the TDEST signal value, thereby writing the AXIS packet to the address through the AXI4 interface. For the receiving interface, the AXI4-AXIS bridge is required to stream the AXI4 write operation into the AXIS protocol, and the value of TDEST is determined based on the address offset being written.
vFPGA对于内存的访问可直接使用AXI4协议进行读写访问,但是为了保证vFPGA之间内存间的隔离性,需要内存管理单元接入进行管理。每一个vFPGA都拥有一套独立的虚拟地址空间,通过内存管理单元将每个vFPGA的虚拟地址空间映射到不同的物理地址上,不同vFPGA能够访问到的地址空间在物理地址上互斥。内存管理单元中地址映射表由PS在vFPGA被部署前配置,考虑到内存管理单元的资源开销,设计以4MB大小的地址范围为一页,内存管理单元记录每一页的虚拟地址到物理地址的偏移量。vFPGA can directly use the AXI4 protocol for memory access for read and write access. However, in order to ensure the isolation of memories between vFPGAs, the memory management unit needs to be accessed for management. Each vFPGA has an independent set of virtual address spaces. The virtual address space of each vFPGA is mapped to different physical addresses through the memory management unit. The address spaces that different vFPGAs can access are mutually exclusive at the physical addresses. The address mapping table in the memory management unit is configured by PS before the vFPGA is deployed. Considering the resource overhead of the memory management unit, the design uses a 4MB address range as one page, and the memory management unit records the virtual address of each page to the physical address. Offset.
进一步,FPGA虚拟化模块中还包括一个PICE协议栈单元,PICE协议栈单元用于维护PICE协议栈,还用于FPGA虚拟化子模块中的vFPGA与上层控制器模块进行通信。PICE协议栈单元主要受上层控制器的控制,在vFPGA初始化完成后,其将为vFPGA配置PCIE相关资源,创建所需的FIFO,vFPGA可以通过AXIS接口收发相关的数据流,完成SEND/RECV操作;Furthermore, the FPGA virtualization module also includes a PICE protocol stack unit. The PICE protocol stack unit is used to maintain the PICE protocol stack and is also used to communicate between the vFPGA in the FPGA virtualization sub-module and the upper-layer controller module. The PICE protocol stack unit is mainly controlled by the upper-layer controller. After the vFPGA initialization is completed, it will configure PCIE related resources for the vFPGA and create the required FIFO. The vFPGA can send and receive relevant data streams through the AXIS interface and complete the SEND/RECV operation;
参照图4,PICE协议栈单元是分层实现的,它包含多个层次,从上到下分别为应用层、事务层、数据链层、物理层。PICE协议栈单元的各个层次都是通过硬件逻辑实现的,发送时数据报文先由应用层产生,然后经过事务层,数据链路层和物理层最终发送出去;接收端则是相反的一个步骤,数据先经过物理层,然后向上送给数据链路层,事务层,最后到达应用层。PICE协议栈单元即为PCI总线。Referring to Figure 4, the PICE protocol stack unit is implemented in layers, and it contains multiple layers, including the application layer, transaction layer, data link layer, and physical layer from top to bottom. Each level of the PICE protocol stack unit is implemented through hardware logic. When sending, the data message is first generated by the application layer, and then passes through the transaction layer, data link layer and physical layer and is finally sent out; the receiving end does the opposite step. , the data first passes through the physical layer, then is sent upward to the data link layer, transaction layer, and finally reaches the application layer. The PICE protocol stack unit is the PCI bus.
应用层,与上层控制器模块通过PCIe接口连接,将获取的FPGA资源调度任务需求转换为数据发送给事务层。PCI spec规定了256字节的配置空间,PCIe总线为了兼容PCI设备,几乎完整的保留了PCI总线的配置空间。并将配置空间扩展到了4KB,用于支持一些PCIe总线中的新功能,如Capability,power management,MSI等。PCIe将配置空间扩展到4KB,原来CF8/CFC的访问方式仍然可以访问所有PCIe配置空间的前256Byte,但是访问不了剩下的空间。故PCIe引入了增强配置空间访问机制,它通过将配置空间映射到MMIO空间,使得对配置空间的访问就像对内存的访问一样,因此可以访问完整的4KB配置空间。The application layer is connected to the upper-layer controller module through the PCIe interface, and converts the obtained FPGA resource scheduling task requirements into data and sends it to the transaction layer. PCI spec specifies a 256-byte configuration space. In order to be compatible with PCI devices, the PCIe bus almost completely retains the PCI bus configuration space. And the configuration space has been expanded to 4KB to support some new functions in the PCIe bus, such as Capability, power management, MSI, etc. PCIe expands the configuration space to 4KB. The original CF8/CFC access method can still access the first 256Byte of all PCIe configuration spaces, but cannot access the remaining space. Therefore, PCIe introduces an enhanced configuration space access mechanism, which maps the configuration space to the MMIO space so that access to the configuration space is like access to memory, so the complete 4KB configuration space can be accessed.
事务层,接收来自应用层的数据并将其封装成数据包发向数据链层,也可以从数据链层接收数据报文并转发到应用层。事务层定义了PCIE协议栈模块所使用的事务,其中大部分都与PCI总线兼容在PCIe Spec中,规定了四种类型的请求(Request):Memory、IO、Configuration和Messages。其中,前三种都是从PCI/PCI-X总线中继承过来的,第四种Messages是PCIe新增加的类型。事务层接收来自核心层的数据并将其封装成TLP(Transaction Layer Packet)发向数据链路层。另外事务层也可以从数据链路层接收数据报文,然后转发到核心层。The transaction layer receives data from the application layer and encapsulates it into data packets and sends them to the data link layer. It can also receive data packets from the data link layer and forward them to the application layer. The transaction layer defines the transactions used by the PCIE protocol stack module, most of which are compatible with the PCI bus. In the PCIe Spec, four types of requests (Request) are specified: Memory, IO, Configuration and Messages. Among them, the first three are inherited from the PCI/PCI-X bus, and the fourth type of Messages is a newly added type of PCIe. The transaction layer receives data from the core layer and encapsulates it into TLP (Transaction Layer Packet) and sends it to the data link layer. In addition, the transaction layer can also receive data packets from the data link layer and then forward them to the core layer.
数据链层,接收来自事务层的数据报文,并添加Sequence Number前缀和CRC后缀,并使用ACK/NAK以保证数据报文传递的可靠性。另外它还定义了多种DLLP(Data LinkLayer Pakcet),DLLP产生于数据链路层结束于数据链路层。The data link layer receives data packets from the transaction layer, adds Sequence Number prefix and CRC suffix, and uses ACK/NAK to ensure the reliability of data packet delivery. In addition, it also defines a variety of DLLP (Data LinkLayer Pakcet). DLLP originates from the data link layer and ends at the data link layer.
物理层,用于接收、转发各种数据包,还用于创建和解码用于同步、管理每个动态可重构区域的FPGA链路的专门序列。物理层是PCIe总线的最底层,将PCIe设备相互连接在一起。物理层还实现了链路训练和初始化的功能,它通过LTSSM来完成。The physical layer is used to receive and forward various data packets, and is also used to create and decode specialized sequences for synchronizing and managing FPGA links in each dynamically reconfigurable area. The physical layer is the lowest layer of the PCIe bus and connects PCIe devices to each other. The physical layer also implements link training and initialization functions, which is completed through LTSSM.
进一步,FPGA虚拟化模块需要上层控制器模块来管理硬件资源,以及通过上层控制器模块与资源调度管理模块通信,本设计中上层控制器模块程序运行在FT2000/4中。Furthermore, the FPGA virtualization module requires an upper-layer controller module to manage hardware resources and communicate with the resource scheduling management module through the upper-layer controller module. In this design, the upper-layer controller module program runs in FT2000/4.
参照图5,每个上层控制器子模块包括vFPGA控制器驱动、系统管理器、系统监视器、FPGA硬件管理器、硬件资源池。Referring to Figure 5, each upper-layer controller sub-module includes a vFPGA controller driver, system manager, system monitor, FPGA hardware manager, and hardware resource pool.
vFPGA控制器驱动,用于对vFPGA控制器进行操纵。由于vFPGA的整个生命周期受上层控制器子模块管控,而上层控制器子模块端的FT2000/4处理器上运行了Linux系统。为了方便上层控制器子模块操纵底层硬件,设计vFPGA控制器驱动。The vFPGA controller driver is used to control the vFPGA controller. Since the entire life cycle of vFPGA is controlled by the upper-layer controller sub-module, the FT2000/4 processor on the upper-layer controller sub-module runs a Linux system. In order to facilitate the upper-layer controller sub-module to manipulate the underlying hardware, the vFPGA controller driver is designed.
对于vFPGA控制器,其寄存器相关信息如表1所示,驱动程序主要需要操作三部分:离合器状态、IO_LUT的映射表以及内存管理单元MMU的内存映射表。For the vFPGA controller, its register-related information is shown in Table 1. The driver mainly needs to operate three parts: clutch status, IO_LUT mapping table, and memory mapping table of the memory management unit MMU.
表1vFPGA控制器寄存器表Table 1vFPGA controller register table
此设备的驱动实现采用基于设备树的字符设备驱动实现。对于每个vFPGA控制器设备,都会有一个相关的字符设备文件暴露给用户,用户可以通过操作/dev/vFPGA_n设备文件连控制底层控制器硬件。用户通过ioctl的系统调用的方式与设备驱动进行沟通。The driver implementation of this device adopts character device driver implementation based on device tree. For each vFPGA controller device, there will be a related character device file exposed to the user, and the user can control the underlying controller hardware by operating the /dev/vFPGA_n device file. Users communicate with device drivers through ioctl system calls.
调用方式参数如表2所示:The calling method parameters are shown in Table 2:
表2vFPGA控制器驱动接口Table 2vFPGA controller driver interface
其中,对于DECOUPLER_ON以及DECOUPLER_OFF,系统调用需要配合中断服务程序完成。用户在发起这两个命令时,驱动程序分别修改DECOUPLER_CTRL的值,而后驱动程序会阻塞得等待一个完成量,该完成量由Decoupler完成相关操作后触发的中断对应的中断服务程序提供。而其余的命令秩序对寄存器进行读写操作均为无阻塞形式。Among them, for DECOUPLER_ON and DECOUPLER_OFF, the system call needs to be completed in conjunction with the interrupt service routine. When the user initiates these two commands, the driver modifies the value of DECOUPLER_CTRL respectively, and then the driver blocks and waits for a completion amount, which is provided by the interrupt service routine corresponding to the interrupt triggered after the Decoupler completes the relevant operation. The rest of the command sequences read and write registers in a non-blocking manner.
系统管理器,用于与资源调度管理模块进行通信,受资源调度管理模块调度管理,负责vFPGA的创建与销毁。系统管理器的主要工作是接收并处理资源调度管理服务的相关操作请求,将这些请求根据当前资源情况实现于当前FPGA具体的硬件资源上。此外,系统管理器也可接收资源调度管理模块的请求将系统监视器的监视结果从数据库中取出并将结果返回。The system manager is used to communicate with the resource scheduling management module, is scheduled and managed by the resource scheduling management module, and is responsible for the creation and destruction of vFPGA. The main job of the system manager is to receive and process related operation requests of the resource scheduling management service, and implement these requests on the specific hardware resources of the current FPGA according to the current resource situation. In addition, the system manager can also receive a request from the resource scheduling management module to retrieve the monitoring results of the system monitor from the database and return the results.
进一步,参照图6,系统管理器的工作流程为:系统管理器与资源调度管理模块进行网络通信,将本计算节点的FPGA虚拟化资源信息传输至资源调度管理模块;Further, referring to Figure 6, the workflow of the system manager is: the system manager communicates with the resource scheduling management module over the network, and transmits the FPGA virtualized resource information of the computing node to the resource scheduling management module;
接收资源调度管理模块的调度请求,根据不同请求做出对应的处理,并交由下游的各类管理器进行实施;Receive scheduling requests from the resource scheduling management module, make corresponding processing according to different requests, and hand them over to various downstream managers for implementation;
接收资源调度管理模块的资源信息监控请求,将系统监视器检测到的信息上传给资源调度管理模块。Receive resource information monitoring requests from the resource scheduling management module, and upload the information detected by the system monitor to the resource scheduling management module.
系统监视器,用于周期性监测FPGA的工作状态、各vFPGA的运行情况、FPGA虚拟化资源使用情况以及PCIE协议栈模块的流量统计情况,并将监测的数据信息持久化记录到数据库中。The system monitor is used to periodically monitor the working status of the FPGA, the operation of each vFPGA, the usage of FPGA virtualization resources, and the traffic statistics of the PCIE protocol stack module, and persistently record the monitored data information into the database.
硬件资源池,包括vFPGA资源池、FPGA内存池,用于管理记录FPGA硬件资源的使用。FPGA硬件资源包括可重构块(如CLB/Block RAM/DSP等)、PCIE Stack中的资源以及FPGA物理内存资源。这些资源的管理相对比较简单,只需记录每个任务对于这两个资源的拥有情况,同一个任务只能拥有一个可重构区域。而对于FPGA物理内存资源而言,由于底层MMU以4M大小为一页,所以在FPGA物理内存资源池中,对所有的物理内存,也需以4M大小的范围做分割管理。如本系统中的FPGA的物理内存大小有8GB,则其分割出来的内存资源数目为8GB/4M,即2048个。Hardware resource pools, including vFPGA resource pools and FPGA memory pools, are used to manage and record the use of FPGA hardware resources. FPGA hardware resources include reconfigurable blocks (such as CLB/Block RAM/DSP, etc.), resources in PCIE Stack, and FPGA physical memory resources. The management of these resources is relatively simple. You only need to record the ownership of these two resources by each task. The same task can only have one reconfigurable area. As for FPGA physical memory resources, since the underlying MMU has a page size of 4M, all physical memory in the FPGA physical memory resource pool needs to be divided and managed within a 4M size range. If the physical memory size of the FPGA in this system is 8GB, the number of divided memory resources is 8GB/4M, which is 2048.
当一个任务被部署的时候,将会从三个池子中的空闲资源中取出资源来部署运行该任务。其首先会根据任务的比特流文件对应的可重构区域,将该任务部署到该可重构区域中,而后根据该任务的需要为其分配相应的内存,这需要根据该任务描述中的内存需求分配。如一个任务需要4G的内存,即vFPGA虚拟地址空间为0-4GB,那么需要从FPGA内存池中的空闲区取出1024个资源。在任务被卸载的时,分配给该任务的资源会被重新回收至各资源池的空闲区。When a task is deployed, resources will be taken from the idle resources in the three pools to deploy and run the task. It will first deploy the task to the reconfigurable area according to the reconfigurable area corresponding to the bitstream file of the task, and then allocate corresponding memory to it according to the needs of the task, which requires the memory in the task description. Demand allocation. If a task requires 4G of memory, that is, the vFPGA virtual address space is 0-4GB, then 1024 resources need to be taken out from the free area in the FPGA memory pool. When a task is offloaded, the resources allocated to the task will be reclaimed to the free area of each resource pool.
FPGA硬件管理器,将相关的操作与FPGA虚拟化模块进行沟通,将分配的硬件资源通过驱动实施于具体FPGA硬件上。这些相关的操作有可重构区域的配置、可重构过程中离合器的控制以及MMU、IO_LUT的配置等。The FPGA hardware manager communicates relevant operations with the FPGA virtualization module, and implements the allocated hardware resources on specific FPGA hardware through drivers. These related operations include the configuration of the reconfigurable area, the control of the clutch during the reconfiguration process, and the configuration of MMU and IO_LUT, etc.
数据库可以根据实际需求进行选择,这里建议使用sqlite进行上层控制器模块中其他组件的数据持久化记录,因为sqlite是一种无服务器轻量级数据库,资源占用小且易使用。The database can be selected according to actual needs. It is recommended to use sqlite for data persistence records of other components in the upper controller module, because sqlite is a serverless lightweight database that takes up little resources and is easy to use.
进一步,资源调度管理模块还包括自动化部署UI;Furthermore, the resource scheduling management module also includes automated deployment UI;
所述自动化部署UI,用于接收FPGA资源调度需求,并与资源调度管理模块进行网络通信,用户通过UI界面实现参数输入,UI客户端根据用户填写的参数,调用相应的RestfulApi接口实现任务的自动化部署。The automated deployment UI is used to receive FPGA resource scheduling requirements and conduct network communication with the resource scheduling management module. The user implements parameter input through the UI interface. The UI client calls the corresponding RestfulApi interface to implement task automation based on the parameters filled in by the user. deploy.
参照图7,所述资源调度管理模块包括对外接口、节点管理单元,资源调度单元;Referring to Figure 7, the resource scheduling management module includes an external interface, a node management unit, and a resource scheduling unit;
对外接口,用于根据自动化部署UI获取的FPGA资源调度任务需求提供FPGA资源调度任务自动化部署接口。对外接口主要提供RestfrulAPI服务,可通过调用RestfrulApi接口实现任务的自动化部署。The external interface is used to provide an automated deployment interface for FPGA resource scheduling tasks based on the FPGA resource scheduling task requirements obtained by the automated deployment UI. The external interface mainly provides RestfrulAPI services, which can realize automated deployment of tasks by calling the RestfrulApi interface.
节点管理单元,用于监控各节点中动态可重构区域的FPGA资源使用情况。The node management unit is used to monitor the FPGA resource usage of the dynamically reconfigurable area in each node.
资源调度单元,用于根据各节点中动态可重构区域的FPGA资源使用情况,将接收的FPGA资源调度任务调度到合适的动态可重构区域上运行。The resource scheduling unit is used to schedule the received FPGA resource scheduling task to the appropriate dynamic reconfigurable area according to the FPGA resource usage in the dynamic reconfigurable area in each node.
具体的:specific:
资源调度管理模块主要是为用户提供资源管理服务,尤其是多节点的使用场景,用户无需关心应该将任务部署到哪一个节点以及各节点资源的占用情况,用户只需要通过图形化UI将任务以及任务需要的资源信息发送给资源调度管理模块,即可完成任务的自动化部署。整个过程用户对内部的调度无感知,能够极大的提高FPGA资源调度任务部署体验。资源调度管理模块部署于同一个局域网内的任意的一块CPU主板操作系统上。The resource scheduling management module mainly provides users with resource management services, especially in multi-node usage scenarios. Users do not need to care about which node the task should be deployed to and the resource occupancy of each node. Users only need to use the graphical UI to assign tasks and The resource information required by the task is sent to the resource scheduling management module to complete the automated deployment of the task. Users are unaware of the internal scheduling during the entire process, which can greatly improve the FPGA resource scheduling task deployment experience. The resource scheduling management module is deployed on any CPU motherboard operating system in the same local area network.
资源调度管理软件模块运行之后,节点管理单元首先会通过组播发布服务,服务中会携带IP和端口信息,各上层控制器子模块的系统管理器接收到该组播消息后会和组播内的IP和端口建立网络连接,连接建立成功之后,各系统管理器会向节点管理单元主动发起注册请求,请求信息中包含节点的资源类型、资源状态、资源使用情况等,节点管理单元接收到注册请求之后,会将该节点的资源纳入管理,注册成功之后,系统管理器会周期上报FPGA资源使用情况给节点管理单元,这样资源调度管理模块就可以对各节点的资源使用情况以及状态进行掌控,一旦用户发起任务部署请求,可根据调度策略将用户任务调度到合适的节点运行。After the resource scheduling management software module is run, the node management unit will first publish the service through multicast. The service will carry IP and port information. After receiving the multicast message, the system manager of each upper-layer controller sub-module will communicate with the multicast internal Establish a network connection with the IP and port. After the connection is successfully established, each system manager will actively initiate a registration request to the node management unit. The request information includes the node's resource type, resource status, resource usage, etc. The node management unit receives the registration After the request, the resources of the node will be included in the management. After successful registration, the system manager will periodically report the FPGA resource usage to the node management unit, so that the resource scheduling management module can control the resource usage and status of each node. Once the user initiates a task deployment request, the user task can be scheduled to the appropriate node for execution according to the scheduling policy.
当用户创建FPGA任务时,资源调度单元首先会遍历各个节点找到满足资源要求的节点,如果不存在满足要求的节点,则任务部署失败,如果只有一个节点满足要求,则将该任务部署到该节点上运行,如果有多个节点满足要求,则会依据调度策略,将任务调度到合适的节点上运行。这里以资源最大利用策略为例,用户任务需要500个Block RAM,假设两个节点满足要求,其中一个节点剩余600个Block RAM,另外一个节点剩余2000个Block RAM,那么将用户任务调度到剩余600个Block RAM的节点,这样做能够最大化的保证单个节点资源利用最大化。调度策略根据实际需求进行自定义设计,调度策略以动态库的形式实现,开发者只需要按照接口要求实现相应的策略,即可实现调度策略的替换。When the user creates an FPGA task, the resource scheduling unit will first traverse each node to find a node that meets the resource requirements. If there is no node that meets the requirements, the task deployment fails. If only one node meets the requirements, the task will be deployed to that node. If multiple nodes meet the requirements, the task will be scheduled to run on the appropriate node according to the scheduling policy. Here we take the resource maximum utilization strategy as an example. The user task requires 500 Block RAM. Assume that two nodes meet the requirements. One node has 600 Block RAM remaining and the other node has 2000 Block RAM remaining. Then the user task is scheduled to the remaining 600 Block RAM. Block RAM nodes, this can maximize the resource utilization of a single node. The scheduling strategy is customized and designed based on actual needs. The scheduling strategy is implemented in the form of a dynamic library. Developers only need to implement the corresponding strategy according to the interface requirements to replace the scheduling strategy.
实施例二:Example 2:
本实施例提供一种FPGA虚拟化资源调度方法,包括:This embodiment provides an FPGA virtualization resource scheduling method, including:
资源调度管理模块接收FPGA资源调度任务,并根据FPGA资源调度任务的需求以及各节点FPGA资源的占用情况,将FPGA资源调度任务调度部署到合适的动态可重构区域上运行;The resource scheduling management module receives the FPGA resource scheduling task, and schedules and deploys the FPGA resource scheduling task to the appropriate dynamic reconfigurable area according to the needs of the FPGA resource scheduling task and the occupancy of FPGA resources of each node;
用于部署FPGA资源调度任务的动态可重构区域根据FPGA资源调度任务的需求,创建用于运行FPGA资源调度任务的vFPGA。The dynamically reconfigurable area used to deploy FPGA resource scheduling tasks creates a vFPGA for running FPGA resource scheduling tasks according to the needs of the FPGA resource scheduling tasks.
进一步,资源调度管理模块获取各节点FPGA资源的占用情况的步骤包括:Further, the steps for the resource scheduling management module to obtain the occupancy status of each node's FPGA resources include:
资源调度管理模块运行后,节点管理单元通过组播发布服务,服务中携带IP和端口信息;After the resource scheduling management module is run, the node management unit publishes services through multicast, and the services carry IP and port information;
各上层节点控制器的系统管理器接收组播消息,并与组播内的IP、端口建立网络连接;The system manager of each upper-layer node controller receives the multicast message and establishes a network connection with the IP and port in the multicast;
连接建立成功之后,各上层节点控制器的系统管理器会主动发起注册请求,节点管理单元接收到注册请求之后,将该节点的资源纳入管理以完成注册;After the connection is successfully established, the system manager of each upper-layer node controller will actively initiate a registration request. After receiving the registration request, the node management unit will include the resources of the node into management to complete the registration;
完成注册后,各上层节点控制器的系统管理器将各自节点的FPGA资源使用情况周期上报给节点管理单元。After completing the registration, the system manager of each upper-layer node controller periodically reports the FPGA resource usage of the respective node to the node management unit.
进一步,参照图8,动态可重构区域创建用于运行FPGA资源调度任务的vFPGA的步骤包括:Further, referring to Figure 8, the steps for dynamically reconfigurable areas to create vFPGAs for running FPGA resource scheduling tasks include:
动态可重构区域的vFPGA控制器中的离合器开启,复位可重构模块并下载重构相应的比特流,配置内存管理单元,并配置IO_LUT;The clutch in the vFPGA controller in the dynamic reconfigurable area is turned on, the reconfigurable module is reset and the corresponding bit stream is downloaded for reconstruction, the memory management unit is configured, and the IO_LUT is configured;
解复位可重构模块并关闭离合器,完成vFPGA的创建工作,以将接收的FPGA资源调度任务加载到vFPGA中运行。Unreset the reconfigurable module and close the clutch to complete the creation of vFPGA to load the received FPGA resource scheduling task into the vFPGA for running.
更进一步,参照图8,为动态可重构区域配置内存管理单元的流程为:Furthermore, referring to Figure 8, the process of configuring the memory management unit for the dynamic reconfigurable area is:
S1、判断已映射地址空间是否小于所需映射空间N,若否则结束配置流程,若是则执行步骤S2;S1. Determine whether the mapped address space is smaller than the required mapping space N. If not, end the configuration process. If so, perform step S2;
S2、从FPGA内存池中取出一个内存资源,通过驱动向该vFPGA的内存管理管理单元添加一条映射记录;S2. Take out a memory resource from the FPGA memory pool and add a mapping record to the memory management unit of the vFPGA through the driver;
S3、重复执行步骤S1~S2,直到已映射地址空间大于或等于所需映射空间N时,结束配置流程。S3. Repeat steps S1 to S2 until the mapped address space is greater than or equal to the required mapped space N, then end the configuration process.
以上所述的实施例仅仅是对本发明的优选实施方式进行描述,并非对本发明的范围进行限定,在不脱离本发明设计精神的前提下,本领域普通技术人员对本发明的技术方案作出的各种变形和改进,均应落入本发明的保护范围内。The above-described embodiments are only descriptions of preferred embodiments of the present invention and do not limit the scope of the present invention. Without departing from the design spirit of the present invention, those of ordinary skill in the art may make various modifications to the technical solutions of the present invention. All deformations and improvements shall fall within the protection scope of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310616927.7A CN116841731A (en) | 2023-05-29 | 2023-05-29 | An FPGA virtualized resource scheduling system and method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310616927.7A CN116841731A (en) | 2023-05-29 | 2023-05-29 | An FPGA virtualized resource scheduling system and method |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116841731A true CN116841731A (en) | 2023-10-03 |
Family
ID=88173312
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310616927.7A Pending CN116841731A (en) | 2023-05-29 | 2023-05-29 | An FPGA virtualized resource scheduling system and method |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116841731A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117707693A (en) * | 2023-12-11 | 2024-03-15 | 之江实验室 | Heterogeneous intelligent computing platform virtualization management system and method |
-
2023
- 2023-05-29 CN CN202310616927.7A patent/CN116841731A/en active Pending
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117707693A (en) * | 2023-12-11 | 2024-03-15 | 之江实验室 | Heterogeneous intelligent computing platform virtualization management system and method |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10365830B2 (en) | Method, device, and system for implementing hardware acceleration processing | |
| US20230036751A1 (en) | Sparse memory handling in pooled memory | |
| CN110083440B (en) | Dynamic reconfiguration of applications on multiprocessor embedded systems | |
| CN106648896B (en) | Method for dual-core sharing of output peripheral by Zynq chip under heterogeneous-name multiprocessing mode | |
| CN117493237B (en) | Computing device, server, data processing method, and storage medium | |
| US11281506B2 (en) | Virtualised gateways | |
| CN105549904A (en) | A data migration method and storage device applied in a storage system | |
| KR20120068464A (en) | Software architecture for service of collective volume memory, and method for providing service of collective volume memory using the said software architecture | |
| CN113312143A (en) | Cloud computing system, command processing method and virtualization simulation device | |
| WO2022143714A1 (en) | Server system, and virtual machine creation method and apparatus | |
| CN117707693A (en) | Heterogeneous intelligent computing platform virtualization management system and method | |
| CN118519753A (en) | Computing resource aggregation method and system based on pooled memory | |
| WO2023174146A1 (en) | Offloading-card namespace management system and method, and input/output request processing system and method | |
| WO2024244557A1 (en) | Inter-node communication method and apparatus, electronic device, and storage medium | |
| CN116841731A (en) | An FPGA virtualized resource scheduling system and method | |
| CN114625482A (en) | Equipment management method and device | |
| CN116662008A (en) | Heterogeneous hardware unified nano-tube scheduling node controller | |
| CN114281529B (en) | Method, system and terminal for dispatching optimization of distributed virtualized client operating system | |
| WO2024087663A1 (en) | Job scheduling method and apparatus, and chip | |
| CN116126459A (en) | Heterogeneous computing environment-oriented FPGA virtualization implementation method | |
| CN116069451B (en) | Virtualization method, device, equipment, medium, accelerator and system | |
| JP7752489B2 (en) | Systems and methods for managing memory resources | |
| US20250321904A1 (en) | Dynamic data localization | |
| CN118550733A (en) | Method for sharing service between android containers | |
| WO2025213785A1 (en) | Pci device resource configuration method and apparatus |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |