Resource management method and device, equipment and medium
By establishing a hardware computing link and optimizing the collaborative work between PCIe devices, the problems of low data processing efficiency and low resource utilization caused by resource isolation in PCIe device design are solved, and efficient collaborative processing of hardware resources is achieved.
Patent Information
- Application Number
- CN202510558778.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-08-01
AI Technical Summary
In the prior art, the design of PCIe devices leads to hardware resource isolation, resulting in the need for multiple communications and data replication during data processing, occupying bus resources and increasing delay, affecting data processing efficiency and resource utilization.
By obtaining the hardware computing link resource requests of the application software, establishing a hardware computing link, processing data in sequence in the link order, reducing data replication from memory to endpoint devices, and realizing collaborative work between hardware devices.
It improves resource utilization, reduces bus path usage and memory replication, simplifies user software design, and optimizes the coordinated work of hardware resources.
Smart Images

Figure CN120407186A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technologies, and in particular, to a resource management method, apparatus, device, and medium. Background Art
[0002] With the comprehensive development of semiconductor technologies, various hardware devices have emerged. The main purpose of the PCIe bus (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard) is to connect various components inside a computer, such as graphics cards, network cards, and sound cards, etc., enabling them (especially with the chipset and processor) to efficiently transfer data and work together. Thanks to the excellent design of the PCIe bus, the interaction interfaces between hardware devices and the host have been greatly unified, which has further promoted the emergence of various specialized devices. These devices have different functions, including image processing, audio processing, data encryption, and special computing acceleration such as (various encoding and decoding, data exclusive OR operations), etc., and users can utilize more and more functions.
[0003] In the traditional mode, the design of a PCIe device only requires meeting the basic PCIe protocol, interacting through a certain application layer protocol and system driver, and finally providing services upward. In this way, these hardware resources are often completely isolated and unrelated, which leads to the need for continuous back-and-forth interaction of commands and data through their respective drivers when users want to use different computing resources simultaneously, greatly lengthening the data processing flow.
[0004] As data processing becomes increasingly complex, usually in an application program, it is necessary to include not only the processing of images and audio but also the encryption of such data. Additionally, to provide data protection, RAID (Redundant Array of Independent Disks) is also used to perform redundant protection on the data. For this series of operations, the software layer has to call the driver programs of the corresponding devices to drive the corresponding PCIe devices for processing. This processing process involves multiple communications between the Host and the PCIe device, and multiple data transfers from memory → PCIe device → memory. When users perform corresponding data processing through software, if the software uses multiple hardware resources during execution, then each time the corresponding hardware resource is used, it will trigger the transfer of data between the host's memory and the PCIe device. This method not only occupies a large amount of bus path resources but also surely causes more latency due to multiple data replications.
[0005] Obviously, how to improve data processing efficiency and resource utilization is a problem that those skilled in the art need to solve. Summary of the Invention
[0006] The object of the present invention is to provide a resource management method, device, equipment and medium. The application software only needs to copy the data to be processed once, saving a large amount of data copying from memory to the endpoint device. When the data is processed on the endpoint device, the link information of the hardware computing link is carried. After the calculation is completed, the output data can be given to the next endpoint device according to the calculation chain information, reducing a large amount of path occupation and memory copying, and improving the utilization rate of various resources.
[0007] In a first aspect, a resource management method is provided, including:
[0008] Obtain a hardware computing chain resource request of the application software, where the hardware computing chain resource request is used to indicate the task order of the request requirements;
[0009] According to the hardware computing chain resource request, match the hardware computing link corresponding to the task order from the mapping relationship, where the mapping relationship represents the mapping of the endpoint device and the capability information; and return the operation handle of the hardware computing link to the application software, where the hardware computing link represents the execution order of multiple endpoint devices;
[0010] After receiving the data processing request obtained by the application software writing the data to be processed into the operation handle, process the data to be processed in sequence according to the hardware computing link. Wherein, after each endpoint device finishes processing, it will send the processed data and the hardware computing link to the next endpoint device determined according to the hardware computing link for processing.
[0011] The present invention can be further configured in a preferred example as follows: Before obtaining the hardware computing chain resource request of the application software, it further includes:
[0012] Obtain the capability information reported by the endpoint device;
[0013] According to the capability information reported by each endpoint device, perform internal mapping to obtain a mapping relationship; and set a configurable functional direct memory access interface;
[0014] Correspondingly, according to the hardware computing chain resource request, matching the hardware computing link corresponding to the task order from the mapping relationship includes:
[0015] Match the endpoint device corresponding to the task order from the mapping relationship according to the task order of the hardware computing chain resource request;
[0016] If the endpoint device corresponding to the task order is successfully matched, construct a hardware computing link according to the endpoint device corresponding to the task order.
[0017] In a preferred example, the present invention can be further configured to: match an endpoint device corresponding to the task order from the mapping relationship according to the task order of the hardware computing chain resource request, including:
[0018] Match an endpoint device corresponding to the task order from the mapping relationship according to the task order of the hardware computing chain resource request; during the matching process, for each task, if at least two endpoint devices are matched, then according to the number of tasks of the to-be-processed tasks of the at least two endpoint devices and the estimated processing duration of each task, determine the waiting duration for the at least two endpoint devices to process this task; according to the waiting duration, determine the endpoint device corresponding to this task from the at least two endpoint devices.
[0019] In a preferred example, the present invention can be further configured to: further include at least one of the following:
[0020] If an endpoint device corresponding to the task order is not successfully matched, then return an information indicating unable to create to the application software, so that the application software can be processed according to a preset resource management method;
[0021] If a data processing exception occurs, then generate an error message and return the error message to the application software.
[0022] In a preferred example, the present invention can be further configured to: further include:
[0023] After the data processing is completed, release the resource occupation of the endpoint device of the hardware computing link;
[0024] Return a processing completion information to the application software, so that the application software can release the operation handle of the hardware computing link.
[0025] In a preferred example, the present invention can be further configured to: process the to-be-processed data in sequence according to the hardware computing link, including:
[0026] According to the priority of the data processing request, determine the data processing method of the target endpoint device, where the target endpoint device is any endpoint device of the hardware computing link;
[0027] Use the target endpoint device to process the data processed by the previous endpoint device received by the target endpoint device according to the data processing method to obtain the processed data.
[0028] In a preferred example, the present invention can be further configured to: process the to-be-processed data in sequence according to the hardware computing link, including:
[0029] Process the data to be processed in sequence according to the hardware computing link, so that the target endpoint device periodically sends the processed data to the remaining endpoint devices, and the remaining endpoint devices determine whether to perform data processing operations through the hardware computing link and the target endpoint device; if so, the remaining endpoint devices perform corresponding data processing operations on the received processed data, and the remaining endpoint devices return confirmation information to the target endpoint device to facilitate the target endpoint device to stop sending the processed data.
[0030] In a second aspect, a resource management device is provided, including:
[0031] A hardware computing link processing module, configured to obtain a hardware computing link resource request of an application software, where the hardware computing link resource request is used to indicate the task order of the request requirements; according to the hardware computing link resource request, match the hardware computing link corresponding to the task order from the mapping relationship, where the mapping relationship represents the mapping between endpoint devices and capability information; and return the operation handle of the hardware computing link to the application software, where the hardware computing link represents the execution order of multiple endpoint devices;
[0032] A data processing module, configured to, after receiving a data processing request obtained by the application software writing the data to be processed into the operation handle, process the data to be processed in sequence according to the hardware computing link. Wherein, after each endpoint device finishes processing, it will send the processed data and the hardware computing link to the next endpoint device determined according to the hardware computing link for processing.
[0033] In a third aspect, an electronic device is provided, where the electronic device includes a memory and a processor, a computer program is stored in the memory, and the processor executes the method according to any one of the first aspects when running the computer program.
[0034] In a fourth aspect, a computer-readable storage medium is provided, where at least one program code is stored in the computer-readable storage medium, and the program code is loaded and executed by the processor to implement the method according to any one of the first aspects.
[0035] In a fifth aspect, a computer program product is provided, including a computer program or instruction, where the computer program or instruction implements the method according to any one of the first aspects when executed by the processor.
[0036] In summary, the resource management method provided by the present invention includes the following beneficial technical effects:
[0037] Obtain the task sequence hardware computing chain resource request of the application software for indicating the request requirements; according to the hardware computing chain resource request, match the hardware computing link corresponding to the task sequence from the mapping relationship; and return the operation handle of the hardware computing link to the application software; after receiving the data processing request obtained by the application software writing the data to be processed into the operation handle, process the data to be processed in sequence according to the hardware computing link, wherein after each endpoint device finishes processing, it will send the processed data and the hardware computing link to the next endpoint device determined according to the hardware computing link for processing; the application software only needs to copy the data to be processed once, saving a large amount of data copying from memory to endpoint devices; when the data is processed on the endpoint device, it carries the link information of the hardware computing link, and after the calculation is completed, the output data can be given to the next endpoint device according to the calculation chain information, reducing a large amount of path occupancy and memory copying, and improving the utilization rate of various resources.
[0038] In addition, the present invention also provides a resource management device, equipment and medium, all having the above beneficial technical effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present invention, the following will briefly introduce the drawings required for use in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0040] Figure 1 It is a schematic diagram of the interaction between PCIe hardware resources and software in related technologies.
[0041] Figure 2 It is a schematic flowchart of a resource management method provided by an embodiment of the present invention.
[0042] Figure 3 It is a process of obtaining a hardware computing link provided by an embodiment of the present invention.
[0043] Figure 4 It is a schematic diagram of the direct transfer of data between EPs provided by an embodiment of the present invention.
[0044] Figure 5 It is a schematic diagram of PCIe capability reporting in the initialization stage provided by an embodiment of the present invention.
[0045] Figure 6 It is a schematic structural diagram of a resource management device provided by an embodiment of the present invention.
[0046] Figure 7 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. Detailed Implementation Modes
[0047] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0048] The terms "include" and "have" in the specification of the present invention and the accompanying drawings above, and any variations related to "include" and "have", are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may include steps or units not listed.
[0049] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific implementation modes.
[0050] See Figure 1 , where RC, Root Complex is a key component in the system. It is the controller on the host side and communicates with PCIe devices (EP devices, i.e., endpoint devices). ENCRY EP refers to an Endpoint device that supports encryption functions. XOR EP refers to an Endpoint device that supports exclusive OR check operations. Graphics EP refers to an Endpoint device with image processing functions. Audio EP refers to an Endpoint device with audio processing functions. Storage EP refers to an Endpoint device with data storage functions.
[0051] When the application layer needs to perform video transcoding → audio transcoding → encryption → RAID XOR calculation → disk storage operations on data, it is necessary to send data from the user space to the kernel space and then to the RC, so that the data can be transmitted through the RC to the corresponding video transcoding endpoint device for data processing. After the data processing is completed, it is returned to the application layer. Then, the application layer sends the data and commands to the kernel space and then to the RC, so that the data can be transmitted through the RC to the corresponding audio transcoding endpoint device for data processing. In this way, it is necessary to copy the data 5 times from the memory and return the data to the user space 4 times, that is, the kernel space needs to interact with the memory 9 times. This method not only occupies a large amount of bus path resources, but also multiple data copies will definitely cause more delays. The current PCIe bus design mainly considers the direct interaction between the host and a single device, and does not consider the direct and complex cooperation problems between hardware devices enough. In the face of the emergence of more diverse hardware devices in the future, this design needs to be changed so that hardware resources can work together, reduce the occupation of path resources, and greatly improve the operation efficiency.
[0052] Based on this, the present invention aims to use an improved design method to achieve the collaborative work between hardware, so as to optimize memory copying, reduce path congestion, simplify the design of user software, and further prepare for more diverse hardware resources and software functions in the future.
[0053] Figure 2 A resource management method provided by an embodiment of the present invention, the resource management method includes:
[0054] S101. Obtain the hardware computing chain resource request of the application software, where the hardware computing chain resource request is used to indicate the task order of the request requirements.
[0055] In the embodiment of the present invention, the application software is installed on the host device and is used to complete various service functions. After the application software is started, it generates a hardware computing chain resource request according to the actual processing requirements of the user, so as to apply for hardware computing chain resources. Among them, the hardware computing chain resource request is used to indicate the task order of the request requirements. The application software sends the computing chain resource requirements to the RC through the management interface, so that the computing chain management module of the RC can obtain the hardware computing chain resource request.
[0056] S102. According to the hardware computing chain resource request, match the hardware computing link corresponding to the task order from the mapping relationship, where the mapping relationship represents the mapping between the endpoint device and the capability information; and return the operation handle of the hardware computing link to the application software, where the hardware computing link characterizes the execution order of multiple endpoint devices.
[0057] The hardware computing chain resource request is used to indicate the task order of the request requirements. According to each task, the corresponding endpoint device is determined, and then the endpoint devices are sorted in the same order according to the task order to obtain the hardware computing link. Exemplarily, see Figure 3 , when the application layer needs to perform image conversion → encryption → RAID XOR calculation → disk storage on the data, first initialize to obtain the functional link, that is, the task order. A specific module in the RC selects the corresponding EP device (endpoint device) according to the internal functional mapping relationship. If the corresponding hardware resources can be found, a hardware computing link is formed: Graphics EP → ENCRY EP → XOR EP → Storage EP; and the operation handle of the corresponding computing link is returned to the application layer software.
[0058] S103. After receiving the data processing request obtained by the application software writing the data to be processed into the operation handle, the data to be processed is processed sequentially according to the hardware computing link. Among them, after each endpoint device finishes processing, it will send the processed data and the hardware computing link to the next endpoint device determined according to the hardware computing link for processing.
[0059] After the application software in the application layer obtains the operation handle of the hardware computing link of the computing chain, it will write the data to be processed into the operation handle to obtain a data processing request. That is to say, after the corresponding hardware computing link is created, when data processing is performed, the application software only needs to call the call interface provided by Func Link once to submit the data to be processed to the RC for execution, and then the data to be processed is processed sequentially according to the hardware computing link. After each endpoint device finishes processing, it will send the processed data and the hardware computing link to the next endpoint device determined according to the hardware computing link for processing. In this mode, copy_from_user for data will only be called once, and in addition, a large amount of data copying from memory to PCIe devices (endpoint devices) is omitted. When the data is processed on the hardware, it itself carries the computing link information of the corresponding hardware computing link. After the calculation is completed on device A, according to the computing link information, device A directly DMA the output data to the next hardware device, reducing a large amount of path occupation and memory copying.
[0060] See Figure 4 , after the hardware computing link is established, when the application layer software performs data processing, it only needs to submit the data once, and then the entire data will flow between the endpoint devices on the PCIe bus as shown in Figure 4 the dotted line in, reducing the interaction times and data transfer volume between the user layer software and the PCIe device bus, and can greatly improve the utilization rate of various resources.
[0061] Further, in some possible cases, an error is returned to the user layer after all processes are executed or when an exception occurs during a certain process in the middle.
[0062] In addition, the PCIe bus supports direct communication between EP devices in its implementation. In the embodiments of the present invention, through a hardware computing link, the hardware computing resources are uniformly managed and coordinated, and the PCIe protocol is optimized and changed, including the need to standardize and unify the data interfaces between various protocols, set up a link management module, add corresponding driver interfaces for link management in the driver layer, and the endpoint device adds the reporting of internal function information. Exemplarily, if a dedicated encryption and decryption device supports some encryption and decryption algorithms, it can report and notify the link management module on the RC.
[0063] It can be seen that in the embodiments of the present invention, a task-order hardware computing chain resource request for indicating a request requirement of the application software is obtained; according to the hardware computing chain resource request, a hardware computing link corresponding to the task order is determined; and an operation handle of the hardware computing link is returned to the application software; after receiving a data processing request obtained by the application software writing the data to be processed into the operation handle, the data to be processed is processed in sequence according to the hardware computing link, wherein after each endpoint device finishes processing, the processed data and the hardware computing link are sent to the next endpoint device determined according to the hardware computing link for processing; the application software only needs to copy the data to be processed once, saving a large amount of data copying from memory to the endpoint device; when the data is processed on the endpoint device, the link information of the hardware computing link is carried, and after the calculation is completed, the output data can be given to the next endpoint device according to the calculation chain information, reducing a large amount of path occupation and memory copying, and improving the utilization rate of various resources.
[0064] In a feasible manner, it is necessary to obtain the capability information of each endpoint device in advance so as to be able to construct a hardware computing link. Specifically, before obtaining the hardware computing chain resource request of the application software, it further includes: obtaining the capability information reported by the endpoint device; performing internal mapping according to the capability information reported by each endpoint device to obtain a mapping relationship; and setting a configurable functional direct memory access interface; the mapping relationship represents the mapping between the endpoint device and the capability information. Among them, a module is added in the RC to specifically integrate the hardware resources and provide a unified service externally. In the PCIe device initialization stage, refer to Figure 5, the link management module in RC collects the capability information of each EP device (endpoint device) and performs internal mapping; the endpoint device provides a configurable functional DMA interface (direct memory access interface) upwards. By the endpoint device actively reporting the capability information, the mapping relationship between the endpoint device and the capability information is constructed; furthermore, according to the task sequence of the hardware computing chain resource request, the endpoint device corresponding to the task sequence is matched from the mapping relationship; if the endpoint device corresponding to the task sequence is successfully matched, the hardware computing link is constructed according to the endpoint device corresponding to the task sequence, so as to accurately obtain the hardware computing link.
[0065] In an implementable manner, matching the endpoint device corresponding to the task sequence from the mapping relationship according to the task sequence of the hardware computing chain resource request includes: matching the endpoint device corresponding to the task sequence from the mapping relationship according to the task sequence of the hardware computing chain resource request; during the matching process, for each task, if at least two endpoint devices are matched, then according to the number of tasks of the to-be-processed tasks of each of the at least two endpoint devices and the estimated processing duration of each task, the waiting duration for the at least two endpoint devices to process this task is determined; according to the waiting duration, the endpoint device corresponding to this task is determined from the at least two endpoint devices.
[0066] Among them, the estimated processing duration is the execution time of a single task on the endpoint device predicted by historical data. For example, the estimated duration of an image processing task is 80 ms. The waiting duration represents the time required for a task to wait for all previous tasks to be completed after entering the device queue of the endpoint device, and can be calculated by multiplying the number of tasks by the estimated duration. During the matching process, if there are at least two endpoint devices corresponding to a certain task, then one endpoint device needs to be selected from the at least two endpoint devices, and the endpoint device with the shortest waiting duration can be selected as the endpoint device corresponding to this task.
[0067] It can be seen that in the embodiment of the present invention, during the process of determining the endpoint device corresponding to the task sequence, if a task corresponds to at least two endpoint devices, the waiting duration for the at least two endpoint devices to process this task can be determined according to the number of tasks of the to-be-processed tasks of each of the at least two endpoint devices and the estimated processing duration of each task, so as to select the endpoint device corresponding to the task through the waiting duration, which can avoid the overload situation of the hot endpoint device, ensure the resource utilization rate, and also enable the task to be completed quickly.
[0068] In an implementable manner, it further includes: if the endpoint device corresponding to the task sequence is not successfully matched, then return the information that cannot be created to the application software, so that the application software can be processed according to the preset resource management method.
[0069] If no endpoint device corresponding to a certain task / tasks is found after traversing the mapping relationship, that is, the endpoint device corresponding to the task sequence is not successfully matched. At this time, it may be that there are endpoint devices but the reporting function information of the endpoint devices has not been collected, or it may be that there are no endpoint devices corresponding to the function, triggering the process of returning the information that cannot be created to the application software, so that the application software can be processed according to the preset resource management method. Among them, the preset resource management method is the conventional processing method, which requires multiple interactions with the application software. The information that cannot be created refers to sending a response message containing an error code and descriptive text to the application software.
[0070] In an implementable manner, it further includes: if a data processing exception occurs, an error message is generated and returned to the application software. During / after the data processing, if an abnormal situation occurs, an error message can be generated according to a preset template. Data processing exceptions include but are not limited to data format errors, calculation overflows, and processing interruptions. In the embodiments of the present invention, an error feedback mechanism is established so that when an exception occurs, the application software can quickly locate the problem.
[0071] In an implementable manner, it further includes: after the data processing is completed, the resource occupancy of the endpoint device of the hardware computing link is released; a processing completion message is returned to the application software so that the application software can release the operation handle of the hardware computing link.
[0072] Specifically, when the last endpoint device of the hardware computing link completes the task, a task completion message is returned to the link management module of the RC, so as to release the resource occupancy of the endpoint device of the hardware computing link. And the RC returns a processing completion message to the application software so that the application software can release the operation handle.
[0073] For data processing, in an implementable manner, the data to be processed is processed in sequence according to the hardware computing link, including: determining the data processing method of the target endpoint device according to the priority of the data processing request, and the target endpoint device is any endpoint device in the hardware computing link; using the target endpoint device to process the data processed by the previous endpoint device received by the target endpoint device according to the data processing method to obtain the processed data.
[0074] Among them, the priority of the data processing request represents a pre-defined request urgency identifier, which is usually divided into real-time level, high priority level, and normal level. The processed data represents the structured result after being processed by a specific algorithm of the target endpoint device.
[0075] Specifically, in one feasible way, the corresponding calculation parameters, i.e., the data processing method, can be configured for the target endpoint according to a predefined priority-processing method mapping table. A higher priority means that the request needs to be processed and completed with high quality. In another feasible way, the data processing method of each endpoint device that is greater than the priority can be determined for the target endpoint according to the predefined priority-processing method mapping table. Furthermore, based on the data processing method of each endpoint device that is greater than the priority, a plurality of processing flows are predetermined, each processing flow including the respective data processing methods of a plurality of endpoint devices, and further, based on the estimated processing time corresponding to the data processing method of each endpoint device, the total processing time of each processing flow is determined; based on the total processing time, the processing flow corresponding to the smallest processing time and having a processing time less than the preset processing time threshold is selected to obtain the data processing method of each endpoint device.
[0076] It can be seen that in the embodiment of the present invention, a corresponding data processing mode can be configured for each endpoint device in combination with the priority, and resources can be reasonably allocated to realize data processing while meeting user needs.
[0077] For data processing, in another feasible way, the key conditions of each preset task are obtained, and the key conditions of each task are dynamically adjusted based on the error rate of historical tasks that are regularly counted and the preset classification threshold; based on the adjusted key conditions, the key conditions of each task in the hardware computing link are determined to divide the tasks into critical tasks and non-critical tasks, thereby realizing dynamic classification of data processing accuracy; the data of non-critical tasks is simplified for accuracy to improve throughput, and it can support concurrent processing of each task and isolate the data streams of different tasks.
[0078] In one feasible manner, the data to be processed is processed in sequence according to the hardware computing link, including: processing the data to be processed in sequence according to the hardware computing link, so that the target endpoint device periodically sends the processed data to the remaining endpoint devices, and the remaining endpoint devices determine whether data processing operations need to be performed through the hardware computing link and the target endpoint device; if necessary, the remaining endpoint devices perform corresponding data processing operations on the received processed data, and the remaining endpoint devices return confirmation information to the target endpoint device, so that the target endpoint device stops sending processed data.
[0079] The target endpoint device is any one of the devices in the hardware computing link. After the target endpoint device completes the data processing operation, it periodically sends the processed data to all remaining endpoint devices / next endpoint devices in the hardware computing link.
[0080] If the processed data is periodically sent to all the remaining endpoint devices in the hardware computing link, after an endpoint device receives the data, it knows which endpoint device sent the data, and determines that it should perform the operation of processing the next data according to the hardware computing link, then it returns an acknowledgment message to the target endpoint device, causing the target endpoint device to stop the periodic sending operation.
[0081] If the processed data is periodically sent to the next remaining endpoint device in the hardware computing link, after the next endpoint device receives the data, it returns an acknowledgment message to the target endpoint device, causing the target endpoint device to stop the periodic sending operation.
[0082] It can be seen that in the embodiment of the present invention, a complete feedback mechanism is established so that the endpoint device can obtain the data that needs to be processed to complete the task processing operation.
[0083] Furthermore, a request status table can be maintained to record the processing progress of each request and the processing status of each endpoint device of each request.
[0084] In a feasible manner, after the remaining endpoint devices return an acknowledgment message to the target endpoint device, if an error occurs during the processing of the remaining endpoint devices, the request repeatedly sent by the target endpoint device is preferentially returned, so as to perform data processing again, and the number of retransmissions is recorded in the request status table. If the preset number threshold is reached, it means that the data processing process is abnormal, and a backup endpoint device can be used for processing, or the abnormality can be reported.
[0085] Based on any of the above embodiments, the embodiment of the present invention provides a specific method for PCIe device resource management and allocation, including:
[0086] Device initialization. After power-on, the PCIe EP device actively exposes its external capabilities to a special module on the RC. The special module on the RC summarizes the reported functions, maps them to the device, and provides a link management interface upward.
[0087] Usage Process. First step: After the application software starts, it requests hardware computing chain resources according to its own processing requirements. Second step: Send the computing chain resource requirements through the management interface. Third step: The RC searches for appropriate hardware resources through the requirements list. If found, proceed to the fourth step; if not, proceed to the eighth step. Fourth step: The RC special module component calculates the chain and returns the operation handle of the corresponding computing chain to the application layer software. Fifth step: The software transfers the data to the computing chain for data processing. Sixth step: After the data processing is completed, the software actively releases the computing chain handle. Seventh step: The RC special module releases the occupancy of the corresponding computing chain resources, and it's over. Release the occupied resources. Eighth step: Return that a suitable computing chain cannot be created. Ninth step: The software uses the computing resources in the traditional way, and it's over.
[0088] In the present invention, by uniformly managing computing resources and providing a simple and unified call interface to the upper layer, the design of the user's functional software can be greatly simplified, and the call logic and process of the user software can be simplified. By uniformly managing various computing capabilities of the hardware, the use of the computing chain can enable data to directly flow to the next hardware processing node, retaining the usage mode of the original PCIe device, being well forward-compatible, greatly reducing the number of data copies between the system and the device, minimizing resource copying and bus occupancy, and improving the overall service ability of the hardware resources. The changes involved in the method and system proposed in the present invention mainly include the driver and the dedicated module for upper-link management on the RC, which can be implemented in C or C++.
[0089] Figure 6 It is a schematic structural diagram of a resource management device provided by an embodiment of the present invention. The embodiment of the present invention provides a resource management device, including:
[0090] A hardware computing link processing module 210, configured to obtain a hardware computing chain resource request of the application software, where the hardware computing chain resource request is used to indicate the task sequence of the request requirements; according to the hardware computing chain resource request, match the hardware computing link corresponding to the task sequence from the mapping relationship, where the mapping relationship represents the mapping between the endpoint device and the capability information; and return the operation handle of the hardware computing link to the application software, where the hardware computing link represents the execution sequence of multiple endpoint devices; a data processing module 220, configured to, after receiving a data processing request obtained by the application software writing the data to be processed into the operation handle, process the data to be processed in sequence according to the hardware computing link, where after each endpoint device finishes processing, it will send the processed data and the hardware computing link to the next endpoint device determined according to the hardware computing link for processing.
[0091] In a preferred example, the present invention can be further configured as follows: The hardware computing link processing module 210 is further configured to obtain the capability information reported by the endpoint device; perform internal mapping based on the capability information reported by each endpoint device to obtain a mapping relationship; and set a configurable functional direct memory access interface; the mapping relationship represents the mapping between the endpoint device and the capability information.
[0092] Correspondingly, the hardware computing link processing module 210 is specifically configured to match the endpoint device corresponding to the task sequence from the mapping relationship according to the task sequence of the hardware computing link resource request; if the endpoint device corresponding to the task sequence is successfully matched, a hardware computing link is constructed according to the endpoint device corresponding to the task sequence.
[0093] In a preferred example, the present invention can be further configured as follows: The hardware computing link processing module 210 is specifically configured to: match the endpoint device corresponding to the task sequence from the mapping relationship according to the task sequence of the hardware computing link resource request; during the matching process, for each task, if at least two endpoint devices are matched, determine the waiting duration for the at least two endpoint devices to process the task according to the number of tasks of the to-be-processed tasks of the at least two endpoint devices and the estimated processing duration of each task; determine the endpoint device corresponding to the task from the at least two endpoint devices according to the waiting duration.
[0094] In a preferred example, the present invention can be further configured as follows: It further includes: a first return module, configured to return an inability-to-create message to the application software if the endpoint device corresponding to the task sequence is not successfully matched, so that the application software can process it according to a preset resource management method; a second return module, configured to generate an error message and return the error message to the application software if a data processing exception occurs.
[0095] In a preferred example, the present invention can be further configured as follows: It further includes: a release module, configured to release the resource occupancy of the endpoint device of the hardware computing link when the data processing is completed; a third return module, configured to return a processing-completed message to the application software, so that the application software can release the operation handle of the hardware computing link.
[0096] In a preferred example, the present invention can be further configured as follows: The data processing module 220 is specifically configured to: determine the data processing method of the target endpoint device according to the priority of the data processing request, where the target endpoint device is any endpoint device of the hardware computing link; use the target endpoint device to perform data processing on the data processed by the previous endpoint device received by the target endpoint device according to the data processing method to obtain the processed data.
[0097] In a preferred example, the present invention can be further configured as follows: The data processing module 220 is specifically used to: process the data to be processed in sequence according to the hardware computing link, so that the target endpoint device periodically sends the processed data to the remaining endpoint devices, and the remaining endpoint devices determine whether to perform data processing operations through the hardware computing link and the target endpoint device; if so, the remaining endpoint devices perform corresponding data processing operations on the received processed data, and the remaining endpoint devices return confirmation information to the target endpoint device, so that the target endpoint device stops sending the processed data.
[0098] Figure 6 For the description of the features in the corresponding embodiments, reference can be made to Figure 2 the relevant descriptions of the corresponding embodiments, which will not be elaborated here one by one.
[0099] Figure 7 The figure is a structural diagram of an electronic device provided by an embodiment of the present invention. As Figure 7 shown, the electronic device includes: a memory 60 for storing a computer program;
[0100] a processor 61 for implementing the steps of the resource management method in the above embodiment when executing the computer program.
[0101] The electronic device provided in this embodiment may include, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, etc.
[0102] Among them, the processor 61 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 61 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), programmable logic array (PLA). The processor 61 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 61 may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 61 may further include an artificial intelligence (AI) processor, and the AI processor is used to process computing operations related to machine learning.
[0103] The memory 60 may include one or more computer-readable storage media, which may be non-transitory. The memory 60 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In this embodiment, the memory 60 is at least used to store the following computer program 601. After the computer program is loaded and executed by the processor 61, it can implement the relevant steps of the resource management method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 60 may also include an operating system 602, data 603, etc., and the storage method may be transient storage or permanent storage. Among them, the operating system 602 may include Windows, Unix, Linux, etc.
[0104] In some embodiments, the electronic device may further include a display screen 62, an input / output interface 63, a communication interface 64, a power supply 65, and a communication bus 66.
[0105] Those skilled in the art can understand that Figure 7 the structure shown in does not constitute a limitation on the electronic device, and it may include more or fewer components than those shown in the figure.
[0106] It can be understood that if the resource management method in the above embodiments is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the current technology, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods in the various embodiments of the present invention. The foregoing storage media include: USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, magnetic disks, or optical disks, etc., which can store program codes.
[0107] Based on this, the embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the steps of the resource management method as described above.
[0108] The above has introduced in detail a resource management method, apparatus, device, and medium provided by an embodiment of the present invention. The various embodiments in the specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the various embodiments, reference can be made to each other. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description in the method part.
[0109] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0110] The above has introduced in detail a resource management method, apparatus, device, and medium provided by the present invention. Specific examples are used herein to elaborate on the principles and implementation manners of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention. It should be noted that for those of ordinary skill in the art in the technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the present invention.
Claims
1. A resource management method, characterized in that, Including: Obtaining a hardware computing chain resource request of an application software, where the hardware computing chain resource request is used to indicate the task sequence of the request requirements; According to the hardware computing chain resource request, matching a hardware computing link corresponding to the task sequence from a mapping relationship, where the mapping relationship represents the mapping of endpoint devices and capability information; and returning an operation handle of the hardware computing link to the application software, where the hardware computing link characterizes the execution sequence of multiple endpoint devices; After receiving a data processing request obtained by the application software writing data to be processed into the operation handle, processing the data to be processed in sequence according to the hardware computing link. Wherein, after each endpoint device finishes processing, it will send the processed data and the hardware computing link to the next endpoint device determined according to the hardware computing link for processing.
2. The method according to claim 1, wherein Before obtaining the hardware computing chain resource request of the application software, it further includes: Obtaining the capability information reported by the endpoint device; According to the capability information reported by each endpoint device, performing internal mapping to obtain a mapping relationship; and setting a configurable functional direct memory access interface; Correspondingly, according to the hardware computing chain resource request, matching a hardware computing link corresponding to the task sequence from the mapping relationship includes: Matching an endpoint device corresponding to the task sequence from the mapping relationship according to the task sequence of the hardware computing chain resource request; If an endpoint device corresponding to the task sequence is successfully matched, constructing a hardware computing link according to the endpoint device corresponding to the task sequence.
3. The method according to claim 2, wherein Matching an endpoint device corresponding to the task sequence from the mapping relationship according to the task sequence of the hardware computing chain resource request includes: Matching an endpoint device corresponding to the task sequence from the mapping relationship according to the task sequence of the hardware computing chain resource request; during the matching process, for each task, if at least two endpoint devices are matched, determining the waiting duration of the at least two endpoint devices for processing the task according to the task quantity of the tasks to be processed by the at least two endpoint devices and estimating the processing duration of each task; and determining the endpoint device corresponding to the task from the at least two endpoint devices according to the waiting duration.
4. The method according to claim 2, wherein It further includes at least one of the following: If an endpoint device corresponding to the task sequence is not successfully matched, returning an information indicating unable to create to the application software so that the application software processes according to a preset resource management method; If a data processing exception occurs, generating an error message and returning the error message to the application software.
5. The method according to claim 1, wherein It further includes: When the data processing is completed, releasing the resource occupation of the endpoint devices of the hardware computing link; Returning a processing completed message to the application software so that the application software releases the operation handle of the hardware computing link.
6. The method according to claim 1, characterized in that, Processing the data to be processed in sequence according to the hardware computing link includes: Determining the data processing method of the target endpoint device according to the priority of the data processing request, where the target endpoint device is any endpoint device according to the hardware computing link; Using the target endpoint device to perform data processing on the data processed by the previous endpoint device received by the target endpoint device according to the data processing method to obtain processed data.
7. The method according to any one of claims 1 to 6, characterized in that Process the data to be processed in sequence according to the hardware computing link, including: Process the data to be processed in sequence according to the hardware computing link, so that the target endpoint device periodically sends the processed data to the remaining endpoint devices, and the remaining endpoint devices determine whether to perform data processing operations through the hardware computing link and the target endpoint device; if necessary, the remaining endpoint devices perform corresponding data processing operations on the received processed data, and the remaining endpoint devices return confirmation information to the target endpoint device to facilitate the target endpoint device to stop sending the processed data.
8. A resource management device, characterized in that, Including: A hardware computing link processing module, configured to obtain a hardware computing link resource request of an application software, where the hardware computing link resource request is used to indicate the task order of the request requirement; According to the hardware computing link resource request, match the hardware computing link corresponding to the task order from the mapping relationship, where the mapping relationship represents the mapping between the endpoint device and the capability information; and return the operation handle of the hardware computing link to the application software, where the hardware computing link represents the execution order of multiple endpoint devices; A data processing module, configured to, after receiving a data processing request obtained by the application software writing the data to be processed into the operation handle, process the data to be processed in sequence according to the hardware computing link. After each endpoint device finishes processing, it sends the processed data and the hardware computing link to the next endpoint device determined according to the hardware computing link for processing.
9. An electronic device, characterized in that, Including: A memory, configured to store a computer program; A processor, configured to execute the computer program to implement the steps of the resource management method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps of the resource management method according to any one of claims 1 to 7 are implemented.