PCIe virtual channel selection method, device, system and medium

文档序号:326241 发布日期:2021-11-30 浏览:11次 中文

阅读说明:本技术 一种PCIe虚拟信道选择方法、装置、系统及介质 (PCIe virtual channel selection method, device, system and medium ) 是由 刘凯 王凯 符云越 于 2021-07-30 设计创作,主要内容包括:本申请提供了一种PCIe虚拟信道选择方法、装置、系统及介质,该方法包括:将预设时段内多个虚拟信道的使用状态输入预先得到的遗传算法模型;预先得到的遗传算法模型根据历史时段内多个虚拟信道的使用状态,和历史时段内多个虚拟信道和多个数据包之间的旧对应关系通过训练预先获得;旧对应关系为出厂设置的对应关系;预先得到的遗传算法模型输出多个虚拟信道与多个数据包之间的第一新对应关系;根据第一新对应关系,选择当前待传输数据包对应的虚拟信道。从而可以准确快速的选择当前待传输数据包对应的合适的虚拟信道,可以提高虚拟信道的利用率,防止虚拟信道拥堵的同时,提高了效率,防止空闲资源的浪费。(The application provides a PCIe virtual channel selection method, a device, a system and a medium, wherein the method comprises the following steps: inputting the use states of a plurality of virtual channels in a preset time period into a genetic algorithm model obtained in advance; the method comprises the following steps that a pre-obtained genetic algorithm model is obtained in advance through training according to the use states of a plurality of virtual channels in a historical period and old corresponding relations between the virtual channels and a plurality of data packets in the historical period; the old corresponding relation is a factory-set corresponding relation; outputting a first new corresponding relation between a plurality of virtual channels and a plurality of data packets by a pre-obtained genetic algorithm model; and selecting the virtual channel corresponding to the current data packet to be transmitted according to the first new corresponding relation. Therefore, the appropriate virtual channel corresponding to the current data packet to be transmitted can be accurately and quickly selected, the utilization rate of the virtual channel can be improved, the virtual channel is prevented from being blocked, the efficiency is improved, and the waste of idle resources is prevented.)

1. A PCIe virtual channel selection method, comprising:

inputting the use states of a plurality of virtual channels in a preset time period into a genetic algorithm model obtained in advance; the pre-obtained genetic algorithm model is obtained in advance through training according to the use states of the virtual channels in the historical period and the old corresponding relations between the virtual channels and the data packets in the historical period; the old corresponding relation is a factory-set corresponding relation;

the pre-obtained genetic algorithm model outputs a first new corresponding relation between the plurality of virtual channels and a plurality of data packets;

and selecting the virtual channel corresponding to the current data packet to be transmitted according to the first new corresponding relation.

2. The method of claim 1, further comprising pre-obtaining the pre-derived genetic algorithm model by:

inputting the use states of the plurality of virtual channels in the historical period into a genetic algorithm model before training to obtain a second new corresponding relation between the plurality of virtual channels and the plurality of data packets;

and training the genetic algorithm model before training according to the old corresponding relation and the second new corresponding relation to obtain the genetic algorithm model obtained in advance.

3. The method of claim 1, wherein the usage status comprises an empty status, an amount of packets that can be accommodated by each of the plurality of virtual channels, and an average amount of packets that can be accommodated by each of the plurality of virtual channels during a predetermined period.

4. The method of claim 1, wherein the selection function of the genetic algorithm model employs a roulette algorithm.

5. A PCIe virtual channel selection apparatus, comprising:

a first input unit for inputting the use states of a plurality of virtual channels within a preset time period into a genetic algorithm model obtained in advance; the pre-obtained genetic algorithm model is obtained in advance through training according to the use states of the virtual channels in the historical period and the old corresponding relations between the virtual channels and the data packets in the historical period; the old corresponding relation is a factory-set corresponding relation; the pre-obtained genetic algorithm model outputs a first new corresponding relation between the plurality of virtual channels and a plurality of data packets;

