Data transmission method and device, equipment, storage medium and program product
By distinguishing between custom operation Bar space and standard operation Bar space in the PCIe protocol, and generating and sending basic data packets for custom atomic operation requests, the problem of limited atomic operation types in the PCIe protocol is solved, and custom atomic operation transmission in multi-device interconnection scenarios is realized, which improves system compatibility and scalability.
Patent Information
- Application Number
- CN202510553122.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2045-04-29
AI Technical Summary
The atomic operation types defined in the PCIe protocol are limited and cannot meet the custom atomic operation requirements in multi-device interconnect scenarios.
By distinguishing between the first base address of the custom operation Bar space of the target device and the second base address of the standard operation Bar space in the PCIe protocol, the basic data packet of the custom atomic operation request is generated and sent, and the basic data packet of the response data is received, to realize the transmission of the custom atomic operation.
It realizes the transmission of customized atomic operations in multi-device interconnection scenarios, is compatible with a variety of PCIe devices, and improves system compatibility and scalability.
Smart Images

Figure CN120075135A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a data transmission method, apparatus, device, storage medium, and program product. Background Art
[0002] With the rapid development of computer technology, especially the increasing computing demands in the field of artificial intelligence, the way of collaborative work among multiple devices has become increasingly important. As a high-bandwidth and low-latency interconnection technology, the Peripheral Component Interconnect Express (PCIe) is widely used for the interconnection among multiple devices.
[0003] To meet the requirements of improving data transfer efficiency and device synchronization, etc., the PCIe protocol defines some atomic operations. An atomic operation refers to one or a series of operations that cannot be interrupted, that is, it will not be interrupted by any other transaction or event before the operation is completed.
[0004] However, the types of atomic operations defined in the PCIe protocol are limited and cannot meet the atomic operation requirements in the multi-device interconnection scenario. Therefore, how to implement the transmission of custom atomic operations is an urgent problem to be solved. Summary of the Invention
[0005] Based on this, in view of the above technical problems, it is necessary to provide a data transmission method, apparatus, device, storage medium, and program product that can implement the transmission of custom atomic operations.
[0006] In a first aspect, this application provides a data transmission method, which is applied to a source device and includes:
[0007] When it is determined that a target device needs to be instructed to execute a custom atomic operation, a first basic data packet is generated according to the operation information of the custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device; wherein the first base address is different from the second base address of the memory Bar space corresponding to the target device; the first basic data packet is sent to the target device; wherein the first basic data packet is used to instruct the target device to execute a custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data when it is determined that the first basic data packet belongs to a custom atomic operation request data packet; the second basic data packet returned by the target device is received; wherein the response data is carried in the second basic data packet.
[0008] In one embodiment, a first basic data packet is generated according to the operation information of a custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device, including: writing the first base address into the address bit of the first basic data packet; writing the operation information of the custom atomic operation into the data bit of the first basic data packet to obtain the first basic data packet.
[0009] In one embodiment, the operation information includes an operation identifier and an operand of the custom atomic operation, and the data bit includes a first sub-data bit and a second sub-data bit. Writing the operation information of the custom atomic operation into the data bit of the first basic data packet to obtain the first basic data packet includes: writing the operation identifier of the custom atomic operation into the first sub-data bit of the first basic data packet; writing the operand into the second sub-data bit of the first basic data packet to obtain the first basic data packet.
[0010] In one embodiment, the first basic data packet is a data packet of the memory write type; and / or, the second basic data packet is a data packet of the message type.
[0011] In one embodiment, the response data is located in the vendor-defined message bit of the second basic data packet.
[0012] In one embodiment, the device number bit of the second basic data packet is used to indicate the ID number of the source device, and / or, the type bit of the second basic data packet is used to indicate the identification ID routing mode.
[0013] Second, the present application also provides a data transmission method, which is applied to a target device and includes:
[0014] Receiving a first basic data packet; wherein, the first basic data packet is a data packet generated by a source device according to the operation information of a custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device; the first base address is different from the second base address of the memory Bar space corresponding to the target device; in the case of determining that the first basic data packet belongs to a custom atomic operation request data packet, performing a custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data; generating a second basic data packet according to the response data and the identification ID of the source device; returning the second basic data packet to the source device.
[0015] In one embodiment, the operation information includes the operation identifier and operands of a custom atomic operation. A custom atomic operation is performed according to the operation information of the custom atomic operation and a first base address to obtain response data, including: determining a second base address corresponding to the target device according to the first base address; determining the processing flow of the custom atomic operation according to the operation identifier of the custom atomic operation; and performing the custom atomic operation on the data stored at the second base address according to the processing flow and the operands to obtain response data.
[0016] In one embodiment, a second basic data packet is generated according to the response data and the identification ID of the source device, including: writing a preset routing type identifier into the type bit of the second basic data; where the preset routing type identifier is used to indicate the ID routing mode; writing the identification ID into the device number bit of the second basic data packet; and writing the response data into the vendor-defined message bit of the second basic data packet to obtain the second basic data packet.
[0017] In one embodiment, the method further includes: determining whether the address bit in the first basic data packet includes the first base address; and if the address bit includes the first base address, determining that the first basic data packet belongs to a custom atomic operation request data packet.
[0018] In one embodiment, the first basic data packet is a data packet of the memory write type; and / or, the second basic data packet is a data packet of the message type.
[0019] In a third aspect, the present application further provides a data transmission device, which is applied to the source device. The device includes:
[0020] A generation module, configured to generate a first basic data packet according to the operation information of the custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device when it is determined that the target device needs to be instructed to perform a custom atomic operation; where the first base address is different from the second base address of the memory Bar space corresponding to the target device; A sending module, configured to send the first basic data packet to the target device; where the first basic data packet is used to instruct the target device to perform a custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data when it is determined that the first basic data packet belongs to a custom atomic operation request data packet; A receiving module, configured to receive a second basic data packet returned by the target device; where the response data is carried in the second basic data packet.
[0021] In a fourth aspect, the present application further provides a data transmission device, which is applied to the target device. The device includes:
[0022] A receiving module, configured to receive a first basic data packet; wherein, the first basic data packet is a data packet generated by a source device according to operation information of a custom atomic operation and a first base address of a custom operation Bar space corresponding to a target device; the first base address is different from a second base address of a memory Bar space corresponding to the target device; An execution module, configured to execute a custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data when it is determined that the first basic data packet belongs to a custom atomic operation request data packet; A generating module, configured to generate a second basic data packet according to the response data and the identification ID of the source device; A sending module, configured to return the second basic data packet to the source device.
[0023] In a fifth aspect, the present application further provides a data transmission device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the method according to any one of the first aspect or the second aspect are implemented.
[0024] In a sixth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method according to any one of the first aspect or the second aspect are implemented.
[0025] In a seventh aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of the first aspect or the second aspect are implemented.
[0026] In the above data transmission method, device, equipment, storage medium and program product, when it is determined that it is necessary to instruct the target device to execute a custom atomic operation, a first basic data packet is generated according to the operation information of the custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device, and the first basic data packet is sent to the target device, so as to instruct the target device to execute a custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data when it is determined that the first basic data packet belongs to a custom atomic operation request data packet. Further, a second basic data packet carrying the response data returned by the target device is received. It can be seen that in the embodiments of the present application, by carrying the operation information of the custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device in the first basic data packet, and carrying the response data in the second basic data packet, the transmission of the custom atomic operation based on the basic data packet is realized, and multiple PCIe devices can be compatible. Therefore, the embodiments of the present application have good compatibility and scalability, so as to meet different custom atomic operations required in the multi-device interconnection scenario. Description of the Drawings
[0027] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0028] Figure 1A It is a schematic diagram of a data transmission application scenario in an embodiment;
[0029] Figure 1B It is a schematic diagram of an improved configuration space in the PCIe protocol in an embodiment;
[0030] Figure 2 It is a schematic flowchart of a data transmission method in an embodiment;
[0031] Figure 3A It is a schematic flowchart of a method for generating a first basic data packet in an embodiment;
[0032] Figure 3B It is a schematic diagram of the message format of a first basic data packet in an embodiment;
[0033] Figure 4 It is a schematic flowchart of a data transmission method in another embodiment;
[0034] Figure 5 It is a schematic flowchart of a method for obtaining response data in an embodiment;
[0035] Figure 6 It is a schematic flowchart of a method for generating a second basic data packet in an embodiment;
[0036] Figure 7 It is a schematic diagram of the message format of a second basic data packet in an embodiment;
[0037] Figure 8 It is a schematic flowchart of a data transmission method in another embodiment;
[0038] Figure 9 It is a schematic diagram of a data transmission architecture in an embodiment;
[0039] Figure 10 It is a schematic flowchart of a data transmission method in another embodiment;
[0040] Figure 11 It is a schematic flowchart of a data transmission method in another embodiment;
[0041] Figure 12 It is a schematic diagram of the structure of a data transmission device in an embodiment;
[0042] Figure 13 It is a schematic structural diagram of a data transmission device in another embodiment;
[0043] Figure 14 It is a schematic structural diagram of a data transmission device in one embodiment. Specific Embodiments
[0044] To make the above objects, features, and advantages of the present application more obvious and understandable, the following will describe the specific embodiments of the present application in detail with reference to the accompanying drawings. It should be understood that many specific details are set forth in the following description to fully understand the present application, but the present application can be implemented in many other ways different from those described herein. Those skilled in the art can make similar improvements without departing from the connotation of the present application. Therefore, the present application is not limited by the specific embodiments disclosed below.
[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which this application belongs. The terms used in the specification of this application herein are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0046] The data transmission method, device, equipment, storage medium, and program product provided in the embodiments of this application can be applied to the transmission application scenario of custom atomic operations between different PCIe devices; of course, it can also be applied to other application scenarios, and no further examples will be given in the embodiments of this application.
[0047] In one embodiment, Figure 1A It is a schematic diagram of a data transmission application scenario in one embodiment. As Figure 1A shown, the data transmission application scenario of the embodiments of this application may include, but is not limited to: a source device 10 and a target device 11. Exemplarily, the source device 10 and the target device 11 can achieve device interconnection through data transmission via the PCIe bus. Among them, the source device 10 and the target device 11 can implement the transmission of custom atomic operations according to the data transmission method provided in the embodiments of this application.
[0048] It should be noted that the source device 10 and the target device 11 in the embodiments of this application can be directly connected for communication, or can be indirectly connected for communication through a switch 12, that is, multiple devices can achieve interconnection and interoperability through the switch.
[0049] It should be understood that in the case where the source device 10 and the target device 11 perform data transmission via the PCIe bus, the source device 10 and the target device 11 can be referred to as PCIe devices.
[0050] Exemplarily, the source device 10 in the embodiments of the present application may include, but is not limited to, a Graphics Processing Unit (GPU) or a host, and / or, the target device 10 in the embodiments of the present application may include, but is not limited to, a GPU or a host.
[0051] In the related art, as a high-bandwidth and low-latency interconnection technology, PCIe is widely used in the interconnection between GPUs and hosts, and / or between multiple GPUs. However, there are certain limitations in the types of atomic operations defined in the PCIe protocol, which cannot meet the atomic operation requirements in the multi-device interconnection scenario. For example, in a multi-GPU interconnection system, when complex data consistency maintenance and synchronization operations are required, the atomic operations supported by the PCIe protocol will not be able to meet the requirements. Another example is that the atomic operations supported by the PCIe protocol cannot fully meet all the atomic operation types required in the GPU interconnection programming model.
[0052] With the wide application of PCIe in the field of GPU interconnection, there is an urgent need for a mechanism that can effectively transmit custom operations, so as to be able to meet different custom atomic operation types required in multi-GPU communication, and can still maintain good system compatibility when multiple devices are interconnected through a switch.
[0053] Based on the above considerations, the embodiments of the present application propose a method in which the custom atomic operations corresponding to different devices and the standard operations in the PCIe protocol respectively correspond to the base addresses of different Bar spaces (i.e., Bar space extension), so that it can be accurately and quickly determined whether it is a custom atomic operation in the future, and the custom atomic operations are transmitted based on the basic data packets in the PCIe protocol. This method can be compatible with a variety of PCIe devices. Therefore, the embodiments of the present application have good compatibility and scalability, so as to be able to meet different custom atomic operations required in the multi-device interconnection scenario.
[0054] For ease of understanding, the following embodiments of the present application first introduce and explain the vocabulary.
[0055] Under normal circumstances, the data path uses a fixed base address register (Bar) configuration for memory mapping. The device can send requests routed by address, such as memory write, memory read, and atomic operations, to the target Bar space through the address routing method. When an atomic operation needs to be performed, the source device sends a transaction layer packet (TLP) request of type Atomic. After the target device executes according to the specific operation requirements, it returns the result to the source device through the Completion operation. The above process is a standard atomic operation process in the PCIe protocol.
[0056] In the embodiments of the present application, the Bar space expansion is essentially achieved by using the redundant Bar registers in the Type0 Header (Type 0 configuration header) other than the Bar registers used for the main data path mapping to perform extended mapping of the custom operation space.
[0057] For the convenience of understanding, in the following embodiments of the present application, taking the number of Bars as 6 (each Bar is 32 bits) and each device needs to use 64-bit Bars as an example, the Bar spaces corresponding to Device 0 and Device 1 are introduced and described exemplarily.
[0058] Figure 1B It is a schematic diagram of the improved configuration space in the PCIe protocol in an embodiment, as Figure 1B shown, the memory spaces corresponding to different devices (such as Device 0 or Device 1) can control the space address range through Bar0 and Bar1, and the custom operation spaces corresponding to different devices (such as Device 0 or Device 1) can control the space address range through the idle Bar2 and Bar3. The final effect is to map the standard operations and custom atomic operations in the PCIe protocol to two different address spaces in the external PCIe address space, which facilitates the target device to determine which operation to perform according to the address space. It should be understood that the custom operation spaces corresponding to different devices can also control the space address range through other idle Bar registers.
[0059] It should be noted that in the PCIe system, the custom operation Bar space is allocated to an independent address space, and after special processing inside the device, it is remapped back to the same address space as the memory (Memory) Bar space.
[0060] Exemplarily, the first basic packet or the second basic packet involved in the embodiments of the present application may include, but is not limited to, TLP packets.
[0061] The data transmission method, device, equipment, storage medium, and program product provided by the embodiments of the present application carry the operation information of the custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device in the first basic data packet, and carry the response data in the second basic data packet, thereby realizing the transmission of the custom atomic operation based on the basic data packet, which can be compatible with a variety of PCIe devices. Therefore, the embodiments of the present application have good compatibility and scalability, so as to meet the different custom atomic operations required in the multi-device interconnection scenario.
[0062] In one embodiment, Figure 2 FIG. is a schematic flowchart of the data transmission method in one embodiment. The embodiments of the present application take the method applied to Figure 1A the source device 10 in as an example for illustration. As Figure 2 shown, the embodiments of the present application provide a data transmission method, which may include the following steps:
[0063] Step 201, when it is determined that it is necessary to instruct the target device to execute a custom atomic operation, generate a first basic data packet according to the operation information of the custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device; wherein, the first base address is different from the second base address of the memory Bar space corresponding to the target device.
[0064] The custom atomic operations involved in the embodiments of the present application can be a general term, which may include one custom atomic operation, or multiple custom atomic operations. It should be noted that when the custom atomic operations involved in the embodiments of the present application include multiple custom atomic operations, the data transmission methods of the source device for each custom atomic operation are the same. For the convenience of understanding, the following embodiments of the present application take the data transmission method for one custom atomic operation as an example for introduction and illustration.
[0065] It should be noted that the custom atomic operations in the embodiments of the present application are different from the standard atomic operations in the PCIe protocol. For example, the types of the custom atomic operations in the embodiments of the present application are different from the standard atomic operations in the PCIe protocol. For another example, the operation byte count of the custom atomic operations in the embodiments of the present application is different from the operation byte count of the standard atomic operations in the PCIe protocol.
[0066] The operation information of the custom atomic operations in the embodiments of the present application can be used to indicate the operation identifier and / or the operand of the custom atomic operation. Among them, the operation identifier of the custom atomic operation can be used to uniquely identify the custom atomic operation.
[0067] In the embodiments of the present application, the source device 10 may pre-obtain the first base address of the custom operation Bar space corresponding to the target device, and the second base address of the memory Bar space corresponding to the target device. Among them, the first base address is different from the second base address of the memory Bar space corresponding to the target device. It should be noted that the first base address can be used to correspond to custom atomic operations, and the second base address can be used to correspond to standard operations in the PCIe protocol (for example, read / write access operations, etc.).
[0068] It should be understood that in the embodiments of the present application, the host device can pre-assign the first base address of the custom operation Bar space and the second base address of the memory Bar space corresponding to each device respectively, so that the source device 10 can map the standard operations and custom atomic operations in the PCIe protocol to two different address spaces, enabling the target device to determine whether to execute custom atomic operations or standard operations according to the accessed address space.
[0069] The first basic data packet in the embodiments of the present application may refer to the basic data packet in the PCIe protocol, that is, a data packet that any PCIe device can support and recognize.
[0070] Exemplarily, the first basic data packet in the embodiments of the present application may include, but is not limited to, any one of the following: a data packet of the Memory Write type, a data packet of the Message type, a data packet of the Atomic type. For example, the first basic data packet is a data packet of the Memory Write type.
[0071] In this step, when the source device 10 determines that it is necessary to instruct the target device to execute a custom atomic operation, it may generate a first basic data packet according to the operation information of the custom atomic operation to be executed and the first base address of the custom operation Bar space corresponding to the target device.
[0072] In a possible implementation manner, the source device 10 may generate a first basic data packet by writing the operation information of the custom atomic operation and the first base address of the custom operation Bar space into the corresponding positions of the first basic data packet according to the first preset custom operation encapsulation rule respectively. Among them, the first preset custom operation encapsulation rule can be used to indicate the request data packet encapsulation rule corresponding to the custom atomic operation.
[0073] In another possible implementation manner, the source device 10 may input the operation information of the custom atomic operation and the first base address of the custom operation Bar space into the first preset custom operation encapsulation model to obtain the first basic data packet output by the first preset custom operation encapsulation model. Among them, the first preset custom operation encapsulation model may include, but is not limited to, an AI encapsulation model.
[0074] Of course, the source device 10 can also generate the first basic data packet in other ways according to the operation information of the custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device.
[0075] Step 202: Send the first basic data packet to the target device; wherein, the first basic data packet is used to instruct the target device to execute a custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data when it is determined that the first basic data packet belongs to a custom atomic operation request data packet.
[0076] In this step, the source device 10 can send the first basic data packet to the target device, so that the target device 11 can execute a custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain the response data corresponding to the custom atomic operation when it is determined that the first basic data packet belongs to a custom atomic operation request data packet.
[0077] It should be noted that the target device 11 can also generate a second basic data packet according to the response data and the identification ID of the source device 10, and return the second basic data packet to the source device 10.
[0078] It should be understood that when the source device 10 is directly connected to the target device 11, the target device 11 can directly return the second basic data packet to the source device 10. When the source device 10 and the target device 11 are connected through a switch, the target device 11 can return the second basic data packet to the source device 10 through the switch.
[0079] It should be noted that since the source device 10 in the embodiment of the present application transmits custom atomic operations based on the first basic data packet, that is, the encapsulation of the operation information of the custom atom is carried based on the most basic function of PCIe, and it can be compatible with a variety of PCIe devices, the embodiment of the present application has good compatibility and scalability.
[0080] Step 203: Receive the second basic data packet returned by the target device; wherein, the response data is carried in the second basic data packet.
[0081] The second basic data packet in the embodiment of the present application may refer to the basic data packet in the PCIe protocol, that is, a data packet that any PCIe device can support and recognize.
[0082] Exemplarily, the second basic data packet in the embodiment of the present application may include, but is not limited to, data packets of the following message types or Completion type data packets. For example, the second basic data packet is a data packet of the message type.
[0083] In this step, the source device 10 can receive the second basic data packet returned by the target device 11. Among them, the response data corresponding to the custom atomic operation is carried in the second basic data packet.
[0084] It should be understood that the source device 10 can parse and process the second basic data packet according to the first preset data packet parsing rule to obtain the response data corresponding to the custom atomic operation. Among them, the first preset data packet parsing rule can be used to indicate the parsing rule of the response data packet corresponding to the custom atomic operation.
[0085] It should be noted that in the embodiments of the present application, since the target device 11 transmits the custom atomic operation based on the second basic data packet, that is, the encapsulation of the response data of the custom atom is carried based on the most basic function of PCIe, and it can be compatible with a variety of PCIe devices. Therefore, the embodiments of the present application have good compatibility and scalability.
[0086] In summary, in the embodiments of the present application, when it is determined that the target device needs to be instructed to execute a custom atomic operation, a first basic data packet is generated according to the operation information of the custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device, and the first basic data packet is sent to the target device, so as to instruct the target device to execute the custom atomic operation according to the operation information of the custom atomic operation and the first base address when it is determined that the first basic data packet belongs to the custom atomic operation request data packet to obtain the response data. Further, the second basic data packet carrying the response data returned by the target device is received. It can be seen that in the embodiments of the present application, by carrying the operation information of the custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device in the first basic data packet, and carrying the response data in the second basic data packet, the transmission of the custom atomic operation based on the basic data packet is realized, and it can be compatible with a variety of PCIe devices. Therefore, the embodiments of the present application have good compatibility and scalability, so as to meet the different custom atomic operations required in the multi-device interconnection scenario.
[0087] It should be noted that when the source device 10 determines that it needs to instruct the target device to execute a standard operation in the PCIe protocol, it can encapsulate the data packet according to the first preset standard operation encapsulation rule to send the encapsulated data packet. Among them, the first preset standard operation encapsulation rule is used to indicate the request data packet encapsulation rule corresponding to the standard operation in the PCIe protocol.
[0088] It should be understood that in the process of the source device 10 following the first preset standard operation encapsulation rule, the second base address of the memory Bar space corresponding to the target device will be written into the corresponding address bit, so that the target device can determine the standard operation that needs to be executed in the PCIe protocol according to the second base address.
[0089] In one embodiment, Figure 3A is a schematic flowchart of a method for generating a first basic data packet in one embodiment. The embodiments of the present application will exemplarily introduce and illustrate the related content of "generating a first basic data packet according to the operation information of a custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device" in step 201 above. As Figure 3A shown, the embodiments of the present application may include the following steps:
[0090] Step 2011, write the first base address into the address bit of the first basic data packet.
[0091] In this step, the source device 10 may write the first base address into the address (Address) bit of the first basic data packet according to the first preset custom operation encapsulation rule.
[0092] Step 2012, write the operation information of the custom atomic operation into the data bit of the first basic data packet to obtain the first basic data packet.
[0093] In this step, the source device 10 may write the operation information of the custom atomic operation into the data (Data) bit of the first basic data packet according to the first preset custom operation encapsulation rule to obtain the first basic data packet.
[0094] Exemplarily, the operation information of the custom atomic operation may include the operation identifier and the operand of the custom atomic operation. The source device 10 may write the operation identifier of the custom atomic operation into the first sub-data bit of the first basic data packet and write the operand into the second sub-data bit of the first basic data packet to obtain the first basic data packet. Among them, the second sub-data bit may be higher than the first sub-data bit, or the second sub-data bit may be lower than the first sub-data bit.
[0095] In the embodiments of the present application, the source device 10 may write the operation identifier of the custom atomic operation into the first sub-data bit of the first basic data packet and write the operand into the second sub-data bit of the first basic data packet to obtain the first basic data packet.
[0096] For ease of understanding, in the following embodiments of the present application, a data packet of the memory write type is taken as an example of the first basic data packet to exemplarily introduce and illustrate the related content of the first basic data packet.
[0097] Figure 3B is a schematic diagram of the message format of the first basic data packet in one embodiment. As Figure 3BAs shown, the first basic data packet may include a first header 30 and a first Payload part 31. Exemplarily, the first header 30 may include, but is not limited to, an Address bit 301. It should be understood that the number of bytes of the Address bit 301 in the embodiments of the present application can be set according to actual needs. For example, the Address bit 301 may include, but is not limited to, 64 bits.
[0098] Of course, the first header 30 may further include other bits. For example, the first header 30 may further include, but is not limited to, at least one of the following: Request ID bit, Tag bit, Format (Fmt) bit, Type bit, Traffic Class (TC) bit, Attributes (Attr) bit, Address Type (AT) bit, Length bit, Last Byte Enable, First Byte Enable, Transaction Layer Packet hint, Transaction Layer Packet Digest, Error Poisoned. In the embodiments of the present application, no further examples will be given here.
[0099] Exemplarily, the first Payload part 31 may include, but is not limited to, a first sub-data bit 311 and a second sub-data bit 312. Among them, the first sub-data bit 311 may be used to carry the operation identifier of the custom atomic operation; the second sub-data bit 312 may be used to carry the operand of the custom atomic operation.
[0100] In summary, in the embodiments of the present application, by writing the operation identifier of the custom atomic operation into the first sub-data bit of the first basic data packet and writing the operand into the second sub-data bit of the first basic data packet, since the operation information of the custom operation is carried based on the first basic data packet in the PCIe protocol, it is convenient to be compatible with any PCIe device, thereby facilitating improving the compatibility and scalability of the data transmission method in the embodiments of the present application.
[0101] In one embodiment, Figure 4 For the flowchart of the data transmission method in another embodiment, the embodiments of the present application take this method as applied to Figure 1A the target device 11 in Figure 4 as an example for illustration. As
[0102] Step 401: Receive a first basic data packet. The first basic data packet is a data packet generated by the source device according to the operation information of a custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device. The first base address is different from the second base address of the memory Bar space corresponding to the target device.
[0103] In this step, the target device 11 can receive the first basic data packet. The first basic data packet can be a data packet generated by the source device 10 according to the operation information of a custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device. The first base address is different from the second base address of the memory Bar space corresponding to the target device.
[0104] It should be noted that the relevant content regarding the first basic data packet in the embodiments of this application can refer to the corresponding content in the above embodiments of this application, and will not be elaborated here.
[0105] Step 402: When it is determined that the first basic data packet belongs to a custom atomic operation request data packet, perform a custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data.
[0106] In this step, when the target device 11 determines that the first basic data packet belongs to a custom atomic operation request data packet, it can perform a custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain the response data corresponding to the custom atomic operation.
[0107] It should be understood that when the target device 11 determines that the first basic data packet belongs to a custom atomic operation request data packet, it can parse the first basic data packet according to a second preset data packet parsing rule to obtain the operation information of the custom atomic operation and the first base address carried in the first basic data packet. The second preset data packet parsing rule can be used to indicate the request data packet parsing rule corresponding to the custom atomic operation.
[0108] Of course, the target device 11 can also obtain the operation information of the custom atomic operation and the first base address carried in the first basic data packet through other means, and this application does not limit this.
[0109] For the convenience of understanding, in the following embodiments of this application, an exemplary introduction is made to the implementation manner of "performing a custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data".
[0110] In a possible implementation, the target device 11 may execute a custom atomic operation according to the operation information of the custom atomic operation and the first base address in accordance with a preset custom operation execution rule to obtain response data. The preset custom operation execution rule may be used to indicate the execution process corresponding to the custom atomic operation in the PCIe protocol.
[0111] Figure 5 FIG. 4 is a flowchart of a method for obtaining response data in an embodiment. Exemplarily, the operation information in the embodiments of the present application may include, but is not limited to, the operation identifier and the operand of the custom atomic operation. The embodiments of the present application make an exemplary introduction and description of a possible implementation of "executing a custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data" in step 402 above. As Figure 5 shown, the embodiments of the present application may include the following steps:
[0112] Step 4021: Determine the second base address corresponding to the target device according to the first base address.
[0113] In the embodiments of the present application, there is a one-to-one correspondence between the first base address of the custom operation Bar space corresponding to any device involved and the second base address of the memory Bar space corresponding to the device, so that the second base address corresponding to the device can be determined according to the first base address of any device.
[0114] In this step, the target device 11 may determine the second base address of the memory Bar space corresponding to the target device according to the first base address of the custom operation Bar space corresponding to the target device, so as to perform a custom atomic operation on the data stored at the second base address subsequently.
[0115] Step 4022: Determine the processing flow of the custom atomic operation according to the operation identifier of the custom atomic operation.
[0116] In the embodiments of the present application, the operation identifiers of different custom atomic operations and the corresponding processing flows may be pre-stored in the target device, so that the processing flow corresponding to the operation identifier of any custom atomic operation can be determined subsequently according to the operation identifier of the custom atomic operation.
[0117] In this step, the target device 11 may determine the processing flow of the custom atomic operation carried in the first basic data packet by querying the operation identifiers of different custom atomic operations stored in the target device 11 and the corresponding processing flows.
[0118] Step 4023: Perform a custom atomic operation on the data stored at the second base address according to the processing flow and the operand to obtain response data.
[0119] In this step, the target device 11 may perform a custom atomic operation on the data stored at the second base address according to the processing flow determined in step 4022 above based on the operands of the custom atomic operation carried in the first base data packet, so as to obtain the response data corresponding to the custom atomic operation.
[0120] In another possible implementation, the target device 11 may input the operation information of the custom atomic operation and the first base address into a preset custom operation execution model to obtain the response data corresponding to the custom atomic operation output by the preset custom operation execution model. The preset custom operation execution model may include, but is not limited to, an AI execution model.
[0121] Of course, the target device 11 may also perform the custom atomic operation in other ways according to the operation information of the custom atomic operation and the first base address to obtain the response data.
[0122] Step 403: Generate a second base data packet according to the response data and the identification ID of the source device.
[0123] The second base data packet in the embodiments of the present application may refer to the base data packet in the PCIe protocol, that is, a data packet that any PCIe device can support for recognition.
[0124] Exemplarily, the second base data packet in the embodiments of the present application may include, but is not limited to, data packets of the following message types or Completion type data packets. For example, the second base data packet is a data packet of the message type.
[0125] In this step, the target device 11 may generate a second base data packet according to the response data corresponding to the custom atomic operation and the identification ID of the source device.
[0126] In a possible implementation, the target device 11 may generate a second base data packet by writing the response data corresponding to the custom atomic operation and the identification ID of the source device into the corresponding positions of the second base data packet according to the second preset custom operation encapsulation rule respectively. The second preset custom operation encapsulation rule may be used to indicate the encapsulation rule of the response data packet corresponding to the custom atomic operation.
[0127] Figure 6 FIG. is a schematic flowchart of a method for generating a second base data packet in an embodiment. The embodiments of the present application exemplarily introduce and explain a possible implementation of "generating a second base data packet according to the response data and the identification ID of the source device" in step 403 above. As Figure 6 shown, the embodiments of the present application may include the following steps:
[0128] Step 4031: Write the preset routing type identifier into the type bit of the second basic data; the preset routing type identifier is used to indicate the ID routing mode.
[0129] In this step, the target device 11 can write the preset routing type identifier into the type (Type) bit of the second basic data according to the second preset custom operation encapsulation rule to indicate the ID routing mode (that is, the type bit of the second basic data packet can be used to indicate the ID routing mode), so as to imitate the characteristics of the completion packet corresponding to the standard atomic operation in the PCIe protocol.
[0130] For example, the preset routing type identifier in the embodiment of the present application may include, but is not limited to, 10010.
[0131] Step 4032: Write the identification ID into the device number bit of the second basic data packet.
[0132] In the embodiment of the present application, the device number bit can be used to indicate the device that needs to receive the second basic data packet.
[0133] In this step, the target device 11 can write the identification ID of the source device 10 into the device number (Device Num) bit of the second basic data packet, that is, the device number bit of the second basic data packet can be used to indicate the ID number of the source device, so as to indicate that the second basic data packet is received by the source device 10.
[0134] Step 4033: Write the response data into the vendor-defined message bit of the second basic data packet to obtain the second basic data packet.
[0135] Exemplarily, the response data corresponding to the custom atomic operation in the embodiment of the present application may be located in the vendor-defined message bit of the second basic data packet.
[0136] In this step, the target device 11 can write the response data corresponding to the custom atomic operation into the vendor-defined message bit of the second basic data packet to obtain the second basic data packet.
[0137] For ease of understanding, in the following embodiments of the present application, a data packet of the message type is used as an example of the second basic data packet to make an exemplary introduction and description of the relevant content of the second basic data packet.
[0138] Figure 7 is a schematic diagram of the message format of the second basic data packet in an embodiment, as Figure 7As shown, the second basic data packet includes a second message header 70 and a second Payload part 71. Exemplarily, the second message header 70 may include, but is not limited to, a type bit 701, a device number bit 702, and a Message code bit 703.
[0139] Exemplarily, the type bit 701 can be used to indicate the ID routing mode; the device number bit 702 can be used to indicate the identification ID of the source device 10.
[0140] Exemplarily, the message code bit 703 can be used to indicate the type of the message data packet. For example, the message code bit 703 may include, but is not limited to, 0111111x.
[0141] Of course, the second message header 70 may further include other bits. For example, the second message header 70 may further include, but is not limited to, at least one of the following: a Bus number bit, a Function Number (Fcn Num) bit, a Request ID bit, a Vendor ID bit, a Tag bit, an Fmt bit, a TC bit, an Attr bit, an AT bit, a length bit, a TH bit, a TD bit, an EP bit. In the embodiments of the present application, no further examples will be given here.
[0142] Exemplarily, the second Payload part 71 may include, but is not limited to, a Vendor-definedMessage bit 711, which can be used to carry response data corresponding to a custom atomic operation.
[0143] In another possible implementation, the target device 11 can obtain the second basic data packet output by the second preset custom operation encapsulation model by inputting the response data corresponding to the custom atomic operation and the identification ID of the source device into the second preset custom operation encapsulation model. Among them, the second preset custom operation encapsulation model may include, but is not limited to, an AI encapsulation model.
[0144] Of course, the target device 11 may also generate the second basic data packet in other ways according to the response data and the identification ID of the source device.
[0145] Step 404, return the second basic data packet to the source device.
[0146] In this step, the target device 11 may return the second basic data packet to the source device 10 so that the source device 10 can receive the second basic data packet returned by the target device 11.
[0147] In summary, in the embodiments of the present application, by receiving a data packet generated by a source device according to operation information of a custom atomic operation and a first base address of a custom operation Bar space corresponding to a target device, and when it is determined that the first base data packet belongs to a custom atomic operation request data packet, a custom atomic operation is performed according to the operation information of the custom atomic operation and the first base address to obtain response data. Further, a second base data packet is generated according to the response data and the identification ID of the source device, and the second base data packet is returned to the source device. It can be seen that in the embodiments of the present application, by carrying the operation information of the custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device in the first base data packet, and carrying the response data in the second base data packet, the transmission of the custom atomic operation based on the base data packet is realized, and any PCIe device can be compatible. Therefore, the embodiments of the present application have good compatibility and scalability, so as to meet different custom atomic operations required in the multi-device interconnection scenario.
[0148] It should be noted that when the target device 11 determines that the first base data packet belongs to a standard operation request data packet in the PCIe protocol, the first base data packet can be parsed and processed according to a preset standard operation parsing rule, a standard operation can be performed according to a preset standard operation execution rule, and / or data can be encapsulated according to a second preset standard operation encapsulation rule to send the encapsulated data packet. Among them, the preset standard operation parsing rule can be used to indicate the request data packet parsing rule corresponding to the standard operation in the PCIe protocol; the preset standard operation execution rule can be used to indicate the execution process corresponding to the standard operation in the PCIe protocol; the second preset standard operation encapsulation rule can be used to indicate the response data packet encapsulation rule corresponding to the standard operation in the PCIe protocol.
[0149] In the embodiments of the present application, the sizes of the custom operation Bar space corresponding to any device and the memory Bar space can be the same. During the PCIe enumeration process, the host (main device) will automatically allocate different base addresses to these two Bar spaces. Similarly, when multiple devices are interconnected through a switch, the host will allocate different address spaces for all devices. Among them, different base addresses will be allocated to the memory Bar space and the custom operation Bar space of each device, but the internal hardware of the device will automatically remove the base address so that the two Bars are mapped to the same memory space. Therefore, although from the perspective of PCIe enumeration, the two Bar spaces correspond to different memory spaces, but from the perspective of a single device, the actual operation is the same memory space.
[0150] To enable all devices to know the memory space locations allocated to other devices, certain settings need to be made to the enumeration program. For example, during the address allocation process, the high-order information of the address that does not affect internal access can be used to identify the device identification number, so that the source device can directly access data from the target device using the high-order address. Regarding the address allocation method, the embodiments of the present application do not limit this.
[0151] In one embodiment, before the target device 11 executes the above step 402, it may determine whether the first basic data packet belongs to a custom atomic operation request data packet, so that when it is determined that the first basic data packet belongs to a custom atomic operation request data packet, a custom atomic operation is performed according to the operation information of the custom atomic operation and the first base address to obtain response data.
[0152] The embodiments of the present application make an exemplary introduction to the relevant content of how the target device determines whether the first basic data packet belongs to a custom atomic operation request data packet.
[0153] In a possible implementation, it is determined whether the address bits in the first basic data packet include the first base address; if the address bits include the first base address, it is determined that the first basic data packet belongs to a custom atomic operation request data packet.
[0154] In this implementation, the target device 11 may determine whether the address bits in the first basic data packet include the first base address (or whether it hits the custom operation Bar space).
[0155] Exemplarily, if the address bits include the first base address (or it hits the custom operation Bar space), the target device 11 may determine that the first basic data packet belongs to a custom atomic operation request data packet.
[0156] Another exemplarily, if the address bits do not include the first base address (or it does not hit the custom operation Bar space), the target device 11 may determine that the first basic data packet does not belong to a custom atomic operation request data packet, that is, it belongs to a standard operation request data packet in the PCIe protocol.
[0157] In this implementation, by determining whether the first basic data packet belongs to a custom atomic operation request data packet according to whether the address bits in the first basic data packet include the first base address, the type of the first basic data packet can be determined very conveniently and accurately.
[0158] In another possible implementation, the target device 11 may determine whether the first basic data packet belongs to a custom atomic operation request data packet by judging the operation information carried in the first basic data packet.
[0159] Exemplarily, if the operation identifier included in the operation information carried in the first basic data packet is used to indicate a custom atomic operation, the target device 11 may determine that the first basic data packet belongs to a custom atomic operation request data packet.
[0160] In another exemplary case, if the operation information carried in the first basic data packet does not include an operation identifier, or the included operation identifier is used to indicate a non-custom atomic operation, the target device 11 may determine that the first basic data packet does not belong to a custom atomic operation request data packet, that is, it belongs to a standard operation request data packet in the PCIe protocol.
[0161] Of course, the target device 11 may also determine whether the first basic data packet belongs to a custom atomic operation request data packet by other means.
[0162] In one embodiment, Figure 8 FIG. is a schematic flow chart of a data transmission method in another embodiment. On the basis of the above embodiments, the embodiments of the present application will take the source device 10 and the target device 11 as examples to give an exemplary introduction to the overall process of the data transmission method. As Figure 8 shown, the method of the embodiments of the present application may include the following steps:
[0163] Step 801, the source device 10 determines whether it is necessary to instruct the target device to perform a custom atomic operation.
[0164] If it is determined that it is not necessary to instruct the target device to perform a custom atomic operation, that is, when it is necessary to instruct the target device to perform a standard operation in the PCIe protocol, step 802 may be executed; if it is determined that it is necessary to instruct the target device to perform a custom atomic operation, step 803 may be executed.
[0165] Step 802, the source device 10 may encapsulate the data packet according to the first preset standard operation encapsulation rule to send the encapsulated data packet.
[0166] Step 803, the source device 10 may write the first base address of the custom operation Bar space corresponding to the target device into the address bit of the first basic data packet.
[0167] Step 804, the source device 10 may write the operation information of the custom atomic operation into the data bit of the first basic data packet to obtain the first basic data packet.
[0168] Step 805, the source device 10 may send the first basic data packet to the target device.
[0169] Step 806, the target device 11 may receive the first basic data packet.
[0170] Step 807, the target device 11 can determine whether the first basic data packet belongs to a custom atomic operation request data packet.
[0171] If it is determined that the first basic data packet does not belong to the custom atomic operation request data packet, that is, the first basic data packet belongs to the standard operation request data packet in the PCIe protocol, step 808 can be executed; if it is determined that the first basic data packet belongs to the custom atomic operation request data packet, step 809 can be executed.
[0172] Step 808, the target device 11 can parse and process the first basic data packet according to the preset standard operation parsing rule and execute the standard operation according to the preset standard operation execution rule, etc.
[0173] Step 809, the target device 11 can parse and process the first basic data packet according to the second preset data packet parsing rule to obtain the operation information of the custom atomic operation and the first base address carried in the first basic data packet.
[0174] Step 810, the target device 11 can determine the second base address corresponding to the target device according to the first base address carried in the first basic data.
[0175] Step 811, the target device 11 can determine the processing flow of the custom atomic operation according to the operation identifier of the custom atomic operation in the operation information.
[0176] Step 812, the target device 11 can perform a custom atomic operation on the data stored in the second base address according to the processing flow and the operand to obtain the response data.
[0177] Step 813, the target device 11 can generate a second basic data packet according to the response data and the identification ID of the source device, and return the second basic data packet to the source device 11.
[0178] Step 814, the source device 10 receives the second basic data packet returned by the target device 11.
[0179] It should be noted that for the implementable manners of the steps in the embodiments of the present application, reference may be made to the relevant content in the above embodiments, which will not be elaborated herein.
[0180] In one embodiment, for the sake of easy understanding, in the embodiments of the present application, the source device 10 includes a first transceiver 101 and a first PCIe controller 102, and the target device 11 includes a second transceiver 111, a second PCIe controller 112, and a main processor 113 as an example to make an exemplary introduction to the data transmission architecture of the data transmission method in the embodiments of the present application. Figure 9 It is a schematic diagram of the data transmission architecture in one embodiment, as Figure 9As shown in the figure, the first transceiver converter 101 in the source device 10 can receive an operation request from the internal bus, generate an operation request data packet (e.g., the first basic data packet, etc.) according to the data transmission method provided in the embodiments of the present application, and send it to the switch 12 through the first PCIe controller 102 based on the first request channel, so that the switch 12 can send the operation request data packet to the second transceiver converter 111 in the target device 11 through the second PCIe controller 112 based on the second request channel.
[0181] Further, the second transceiver converter 111 can parse and process the operation request data packet according to the data transmission method provided in the embodiments of the present application to obtain the requested operation information and the second base address, and send the requested operation information and the second base address to the main processor 113 through the internal bus.
[0182] Further, the main processor 113 can execute the corresponding requested operation (e.g., a custom atomic operation, etc.) according to the data transmission method provided in the present application to obtain response data, and send the response data to the second transceiver converter 111 through the internal bus.
[0183] Further, the second transceiver converter 111 can generate a response data packet according to the data transmission method provided in the embodiments of the present application, and send it to the switch 12 through the second PCIe controller 112 based on the second response channel, so that the switch 12 can send the response data packet to the first transceiver converter 101 in the source device 10 through the first PCIe controller 102 based on the first response channel.
[0184] Exemplarily, in the embodiments of the present application, the master device can also send Bar space allocation indication information to the first transceiver converter 101 and the second transceiver converter 111 respectively through the switch 12. The Bar space allocation indication information can be used to indicate the first base address of the custom operation Bar space and the second base address of the memory Bar space corresponding to different devices.
[0185] For ease of understanding, in the following embodiments of the present application, taking the first transceiver converter 101 in the source device 10 as the execution subject, the data transmission method in the embodiments of the present application is introduced and illustrated exemplarily. Figure 10 For the flowchart of the data transmission method in another embodiment, as Figure 10 shown, the method of the embodiments of the present application may include the following steps:
[0186] Step 1001, the first transceiver converter 101 can receive an operation request from the internal bus.
[0187] Exemplarily, the operation request in the embodiments of the present application may be a request sent by the main processor in the source device 10 to the first transceiver converter 101 through an internal bus.
[0188] Step 1002, the first transceiver converter 101 may determine whether the operation request is a custom atomic operation request.
[0189] If the operation request does not contain the operation information of the custom atomic operation, it is determined that the operation request does not belong to the custom atomic operation request, and step 1003 is executed; if the operation request contains the operation information of the custom atomic operation, it is determined that the operation request is a custom atomic operation request, and step 1005 is executed.
[0190] Step 1003, the first transceiver converter 101 may perform data packet encapsulation according to the first preset standard operation encapsulation rule to send the encapsulated data packet. Among them, the second base address of the memory Bar space corresponding to the target device is added to the address bit.
[0191] Step 1004, the first transceiver converter 101 may determine whether to wait for a response data packet according to the PCIe protocol.
[0192] Step 1005, the first transceiver converter 101 may write the first base address of the custom operation Bar space corresponding to the target device into the address bit of the first basic data packet.
[0193] Step 1006, the first transceiver converter 101 may write the operation information of the custom atomic operation into the data bit of the first basic data packet to obtain the first basic data packet.
[0194] Step 1007, the first transceiver converter 101 may send the first basic data packet to the target device.
[0195] Step 1008, the first transceiver converter 101 may wait for the target device 10 to return the second basic data packet.
[0196] Step 1009, when the first transceiver converter 101 receives the second basic data packet returned by the target device 10, it may perform parsing processing on the second basic data packet to obtain response data, and return the response data to the main processor of the source device 10.
[0197] It should be noted that for the implementable manners of each step in the embodiments of the present application, reference may be made to the relevant content in the above embodiments, which will not be elaborated here.
[0198] For the sake of easy understanding, in the following embodiments of the present application, taking the second transceiver converter 111 in the target device 11 as the execution subject as an example, an exemplary introduction and description of the data transmission method in the embodiments of the present application is given. Figure 11It is a schematic flowchart of a data transmission method in another embodiment. As Figure 11 shown, the method of the embodiment of the present application may include the following steps:
[0199] Step 1101, the second transceiver 111 may receive the first basic data packet.
[0200] Step 1102, the second transceiver 111 may determine whether the address bit in the first basic data packet includes the first base address.
[0201] If the address bit in the first basic data packet does not include the first base address, step 1103 is executed; if the address bit in the first basic data packet includes the first base address, step 1105 is executed.
[0202] Step 1103, the second transceiver 111 may perform parsing processing on the first basic data packet according to a preset standard operation parsing rule, and send the parsing result to the main processor in the target device 11.
[0203] In this step, the second transceiver 111 may send the parsing result to the main processor in the target device 11, so that the main processor can perform subsequent processing according to the parsing result.
[0204] Step 1104, the second transceiver 111 may determine whether to forward the response data packet according to the PCIe protocol.
[0205] Step 1105, the second transceiver 111 may perform parsing processing on the first basic data packet according to a second preset data packet parsing rule to obtain the operation information of the custom atomic operation carried in the first basic data packet and the first base address.
[0206] Step 1106, the second transceiver 111 may determine the second base address corresponding to the target device according to the first base address carried in the first basic data.
[0207] Step 1107, the second transceiver 111 may send the operation information of the custom atomic operation and the second base address to the main processor in the target device.
[0208] In this step, the second transceiver 111 sends the operation information of the custom atomic operation and the second base address to the main processor in the target device, so that the main processor can execute the custom atomic operation according to the operation information of the custom atomic operation and the second base address to obtain the response data.
[0209] Step 1108, the second transceiver 111 may wait for the response data returned by the main processor.
[0210] Step 1109: The second transceiver 111 may generate a second basic data packet based on the response data and the identification ID of the source device, and return the second basic data packet to the source device 11.
[0211] It should be noted that for the implementable manners of the steps in the embodiments of the present application, reference may be made to the relevant content in the above embodiments, and details are not described herein again.
[0212] It should be understood that although the steps in the flowcharts involved in the above embodiments are sequentially shown according to the indications of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless clearly stated herein, there is no strict order limitation for the execution of these steps, and these steps may be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same moment, but may be executed at different moments. The execution order of these steps or stages is not necessarily sequential, but may be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0213] Based on the same inventive concept, the embodiments of the present application further provide a data transmission device for implementing the data transmission method involved above. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the data transmission device provided below may refer to the limitations on the data transmission method in the above text, and details are not described herein again.
[0214] In one embodiment, Figure 12 FIG. is a schematic structural diagram of a data transmission device in one embodiment. The data transmission device in the embodiments of the present application may be applied to a source device. As Figure 12 shown, the data transmission device 120 in the embodiments of the present application may include: a generation module 1201, a sending module 1202, and a receiving module 1203.
[0215] Among them, the generation module 1201 is configured to generate a first basic data packet according to the operation information of the custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device when it is determined that the target device needs to be instructed to execute a custom atomic operation; wherein, the first base address is different from the second base address of the memory Bar space corresponding to the target device;
[0216] A sending module 1202, configured to send a first basic data packet to a target device; wherein, the first basic data packet is used to instruct the target device to perform a custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data when it is determined that the first basic data packet belongs to a custom atomic operation request data packet.
[0217] A receiving module 1203, configured to receive a second basic data packet returned by the target device; wherein, the response data is carried in the second basic data packet.
[0218] In one embodiment, the generating module 1201 may include:
[0219] A first writing unit, configured to write the first base address into the address bit of the first basic data packet;
[0220] A second writing unit, configured to write the operation information of the custom atomic operation into the data bit of the first basic data packet to obtain the first basic data packet.
[0221] In one embodiment, the operation information includes an operation identifier and an operand of the custom atomic operation, the data bit includes a first sub-data bit and a second sub-data bit, and the second writing unit may be specifically configured to: write the operation identifier of the custom atomic operation into the first sub-data bit of the first basic data packet; write the operand into the second sub-data bit of the first basic data packet to obtain the first basic data packet.
[0222] In one embodiment, the first basic data packet is a data packet of the memory write type; and / or, the second basic data packet is a data packet of the message type.
[0223] In one embodiment, the response data is located in the vendor-defined message bit of the second basic data packet.
[0224] In one embodiment, the device number bit of the second basic data packet is used to indicate the ID number of the source device, and / or, the type bit of the second basic data packet is used to indicate the identification ID routing mode.
[0225] The data transmission device provided in the embodiments of the present application can be used to execute the technical solutions regarding the source device in the above data transmission method embodiments of the present application. The implementation principles and technical effects are similar and will not be elaborated here.
[0226] In one embodiment, Figure 13 For the structural schematic diagram of the data transmission device in another embodiment, the data transmission device in the embodiments of the present application can be applied to the target device. As Figure 13 shown, the data transmission device 130 in the embodiments of the present application may include: a receiving module 1301, an execution module 1302, a generating module 1303, and a sending module 1304.
[0227] Among them, a receiving module 1301 is configured to receive a first basic data packet. The first basic data packet is a data packet generated by a source device according to operation information of a custom atomic operation and a first base address of a custom operation Bar space corresponding to a target device. The first base address is different from a second base address of a memory Bar space corresponding to the target device.
[0228] An execution module 1302 is configured to, when determining that the first basic data packet belongs to a custom atomic operation request data packet, execute a custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data.
[0229] A generating module 1303 is configured to generate a second basic data packet according to the response data and an identification ID of the source device.
[0230] A sending module 1304 is configured to return the second basic data packet to the source device.
[0231] In one embodiment, the operation information includes an operation identifier and an operand of the custom atomic operation. The execution module 1302 may specifically be configured to: determine a second base address corresponding to the target device according to the first base address; determine a processing flow of the custom atomic operation according to the operation identifier of the custom atomic operation; and execute the custom atomic operation on the data stored at the second base address according to the processing flow and the operand to obtain response data.
[0232] In one embodiment, the generating module 1303 may specifically be configured to: write a preset routing type identifier into a type bit of the second basic data; where the preset routing type identifier is used to indicate an ID routing mode; write the identification ID into a device number bit of the second basic data packet; and write the response data into a vendor-defined message bit of the second basic data packet to obtain the second basic data packet.
[0233] In one embodiment, the data transmission device in the embodiments of the present application may further include:
[0234] A judging module, configured to judge whether an address bit in the first basic data packet includes the first base address.
[0235] A determining module, configured to, if the address bit includes the first base address, determine that the first basic data packet belongs to a custom atomic operation request data packet.
[0236] In one embodiment, the first basic data packet is a data packet of a memory write type; and / or, the second basic data packet is a data packet of a message type.
[0237] The data transmission device provided in the embodiments of the present application can be used to execute the technical solutions regarding the target device in the above-mentioned data transmission method embodiments of the present application. The implementation principles and technical effects are similar and will not be elaborated here.
[0238] Each module in the above-mentioned data transmission device can be implemented in whole or in part by software, hardware, and their combination. The above-mentioned modules can be embedded in the processor in the data transmission device in hardware form or be independent of it, or be stored in the memory of the data transmission device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.
[0239] In one embodiment, Figure 14 FIG. is a schematic structural diagram of a data transmission device in one embodiment. The data transmission device in the embodiments of the present application may include, but is not limited to, a source device or a target device. As Figure 14 shown, the data transmission device in the embodiments of the present application may include, but is not limited to, a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the data transmission device is used to provide computing and control capabilities. The memory of the data transmission device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the data transmission device is used to store data information and the like involved in the process of the data transmission method of the present application. The input / output interface of the data transmission device is used to exchange information between the processor and external devices. The communication interface of the data transmission device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data transmission method is implemented.
[0240] Those skilled in the art can understand that Figure 14 the structure shown in is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the data transmission device to which the solution of the present application is applied. The specific data transmission device may include more or fewer components than those shown in the figure, or combine some components, or have a different component layout.
[0241] In one embodiment, a data transmission device is further provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the steps in the above method embodiments are implemented.
[0242] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0243] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0244] Those of ordinary skill in the art can understand that all or part of the processes in the above method embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above method embodiments. Among them, any reference to a memory, database, or other medium used in the various embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the various embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the various embodiments provided in the present application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.
[0245] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0246] The above embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation to the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several variations and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. A data transmission method, characterized in that: The method is applied to a source device, and the method comprises: In the case where it is determined that the target device needs to be instructed to perform a custom atomic operation, a first basic data packet is generated according to the operation information of the custom atomic operation and a first base address of the custom operation Bar space corresponding to the target device; wherein the first base address is different from a second base address of the memory Bar space corresponding to the target device; Sending the first basic data packet to the target device; wherein the first basic data packet is used to instruct the target device to perform the custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data when determining that the first basic data packet belongs to a custom atomic operation request data packet; A second basic data packet returned by the target device is received; wherein the second basic data packet carries the response data.
2. The method according to claim 1, characterized in that The generating a first basic data packet according to the operation information of the custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device includes: Writing the first base address into the address bit of the first basic data packet; The operation information of the custom atomic operation is written into the data bits of the first basic data packet to obtain the first basic data packet.
3. The method according to claim 2, characterized in that The operation information includes an operation identifier and an operand of the custom atomic operation, the data bit includes a first sub-data bit and a second sub-data bit, and the operation information of the custom atomic operation is written into the data bit of the first basic data packet to obtain the first basic data packet, including: Writing the operation identifier of the custom atomic operation into the first sub-data bit of the first basic data packet; The operand is written into the second sub-data bit of the first basic data packet to obtain the first basic data packet.
4. The method according to any one of claims 1 to 3, characterized in that The first basic data packet is a memory write type data packet; and / or, The second basic data packet is a message type data packet.
5. The method according to any one of claims 1 to 3, characterized in that: The response data is located in the vendor-defined message position of the second basic data packet.
6. The method according to any one of claims 1 to 3, characterized in that The device number bit of the second basic data packet is used to indicate the ID number of the source device, and / or the type bit of the second basic data packet is used to indicate the identification ID routing mode.
7. A data transmission method, characterized in that: The method is applied to a target device, and the method comprises: Receive a first basic data packet; wherein the first basic data packet is a data packet generated by the source device according to the operation information of the custom atomic operation and the first base address of the custom operation Bar space corresponding to the target device; the first base address is different from the second base address of the memory Bar space corresponding to the target device; In the case where it is determined that the first basic data packet belongs to a custom atomic operation request data packet, performing the custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data; Generate a second basic data packet according to the response data and the identification ID of the source device; The second basic data packet is returned to the source device.
8. The method according to claim 7, characterized in that The operation information includes an operation identifier and an operand of the custom atomic operation, and the custom atomic operation is executed according to the operation information of the custom atomic operation and the first base address to obtain response data, including: Determining the second base address corresponding to the target device according to the first base address; Determining a processing flow of the custom atomic operation according to an operation identifier of the custom atomic operation; The custom atomic operation is performed on the data stored at the second base address according to the processing flow and the operand to obtain response data.
9. The method according to claim 7 or 8, characterized in that: The generating a second basic data packet according to the response data and the identification ID of the source device includes: Writing a preset routing type identifier into the type bit of the second basic data; wherein the preset routing type identifier is used to indicate an ID routing mode; Writing the identification ID into the device number bit of the second basic data packet; The response data is written into the vendor-defined message bit of the second basic data packet to obtain the second basic data packet.
10. The method according to claim 7 or 8, characterized in that: The method further comprises: Determining whether the address bits in the first basic data packet include the first base address; If the address bits include the first base address, it is determined that the first basic data packet belongs to the custom atomic operation request data packet.
11. The method according to claim 7 or 8, characterized in that: The first basic data packet is a memory write type data packet; and / or, The second basic data packet is a message type data packet.
12. A data transmission device, characterized in that: The device is applied to a source device, and comprises: A generating module, configured to generate a first basic data packet according to operation information of the custom atomic operation and a first base address of a custom operation Bar space corresponding to the target device, when it is determined that the target device needs to be instructed to perform a custom atomic operation; wherein the first base address is different from a second base address of a memory Bar space corresponding to the target device; A sending module, configured to send the first basic data packet to the target device; wherein the first basic data packet is used to instruct the target device to perform the custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data when determining that the first basic data packet belongs to a custom atomic operation request data packet; A receiving module is used to receive a second basic data packet returned by the target device; wherein the second basic data packet carries the response data.
13. A data transmission device, characterized in that: The device is applied to a target device, and comprises: A receiving module, configured to receive a first basic data packet; wherein the first basic data packet is a data packet generated by a source device according to operation information of a custom atomic operation and a first base address of a custom operation Bar space corresponding to the target device; the first base address is different from a second base address of a memory Bar space corresponding to the target device; an execution module, configured to, when determining that the first basic data packet belongs to a custom atomic operation request data packet, execute the custom atomic operation according to the operation information of the custom atomic operation and the first base address to obtain response data; A generating module, configured to generate a second basic data packet according to the response data and an identification ID of the source device; A sending module is used to return the second basic data packet to the source device.
14. A data transmission device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the processor implements the steps of the method according to any one of claims 1 to 6, or implements the steps of the method according to any one of claims 7 to 11.
15. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 6, or implements the steps of the method according to any one of claims 7 to 11.
16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 6, or implements the steps of the method according to any one of claims 7 to 11.
Citation Information
Patent Citations
Operation address determination method, PCIe system, electronic equipment and storage medium
CN112445729A
Memory access boundary check for programmable atomic operations
CN114385545A
Context loading mechanism in coarse-grained configurable array processor
CN117632842A
Data transmission method, device and equipment, medium and computer program product
CN118467453A
Accelerated memory allocation
EP4322012A1
Cited By
Synchronous communication method and system based on PCIe atomic operation
CN121326799A