and the selecting unit is used for selecting the virtual channel corresponding to the current data packet to be transmitted according to the first new corresponding relation.

6. The apparatus of claim 5, further comprising pre-obtaining the pre-derived genetic algorithm model by:

a second input unit, configured to input the usage states of the multiple virtual channels in the historical period into a genetic algorithm model before training, so as to obtain a second new correspondence between the multiple virtual channels and the multiple data packets;

and the training unit is used for training the genetic algorithm model before training according to the old corresponding relation and the second new corresponding relation to obtain the genetic algorithm model obtained in advance.

7. The apparatus of claim 5, wherein the usage status comprises an empty status, an amount of data packets that can be accommodated by each of the plurality of virtual channels, and an average amount of data packets that can be accommodated by each of the plurality of virtual channels during a predetermined period.

8. The apparatus of claim 5, wherein the selection function of the genetic algorithm model employs a roulette algorithm.

9. A PCIe virtual channel selection system, comprising:

a memory for storing a computer program;

a processor for implementing the steps of the PCIe virtual channel selection method as recited in any one of claims 1-4 when executing said computer program.

10. A computer-readable storage medium, having stored thereon, a computer program which, when being processed and executed, carries out the steps of a PCIe virtual channel selection method as recited in any one of claims 1-4.

Technical Field

The present application relates to the field of computers, and in particular, to a method, an apparatus, a system, and a medium for PCIe virtual channel selection.

Background

PCIe (Peripheral Component Interconnect Express) has characteristics of high-speed serial, point-to-point, and multi-channel transmission, and thus is widely used in the field of data transmission.

PCIe defines a Virtual Channel (VC) for data transmission, PCIe data transmission mainly transmits a TLP (Transaction layer packet), a TC (Traffic Class, transmission level) in the TLP is used to represent a priority of the transmitted TLP, packets with different priorities are transmitted to different Virtual channels, a selection manner is single, and when a plurality of packets have the same transmission level, that is, the plurality of packets correspond to the same Virtual channel, congestion of the Virtual channel is easily caused.

At this time, the transmission grade needs to be modified, the priority needs to be changed, the modification at the current stage is performed by manpower, the process is complex, and resource waste is easily caused. Therefore, how to prevent resource waste, flexibly modify transmission levels and improve the utilization rate of virtual channels is a technical problem to be solved in the field.

Disclosure of Invention

In order to solve the technical problems, the application provides a PCIe virtual channel selection method, device, system, and medium, which can improve the utilization rate of a virtual channel, prevent congestion of the virtual channel, improve efficiency, and prevent waste of idle resources.

In a first aspect, the present application provides a PCIe virtual channel selection method, including:

inputting the use states of a plurality of virtual channels in a preset time period into a genetic algorithm model obtained in advance; the pre-obtained genetic algorithm model is obtained in advance through training according to the use states of the virtual channels in the historical period and the old corresponding relations between the virtual channels and the data packets in the historical period; the old corresponding relation is a factory-set corresponding relation;

the pre-obtained genetic algorithm model outputs a first new corresponding relation between the plurality of virtual channels and a plurality of data packets;

and selecting the virtual channel corresponding to the current data packet to be transmitted according to the first new corresponding relation.

Optionally, the method further comprises obtaining the pre-obtained genetic algorithm model in advance by:

inputting the use states of the plurality of virtual channels in the historical period into a genetic algorithm model before training to obtain a second new corresponding relation between the plurality of virtual channels and the plurality of data packets;

and training the genetic algorithm model before training according to the old corresponding relation and the second new corresponding relation to obtain the genetic algorithm model obtained in advance.

Optionally, the usage status includes an empty-full status, an amount of data packets that can be respectively accommodated by the plurality of virtual channels, and an average amount of data packets that can be accommodated by each of the plurality of virtual channels in a preset time period.

Optionally, the selection function of the genetic algorithm model employs a roulette algorithm.

In a second aspect, the present application provides a PCIe virtual channel selection apparatus, including:

a first input unit for inputting the use states of a plurality of virtual channels within a preset time period into a genetic algorithm model obtained in advance; the pre-obtained genetic algorithm model is obtained in advance through training according to the use states of the virtual channels in the historical period and the old corresponding relations between the virtual channels and the data packets in the historical period; the old corresponding relation is a factory-set corresponding relation; the pre-obtained genetic algorithm model outputs a first new corresponding relation between the plurality of virtual channels and a plurality of data packets;

and the selecting unit is used for selecting the virtual channel corresponding to the current data packet to be transmitted according to the first new corresponding relation.

Optionally, the method further comprises obtaining the pre-obtained genetic algorithm model in advance by:

a second input unit, configured to input the usage states of the multiple virtual channels in the historical period into a genetic algorithm model before training, so as to obtain a second new correspondence between the multiple virtual channels and the multiple data packets;

and the training unit is used for training the genetic algorithm model before training according to the old corresponding relation and the second new corresponding relation to obtain the genetic algorithm model obtained in advance.

Optionally, the usage status includes an empty-full status, an amount of data packets that can be respectively accommodated by the plurality of virtual channels, and an average amount of data packets that can be accommodated by each of the plurality of virtual channels in a preset time period.

Optionally, the selection function of the genetic algorithm model employs a roulette algorithm.

In a third aspect, the present application provides a PCIe virtual channel selection system, including:

a memory for storing a computer program;

a processor for implementing the steps of the PCIe virtual channel selection method as described above when executing the computer program.

In a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program which when processed and executed implements the steps of the PCIe virtual channel selection method as described above.

Compared with the prior art, the method has the advantages that:

the application provides a PCIe virtual channel selection method, a device, a system and a medium, wherein the method comprises the following steps: inputting the use states of a plurality of virtual channels in a preset time period into a genetic algorithm model obtained in advance; the method comprises the following steps that a pre-obtained genetic algorithm model is obtained in advance through training according to the use states of a plurality of virtual channels in a historical period and old corresponding relations between the virtual channels and a plurality of data packets in the historical period; the old corresponding relation is a factory-set corresponding relation; outputting a first new corresponding relation between a plurality of virtual channels and a plurality of data packets by a pre-obtained genetic algorithm model; and selecting the virtual channel corresponding to the current data packet to be transmitted according to the first new corresponding relation. Therefore, the appropriate virtual channel corresponding to the current data packet to be transmitted can be accurately and quickly selected, the utilization rate of the virtual channel can be improved, the virtual channel is prevented from being blocked, the efficiency is improved, and the waste of idle resources is prevented.

Drawings

In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.

Fig. 1 is a flowchart illustrating a PCIe virtual channel selection method provided in an embodiment of the present application;

fig. 2 is a schematic diagram illustrating a PCIe virtual channel selection apparatus according to an embodiment of the present application.

Detailed Description

In order to make the aforementioned objects, features and advantages of the present application more comprehensible, embodiments accompanying the present application are described in detail below with reference to the accompanying drawings.

In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application, but the present application may be practiced in other ways than those described herein, and it will be apparent to those of ordinary skill in the art that the present application is not limited by the specific embodiments disclosed below.

As described in the background art, PCIe (Peripheral Component Interconnect Express) has characteristics of high-speed serial, point-to-point, and multi-channel transmission, and thus is widely used in the field of data transmission.

PCIe defines a Virtual Channel (VC) for data transmission, PCIe data transmission mainly transmits a TLP (Transaction layer packet), a TC (Traffic Class, transmission level) in the TLP is used to represent a priority of the transmitted TLP, packets with different priorities are transmitted to different Virtual channels, a selection manner is single, and when a plurality of packets have the same transmission level, that is, the plurality of packets correspond to the same Virtual channel, congestion of the Virtual channel is easily caused.

At this time, the transmission grade needs to be modified, the priority needs to be changed, the modification at the current stage is performed by manpower, the process is complex, and resource waste is easily caused. Therefore, how to prevent resource waste, flexibly modify transmission levels and improve the utilization rate of virtual channels is a technical problem to be solved in the field.

In order to solve the above technical problem, the present application provides a PCIe virtual channel selection method, apparatus, system, and medium, where the method includes: inputting the use states of a plurality of virtual channels in a preset time period into a genetic algorithm model obtained in advance; the method comprises the following steps that a pre-obtained genetic algorithm model is obtained in advance through training according to the use states of a plurality of virtual channels in a historical period and old corresponding relations between the virtual channels and a plurality of data packets in the historical period; the old corresponding relation is a factory-set corresponding relation; outputting a first new corresponding relation between a plurality of virtual channels and a plurality of data packets by a pre-obtained genetic algorithm model; and selecting the virtual channel corresponding to the current data packet to be transmitted according to the first new corresponding relation. Therefore, the appropriate virtual channel corresponding to the current data packet to be transmitted can be accurately and quickly selected, the utilization rate of the virtual channel can be improved, the virtual channel is prevented from being blocked, the efficiency is improved, and the waste of idle resources is prevented.

For a better understanding of the technical solutions and effects of the present application, specific embodiments will be described in detail below with reference to the accompanying drawings.

Exemplary method

Referring to fig. 1, this figure is a flowchart of a PCIe virtual channel selection method provided in the embodiment of the present application, including:

s101: inputting the use states of a plurality of virtual channels in a preset time period into a genetic algorithm model obtained in advance; the pre-obtained genetic algorithm model is obtained in advance through training according to the use states of the virtual channels in the historical period and the old corresponding relations between the virtual channels and the data packets in the historical period; the old corresponding relation is a factory-set corresponding relation; the pre-obtained genetic algorithm model outputs a first new corresponding relation between the plurality of virtual channels and a plurality of data packets;

in the embodiment of the present application, a timer may be used to time the preset time period, and it should be noted that the embodiment of the present application does not specifically limit the specific duration of the preset time period, and the specific duration may be set by a person skilled in the art according to an actual situation. Alternatively, the establishment of the virtual channels in the embodiments of the present application is done by an FPGA, it being understood that other logic devices or other programmable devices suitable for use with the present invention are possible.

In this embodiment of the present application, the usage states of the plurality of virtual channels in the preset time period may be input into the genetic algorithm model obtained in advance, specifically, the usage states, that is, the working states, of the plurality of virtual channels in the preset time period may be collected first, and recorded in the virtual channel state memory, and stored in the memory in sequence according to time.

Optionally, the usage status may include an empty-full status, an amount of data packets that can be respectively accommodated by the plurality of virtual channels, and an average amount of data packets that can be accommodated by each of the plurality of virtual channels in a preset time period.

The pre-obtained genetic algorithm model refers to a genetic algorithm model obtained through training, the pre-obtained genetic algorithm model is obtained in advance through training according to the using states of the plurality of virtual channels in the historical time period and the old corresponding relation between the plurality of virtual channels and the plurality of data packets in the historical time period, and the old corresponding relation is the corresponding relation set by a factory. Optionally, the usage status of the plurality of virtual channels in the history period may include an empty-full status, an amount of data packets that can be respectively accommodated by the plurality of virtual channels, and an average amount of data packets that can be accommodated by each of the plurality of virtual channels in the history period.

Alternatively, the pre-obtained genetic algorithm model may be obtained in advance by:

and inputting the use states of the plurality of virtual channels in the historical period into the genetic algorithm model before training to obtain a second new corresponding relation between the plurality of virtual channels and the plurality of data packets, and training the genetic algorithm model before training according to the old corresponding relation and the second new corresponding relation to obtain the genetic algorithm model obtained in advance. Wherein the old correspondence is a correspondence between a factory-set data packet and a virtual channel.

When the corresponding relation between the plurality of virtual channels and the plurality of data packets output by the trained genetic algorithm model is superior to the old corresponding relation, the trained genetic algorithm model can be considered to be available, the utilization rate of the virtual channels can be improved by using the trained genetic algorithm model, the virtual channels are prevented from being blocked, the efficiency is improved, and the waste of idle resources is prevented.

Specifically, since the genetic algorithm model cannot directly process parameters such as the usage state of the virtual channel, the usage state of the virtual channel must be expressed as a chromosome or an individual of the genetic space by encoding. This conversion operation is called encoding, and specifically, the binary encoding method is used to encode the use states of the virtual channels in sequence, so as to complete the one-to-one correspondence of the chromosomes to the virtual channel IDs. The coding format is shown in table 1:

TABLE 1

Central to the evolution of organisms in nature is the recombination (plus variation) of biogenetic genes. Also, what plays a central role in genetic algorithms is the crossover operator of genetic operations. The crossover is an operation of generating a new individual by replacing and recombining partial structures of two parent individuals. Through crossover, the search capability of genetic algorithms is dramatically improved.

In the embodiment of the application, the crossing process takes 3 bits of the virtual channel segment as a unit to perform crossing operation, a situation that a plurality of virtual channels are converged in the same chromosome occurs in the crossing process, if the situation occurs, the fitness is normally calculated, and if the fitness meets a preset condition, the screened virtual channels are closed, so that the situation that a plurality of virtual channels are converged in the same chromosome is avoided.

The fitness in the evolutionary theory represents the adaptability of an individual to the environment and also represents the ability of the individual to reproduce offspring. The fitness function of the genetic algorithm is also called an evaluation function, is an index for judging the degree of goodness of individuals in a population, and is evaluated according to an objective function of a problem to be solved.

In the process of genetic algorithm variation, if the phenomenon of same priority level occurs inside, two virtual channels are set to be the same priority level, which is not allowed, and the original priority chromosome segment is forced to be replaced by a new one, namely, the internal chromosome segment (virtual channel priority) is exchanged.

In the population filtering process of the genetic algorithm, all chromosomes obtain the fitness of the decoded individuals (only one chromosome), and two individuals with the lowest fitness in the population are removed, namely, the two individuals are deleted and cached. Buffering the chromosome (virtual channel sequence) after cross mutation into a virtual channel buffer, and then decoding the state corresponding to the chromosome from a comparison table formed by coding. The respective states of the virtual channels are obtained.

And according to each state of the virtual channels, after the weight is configured, calculating the individual fitness through a fitness function, and then selecting by adopting a roulette algorithm to obtain the mapping relation between the newly established virtual channels and the data packets.

S102: and selecting the virtual channel corresponding to the current data packet to be transmitted according to the first new corresponding relation.

In the embodiment of the application, since the first new corresponding relationship is the corresponding relationship between the plurality of virtual channels and the plurality of data packets which are screened by utilizing the genetic algorithm and are most suitable for the current environment, the channel utilization rate can reach an ideal value as much as possible, the waste of idle resources is prevented, and the high-speed transmission of the virtual channels is ensured.

For example, the data packets 1, 2, 3, and 4 in the old correspondence setting all correspond to the virtual channel a, which is very likely to cause the virtual channel to be blocked, the virtual channel is selected according to the first new correspondence, the data packet 1 may be allocated to the virtual channel a, the data packet 2 may be allocated to the virtual channel B, the data packet 3 may be allocated to the virtual channel C, and the data packet 4 may be allocated to the virtual channel D, without modifying the correspondence by manpower, the old correspondence may be modified into the first new correspondence more suitable for the current situation by using the genetic algorithm of the embodiment of the present application, so that the appropriate virtual channel corresponding to the current data packet to be transmitted may be accurately and quickly selected, the utilization rate of the virtual channel may be improved, the virtual channel may be prevented from being blocked, the efficiency may be improved, and the waste of idle resources may be prevented.

The application provides a PCIe virtual channel selection method, which comprises the following steps: inputting the use states of a plurality of virtual channels in a preset time period into a genetic algorithm model obtained in advance; the method comprises the following steps that a pre-obtained genetic algorithm model is obtained in advance through training according to the use states of a plurality of virtual channels in a historical period and old corresponding relations between the virtual channels and a plurality of data packets in the historical period; the old corresponding relation is a factory-set corresponding relation; outputting a first new corresponding relation between a plurality of virtual channels and a plurality of data packets by a pre-obtained genetic algorithm model; and selecting the virtual channel corresponding to the current data packet to be transmitted according to the first new corresponding relation. Therefore, the appropriate virtual channel corresponding to the current data packet to be transmitted can be accurately and quickly selected, the utilization rate of the virtual channel can be improved, the virtual channel is prevented from being blocked, the efficiency is improved, and the waste of idle resources is prevented.

Exemplary devices

Referring to fig. 2, this figure is a PCIe virtual channel selection apparatus provided in an embodiment of the present application, including:

a first input unit 201 for inputting the use states of a plurality of virtual channels within a preset time period into a genetic algorithm model obtained in advance; the pre-obtained genetic algorithm model is obtained in advance through training according to the use states of the virtual channels in the historical period and the old corresponding relations between the virtual channels and the data packets in the historical period; the old corresponding relation is a factory-set corresponding relation; the pre-obtained genetic algorithm model outputs a first new corresponding relation between the plurality of virtual channels and a plurality of data packets;

a selecting unit 202, configured to select, according to the first new correspondence, a virtual channel corresponding to the current data packet to be transmitted.

Optionally, the method further comprises obtaining the pre-obtained genetic algorithm model in advance by:

a second input unit, configured to input the usage states of the multiple virtual channels in the historical period into a genetic algorithm model before training, so as to obtain a second new correspondence between the multiple virtual channels and the multiple data packets;

and the training unit is used for training the genetic algorithm model before training according to the old corresponding relation and the second new corresponding relation to obtain the genetic algorithm model obtained in advance.

Optionally, the usage status includes an empty-full status, an amount of data packets that can be respectively accommodated by the plurality of virtual channels, and an average amount of data packets that can be accommodated by each of the plurality of virtual channels in a preset time period.

Optionally, the selection function of the genetic algorithm model employs a roulette algorithm.

The application provides a PCIe virtual channel selection device, which inputs the use states of a plurality of virtual channels in a preset time period into a genetic algorithm model obtained in advance; the method comprises the following steps that a pre-obtained genetic algorithm model is obtained in advance through training according to the use states of a plurality of virtual channels in a historical period and old corresponding relations between the virtual channels and a plurality of data packets in the historical period; the old corresponding relation is a factory-set corresponding relation; outputting a first new corresponding relation between a plurality of virtual channels and a plurality of data packets by a pre-obtained genetic algorithm model; and selecting the virtual channel corresponding to the current data packet to be transmitted according to the first new corresponding relation. Therefore, the appropriate virtual channel corresponding to the current data packet to be transmitted can be accurately and quickly selected, the utilization rate of the virtual channel can be improved, the virtual channel is prevented from being blocked, the efficiency is improved, and the waste of idle resources is prevented.

On the basis of the foregoing embodiments, an embodiment of the present application further provides a PCIe virtual channel selection system, including:

a memory for storing a computer program;

a processor for implementing the steps of the PCIe virtual channel selection method as described above when executing the computer program.

On the basis of the foregoing embodiments, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is processed and executed, the steps of the PCIe virtual channel selection method are implemented as described above.

The computer-readable storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.

The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.

The foregoing is merely a preferred embodiment of the present application and, although the present application discloses the foregoing preferred embodiments, the present application is not limited thereto. Those skilled in the art can now make numerous possible variations and modifications to the disclosed embodiments, or modify equivalent embodiments, using the methods and techniques disclosed above, without departing from the scope of the claimed embodiments. Therefore, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present application still fall within the protection scope of the technical solution of the present application without departing from the content of the technical solution of the present application.

10页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于有限状态马尔科夫的宽带无线信道建模方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!