WO2023207456A1 - Command transmission method and apparatus - Google Patents

Command transmission method and apparatus Download PDF

Info

Publication number
WO2023207456A1
WO2023207456A1 PCT/CN2023/083662 CN2023083662W WO2023207456A1 WO 2023207456 A1 WO2023207456 A1 WO 2023207456A1 CN 2023083662 W CN2023083662 W CN 2023083662W WO 2023207456 A1 WO2023207456 A1 WO 2023207456A1
Authority
WO
WIPO (PCT)
Prior art keywords
command
work queue
transmission mode
information
cache
Prior art date
Application number
PCT/CN2023/083662
Other languages
French (fr)
Chinese (zh)
Inventor
李瑛�
程中武
李力军
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023207456A1 publication Critical patent/WO2023207456A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0659Command handling arrangements, e.g. command buffers, queues, command scheduling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • G06F12/0646Configuration or reconfiguration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0877Cache access modes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Definitions

  • the present application relates to the field of chip technology, and more specifically, to a command transmission method and device.
  • DSA domain special accelerate
  • DSA can offload typical data processing to reduce CPU usage, thereby improving the overall performance of the system.
  • the encryption and decryption engine can implement encryption and decryption operations
  • the hash engine can implement hash operations
  • the codec engine can implement video encoding and decoding.
  • DSA can obtain commands from the CPU and execute the commands to achieve the above various data processing.
  • the CPU can issue at least one command to the DSA through an asynchronous mode or a synchronous mode.
  • the asynchronous mode means that the at least one command and the notification message of the at least one command are respectively sent to the DSA.
  • the synchronous mode means that the at least one command is sent to the DSA.
  • the command is carried in the notification message of the at least one command and is sent to the DSA together.
  • This application provides a command transmission method, which can transmit commands in asynchronous mode or synchronous mode through a set of message interfaces, which can improve the flexibility of command transmission.
  • this application provides a command transmission method, which can be used for a central processor.
  • the method can include: generating a notification message, the notification message being used to notify the accelerator to execute the first command, the notification message including the first work
  • the first work queue cache is used to store the first command.
  • the first address information is used to indicate that the first command is stored in the first work queue cache.
  • the first transmission mode information is used to indicate the transmission mode of the first command.
  • the transmission mode includes a synchronous mode or an asynchronous mode. When the transmission mode of the first command is the synchronous mode, the notification The message also includes the first command; sending the notification message to the accelerator.
  • the central processor can indicate the transmission mode of the first command through the first transmission mode information in the notification message.
  • the central processor can use the identification information cached by the first work queue in the notification message and The first address information indicates the storage address of the first command in the memory.
  • the transmission mode of the first command is the synchronous mode
  • the first command can be carried through the notification message.
  • the accelerator may obtain the first command and execute the first command based on the notification message.
  • commands can be transmitted between the central processor and the accelerator through a set of message interfaces in asynchronous mode or synchronous mode. In this way, the central processor can select the command according to the characteristics of the command. By choosing an appropriate method for delivery, you can retain the flexibility of command delivery and gain the benefit of quickly processing short commands.
  • the notification message is also used to notify the accelerator to execute the second command.
  • the notification message also includes the identification information cached by the second work queue, the second address information and the second transmission mode information.
  • the second work queue cache is used to store the second command
  • the second address information is used to indicate the storage address of the second command in the second work queue cache
  • the second transmission mode information is used to indicate the storage address of the second command. Transmission mode.
  • the transmission mode of the first command is different from the transmission mode of the second command.
  • the notification message also includes the second command.
  • the central processor can transmit commands compatible with asynchronous mode and synchronous mode through a set of message interfaces. That is to say, synchronous mode and asynchronous mode can be operated in combination, thereby improving the flexibility of command transmission. .
  • the first work queue cache and the second work queue cache are the same, and the storage address of the first command in the first work queue cache is the same as the storage address of the second command in the first work queue.
  • the storage addresses in the cache are different; or, the first work queue cache and the second work queue cache are different.
  • the different commands can share the same work queue cache through the first address information in the notification message, thereby achieving collaborative work.
  • the first command includes multiple commands
  • the second command includes multiple commands
  • the central processor can issue multiple commands in batches in asynchronous mode through a set of message interfaces, and/or, issue multiple commands in batches in synchronous mode, which can improve the flexibility of command transmission. sex and efficiency.
  • the notification message also includes a first identification field, a first address field, a first transmission mode field, and a first command field.
  • the first identification field is used to carry the first work queue cache.
  • the identification information and the first address field are used to carry the first address information
  • the first transmission mode field is used to carry the first transmission mode information
  • the first command field is used to carry the first command.
  • the central processor can distinguish the transmission mode adopted by each command as a synchronous mode or an asynchronous mode through a unified format notification message, without modifying the central processor or requiring additional instructions.
  • the method may further include: writing the first command based on the first target address information. into the memory, and the first target address information is used to indicate the storage address of the first command in the memory.
  • this application also provides a command transmission method, which can be used for an accelerator.
  • the method can include: receiving a notification message from the processor, the notification message being used to notify the accelerator to execute the first command, the notification message including The first work queue buffers the identification information, the first address information and the first transmission mode information.
  • the first work queue buffer is used to store the first command.
  • the first address information is used to indicate that the first command is in the first The storage address in the work queue cache.
  • the first transmission mode information is used to indicate the transmission mode of the first command.
  • the transmission mode includes a synchronous mode or an asynchronous mode. When the transmission mode of the first command is the synchronous mode, , the notification message also includes the first command; based on the notification message, the first command is obtained; and the first command is executed.
  • the central processor can indicate the transmission mode of the first command through the first transmission mode information in the notification message.
  • the central processor can use the identification information cached by the first work queue in the notification message and The first address information indicates the storage address of the first command in the memory.
  • the transmission mode of the first command is the synchronous mode
  • the first command can be carried through the notification message.
  • the accelerator may obtain the first command and execute the first command based on the notification message.
  • commands can be transmitted between the central processor and the accelerator through a set of message interfaces in asynchronous mode or synchronous mode. In this way, the central processor can choose the appropriate method to issue the command according to the characteristics of the command, and can retain the command issuance. The flexibility can gain the benefit of fast processing of short commands.
  • the notification message is also used to notify the accelerator to execute the second command.
  • the notification message also includes the identification information cached by the second work queue, the second address information and the second transmission mode information.
  • the second work queue cache is used to store the second command
  • the second address information is used to indicate the storage address of the second command in the second work queue cache
  • the second transmission mode information is used to indicate the storage address of the second command.
  • Transmission mode, the transmission mode of the first command is different from the transmission mode of the second command, wherein when the transmission mode of the second command is the synchronization mode, the notification message also includes the second command, and the method further includes : Based on the notification message, obtain the second command; execute the second command.
  • the central processor can transmit commands compatible with asynchronous mode and synchronous mode through a set of message interfaces. That is to say, synchronous mode and asynchronous mode can be operated in combination, thereby improving the flexibility of command transmission. .
  • the first work queue cache is the same as the second work queue cache, but the storage address of the first command in the first work queue cache is the same as the storage address of the second command in the first work queue cache.
  • the storage addresses in the queue cache are different; or, the first work queue cache and the second work queue cache are different.
  • the different commands can share the same work queue cache through the first address information in the notification message, thereby achieving collaborative work.
  • the first command includes multiple commands
  • the second command includes multiple commands
  • the central processor can issue multiple commands in batches in asynchronous mode through a set of message interfaces, and/or, issue multiple commands in batches in synchronous mode, which can improve the flexibility of command transmission. sex and efficiency.
  • the notification message also includes a first identification field, a first address field, a first transmission mode field, and a first command field.
  • the first identification field is used to carry the first work queue cache.
  • the identification information and the first address field are used to carry the first address information
  • the first transmission mode field is used to carry the first transmission mode information
  • the first command field is used to carry the first command.
  • obtaining the first command based on the notification message includes: based on the identification information cached in the first work queue, the first address information and the first transmission mode information, from the memory Read the first command in .
  • the central processor can distinguish the transmission mode adopted by each command as a synchronous mode or an asynchronous mode through a unified format notification message, without modifying the central processor or requiring additional instructions.
  • reading the first command from the memory based on the identification information cached by the first work queue, the first address information and the first transmission mode information includes: when the first A transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, but when the first command cannot be written to the command cache queue of the accelerator, based on the identification information cached in the first work queue and the first address Information, the first command is read from this memory.
  • the asynchronous mode can be further used to read the first command from the memory.
  • the asynchronous mode can be used to solve the problem of command transmission failure caused by the storage space size of the command queue cache in the accelerator or the processing speed of the accelerator in the synchronous mode, thereby improving the performance of the central processor.
  • reading the first command from the memory based on the identification information cached by the first work queue and the first address information includes: based on the identification information cached by the first work queue , the first address information and the preset mapping relationship determine the first target address information.
  • the mapping relationship is used to indicate the identification information cached by the first work queue and the storage address cached by the first work queue in the memory.
  • the first target address information is used to indicate the storage address of the first command in the memory; based on the first target address information, the first command is read from the memory.
  • mapping relationship may be pre-configured in the accelerator, or the accelerator may obtain the mapping relationship from other devices in advance, which is not limited in the embodiments of the present application.
  • the accelerator obtains the mapping relationship in advance, that is, the notification message does not need to carry the mapping relationship, which can reduce the amount of transmitted data and thereby improve transmission efficiency.
  • the method before reading the first command from the memory based on the first target address information, the method further includes: writing the first command based on the first target address information. into this memory.
  • the accelerator writes the first command into the memory, Then the first command is read from the memory, so that the asynchronous mode can be used to handle scenarios that the synchronous mode cannot handle.
  • reading the first command from the memory based on the identification information cached by the first work queue, the first address information and the first transmission mode information includes: when the first When a transmission mode information is used to indicate that the transmission mode of the first command is the asynchronous mode, the first command is read from the memory based on the identification information cached in the first work queue and the first address information.
  • the accelerator can cache based on the identification information of the first work queue and the third Using address information and reading the first command from the memory can reduce the storage space requirements of the accelerator and reduce the processing complexity of the accelerator.
  • obtaining the first command based on the notification message includes: when the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronization mode, and the first command When the command cache queue of the accelerator can be written, the first command is read from the command cache queue.
  • the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode
  • the first command can be written into the command cache queue of the accelerator, from Reading the first command from the command cache queue can reduce interaction overhead, thereby improving command transmission efficiency.
  • the method before reading the first command from the command cache queue, the method further includes: writing the first command into the command cache queue.
  • this application also provides a command transmission device.
  • the device may include: a processor and a communication interface.
  • the processor is coupled to the communication interface.
  • the processor is used to: generate a notification message, and the notification message is used to notify the accelerator.
  • the notification message includes identification information, first address information and first transmission mode information of the first work queue cache.
  • the first work queue cache is used to store the first command.
  • the first address information is used to store the first command.
  • the transmission mode includes a synchronous mode or an asynchronous mode, wherein when the first When the command transmission mode is the synchronous mode, the notification message also includes the first command; the notification message is sent to the accelerator through the communication interface.
  • the notification message is also used to notify the accelerator to execute the second command.
  • the notification message also includes the identification information cached by the second work queue, the second address information and the second transmission mode information.
  • the second work queue cache is used to store the second command
  • the second address information is used to indicate the storage address of the second command in the second work queue cache
  • the second transmission mode information is used to indicate the storage address of the second command. Transmission mode.
  • the transmission mode of the first command is different from the transmission mode of the second command.
  • the notification message also includes the second command.
  • the first work queue cache and the second work queue cache are the same, and the storage address of the first command in the first work queue cache is the same as the storage address of the second command in the first work queue.
  • the storage addresses in the cache are different; or, the first work queue cache and the second work queue cache are different.
  • the first command includes multiple commands
  • the second command includes multiple commands
  • the notification message also includes a first identification field, a first address field, a first transmission mode field, and a first command field.
  • the first identification field is used to carry the first work queue cache.
  • the identification information and the first address field are used to carry the first address information
  • the first transmission mode field is used to carry the first transmission mode information
  • the first command field is used to carry the first command.
  • the processor is further configured to: when the first transmission mode information is used to indicate that the transmission mode of the first command is an asynchronous mode, based on the first target address information, transfer the first command to Written into the memory, the first target address information is used to indicate the storage address of the first command in the memory.
  • this application also provides a command transmission device.
  • the device may include: a processor and a communication interface.
  • the processor is coupled to the communication interface.
  • the processor is configured to: receive a notification message from the processor through the communication interface.
  • the notification message is used to notify the accelerator to execute the first command.
  • the notification message includes the identification information, the first address information and the first transmission mode information of the first work queue cache.
  • the first work queue cache is used to store the first command.
  • the first address information is used to indicate the storage address of the first command in the first work queue cache
  • the first transmission mode information is used to indicate the transmission mode of the first command.
  • the transmission mode includes synchronous mode or asynchronous mode. mode, wherein when the transmission mode of the first command is the synchronous mode, the notification message also includes the first command; based on the notification message, the first command is obtained; and the first command is executed.
  • the notification message is also used to notify the accelerator to execute the second command.
  • the notification message also includes the identification information cached by the second work queue, the second address information and the second transmission mode information.
  • the second work queue cache is used to store the second command
  • the second address information is used to indicate the storage address of the second command in the second work queue cache
  • the second transmission mode information is used to indicate the storage address of the second command.
  • transmission mode the transmission of the first command
  • the transmission mode is different from the transmission mode of the second command, wherein when the transmission mode of the second command is the synchronous mode, the notification message also includes the second command, and the processor is further configured to: based on the notification message, Obtain the second command; execute the second command.
  • the first work queue cache is the same as the second work queue cache, but the storage address of the first command in the first work queue cache is the same as the storage address of the second command in the first work queue cache.
  • the storage addresses in the queue cache are different; or, the first work queue cache and the second work queue cache are different.
  • the first command includes multiple commands
  • the second command includes multiple commands
  • the notification message also includes a first identification field, a first address field, a first transmission mode field, and a first command field.
  • the first identification field is used to carry the first work queue cache.
  • the identification information and the first address field are used to carry the first address information
  • the first transmission mode field is used to carry the first transmission mode information
  • the first command field is used to carry the first command.
  • the processor is specifically configured to: read the first command from the memory based on the identification information cached in the first work queue, the first address information and the first transmission mode information. .
  • the processor is specifically configured to: when the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, but the first command cannot write a command of the accelerator When caching the queue, the first command is read from the memory based on the cached identification information of the first work queue and the first address information.
  • the processor is specifically configured to: determine the first target address information based on the identification information cached by the first work queue, the first address information and a preset mapping relationship, where the mapping relationship is In order to indicate the correspondence between the identification information cached by the first work queue and the storage address of the first work queue cache in the memory, the first target address information is used to indicate the storage of the first command in the memory. address; based on the first target address information, read the first command from the memory.
  • the processor is further configured to: before reading the first command from the memory based on the first target address information, read the first command based on the first target address information. The command is written to this memory.
  • the processor is specifically configured to: when the first transmission mode information is used to indicate that the transmission mode of the first command is the asynchronous mode, based on the identification information cached in the first work queue and The first address information reads the first command from the memory.
  • the processor is specifically configured to: when the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, and the first command can write a command of the accelerator When the queue is cached, the first command is read from the command cache queue.
  • the processor is further configured to write the first command into the command cache queue before reading the first command from the command cache queue.
  • the present application also provides a command transmission device, which may include units for implementing the methods described in the above aspects or various possible implementations thereof.
  • the present application also provides a computer-readable storage medium, which stores a computer program.
  • the computer program When executed by at least one processor, the computer program is used to implement the above aspects or any possible implementation thereof. The method described in the method.
  • the present application also provides a computer program product, which when executed by at least one processor is used to implement the methods described in the above aspects or any possible implementation manner thereof.
  • the command transmission device, computer storage medium and computer program product provided by this application are all used to execute the command transmission method provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects of the command transmission method provided above. The effect will not be described here.
  • Figure 1 is a schematic block diagram of a command transmission system 100 provided by an embodiment of the present application.
  • Figure 2 is a schematic flow chart of the command transmission method 200 provided by the embodiment of the present application.
  • FIG. 3 is a schematic diagram of the format of the notification message provided by the embodiment of the present application.
  • Figure 4 is a schematic flow chart of the command transmission method 300 provided by the embodiment of the present application.
  • Figure 5 is a schematic flow chart of the command transmission method 400 provided by the embodiment of the present application.
  • Figure 6 is a schematic block diagram of the command transmission device 500 provided by the embodiment of the present application.
  • Figure 7 is a schematic block diagram of the command transmission device 600 provided by the embodiment of the present application.
  • Figure 8 is a schematic block diagram of the command transmission device 700 provided by the embodiment of the present application.
  • FIG. 9 is a schematic block diagram of a command transmission device 800 provided by an embodiment of the present application.
  • At least one (item) refers to one or more, and “plurality” refers to two or more.
  • “And/or” is used to describe the relationship between associated objects, indicating that there can be three relationships. For example, “A and/or B” can mean: only A exists, only B exists, and A and B exist simultaneously. , where A and B can be singular or plural. The character “/” generally indicates that the related objects are in an "or” relationship. “At least one of the following” or similar expressions thereof refers to any combination of these items, including any combination of a single item (items) or a plurality of items (items).
  • At least one of a, b or c can mean: a, b, c, "a and b", “a and c", “b and c", or "a and b and c” ”, where a, b, c can be single or multiple.
  • the command transmission method in asynchronous mode may include the following steps (1) to (5):
  • the CPU writes command 1 into the work queue cache 1 in the DDR.
  • the DDR may include at least one work queue cache, and the at least one work queue cache includes the work queue cache 1.
  • the CPU sends a notification message to the DSA, and the notification message includes the index of the work queue cache 1; accordingly, the DSA receives the notification message from the CPU.
  • the DSA determines the address information based on the index of the work queue cache 1 and the preset mapping relationship.
  • the address information is used to indicate the storage address of the work queue cache 1 in the DDR.
  • the mapping relationship is used to indicate the Correspondence between the index of work queue cache 1 and the storage address of work queue cache 1 in the DDR.
  • the DSA reads the command 1 from the work queue cache 1 based on the address information.
  • the CPU can carry the index of the work queue cache corresponding to the batch command through the notification message, and write the batch command into the corresponding work queue cache in the memory; accordingly, the DSA reads the batch command from the memory based on the notification message. Reading the batch command and executing it is not limited in this application.
  • commands and notification messages are transmitted asynchronously, providing greater flexibility.
  • DSA needs to first receive the notification message sent by the CPU, and then read the command from the DDR based on the notification message. There is a lot of interaction and high overhead. Especially when the data volume of the command is small, the overhead accounts for a larger proportion, which will cause the command to The transmission efficiency is poor.
  • the command transmission method in synchronous mode may include the following steps (a) to (f):
  • the CPU sends a command enqueuing instruction to the DSA.
  • the command enqueuing instruction is used to instruct command 2 to be saved to the command queue cache in the DSA.
  • the command enqueuing instruction includes the command 2; accordingly, the DSA receives from This command is queued to the instruction for this CPU.
  • the DSA determines the reception result of the command 2 based on the data amount of the command 2 and the storage space of the command queue cache, and the reception result includes reception success or reception failure.
  • the DSA continues to perform steps (d) to (e); if the reception result is a reception failure, the DSA waits for further instructions from the CPU to reacquire the command 2.
  • the DSA reads the command 2 from the command queue cache.
  • the CPU can carry batch commands through the command queue cache; accordingly, if the batch commands are received successfully, the DSA can read the batch commands from the command queue cache and execute them, which is not limited in this application.
  • the interaction is simple and the overhead is small. Especially when the data volume of the command is small, the overhead is relatively small, which can improve the efficiency of command transmission.
  • using synchronous mode to transmit commands will be limited by the storage space of the command queue cache in the DSA and the processing speed of the DSA. That is to say, the storage space of the command queue cache is small or the processing speed of the DSA is slow. Scenarios that may cause command reception to fail.
  • Figure 1 shows a schematic block diagram of a command transmission system 100 provided by an embodiment of the present application.
  • the system 100 may include: a central processing unit (CPU) 110 and an accelerator 120, wherein the CPU 110 may include an interface a1, the accelerator 120 may include an interface b1, the CPU 110 and the accelerator 120. Commands can be transmitted between accelerators 120 through the interface a1 and the interface b1.
  • CPU central processing unit
  • accelerator 120 may include an interface b1
  • the CPU 110 and the accelerator 120 can be transmitted between accelerators 120 through the interface a1 and the interface b1.
  • the accelerator 120 may be a DSA, such as an encryption and decryption engine, a hash engine, a codec engine, etc.
  • the system 100 may also include a memory 130.
  • the memory 130 may include an interface c1 and an interface c2.
  • the central processor 110 may also include an interface a2.
  • the accelerator 120 may also include an interface b2.
  • the central processor 110 and Commands can be transmitted between the memory 130 through the interface a2 and the interface c1, and commands can be transmitted between the accelerator 120 and the memory 130 through the interface b2 and the interface c2.
  • the memory 130 may be DDR.
  • system 100 can be used on a chip.
  • the command transmission system provided by the embodiment of the present application is introduced above with reference to Figure 1.
  • the command transmission method provided by the embodiment of the present application will be further introduced below.
  • FIG. 2 shows a schematic flow chart of the message transmission method 200 provided by the embodiment of the present application.
  • the method 200 can be applied to the system 100 shown in FIG. 1 .
  • the method 200 may include the following steps. It should be noted that the steps listed below may be executed in various orders and/or occur simultaneously, and are not limited to the execution order shown in FIG. 2 .
  • the central processor generates a notification message.
  • the notification message is used to notify the accelerator to execute the first command.
  • the notification message includes the identification information cached by the first work queue, the first address information and the first transmission mode information.
  • the first work queue The cache is used to store the first command, the first address information is used to indicate the storage address of the first command in the first work queue cache, and the first transmission mode information is used to indicate the transmission mode of the first command,
  • the transmission mode includes a synchronous mode or an asynchronous mode, wherein when the transmission mode of the first command is the synchronous mode, the notification message also includes the first command.
  • this application does not limit the format of the notification message.
  • the notification message may also include a first identification field, a first address field and a first transmission mode field, where the first identification field is used to carry identification information cached by the first work queue. .
  • the first address field is used to carry the first address information
  • the first transmission mode field is used to carry the first transmission mode information.
  • the notification message may also include a first command field.
  • the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronization mode
  • the first command field is used to carry the first command.
  • the first transmission mode information is used to indicate that the transmission mode of the first command is the asynchronous mode
  • the first command field is an invalid field.
  • Figure 3 shows a schematic format diagram of the notification message provided by the embodiment of the present application.
  • the notification message may include: a first identification field, a first address field, a first transmission mode field and a first command field.
  • the length of the first identification field is 16 bits
  • the length of the first address field is 16 bits.
  • the length is 32 bits
  • the length of the first transmission mode field is 1 bit
  • the length of the first command field is 463 bits.
  • the central processor can distinguish the transmission mode adopted by each command as a synchronous mode or an asynchronous mode through a unified format notification message, without modifying the central processor or requiring additional instructions.
  • the identification information can identify the first work queue cache in various ways, which is not limited in this application.
  • the identification information may include the number, name or index of the first work queue cache.
  • the memory includes work queue cache 1, work queue cache 2, ..., and work queue cache 5.
  • the first work queue cache is work queue cache 2.
  • the storage address of work queue cache 1 is: Add 0 ⁇ Add 1G.
  • the storage address of work queue cache 2 is: Add(1G+1k) ⁇ Add(2G+1k),...
  • the storage address of work queue cache 5 is: Add(4G+4k) ⁇ Add(5G+4k), where , work queue cache 1, work queue cache 2...work queue cache
  • the indexes of storage 5 are N1, N2,..., and N5.
  • the identification information can be "N2".
  • the first address information may indicate the storage address of the first command in the first work queue cache in various ways.
  • the first address information may include a storage address of the first command cached in the first work queue.
  • the first address information may be: Add(1G+3k) ⁇ Add(1G+5k).
  • the first work queue cache includes at least one storage area
  • the first address information may include an index of a storage area used to store the first command in the at least one storage area.
  • the storage addresses of the first work queue cache are: Add(1G+1k) ⁇ Add(2G+1k), and the first work queue cache is divided into storage area 1, storage area 2,..., storage areas. 5.
  • Storage area 2 is used to store the first command.
  • the indexes of storage area 1, storage area 2,..., and storage area 5 are respectively N2-Sub1, N2-Sub2,..., N2-Sub5.
  • the first command One address information can be "N2-Sub2".
  • this application does not limit the format of the command (such as the first command).
  • the format of existing commands please refer to the format of existing commands.
  • the command may include type information, address information, length information and command parameters.
  • the type information is used to indicate the command type of the command (such as read command, write command, encryption command, etc.)
  • the address information is used to indicate the storage address of the data to be processed
  • the length information is used to indicate the length of the data to be processed
  • the command parameters include parameters required during the execution of the command (such as the encryption algorithm used in encryption processing).
  • the notification message is also used to notify the accelerator to execute the second command.
  • the notification message also includes the identification information, the second address information and the second transmission mode information of the second work queue cache.
  • the second work queue cache uses When storing the second command, the second address information is used to indicate the storage address of the second command in the second work queue cache, the second transmission mode information is used to indicate the transmission mode of the second command, and the second transmission mode information is used to indicate the transmission mode of the second command.
  • the transmission mode of a command is different from the transmission mode of the second command, wherein when the transmission mode of the second command is the synchronization mode, the notification message also includes the second command.
  • the central processor can transmit commands compatible with asynchronous mode and synchronous mode through a set of message interfaces. That is to say, synchronous mode and asynchronous mode can be operated in combination, thereby improving the flexibility of command transmission. .
  • this application does not limit the storage locations of the first command and the second command.
  • the first work queue cache and the second work queue cache are the same, and the storage address of the first command in the first work queue cache is the same as the storage address of the second command in the first work queue.
  • the storage addresses in the cache are different.
  • the first work queue cache is different from the second work queue cache.
  • this application does not limit the number of commands included in the first command or the number of commands included in the second command.
  • the first command includes multiple commands.
  • the second command includes multiple commands.
  • the first command includes multiple commands
  • the second command includes multiple commands
  • the central processor can issue multiple commands in batches in asynchronous mode through a set of message interfaces, and/or, issue multiple commands in batches in synchronous mode, which can improve the flexibility of command transmission. sex and efficiency.
  • the central processor sends the notification message to the accelerator; accordingly, the accelerator receives the notification message from the central processor.
  • the method 200 may also include: the processor writes the first command based on the first target address information.
  • the first target address information is used to indicate the storage address of the first command in the memory, wherein the memory may include at least one work queue cache, and the at least one work queue cache includes the first work queue cache.
  • the central processor can indicate the transmission mode of the first command through the first transmission mode information in the notification message.
  • the central processor can use the identification information cached by the first work queue in the notification message and The first address information indicates the storage address of the first command in the memory.
  • the transmission mode of the first command is the synchronous mode
  • the first command can be carried through the notification message.
  • the accelerator may obtain the first command and execute the first command based on the notification message.
  • commands can be transmitted between the central processor and the accelerator through a set of message interfaces in asynchronous mode or synchronous mode. In this way, the central processor can choose the appropriate method to issue the command according to the characteristics of the command, and can retain the command issuance. The flexibility can gain the benefit of fast processing of short commands.
  • the accelerator obtains the first command based on the notification message.
  • S203 may include: reading the first command from the memory based on the identification information cached in the first work queue, the first address information, and the first transmission mode information.
  • reading the first command from the memory based on the identification information cached by the first work queue, the first address information and the first transmission mode information may include: when the When the first transmission mode information is used to indicate that the transmission mode of the first command is the asynchronous mode, the first command is read from the memory based on the identification information cached in the first work queue and the first address information.
  • the accelerator can cache based on the identification information of the first work queue and the third Using address information and reading the first command from the memory can reduce the storage space requirements of the accelerator and reduce the processing complexity of the accelerator.
  • reading the first command from the memory based on the identification information cached by the first work queue, the first address information and the first transmission mode information may include: The first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, but when the first command cannot be written to the command cache queue of the accelerator, based on the identification information cached in the first work queue and the third An address information is used to read the first command from the memory.
  • the asynchronous mode can be further used to read the first command from the memory.
  • the asynchronous mode can be used to solve the problem of command transmission failure caused by the storage space size of the command queue cache in the accelerator or the processing speed of the accelerator in the synchronous mode, thereby improving central processing. performance of the device.
  • the accelerator can read the first command from the memory based on the identification information cached in the first work queue and the first address information in various ways, which is not limited in this application.
  • the accelerator may determine the first target address information based on the identification information cached by the first work queue, the first address information and a preset mapping relationship, the mapping relationship being used to indicate the first A corresponding relationship between the identification information cached by the work queue and the storage address cached by the first work queue in the memory.
  • the first target address information is used to indicate the storage address of the first command in the memory; based on the The first target address information is read from the memory and the first command is read.
  • the accelerator may write the first command into the memory based on the first target address information.
  • S203 may include: when the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, and the first command can be written to the command cache queue of the accelerator, from the command cache The first command is read from the queue.
  • the method before reading the first command from the command cache queue, the method further includes: writing the first command into the command cache queue.
  • the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode
  • the first command can be written into the command cache queue of the accelerator, from Reading the first command from the command cache queue can reduce interaction overhead, thereby improving command transmission efficiency.
  • the accelerator executes the first command.
  • Figure 4 shows a schematic flow chart of the command transmission method 300 provided by the embodiment of the present application.
  • the method 300 may be applied to the system 100 as shown in FIG. 1 .
  • the method 300 may include the following steps. It should be noted that the steps listed below may be executed in various orders and/or occur simultaneously, and are not limited to the execution order shown in FIG. 4 .
  • the central processor generates a notification message.
  • the notification message is used to notify the accelerator to execute the first command.
  • the notification message includes the identification information cached by the first work queue, the first address information and the first transmission mode information.
  • the first work queue The cache is used to store the first command, the first address information is used to indicate the storage address of the first command in the first work queue cache, and the first transmission mode information is used to indicate that the transmission mode of the first command is Asynchronous mode.
  • the central processor sends the notification message to the accelerator; accordingly, the accelerator receives the notification message from the processor.
  • the processor writes the first command into the memory based on the first target address information.
  • the first target address information is used to indicate the storage address of the first command in the memory.
  • the memory includes at least one work queue cache, The at least one work queue cache includes the first work queue cache.
  • the accelerator determines the first target address information based on the identification information cached in the first work queue, the preset mapping relationship and the first address information.
  • the mapping relationship is used The corresponding relationship between the identification information indicating the first work queue cache and the storage address of the first work queue cache in the memory.
  • the accelerator reads the first command from the memory based on the first target address information.
  • the accelerator executes the first command.
  • Figure 5 shows a schematic flow chart of the command transmission method 400 provided by the embodiment of the present application.
  • the method 400 may be applied to the system 100 as shown in FIG. 1 .
  • the method 400 may include the following steps. It should be noted that the steps listed below may be executed in various orders and/or occur simultaneously, and are not limited to the execution order shown in FIG. 5 .
  • the central processor generates a notification message, which is used to notify the accelerator to execute the first command.
  • the notification message includes the identification information cached by the first work queue, the first address information, the first transmission mode information and the first command,
  • the first work queue cache is used to store the first command, the first address information is used to indicate the storage address of the first command in the first work queue cache, and the first transmission mode information is used to indicate the first
  • the transmission mode of the command is synchronous mode.
  • the central processor sends the notification message to the accelerator; accordingly, the accelerator receives the notification message from the central processor.
  • the accelerator determines whether the first command can be written into the command queue cache of the accelerator based on the transmission mode of the first command being the synchronous mode. If the first command cannot be written into the command queue buffer, continue to execute S404-S406; if the first command can be written into the command queue buffer, continue to execute S407-S408.
  • the accelerator determines the first target address information based on the identification information cached in the first work queue, the preset mapping relationship and the first address information.
  • the first target address information is used to indicate the location of the first command in the memory.
  • Storage address, the mapping relationship is used to indicate the correspondence between the identification information of the first work queue cache and the storage address of the first work queue cache in the memory, wherein the memory includes at least one work queue cache, the at least A work queue cache includes the first work queue cache.
  • the accelerator writes the first command into the memory based on the first target address information.
  • the accelerator reads the command from the memory based on the first target address information.
  • the accelerator writes the first command into the command queue cache.
  • the accelerator reads the first command from the command queue cache.
  • the accelerator executes the first command.
  • the command transmission method provided by the embodiment of the present application is introduced above with reference to Figures 2 to 5.
  • the command transmission device provided by the embodiment of the present application will be further introduced below.
  • FIG. 6 shows a schematic block diagram of the command transmission device 500 provided by the embodiment of the present application.
  • the device 500 may include: a generating module 501 and a sending module 502.
  • the device 500 can be used in the above-mentioned system 100. Further, the device 500 can be the central processor 110 in the above-mentioned system 100.
  • the generation module 501 is used to generate a notification message.
  • the notification message is used to notify the accelerator to execute the first command.
  • the notification message includes the identification information cached by the first work queue, the first address information and the first transmission mode information.
  • the first work queue cache is used to store the first command
  • the first address information is used to indicate the storage address of the first command in the first work queue cache
  • the first transmission mode information is used to Indicates the transmission mode of the first command.
  • the transmission mode includes a synchronous mode or an asynchronous mode. When the transmission mode of the first command is the synchronous mode, the notification message also includes the first command. .
  • the sending module 502 is used to send the notification message to the accelerator.
  • the notification message is also used to notify the accelerator to execute the second command, and the notification message also includes the identification information cached by the second work queue, the second address information and the second transmission mode information.
  • the second work queue cache is used to store the second command, and the second address information is used to indicate where the second command is located.
  • the storage address in the second work queue cache, the second transmission mode information is used to indicate the transmission mode of the second command, the transmission mode of the first command is different from the transmission mode of the second command, wherein , when the transmission mode of the second command is the synchronization mode, the notification message further includes the second command.
  • the first work queue cache and the second work queue cache are the same, and the storage address of the first command in the first work queue cache is the same as the storage address of the second command in the first work queue.
  • the storage addresses in the cache are different; or, the first work queue cache and the second work queue cache are different.
  • the first command includes multiple commands
  • the second command includes multiple commands
  • the notification message also includes a first identification field, a first address field, a first transmission mode field, and a first command field.
  • the first identification field is used to carry the first work queue cache.
  • the identification information and the first address field are used to carry the first address information
  • the first transmission mode field is used to carry the first transmission mode information
  • the first command field is used to carry the first command.
  • the device 500 also includes a writing module 503.
  • the writing module 503 is configured to write the first command based on the first target address information when the first transmission mode information is used to indicate that the transmission mode of the first command is an asynchronous mode.
  • the command is written into the memory, and the first target address information is used to indicate the storage address of the first command in the memory.
  • the device 500 may be specifically a central processing unit in the above-mentioned method 200, method 300 or method 400 embodiments, and the device 500 may be used to perform the above-mentioned method 200, method 300 or method 400 embodiments with the central processing unit. To avoid duplication, the various processes and/or steps corresponding to the processor will not be described again here.
  • One or more of the various modules in the embodiment shown in Figure 6 may be implemented through software, hardware, firmware, or a combination thereof.
  • the software or firmware includes, but is not limited to, computer program instructions or code, and may be executed by a hardware processor.
  • the hardware includes but is not limited to various types of integrated circuits, such as central processing unit (CPU), digital signal processor (DSP), field programmable gate array (FPGA) or field programmable gate array (FPGA).
  • ASIC Application Specific Integrated Circuit
  • Figure 7 shows a schematic block diagram of a command transmission device 600 provided by an embodiment of the present application.
  • the device 600 may include a processor 601 and a communication interface 602.
  • the processor 601 is coupled to the communication interface 602.
  • the communication interface 602 is used to output data, such as notification messages, from the processor 601; the processor 601 is used to run computer programs or instructions, so that the device 600 implements the method described in the above method 200, method 300 or method 400 embodiment. .
  • the processor 601 in the embodiment of this application includes but is not limited to a central processing unit (Central Processing Unit, CPU), a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC). ), off-the-shelf programmable gate array (Field Programmable Gate Array, FPGA), discrete gate or transistor logic devices or discrete hardware components, etc.
  • a general-purpose processor can be a microprocessor, a microcontroller, or any conventional processor.
  • the processor 601 is used to generate a notification message.
  • the notification message is used to notify the accelerator to execute the first command.
  • the notification message includes the identification information cached by the first work queue, the first address information and the first transmission mode information.
  • a work queue cache is used to store the first command, and the first address information is used to indicate that the first command is in the first work queue.
  • the first transmission mode information is used to indicate the transmission mode of the first command.
  • the transmission mode includes a synchronous mode or an asynchronous mode. When the transmission mode of the first command is the synchronous mode,
  • the notification message also includes the first command; the notification message is sent to the accelerator through the communication interface 602.
  • the device 600 can be specifically a central processing unit in the above method 200, method 300 or method 400 embodiment, and the device 600 can be used to execute the above method 200, method 300. Or the various processes and/or steps corresponding to the central processor in the method 400 embodiment will not be described again in order to avoid duplication.
  • the device 600 may also include a memory 603.
  • the memory 603 may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory.
  • non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electrically removable memory.
  • Erase programmable read-only memory Electrode EPROM, EEPROM
  • Volatile memory may be Random Access Memory (RAM), which is used as an external cache.
  • RAM static random access memory
  • DRAM dynamic random access memory
  • DRAM synchronous dynamic random access memory
  • SDRAM double data rate synchronous dynamic random access memory
  • Double Data Rate SDRAM DDR SDRAM
  • ESDRAM enhanced synchronous dynamic random access memory
  • Synchlink DRAM SLDRAM
  • Direct Rambus RAM Direct Rambus RAM
  • the memory 603 is used to store program codes and instructions of the device 600 .
  • the memory 603 is also used to store data obtained when the processor 601 executes the above-mentioned method 200, method 300 or method 400 embodiments, such as notification messages or commands.
  • the memory 603 may be a separate device or integrated in the processor 601.
  • FIG. 7 only shows a simplified design of the device 600.
  • the device 600 may also include other necessary components, including but not limited to any number of communication interfaces, processors, controllers, memories, etc., and all devices 600 that can implement the present application are included in the present application. within the scope of protection.
  • the device 600 may be a chip device.
  • the chip device can also include one or more memories for storing computer execution instructions.
  • the processor can execute the computer execution instructions stored in the memory, so that the chip device executes the above command transmission method. .
  • the chip device can be a field programmable gate array, a dedicated integrated chip, a system chip, a central processing unit, a network processor, a digital signal processing circuit, a microcontroller, or a programmable controller that implements related functions. or other integrated chips.
  • Figure 8 shows a schematic block diagram of the command transmission device 700 provided by the embodiment of the present application.
  • the device 700 may include: a receiving module 701, a reading module 702, and an execution module 703.
  • the device 700 can be used in the above-mentioned system 100. Further, the device 700 can be the accelerator 120 in the above-mentioned system 100.
  • the receiving module 701 is used to receive a notification message from the processor.
  • the notification message is used to notify the accelerator to execute the first command.
  • the notification message includes the identification information cached by the first work queue, the first address information and the first transmission mode information.
  • the first work queue cache is used to store the first command, and the first address information is used to indicate that the first command is in the The storage address in the first work queue cache.
  • the first transmission mode information is used to indicate the transmission mode of the first command.
  • the transmission mode includes a synchronous mode or an asynchronous mode. When the transmission mode of the first command is the synchronous mode, mode, the notification message also includes the first command.
  • the reading module 702 is used to obtain the first command based on the notification message.
  • the execution module 703 is used to execute the first command.
  • the notification message is also used to notify the accelerator to execute the second command.
  • the notification message also includes the identification information cached by the second work queue, the second address information and the second transmission mode information.
  • the second work queue cache is used to store the second command
  • the second address information is used to indicate the storage address of the second command in the second work queue cache
  • the second transmission mode information is used to indicate the storage address of the second command. Transmission mode.
  • the transmission mode of the first command is different from the transmission mode of the second command.
  • the notification message also includes the second command; the reading module 702 It is also used to obtain the second command based on the notification message; the execution module 703 is also used to execute the second command.
  • the first work queue cache is the same as the second work queue cache, but the storage address of the first command in the first work queue cache is the same as the storage address of the second command in the first work queue cache.
  • the storage addresses in the queue cache are different; or, the first work queue cache and the second work queue cache are different.
  • the first command includes multiple commands
  • the second command includes multiple commands
  • the notification message also includes a first identification field, a first address field, a first transmission mode field, and a first command field.
  • the first identification field is used to carry the first work queue cache.
  • the identification information and the first address field are used to carry the first address information
  • the first transmission mode field is used to carry the first transmission mode information
  • the first command field is used to carry the first command.
  • the reading module 702 is specifically configured to read the first work queue cached identification information, the first address information and the first transmission mode information from the memory. One command.
  • the reading module 702 is specifically used to: when the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, but the first command cannot be written to the accelerator When the command cache queue is cached, the first command is read from the memory based on the identification information cached in the first work queue and the first address information.
  • the device 700 further includes: a determining module 704.
  • the determining module 704 is configured to determine the first target address information based on the identification information cached by the first work queue, the first address information and a preset mapping relationship, and the mapping relationship is used for Indicates the correspondence between the identification information cached by the first work queue and the storage address cached by the first work queue in the memory.
  • the first target address information is used to indicate the storage address of the first command in the memory.
  • the reading module 702 is specifically configured to read the first command from the memory based on the first target address information.
  • the device 700 also includes: a writing module 705.
  • the writing module 705 is configured to write the first command based on the first target address information before reading the first command from the memory based on the first target address information. Write to this memory.
  • the reading module 702 is also configured to: when the first transmission mode information is used to indicate that the transmission mode of the first command is the asynchronous mode, based on the identification information cached in the first work queue and the first address information, and reads the first command from the memory.
  • the reading module 702 is also used to: when the first transmission mode information is used to indicate the When the transmission mode of the first command is the synchronous mode, and the first command can be written into the command cache queue of the accelerator, the first command is read from the command cache queue.
  • the writing module 705 is also configured to write the first command into the command cache queue before reading the first command from the command cache queue.
  • the device 700 may be specifically an accelerator in the above-mentioned method 200, method 300 or method 400 embodiments, and the device 700 may be used to execute the accelerator corresponding to the above-mentioned method 200, method 300 or method 400 embodiments. To avoid repetition, various processes and/or steps will not be described again here.
  • One or more of the various modules in the embodiment shown in Figure 8 may be implemented through software, hardware, firmware, or a combination thereof.
  • the software or firmware includes, but is not limited to, computer program instructions or code, and may be executed by a hardware processor.
  • the hardware includes but is not limited to various types of integrated circuits, such as central processing unit (CPU), digital signal processor (DSP), field programmable gate array (FPGA) or field programmable gate array (FPGA).
  • ASIC Application Specific Integrated Circuit
  • Figure 9 shows a schematic block diagram of a command transmission device 800 provided by an embodiment of the present application.
  • the device 800 may include a processor 801 and a communication interface 802.
  • the processor 801 is coupled to the communication interface 802.
  • the communication interface 802 is used to provide data, such as notification messages, to the processor 801; the processor 801 is used to run computer programs or instructions, so that the device 800 implements the method described in the above method 200, method 300 or method 400 embodiment. .
  • the processor 801 in the embodiment of this application includes but is not limited to a central processing unit (Central Processing Unit, CPU), a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC ), off-the-shelf programmable gate array (Field Programmable Gate Array, FPGA), discrete gate or transistor logic devices or discrete hardware components, etc.
  • a general-purpose processor can be a microprocessor, a microcontroller, or any conventional processor.
  • the processor 801 is configured to receive a notification message from the processor through the communication interface 802.
  • the notification message is used to notify the accelerator to execute the first command.
  • the notification message includes the identification information and the first address information cached by the first work queue. and first transmission mode information, the first work queue cache is used to store the first command, the first address information is used to indicate the storage address of the first command in the first work queue cache, the first transmission mode The information is used to indicate the transmission mode of the first command.
  • the transmission mode includes a synchronous mode or an asynchronous mode. When the transmission mode of the first command is the synchronous mode, the notification message also includes the first command; based on the Notify the message to obtain the first command; execute the first command.
  • the device 800 can be specifically an accelerator in the above method 200, method 300 or method 400 embodiment, and the device 800 can be used to execute the above method 200, method 300 or method.
  • various processes and/or steps corresponding to the accelerator in the embodiment 400 will not be described again here.
  • the device 800 may also include a memory 803.
  • the memory 803 may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory.
  • the non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electrically removable memory. Erase programmable read-only memory (Electrically EPROM, EEPROM) or flash memory.
  • Volatile The permanent memory may be Random Access Memory (RAM), which is used as an external cache.
  • RAM static random access memory
  • DRAM dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • Enhanced SDRAM, ESDRAM enhanced synchronous dynamic random access memory
  • Synchlink DRAM, SLDRAM synchronous link dynamic random access memory
  • Direct Rambus RAM Direct Rambus RAM
  • the memory 803 is used to store program codes and instructions of the device 800 .
  • the memory 803 is also used to store data obtained when the processor 801 executes the above-mentioned method 200, method 300 or method 400 embodiments, such as notification messages or commands.
  • the memory 803 may be a separate device or integrated in the processor 801.
  • FIG. 9 only shows a simplified design of the device 800.
  • the device 800 may also include other necessary components, including but not limited to any number of communication interfaces, processors, controllers, memories, etc., and all devices 800 that can implement the present application are included in the present application. within the scope of protection.
  • the device 800 may be a chip device.
  • the chip device can also include one or more memories for storing computer execution instructions.
  • the processor can execute the computer execution instructions stored in the memory, so that the chip device executes the above command transmission method. .
  • the chip device can be a field programmable gate array, a dedicated integrated chip, a system chip, a central processing unit, a network processor, a digital signal processing circuit, a microcontroller, or a programmable controller that implements related functions. or other integrated chips.
  • the size of the sequence numbers of the above-mentioned processes does not mean the order of execution.
  • the execution order of each process should be determined by its functions and internal logic, and should not be used in the embodiments of the present application.
  • the implementation process constitutes any limitation.
  • the disclosed systems, devices and methods can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product.
  • the computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application.
  • the aforementioned storage media include: U disk, mobile hard disk, Read Only Memory (ROM), Random Access Memory (RAM), magnetic disk or optical disk and other media that can store program code.

Abstract

Provided in the present application are a command transmission method and apparatus. A command can be transmitted in an asynchronous mode or a synchronous mode by means of a set of message interfaces, such that the flexibility of command transmission can be improved. The method can comprise: generating a notification message, wherein the notification message is used for notifying an accelerator to execute a first command, the notification message comprises identification information of a first work queue cache, first address information and first transmission mode information, the first work queue cache is used for storing the first command, the first address information is used for indicating a storage address of the first command in the first work queue cache, the first transmission mode information is used for indicating a transmission mode of the first command, the transmission mode comprises a synchronous mode or an asynchronous mode, and when the transmission mode of the first command is the synchronous mode, the notification message further comprises the first command; and sending the notification message to the accelerator.

Description

命令传输方法和装置Command transmission method and device
本申请要求于2022年04月28日提交中国专利局、申请号为202210460670.6、申请名称为“命令传输方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the China Patent Office on April 28, 2022, with application number 202210460670.6 and the application title "Command Transmission Method and Device", the entire content of which is incorporated into this application by reference.
技术领域Technical field
本申请涉及芯片技术领域,并且更具体地,涉及一种命令传输方法和装置。The present application relates to the field of chip technology, and more specifically, to a command transmission method and device.
背景技术Background technique
现有的芯片中除了包括中央处理器(central processing unit,CPU)以外,通常还会包括各类加速引擎,如加解密引擎、哈希引擎、编解码引擎等,这些加速引擎统称为专用加速器(domain special accelerate,DSA)。DSA可以卸载典型数据处理,以减少CPU的占用,从而提高系统的整体性能,如加解密引擎可以实现加解密运算,哈希引擎可以实现哈希运算,编解码引擎可以实现视频编解码等。DSA可以从CPU处获取命令,并执行该命令以实现上述各种数据处理。In addition to the central processing unit (CPU), existing chips usually also include various acceleration engines, such as encryption and decryption engines, hash engines, encoding and decoding engines, etc. These acceleration engines are collectively called dedicated accelerators ( domain special accelerate, DSA). DSA can offload typical data processing to reduce CPU usage, thereby improving the overall performance of the system. For example, the encryption and decryption engine can implement encryption and decryption operations, the hash engine can implement hash operations, and the codec engine can implement video encoding and decoding. DSA can obtain commands from the CPU and execute the commands to achieve the above various data processing.
现有技术中,CPU可以通过异步模式或同步模式向DSA下发至少一个命令,其中,异步模式即该至少一个命令和该至少一个命令的通知消息分别下发至DSA,同步模式即将该至少一个命令携带在该至少一个命令的通知消息中一起下发至DSA。In the prior art, the CPU can issue at least one command to the DSA through an asynchronous mode or a synchronous mode. The asynchronous mode means that the at least one command and the notification message of the at least one command are respectively sent to the DSA. The synchronous mode means that the at least one command is sent to the DSA. The command is carried in the notification message of the at least one command and is sent to the DSA together.
然而,由于同步模式和异步模式采用不同的消息接口,因此,命令传输的灵活性较差。However, since synchronous mode and asynchronous mode use different message interfaces, command transmission is less flexible.
发明内容Contents of the invention
本申请提供一种命令传输方法,可以通过一套消息接口采用异步模式或同步模式传输命令,能够提高命令传输的灵活性。This application provides a command transmission method, which can transmit commands in asynchronous mode or synchronous mode through a set of message interfaces, which can improve the flexibility of command transmission.
第一方面,本申请提供一种命令传输方法,该方法可以用于中央处理器,该方法可以包括:生成通知消息,该通知消息用于通知加速器执行第一命令,该通知消息包括第一工作队列缓存的标识信息、第一地址信息和第一传输模式信息,该第一工作队列缓存用于存储该第一命令,该第一地址信息用于指示该第一命令在该第一工作队列缓存内的存储地址,该第一传输模式信息用于指示该第一命令的传输模式,该传输模式包括同步模式或异步模式,其中,当该第一命令的传输模式为该同步模式时,该通知消息还包括该第一命令;向该加速器发送该通知消息。In a first aspect, this application provides a command transmission method, which can be used for a central processor. The method can include: generating a notification message, the notification message being used to notify the accelerator to execute the first command, the notification message including the first work The identification information, first address information and first transmission mode information of the queue cache. The first work queue cache is used to store the first command. The first address information is used to indicate that the first command is stored in the first work queue cache. The first transmission mode information is used to indicate the transmission mode of the first command. The transmission mode includes a synchronous mode or an asynchronous mode. When the transmission mode of the first command is the synchronous mode, the notification The message also includes the first command; sending the notification message to the accelerator.
采用本申请提供的命令传输方法,中央处理器可以通过通知消息中的第一传输模式信息指示第一命令的传输模式,该中央处理器可以通过通知消息中的第一工作队列缓存的标识信息和第一地址信息指示该第一命令在内存中的存储地址,当该第一命令的传输模式为同步模式时,通过该通知消息可以承载该第一命令。相应地,该加速器可以基于该通知消息,获取该第一命令并执行该第一命令。也就是说,中央处理器和加速器之间可以通过一套消息接口采用异步模式或同步模式传输命令,这样,中央处理器可以根据命令的特性选 择合适的方式进行下发,既可以保留命令下发的灵活性又可以获得快速处理短命令的收益。Using the command transmission method provided by this application, the central processor can indicate the transmission mode of the first command through the first transmission mode information in the notification message. The central processor can use the identification information cached by the first work queue in the notification message and The first address information indicates the storage address of the first command in the memory. When the transmission mode of the first command is the synchronous mode, the first command can be carried through the notification message. Correspondingly, the accelerator may obtain the first command and execute the first command based on the notification message. In other words, commands can be transmitted between the central processor and the accelerator through a set of message interfaces in asynchronous mode or synchronous mode. In this way, the central processor can select the command according to the characteristics of the command. By choosing an appropriate method for delivery, you can retain the flexibility of command delivery and gain the benefit of quickly processing short commands.
在一种可能的实现方式中,该通知消息还用于通知该加速器执行第二命令,该通知消息还包括第二工作队列缓存的标识信息、第二地址信息和第二传输模式信息,该第二工作队列缓存用于存储该第二命令,该第二地址信息用于指示该第二命令在该第二工作队列缓存内的存储地址,该第二传输模式信息用于指示该第二命令的传输模式,该第一命令的传输模式与该第二命令的传输模式不同,其中,当该第二命令的传输模式为该同步模式时,该通知消息还包括该第二命令。In a possible implementation, the notification message is also used to notify the accelerator to execute the second command. The notification message also includes the identification information cached by the second work queue, the second address information and the second transmission mode information. The second work queue cache is used to store the second command, the second address information is used to indicate the storage address of the second command in the second work queue cache, and the second transmission mode information is used to indicate the storage address of the second command. Transmission mode. The transmission mode of the first command is different from the transmission mode of the second command. When the transmission mode of the second command is the synchronization mode, the notification message also includes the second command.
采用本申请实施例提供的命令传输方法,中央处理器通过可以通过一套消息接口兼容异步模式和同步模式传输命令,也就是说,同步模式和异步模式可以结合运行,从而提高命令传输的灵活性。Using the command transmission method provided by the embodiments of this application, the central processor can transmit commands compatible with asynchronous mode and synchronous mode through a set of message interfaces. That is to say, synchronous mode and asynchronous mode can be operated in combination, thereby improving the flexibility of command transmission. .
在一种可能的实现方式中,该第一工作队列缓存与该第二工作队列缓存相同,该第一命令在该第一工作队列缓存内的存储地址与该第二命令在该第一工作队列缓存内的存储地址不同;或者,该第一工作队列缓存与该第二工作队列缓存不同。In a possible implementation, the first work queue cache and the second work queue cache are the same, and the storage address of the first command in the first work queue cache is the same as the storage address of the second command in the first work queue. The storage addresses in the cache are different; or, the first work queue cache and the second work queue cache are different.
采用本申请实施例提供的命令传输方法,不同命令可以写入同一工作队列缓存中的不同存储地址,或者可以写入不同的工作队列缓存,能够提高命令读写的灵活性。Using the command transmission method provided by the embodiments of this application, different commands can be written to different storage addresses in the same work queue cache, or can be written to different work queue caches, which can improve the flexibility of command reading and writing.
此外,当不同命令写入同一工作队列缓存时,不同命令可以通过通知消息中的第一地址信息可以共享相同的工作队列缓存,从而实现协同工作。In addition, when different commands write to the same work queue cache, the different commands can share the same work queue cache through the first address information in the notification message, thereby achieving collaborative work.
在一种可能的实现方式中,该第一命令包括多个命令,和/或,该第二命令包括多个命令。In a possible implementation, the first command includes multiple commands, and/or the second command includes multiple commands.
采用本申请实施例提供的命令传输方法,中央处理器可以通过一套消息接口采用异步模式批量下发多个命令,和/或,采用同步模式批量下发多个命令,能够提高命令传输的灵活性和效率。Using the command transmission method provided by the embodiments of this application, the central processor can issue multiple commands in batches in asynchronous mode through a set of message interfaces, and/or, issue multiple commands in batches in synchronous mode, which can improve the flexibility of command transmission. sex and efficiency.
在一种可能的实现方式中,该通知消息还包括第一标识字段、第一地址字段、第一传输模式字段和第一命令字段,该第一标识字段用于承载该第一工作队列缓存的标识信息、该第一地址字段用于承载该第一地址信息,该第一传输模式字段用于承载该第一传输模式信息,该第一命令字段用于承载该第一命令。In a possible implementation, the notification message also includes a first identification field, a first address field, a first transmission mode field, and a first command field. The first identification field is used to carry the first work queue cache. The identification information and the first address field are used to carry the first address information, the first transmission mode field is used to carry the first transmission mode information, and the first command field is used to carry the first command.
采用本申请实施例提供的命令传输方法,中央处理器通过统一格式的通知消息就可以区分各命令采用的传输模式为同步模式或异步模式,无需修改中央处理器也无需额外的指令。Using the command transmission method provided by the embodiments of this application, the central processor can distinguish the transmission mode adopted by each command as a synchronous mode or an asynchronous mode through a unified format notification message, without modifying the central processor or requiring additional instructions.
在一种可能的实现方式中,当该第一传输模式信息用于指示该第一命令的传输模式为异步模式时,该方法还可以包括:基于第一目标地址信息,将该第一命令写入内存中,该第一目标地址信息用于指示该第一命令在该内存中的存储地址。In a possible implementation, when the first transmission mode information is used to indicate that the transmission mode of the first command is an asynchronous mode, the method may further include: writing the first command based on the first target address information. into the memory, and the first target address information is used to indicate the storage address of the first command in the memory.
第二方面,本申请还提供一种命令传输方法,该方法可以用于加速器,该方法可以包括:接收来自处理器的通知消息,该通知消息用于通知加速器执行第一命令,该通知消息包括第一工作队列缓存的标识信息、第一地址信息和第一传输模式信息,该第一工作队列缓存用于存储该第一命令,该第一地址信息用于指示该第一命令在该第一工作队列缓存内的存储地址,该第一传输模式信息用于指示该第一命令的传输模式,该传输模式包括同步模式或异步模式,其中,当该第一命令的传输模式为该同步模式时,该通知消息还包括该第一命令;基于该通知消息,获取该第一命令;执行该第一命令。 In a second aspect, this application also provides a command transmission method, which can be used for an accelerator. The method can include: receiving a notification message from the processor, the notification message being used to notify the accelerator to execute the first command, the notification message including The first work queue buffers the identification information, the first address information and the first transmission mode information. The first work queue buffer is used to store the first command. The first address information is used to indicate that the first command is in the first The storage address in the work queue cache. The first transmission mode information is used to indicate the transmission mode of the first command. The transmission mode includes a synchronous mode or an asynchronous mode. When the transmission mode of the first command is the synchronous mode, , the notification message also includes the first command; based on the notification message, the first command is obtained; and the first command is executed.
采用本申请提供的命令传输方法,中央处理器可以通过通知消息中的第一传输模式信息指示第一命令的传输模式,该中央处理器可以通过通知消息中的第一工作队列缓存的标识信息和第一地址信息指示该第一命令在内存中的存储地址,当该第一命令的传输模式为同步模式时,通过该通知消息可以承载该第一命令。相应地,该加速器可以基于该通知消息,获取该第一命令并执行该第一命令。也就是说,中央处理器和加速器之间可以通过一套消息接口采用异步模式或同步模式传输命令,这样,中央处理器可以根据命令的特性选择合适的方式进行下发,既可以保留命令下发的灵活性又可以获得快速处理短命令的收益。Using the command transmission method provided by this application, the central processor can indicate the transmission mode of the first command through the first transmission mode information in the notification message. The central processor can use the identification information cached by the first work queue in the notification message and The first address information indicates the storage address of the first command in the memory. When the transmission mode of the first command is the synchronous mode, the first command can be carried through the notification message. Correspondingly, the accelerator may obtain the first command and execute the first command based on the notification message. In other words, commands can be transmitted between the central processor and the accelerator through a set of message interfaces in asynchronous mode or synchronous mode. In this way, the central processor can choose the appropriate method to issue the command according to the characteristics of the command, and can retain the command issuance. The flexibility can gain the benefit of fast processing of short commands.
在一种可能的实现方式中,该通知消息还用于通知该加速器执行第二命令,该通知消息还包括第二工作队列缓存的标识信息、第二地址信息和第二传输模式信息,该第二工作队列缓存用于存储该第二命令,该第二地址信息用于指示该第二命令在该第二工作队列缓存内的存储地址,该第二传输模式信息用于指示该第二命令的传输模式,该第一命令的传输模式与该第二命令的传输模式不同,其中,当该第二命令的传输模式为该同步模式时,该通知消息还包括该第二命令,该方法还包括:基于该通知消息,获取该第二命令;执行该第二命令。In a possible implementation, the notification message is also used to notify the accelerator to execute the second command. The notification message also includes the identification information cached by the second work queue, the second address information and the second transmission mode information. The second work queue cache is used to store the second command, the second address information is used to indicate the storage address of the second command in the second work queue cache, and the second transmission mode information is used to indicate the storage address of the second command. Transmission mode, the transmission mode of the first command is different from the transmission mode of the second command, wherein when the transmission mode of the second command is the synchronization mode, the notification message also includes the second command, and the method further includes : Based on the notification message, obtain the second command; execute the second command.
采用本申请实施例提供的命令传输方法,中央处理器通过可以通过一套消息接口兼容异步模式和同步模式传输命令,也就是说,同步模式和异步模式可以结合运行,从而提高命令传输的灵活性。Using the command transmission method provided by the embodiments of this application, the central processor can transmit commands compatible with asynchronous mode and synchronous mode through a set of message interfaces. That is to say, synchronous mode and asynchronous mode can be operated in combination, thereby improving the flexibility of command transmission. .
在一种可能的实现方式中,该第一工作队列缓存与该第二工作队列缓存相同,但该第一命令在该第一工作队列缓存内的存储地址与该第二命令在该第一工作队列缓存内的存储地址不同;或者,该第一工作队列缓存与该第二工作队列缓存不同。In a possible implementation, the first work queue cache is the same as the second work queue cache, but the storage address of the first command in the first work queue cache is the same as the storage address of the second command in the first work queue cache. The storage addresses in the queue cache are different; or, the first work queue cache and the second work queue cache are different.
采用本申请实施例提供的命令传输方法,不同命令可以写入同一工作队列缓存中的不同存储地址,或者可以写入不同的工作队列缓存,能够提高命令读写的灵活性。Using the command transmission method provided by the embodiments of this application, different commands can be written to different storage addresses in the same work queue cache, or can be written to different work queue caches, which can improve the flexibility of command reading and writing.
此外,当不同命令写入同一工作队列缓存时,不同命令可以通过通知消息中的第一地址信息可以共享相同的工作队列缓存,从而实现协同工作。In addition, when different commands write to the same work queue cache, the different commands can share the same work queue cache through the first address information in the notification message, thereby achieving collaborative work.
在一种可能的实现方式中,该第一命令包括多个命令,和/或,该第二命令包括多个命令。In a possible implementation, the first command includes multiple commands, and/or the second command includes multiple commands.
采用本申请实施例提供的命令传输方法,中央处理器可以通过一套消息接口采用异步模式批量下发多个命令,和/或,采用同步模式批量下发多个命令,能够提高命令传输的灵活性和效率。Using the command transmission method provided by the embodiments of this application, the central processor can issue multiple commands in batches in asynchronous mode through a set of message interfaces, and/or, issue multiple commands in batches in synchronous mode, which can improve the flexibility of command transmission. sex and efficiency.
在一种可能的实现方式中,该通知消息还包括第一标识字段、第一地址字段、第一传输模式字段和第一命令字段,该第一标识字段用于承载该第一工作队列缓存的标识信息、该第一地址字段用于承载该第一地址信息,该第一传输模式字段用于承载该第一传输模式信息,该第一命令字段用于承载该第一命令。In a possible implementation, the notification message also includes a first identification field, a first address field, a first transmission mode field, and a first command field. The first identification field is used to carry the first work queue cache. The identification information and the first address field are used to carry the first address information, the first transmission mode field is used to carry the first transmission mode information, and the first command field is used to carry the first command.
在一种可能的实现方式中,该基于该通知消息,获取该第一命令,包括:基于该第一工作队列缓存的标识信息、该第一地址信息和该第一传输模式信息,从该内存中读取该第一命令。In a possible implementation, obtaining the first command based on the notification message includes: based on the identification information cached in the first work queue, the first address information and the first transmission mode information, from the memory Read the first command in .
采用本申请实施例提供的命令传输方法,中央处理器通过统一格式的通知消息就可以区分各命令采用的传输模式为同步模式或异步模式,无需修改中央处理器也无需额外的指令。 Using the command transmission method provided by the embodiments of this application, the central processor can distinguish the transmission mode adopted by each command as a synchronous mode or an asynchronous mode through a unified format notification message, without modifying the central processor or requiring additional instructions.
在一种可能的实现方式中,该基于该第一工作队列缓存的标识信息、该第一地址信息和该第一传输模式信息,从该内存中读取该第一命令,包括:当该第一传输模式信息用于指示该第一命令的传输模式为该同步模式,但该第一命令不能写入该加速器的命令缓存队列时,基于该第一工作队列缓存的标识信息和该第一地址信息,从该内存中读取该第一命令。In a possible implementation, reading the first command from the memory based on the identification information cached by the first work queue, the first address information and the first transmission mode information includes: when the first A transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, but when the first command cannot be written to the command cache queue of the accelerator, based on the identification information cached in the first work queue and the first address Information, the first command is read from this memory.
采用本申请实施例提供的命令传输方法,当该第一命令的传输模式为同步模式,当该第一命令不能写入加速器的命令缓存队列时,可以进一步采用异步模式从内存中读取该第一命令。也就是说,可以通过异步模式解决在同步模式下由于加速器中的命令队列缓存的存储空间大小或加速器的处理速度的原因导致的命令传输失败的问题,从而提升中央处理器的性能。Using the command transmission method provided by the embodiment of the present application, when the transmission mode of the first command is synchronous mode, and when the first command cannot be written into the command cache queue of the accelerator, the asynchronous mode can be further used to read the first command from the memory. One command. In other words, the asynchronous mode can be used to solve the problem of command transmission failure caused by the storage space size of the command queue cache in the accelerator or the processing speed of the accelerator in the synchronous mode, thereby improving the performance of the central processor.
在一种可能的实现方式中,该基于该第一工作队列缓存的标识信息和该第一地址信息,从该内存中读取该第一命令,包括:基于该第一工作队列缓存的标识信息、该第一地址信息和预设的映射关系,确定第一目标地址信息,该映射关系用于指示该第一工作队列缓存的标识信息和该第一工作队列缓存在该内存中的存储地址之间的对应关系,该第一目标地址信息用于指示该第一命令在该内存中的存储地址;基于该第一目标地址信息,从该内存中读取该第一命令。In a possible implementation, reading the first command from the memory based on the identification information cached by the first work queue and the first address information includes: based on the identification information cached by the first work queue , the first address information and the preset mapping relationship determine the first target address information. The mapping relationship is used to indicate the identification information cached by the first work queue and the storage address cached by the first work queue in the memory. The first target address information is used to indicate the storage address of the first command in the memory; based on the first target address information, the first command is read from the memory.
可选地,该映射关系可以预先配置在该加速器中,或者该加速器可以预先从其它装置处获取该映射关系,本申请实施例对此不作限定。Optionally, the mapping relationship may be pre-configured in the accelerator, or the accelerator may obtain the mapping relationship from other devices in advance, which is not limited in the embodiments of the present application.
采用本申请实施例提供的命令传输方法,该加速器预先得到该映射关系,即通知消息中无需携带该映射关系,这样可以降低传输数据量,从而提高传输效率。Using the command transmission method provided by the embodiment of the present application, the accelerator obtains the mapping relationship in advance, that is, the notification message does not need to carry the mapping relationship, which can reduce the amount of transmitted data and thereby improve transmission efficiency.
在一种可能的实现方式中,在该基于该第一目标地址信息,从该内存中读取该第一命令之前,该方法还包括:基于该第一目标地址信息,将该第一命令写入该内存中。In a possible implementation, before reading the first command from the memory based on the first target address information, the method further includes: writing the first command based on the first target address information. into this memory.
采用本申请实施例提供的命令传输方法,当该第一命令的传输模式为同步模式,当该第一命令不能写入加速器的命令缓存队列时,该加速器将该第一命令写入该内存,然后在从该内存中读取该第一命令,这样,可以采用异步模式处理同步模式处理不了的场景。Using the command transmission method provided by the embodiment of the present application, when the transmission mode of the first command is the synchronous mode and the first command cannot be written into the command cache queue of the accelerator, the accelerator writes the first command into the memory, Then the first command is read from the memory, so that the asynchronous mode can be used to handle scenarios that the synchronous mode cannot handle.
在一种可能的实现方式中,该基于该第一工作队列缓存的标识信息、该第一地址信息和该第一传输模式信息,从该内存中读取该第一命令,包括:当该第一传输模式信息用于指示该第一命令的传输模式为该异步模式时,基于该第一工作队列缓存的标识信息和该第一地址信息,从该内存中读取该第一命令。In a possible implementation, reading the first command from the memory based on the identification information cached by the first work queue, the first address information and the first transmission mode information includes: when the first When a transmission mode information is used to indicate that the transmission mode of the first command is the asynchronous mode, the first command is read from the memory based on the identification information cached in the first work queue and the first address information.
采用本申请实施例提供的命令传输方法,当该第一传输模式信息用于指示该第一命令的传输模式为该异步模式时,该加速器可以基于该第一工作队列缓存的标识信息和该第一地址信息,从该内存中读取该第一命令,可以降低对加速器的存储空间的要求,以及降低加速器的处理复杂度。Using the command transmission method provided by the embodiment of the present application, when the first transmission mode information is used to indicate that the transmission mode of the first command is the asynchronous mode, the accelerator can cache based on the identification information of the first work queue and the third Using address information and reading the first command from the memory can reduce the storage space requirements of the accelerator and reduce the processing complexity of the accelerator.
在一种可能的实现方式中,该基于该通知消息,获取该第一命令,包括:当该第一传输模式信息用于指示该第一命令的传输模式为该同步模式,且该第一命令能写入该加速器的命令缓存队列时,从该命令缓存队列中读取该第一命令。In a possible implementation, obtaining the first command based on the notification message includes: when the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronization mode, and the first command When the command cache queue of the accelerator can be written, the first command is read from the command cache queue.
采用本申请实施例提供的命令传输方法,当该第一传输模式信息用于指示该第一命令的传输模式为该同步模式,且该第一命令能写入该加速器的命令缓存队列时,从该命令缓存队列中读取该第一命令,可以减少交互开销,从而提高命令传输效率。 Using the command transmission method provided by the embodiment of the present application, when the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, and the first command can be written into the command cache queue of the accelerator, from Reading the first command from the command cache queue can reduce interaction overhead, thereby improving command transmission efficiency.
在一种可能的实现方式中,在从该命令缓存队列中读取该第一命令之前,该方法还包括:将该第一命令写入该命令缓存队列中。In a possible implementation, before reading the first command from the command cache queue, the method further includes: writing the first command into the command cache queue.
第三方面,本申请还提供一种命令传输装置,该装置可以包括:处理器和通信接口,该处理器和该通信接口耦合,该处理器用于:生成通知消息,该通知消息用于通知加速器执行第一命令,该通知消息包括第一工作队列缓存的标识信息、第一地址信息和第一传输模式信息,该第一工作队列缓存用于存储该第一命令,该第一地址信息用于指示该第一命令在该第一工作队列缓存内的存储地址,该第一传输模式信息用于指示该第一命令的传输模式,该传输模式包括同步模式或异步模式,其中,当该第一命令的传输模式为该同步模式时,该通知消息还包括该第一命令;通过该通信接口向该加速器发送该通知消息。In a third aspect, this application also provides a command transmission device. The device may include: a processor and a communication interface. The processor is coupled to the communication interface. The processor is used to: generate a notification message, and the notification message is used to notify the accelerator. Execute the first command. The notification message includes identification information, first address information and first transmission mode information of the first work queue cache. The first work queue cache is used to store the first command. The first address information is used to store the first command. Indicates the storage address of the first command in the first work queue cache, and the first transmission mode information is used to indicate the transmission mode of the first command. The transmission mode includes a synchronous mode or an asynchronous mode, wherein when the first When the command transmission mode is the synchronous mode, the notification message also includes the first command; the notification message is sent to the accelerator through the communication interface.
在一种可能的实现方式中,该通知消息还用于通知该加速器执行第二命令,该通知消息还包括第二工作队列缓存的标识信息、第二地址信息和第二传输模式信息,该第二工作队列缓存用于存储该第二命令,该第二地址信息用于指示该第二命令在该第二工作队列缓存内的存储地址,该第二传输模式信息用于指示该第二命令的传输模式,该第一命令的传输模式与该第二命令的传输模式不同,其中,当该第二命令的传输模式为该同步模式时,该通知消息还包括该第二命令。In a possible implementation, the notification message is also used to notify the accelerator to execute the second command. The notification message also includes the identification information cached by the second work queue, the second address information and the second transmission mode information. The second work queue cache is used to store the second command, the second address information is used to indicate the storage address of the second command in the second work queue cache, and the second transmission mode information is used to indicate the storage address of the second command. Transmission mode. The transmission mode of the first command is different from the transmission mode of the second command. When the transmission mode of the second command is the synchronization mode, the notification message also includes the second command.
在一种可能的实现方式中,该第一工作队列缓存与该第二工作队列缓存相同,该第一命令在该第一工作队列缓存内的存储地址与该第二命令在该第一工作队列缓存内的存储地址不同;或者,该第一工作队列缓存与该第二工作队列缓存不同。In a possible implementation, the first work queue cache and the second work queue cache are the same, and the storage address of the first command in the first work queue cache is the same as the storage address of the second command in the first work queue. The storage addresses in the cache are different; or, the first work queue cache and the second work queue cache are different.
在一种可能的实现方式中,该第一命令包括多个命令,和/或,该第二命令包括多个命令。In a possible implementation, the first command includes multiple commands, and/or the second command includes multiple commands.
在一种可能的实现方式中,该通知消息还包括第一标识字段、第一地址字段、第一传输模式字段和第一命令字段,该第一标识字段用于承载该第一工作队列缓存的标识信息、该第一地址字段用于承载该第一地址信息,该第一传输模式字段用于承载该第一传输模式信息,该第一命令字段用于承载该第一命令。In a possible implementation, the notification message also includes a first identification field, a first address field, a first transmission mode field, and a first command field. The first identification field is used to carry the first work queue cache. The identification information and the first address field are used to carry the first address information, the first transmission mode field is used to carry the first transmission mode information, and the first command field is used to carry the first command.
在一种可能的实现方式中,该处理器还用于:当该第一传输模式信息用于指示该第一命令的传输模式为异步模式时,基于第一目标地址信息,将该第一命令写入内存中,该第一目标地址信息用于指示该第一命令在该内存中的存储地址。In a possible implementation, the processor is further configured to: when the first transmission mode information is used to indicate that the transmission mode of the first command is an asynchronous mode, based on the first target address information, transfer the first command to Written into the memory, the first target address information is used to indicate the storage address of the first command in the memory.
第四方面,本申请还提供一种命令传输装置,该装置可以包括:处理器和通信接口,该处理器和该通信接口耦合,该处理器用于:通过该通信接口接收来自处理器的通知消息,该通知消息用于通知加速器执行第一命令,该通知消息包括第一工作队列缓存的标识信息、第一地址信息和第一传输模式信息,该第一工作队列缓存用于存储该第一命令,该第一地址信息用于指示该第一命令在该第一工作队列缓存内的存储地址,该第一传输模式信息用于指示该第一命令的传输模式,该传输模式包括同步模式或异步模式,其中,当该第一命令的传输模式为该同步模式时,该通知消息还包括该第一命令;基于该通知消息,获取该第一命令;执行该第一命令。In a fourth aspect, this application also provides a command transmission device. The device may include: a processor and a communication interface. The processor is coupled to the communication interface. The processor is configured to: receive a notification message from the processor through the communication interface. , the notification message is used to notify the accelerator to execute the first command. The notification message includes the identification information, the first address information and the first transmission mode information of the first work queue cache. The first work queue cache is used to store the first command. , the first address information is used to indicate the storage address of the first command in the first work queue cache, and the first transmission mode information is used to indicate the transmission mode of the first command. The transmission mode includes synchronous mode or asynchronous mode. mode, wherein when the transmission mode of the first command is the synchronous mode, the notification message also includes the first command; based on the notification message, the first command is obtained; and the first command is executed.
在一种可能的实现方式中,该通知消息还用于通知该加速器执行第二命令,该通知消息还包括第二工作队列缓存的标识信息、第二地址信息和第二传输模式信息,该第二工作队列缓存用于存储该第二命令,该第二地址信息用于指示该第二命令在该第二工作队列缓存内的存储地址,该第二传输模式信息用于指示该第二命令的传输模式,该第一命令的传 输模式与该第二命令的传输模式不同,其中,当该第二命令的传输模式为该同步模式时,该通知消息还包括该第二命令,该处理器还用于:基于该通知消息,获取该第二命令;执行该第二命令。In a possible implementation, the notification message is also used to notify the accelerator to execute the second command. The notification message also includes the identification information cached by the second work queue, the second address information and the second transmission mode information. The second work queue cache is used to store the second command, the second address information is used to indicate the storage address of the second command in the second work queue cache, and the second transmission mode information is used to indicate the storage address of the second command. transmission mode, the transmission of the first command The transmission mode is different from the transmission mode of the second command, wherein when the transmission mode of the second command is the synchronous mode, the notification message also includes the second command, and the processor is further configured to: based on the notification message, Obtain the second command; execute the second command.
在一种可能的实现方式中,该第一工作队列缓存与该第二工作队列缓存相同,但该第一命令在该第一工作队列缓存内的存储地址与该第二命令在该第一工作队列缓存内的存储地址不同;或者,该第一工作队列缓存与该第二工作队列缓存不同。In a possible implementation, the first work queue cache is the same as the second work queue cache, but the storage address of the first command in the first work queue cache is the same as the storage address of the second command in the first work queue cache. The storage addresses in the queue cache are different; or, the first work queue cache and the second work queue cache are different.
在一种可能的实现方式中,该第一命令包括多个命令,和/或,该第二命令包括多个命令。In a possible implementation, the first command includes multiple commands, and/or the second command includes multiple commands.
在一种可能的实现方式中,该通知消息还包括第一标识字段、第一地址字段、第一传输模式字段和第一命令字段,该第一标识字段用于承载该第一工作队列缓存的标识信息、该第一地址字段用于承载该第一地址信息,该第一传输模式字段用于承载该第一传输模式信息,该第一命令字段用于承载该第一命令。In a possible implementation, the notification message also includes a first identification field, a first address field, a first transmission mode field, and a first command field. The first identification field is used to carry the first work queue cache. The identification information and the first address field are used to carry the first address information, the first transmission mode field is used to carry the first transmission mode information, and the first command field is used to carry the first command.
在一种可能的实现方式中,该处理器具体用于:基于该第一工作队列缓存的标识信息、该第一地址信息和该第一传输模式信息,从该内存中读取该第一命令。In a possible implementation, the processor is specifically configured to: read the first command from the memory based on the identification information cached in the first work queue, the first address information and the first transmission mode information. .
在一种可能的实现方式中,该处理器具体用于:当该第一传输模式信息用于指示该第一命令的传输模式为该同步模式,但该第一命令不能写入该加速器的命令缓存队列时,基于该第一工作队列缓存的标识信息和该第一地址信息,从该内存中读取该第一命令。In a possible implementation, the processor is specifically configured to: when the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, but the first command cannot write a command of the accelerator When caching the queue, the first command is read from the memory based on the cached identification information of the first work queue and the first address information.
在一种可能的实现方式中,该处理器具体用于:基于该第一工作队列缓存的标识信息、该第一地址信息和预设的映射关系,确定第一目标地址信息,该映射关系用于指示该第一工作队列缓存的标识信息和该第一工作队列缓存在该内存中的存储地址之间的对应关系,该第一目标地址信息用于指示该第一命令在该内存中的存储地址;基于该第一目标地址信息,从该内存中读取该第一命令。In a possible implementation, the processor is specifically configured to: determine the first target address information based on the identification information cached by the first work queue, the first address information and a preset mapping relationship, where the mapping relationship is In order to indicate the correspondence between the identification information cached by the first work queue and the storage address of the first work queue cache in the memory, the first target address information is used to indicate the storage of the first command in the memory. address; based on the first target address information, read the first command from the memory.
在一种可能的实现方式中,该处理器还用于:在该基于该第一目标地址信息,从该内存中读取该第一命令之前,基于该第一目标地址信息,将该第一命令写入该内存中。In a possible implementation, the processor is further configured to: before reading the first command from the memory based on the first target address information, read the first command based on the first target address information. The command is written to this memory.
在一种可能的实现方式中,该处理器具体用于:当该第一传输模式信息用于指示该第一命令的传输模式为该异步模式时,基于该第一工作队列缓存的标识信息和该第一地址信息,从该内存中读取该第一命令。In a possible implementation, the processor is specifically configured to: when the first transmission mode information is used to indicate that the transmission mode of the first command is the asynchronous mode, based on the identification information cached in the first work queue and The first address information reads the first command from the memory.
在一种可能的实现方式中,该处理器具体用于:当该第一传输模式信息用于指示该第一命令的传输模式为该同步模式,且该第一命令能写入该加速器的命令缓存队列时,从该命令缓存队列中读取该第一命令。In a possible implementation, the processor is specifically configured to: when the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, and the first command can write a command of the accelerator When the queue is cached, the first command is read from the command cache queue.
在一种可能的实现方式中,该处理器还用于:在从该命令缓存队列中读取该第一命令之前,将该第一命令写入该命令缓存队列中。In a possible implementation, the processor is further configured to write the first command into the command cache queue before reading the first command from the command cache queue.
第五方面,本申请还提供一种命令传输装置,该装置可以包括用于实现上述各个方面或其各种可能的实现方式中所述的方法的单元。In a fifth aspect, the present application also provides a command transmission device, which may include units for implementing the methods described in the above aspects or various possible implementations thereof.
第六方面,本申请还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序,该计算机程序被至少一个处理器执行时用于实现上述各个方面或其任意可能的实现方式中所述的方法。In a sixth aspect, the present application also provides a computer-readable storage medium, which stores a computer program. When executed by at least one processor, the computer program is used to implement the above aspects or any possible implementation thereof. The method described in the method.
第七方面,本申请还提供一种计算机程序产品,当该计算机程序产品被至少一个处理器执行时用于实现上述各个方面或其任意可能的实现方式中所述的方法。 In a seventh aspect, the present application also provides a computer program product, which when executed by at least one processor is used to implement the methods described in the above aspects or any possible implementation manner thereof.
本申请提供的命令传输装置、计算机存储介质和计算机程序产品均用于执行上文所提供的命令传输方法,因此,其所能达到的有益效果可参考上文所提供的命令传输方法中的有益效果,此处不再赘述。The command transmission device, computer storage medium and computer program product provided by this application are all used to execute the command transmission method provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects of the command transmission method provided above. The effect will not be described here.
附图说明Description of the drawings
图1是本申请实施例提供的命令传输系统100的示意性框图;Figure 1 is a schematic block diagram of a command transmission system 100 provided by an embodiment of the present application;
图2是本申请实施例提供的命令传输方法200的示意性流程图;Figure 2 is a schematic flow chart of the command transmission method 200 provided by the embodiment of the present application;
图3是本申请实施例提供的通知消息的格式示意图;Figure 3 is a schematic diagram of the format of the notification message provided by the embodiment of the present application;
图4是本申请实施例提供的命令传输方法300的示意性流程图;Figure 4 is a schematic flow chart of the command transmission method 300 provided by the embodiment of the present application;
图5是本申请实施例提供的命令传输方法400的示意性流程图;Figure 5 is a schematic flow chart of the command transmission method 400 provided by the embodiment of the present application;
图6是本申请实施例提供的命令传输装置500的示意性框图;Figure 6 is a schematic block diagram of the command transmission device 500 provided by the embodiment of the present application;
图7是本申请实施例提供的命令传输装置600的示意性框图;Figure 7 is a schematic block diagram of the command transmission device 600 provided by the embodiment of the present application;
图8是本申请实施例提供的命令传输装置700的示意性框图;Figure 8 is a schematic block diagram of the command transmission device 700 provided by the embodiment of the present application;
图9是本申请实施例提供的命令传输装置800的示意性框图。FIG. 9 is a schematic block diagram of a command transmission device 800 provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
需要说明的是,在本申请中,“第一”、“第二”等仅用于区分描述的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元。方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that in this application, "first", "second", etc. are only used for the purpose of differentiating descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order. Furthermore, the terms "including" and "having" and any variations thereof are intended to cover a non-exclusive inclusion, for example, the inclusion of a series of steps or units. Methods, systems, products or devices are not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such processes, methods, products or devices.
还需要说明的是,在本申请中,“至少一个(项)”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,用于描述关联对象的关联关系,表示可以存在三种关系,例如,“A和/或B”可以表示:只存在A,只存在B以及同时存在A和B三种情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b或c中的至少一项(个),可以表示:a、b、c、“a和b”、“a和c”、“b和c”、或“a和b和c”,其中a,b,c可以是单个,也可以是多个。It should also be noted that in this application, "at least one (item)" refers to one or more, and "plurality" refers to two or more. "And/or" is used to describe the relationship between associated objects, indicating that there can be three relationships. For example, "A and/or B" can mean: only A exists, only B exists, and A and B exist simultaneously. , where A and B can be singular or plural. The character "/" generally indicates that the related objects are in an "or" relationship. “At least one of the following” or similar expressions thereof refers to any combination of these items, including any combination of a single item (items) or a plurality of items (items). For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c" ”, where a, b, c can be single or multiple.
首先,先介绍一下现有的CPU与DSA之间的命令传输方法。现有的命令传输方法,按照DSA获取命令的方式,可以分为异步模式和同步模式。First, let’s introduce the existing command transmission method between CPU and DSA. Existing command transmission methods can be divided into asynchronous mode and synchronous mode according to the way the DSA obtains commands.
异步模式的命令传输方法可以包括以下步骤(1)~(5):The command transmission method in asynchronous mode may include the following steps (1) to (5):
(1)CPU将命令1写入DDR中的工作队列缓存1中,该DDR可以包括至少一个工作队列缓存,该至少一个工作队列缓存包括该工作队列缓存1。(1) The CPU writes command 1 into the work queue cache 1 in the DDR. The DDR may include at least one work queue cache, and the at least one work queue cache includes the work queue cache 1.
(2)该CPU向DSA发送通知消息,该通知消息包括该工作队列缓存1的索引;相应地,该DSA接收来自该CPU的该通知消息。(2) The CPU sends a notification message to the DSA, and the notification message includes the index of the work queue cache 1; accordingly, the DSA receives the notification message from the CPU.
(3)该DSA基于该工作队列缓存1的索引和预设的映射关系,确定地址信息,该地址信息用于指示该工作队列缓存1在该DDR中的存储地址,该映射关系用于指示该工作队列缓存1的索引和该工作队列缓存1在该DDR中的存储地址之间的对应关系。 (3) The DSA determines the address information based on the index of the work queue cache 1 and the preset mapping relationship. The address information is used to indicate the storage address of the work queue cache 1 in the DDR. The mapping relationship is used to indicate the Correspondence between the index of work queue cache 1 and the storage address of work queue cache 1 in the DDR.
(4)该DSA基于该地址信息,从该工作队列缓存1中读取该命令1。(4) The DSA reads the command 1 from the work queue cache 1 based on the address information.
(5)该DSA执行该命令1。(5) The DSA executes the command 1.
需要说明的是,上述步骤(1)至(5)示意性介绍了CPU向DSA下发命令1的步骤,但本申请不限于此。It should be noted that the above steps (1) to (5) schematically introduce the steps of the CPU issuing command 1 to the DSA, but the application is not limited thereto.
可选地,该CPU可以通过该通知消息携带批量命令对应的工作队列缓存的索引,并将该批量命令分别写入内存中相应的工作队列缓存中;相应地,DSA基于该通知消息从内存中读取该批量命令并执行,本申请对此不作限定。Optionally, the CPU can carry the index of the work queue cache corresponding to the batch command through the notification message, and write the batch command into the corresponding work queue cache in the memory; accordingly, the DSA reads the batch command from the memory based on the notification message. Reading the batch command and executing it is not limited in this application.
采用上述异步模式,命令和通知消息异步传输,灵活性较强。但是DSA需要先接收CPU发送的通知消息,再基于该通知消息从DDR中读取命令,交互多,开销大,尤其在命令的数据量较小的情况下,开销占比更大,会导致命令传输的效率较差。Using the above-mentioned asynchronous mode, commands and notification messages are transmitted asynchronously, providing greater flexibility. However, DSA needs to first receive the notification message sent by the CPU, and then read the command from the DDR based on the notification message. There is a lot of interaction and high overhead. Especially when the data volume of the command is small, the overhead accounts for a larger proportion, which will cause the command to The transmission efficiency is poor.
同步模式的命令传输方法可以包括以下步骤(a)~(f):The command transmission method in synchronous mode may include the following steps (a) to (f):
(a)CPU向DSA发送命令入队指令,该命令入队指令用于指示将命令2保存至该DSA中的命令队列缓存,该命令入队指令包括该命令2;相应地,该DSA接收来自该CPU的该命令入队指令。(a) The CPU sends a command enqueuing instruction to the DSA. The command enqueuing instruction is used to instruct command 2 to be saved to the command queue cache in the DSA. The command enqueuing instruction includes the command 2; accordingly, the DSA receives from This command is queued to the instruction for this CPU.
(b)该DSA基于该命令2的数据量和命令队列缓存的存储空间,确定该命令2的接收结果,该接收结果包括接收成功或接收失败。(b) The DSA determines the reception result of the command 2 based on the data amount of the command 2 and the storage space of the command queue cache, and the reception result includes reception success or reception failure.
(c)该DSA向该CPU反馈该接收结果;相应地,该CPU接收来自该DSA的该接收结果。(c) The DSA feeds back the reception result to the CPU; accordingly, the CPU receives the reception result from the DSA.
可选地,若该接收结果为接收成功,该DSA继续执行步骤(d)至(e);若该接收结果为接收失败,则该DSA等待该CPU的进一步指示,以重新获取该命令2。Optionally, if the reception result is a successful reception, the DSA continues to perform steps (d) to (e); if the reception result is a reception failure, the DSA waits for further instructions from the CPU to reacquire the command 2.
(d)该DSA将该命令2写入该命令队列缓存中。(d) The DSA writes the command 2 into the command queue buffer.
(e)该DSA从该命令队列缓存中读取该命令2。(e) The DSA reads the command 2 from the command queue cache.
(f)该DSA执行该命令2。(f) The DSA executes command 2.
需要说明的是,上述步骤(a)至(f)示意性介绍了CPU向DSA下发命令2的步骤,但本申请不限于此。It should be noted that the above steps (a) to (f) schematically introduce the steps of the CPU issuing command 2 to the DSA, but the application is not limited thereto.
可选地,该CPU可以通过该命令队列缓存携带批量命令;相应地,若该批量命令均接收成功,该DSA可以从命令队列缓存中读取该批量命令并执行,本申请对此不作限定。Optionally, the CPU can carry batch commands through the command queue cache; accordingly, if the batch commands are received successfully, the DSA can read the batch commands from the command queue cache and execute them, which is not limited in this application.
采用上述同步模式,交互简单、开销小,尤其在命令的数据量较小的情况下,开销占比较小,可以提供命令传输的效率。但是,采用同步模式传输命令会受限于DSA中的命令队列缓存的存储空间大小以及DSA的处理速度,也就是说,该命令队列缓存的存储空间较小或该DSA的处理速度较慢,都可能导致命令接收失败的场景。Using the above synchronization mode, the interaction is simple and the overhead is small. Especially when the data volume of the command is small, the overhead is relatively small, which can improve the efficiency of command transmission. However, using synchronous mode to transmit commands will be limited by the storage space of the command queue cache in the DSA and the processing speed of the DSA. That is to say, the storage space of the command queue cache is small or the processing speed of the DSA is slow. Scenarios that may cause command reception to fail.
综上所述,通过上述同步模式或异步模式传输命令,覆盖的应用场景比较单一,从而命令传输的灵活性较差。To sum up, transmitting commands through the above-mentioned synchronous mode or asynchronous mode covers a relatively single application scenario, so the flexibility of command transmission is poor.
下面将介绍本申请实施例提供的命令传输方法所应用的命令传输系统的架构。The following will introduce the architecture of the command transmission system used in the command transmission method provided by the embodiment of the present application.
图1示出了本申请实施例提供的命令传输系统100的示意性框图。如图1所示,该系统100可以包括:中央处理器(CPU)110和加速器120,其中,该中央处理器110可以包括接口a1,该加速器120可以包括接口b1,该中央处理器110和该加速器120之间可以通过该接口a1和该接口b1传输命令。Figure 1 shows a schematic block diagram of a command transmission system 100 provided by an embodiment of the present application. As shown in Figure 1, the system 100 may include: a central processing unit (CPU) 110 and an accelerator 120, wherein the CPU 110 may include an interface a1, the accelerator 120 may include an interface b1, the CPU 110 and the accelerator 120. Commands can be transmitted between accelerators 120 through the interface a1 and the interface b1.
示例的,该加速器120可以为DSA,如加解密引擎、哈希引擎、编解码引擎等。 For example, the accelerator 120 may be a DSA, such as an encryption and decryption engine, a hash engine, a codec engine, etc.
可选地,该系统100还可以包括内存130,该内存130可以包括接口c1和接口c2,该中央处理器110还可以包括接口a2,该加速器120还可以包括接口b2,该中央处理器110和该内存130之间可以通过该接口a2和该接口c1传输命令,该加速器120和该内存130之间可以通过该接口b2和该接口c2传输命令。Optionally, the system 100 may also include a memory 130. The memory 130 may include an interface c1 and an interface c2. The central processor 110 may also include an interface a2. The accelerator 120 may also include an interface b2. The central processor 110 and Commands can be transmitted between the memory 130 through the interface a2 and the interface c1, and commands can be transmitted between the accelerator 120 and the memory 130 through the interface b2 and the interface c2.
示例的,该内存130可以为DDR。For example, the memory 130 may be DDR.
可选地,该系统100可以用于芯片。Optionally, the system 100 can be used on a chip.
上面结合图1介绍了本申请实施例提供的命令传输系统,下面将进一步介绍本申请实施例提供的命令传输方法。The command transmission system provided by the embodiment of the present application is introduced above with reference to Figure 1. The command transmission method provided by the embodiment of the present application will be further introduced below.
图2示出了本申请实施例提供的消息传输方法200的示意性流程图,该方法200可以应用于如图1中所示的系统100。如图2所示,该方法200可以包括以下步骤,需要说明的是,以下所列步骤可以以各种顺序执行和/或同时发生,不限于图2所示的执行顺序。FIG. 2 shows a schematic flow chart of the message transmission method 200 provided by the embodiment of the present application. The method 200 can be applied to the system 100 shown in FIG. 1 . As shown in FIG. 2 , the method 200 may include the following steps. It should be noted that the steps listed below may be executed in various orders and/or occur simultaneously, and are not limited to the execution order shown in FIG. 2 .
S201.中央处理器生成通知消息,该通知消息用于通知加速器执行第一命令,该通知消息包括第一工作队列缓存的标识信息、第一地址信息和第一传输模式信息,该第一工作队列缓存用于存储该第一命令,该第一地址信息用于指示该第一命令在该第一工作队列缓存内的存储地址,该第一传输模式信息用于指示该第一命令的传输模式,该传输模式包括同步模式或异步模式,其中,当该第一命令的传输模式为该同步模式时,该通知消息还包括该第一命令。S201. The central processor generates a notification message. The notification message is used to notify the accelerator to execute the first command. The notification message includes the identification information cached by the first work queue, the first address information and the first transmission mode information. The first work queue The cache is used to store the first command, the first address information is used to indicate the storage address of the first command in the first work queue cache, and the first transmission mode information is used to indicate the transmission mode of the first command, The transmission mode includes a synchronous mode or an asynchronous mode, wherein when the transmission mode of the first command is the synchronous mode, the notification message also includes the first command.
可选地,本申请对该通知消息的格式不做限定。Optionally, this application does not limit the format of the notification message.
在一种可能的实现方式中,该通知消息还可以包括第一标识字段、第一地址字段和第一传输模式字段,其中,该第一标识字段用于承载该第一工作队列缓存的标识信息、该第一地址字段用于承载该第一地址信息,该第一传输模式字段用于承载该第一传输模式信息。In a possible implementation, the notification message may also include a first identification field, a first address field and a first transmission mode field, where the first identification field is used to carry identification information cached by the first work queue. . The first address field is used to carry the first address information, and the first transmission mode field is used to carry the first transmission mode information.
可选地,该通知消息还可以包括第一命令字段,当该第一传输模式信息用于指示该第一命令的传输模式为该同步模式时,该第一命令字段用于承载该第一命令,当该第一传输模式信息用于指示该第一命令的传输模式为该异步模式时,该第一命令字段为无效字段。Optionally, the notification message may also include a first command field. When the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronization mode, the first command field is used to carry the first command. , when the first transmission mode information is used to indicate that the transmission mode of the first command is the asynchronous mode, the first command field is an invalid field.
示例的,图3示出了本申请实施例提供的通知消息的格式示意图。如图3所示,该通知消息可以包括:第一标识字段、第一地址字段、第一传输模式字段和第一命令字段,该第一标识字段的长度为16比特,该第一地址字段的长度为32比特,该第一传输模式字段的长度为1比特,该第一命令字段的长度为463比特。As an example, Figure 3 shows a schematic format diagram of the notification message provided by the embodiment of the present application. As shown in Figure 3, the notification message may include: a first identification field, a first address field, a first transmission mode field and a first command field. The length of the first identification field is 16 bits, and the length of the first address field is 16 bits. The length is 32 bits, the length of the first transmission mode field is 1 bit, and the length of the first command field is 463 bits.
采用本申请实施例提供的命令传输方法,中央处理器通过统一格式的通知消息就可以区分各命令采用的传输模式为同步模式或异步模式,无需修改中央处理器也无需额外的指令。Using the command transmission method provided by the embodiments of this application, the central processor can distinguish the transmission mode adopted by each command as a synchronous mode or an asynchronous mode through a unified format notification message, without modifying the central processor or requiring additional instructions.
可选地,该标识信息可以通过多种方式标识该第一工作队列缓存,本申请对此不作限定。Optionally, the identification information can identify the first work queue cache in various ways, which is not limited in this application.
在一种可能的实现方式中,该标识信息可以包括该第一工作队列缓存的编号、名称或索引。In a possible implementation, the identification information may include the number, name or index of the first work queue cache.
示例的,以内存中包括工作队列缓存1、工作队列缓存2、…、工作队列缓存5,该第一工作队列缓存为工作队列缓存2,工作队列缓存1的存储地址为:Add 0~Add 1G、工作队列缓存2的存储地址为:Add(1G+1k)~Add(2G+1k)、…、工作队列缓存5的存储地址为:Add(4G+4k)~Add(5G+4k),其中,工作队列缓存1、工作队列缓存2…工作队列缓 存5的索引分别为N1、N2、…、N5为例,该标识信息可以为“N2”。For example, the memory includes work queue cache 1, work queue cache 2, ..., and work queue cache 5. The first work queue cache is work queue cache 2. The storage address of work queue cache 1 is: Add 0~Add 1G. , the storage address of work queue cache 2 is: Add(1G+1k)~Add(2G+1k),..., the storage address of work queue cache 5 is: Add(4G+4k)~Add(5G+4k), where , work queue cache 1, work queue cache 2...work queue cache As an example, the indexes of storage 5 are N1, N2,..., and N5. The identification information can be "N2".
可选地,第一地址信息可以通过多种方式指示该第一命令在该第一工作队列缓存内的存储地址。Optionally, the first address information may indicate the storage address of the first command in the first work queue cache in various ways.
在一种可能的实现方式中,该第一地址信息可以包括该第一命令在该第一工作队列缓存的存储地址。In a possible implementation, the first address information may include a storage address of the first command cached in the first work queue.
示例的,以该第一工作队列缓存的存储地址为:Add(1G+1k)~Add(2G+1k)为例,若Add(1G+3k)~Add(1G+5k)用于存储该第一命令,则该第一地址信息可以为:Add(1G+3k)~Add(1G+5k)。For example, taking the storage address of the first work queue cache as: Add(1G+1k)~Add(2G+1k), if Add(1G+3k)~Add(1G+5k) is used to store the first A command, the first address information may be: Add(1G+3k)~Add(1G+5k).
在另一种可能的实现方式中,该第一工作队列缓存包括至少一个存储区,该第一地址信息可以包括该至少一个存储区中用于存储该第一命令的存储区的索引。In another possible implementation, the first work queue cache includes at least one storage area, and the first address information may include an index of a storage area used to store the first command in the at least one storage area.
示例的,以该第一工作队列缓存的存储地址为:Add(1G+1k)~Add(2G+1k),该第一工作队列缓存被划分为存储区1、存储区2、…、存储区5,存储区2用于存储该第一命令,其中,存储区1、存储区2、…、存储区5的索引分别为N2-Sub1、N2-Sub2、…、N2-Sub5为例,该第一地址信息可以为“N2-Sub2”。For example, the storage addresses of the first work queue cache are: Add(1G+1k)~Add(2G+1k), and the first work queue cache is divided into storage area 1, storage area 2,..., storage areas. 5. Storage area 2 is used to store the first command. The indexes of storage area 1, storage area 2,..., and storage area 5 are respectively N2-Sub1, N2-Sub2,..., N2-Sub5. For example, the first command One address information can be "N2-Sub2".
可选地,本申请对命令(如第一命令)的格式不做限定。具体可以参考现有命令的格式。Optionally, this application does not limit the format of the command (such as the first command). For details, please refer to the format of existing commands.
在一种可能的实现方式中,该命令可以包括类型信息、地址信息、长度信息和命令参数,该类型信息用于指示该命令的命令类型(如读取命令、写入命令、加密命令等),该地址信息用于指示待处理数据的存储地址,该长度信息用于指示待处理数据的长度,该命令参数包括该命令执行过程中需要的参数(如加密处理时采用的加密算法)。In a possible implementation, the command may include type information, address information, length information and command parameters. The type information is used to indicate the command type of the command (such as read command, write command, encryption command, etc.) , the address information is used to indicate the storage address of the data to be processed, the length information is used to indicate the length of the data to be processed, and the command parameters include parameters required during the execution of the command (such as the encryption algorithm used in encryption processing).
可选地,该通知消息还用于通知该加速器执行第二命令,该通知消息还包括第二工作队列缓存的标识信息、第二地址信息和第二传输模式信息,该第二工作队列缓存用于存储该第二命令,该第二地址信息用于指示该第二命令在该第二工作队列缓存内的存储地址,该第二传输模式信息用于指示该第二命令的传输模式,该第一命令的传输模式与该第二命令的传输模式不同,其中,当该第二命令的传输模式为该同步模式时,该通知消息还包括该第二命令。Optionally, the notification message is also used to notify the accelerator to execute the second command. The notification message also includes the identification information, the second address information and the second transmission mode information of the second work queue cache. The second work queue cache uses When storing the second command, the second address information is used to indicate the storage address of the second command in the second work queue cache, the second transmission mode information is used to indicate the transmission mode of the second command, and the second transmission mode information is used to indicate the transmission mode of the second command. The transmission mode of a command is different from the transmission mode of the second command, wherein when the transmission mode of the second command is the synchronization mode, the notification message also includes the second command.
采用本申请实施例提供的命令传输方法,中央处理器通过可以通过一套消息接口兼容异步模式和同步模式传输命令,也就是说,同步模式和异步模式可以结合运行,从而提高命令传输的灵活性。Using the command transmission method provided by the embodiments of this application, the central processor can transmit commands compatible with asynchronous mode and synchronous mode through a set of message interfaces. That is to say, synchronous mode and asynchronous mode can be operated in combination, thereby improving the flexibility of command transmission. .
可选地,本申请对该第一命令和该第二命令存储的位置不做限定。Optionally, this application does not limit the storage locations of the first command and the second command.
在一种可能的实现方式中,该第一工作队列缓存与该第二工作队列缓存相同,该第一命令在该第一工作队列缓存内的存储地址与该第二命令在该第一工作队列缓存内的存储地址不同。In a possible implementation, the first work queue cache and the second work queue cache are the same, and the storage address of the first command in the first work queue cache is the same as the storage address of the second command in the first work queue. The storage addresses in the cache are different.
在另一种可能的实现方式中,该第一工作队列缓存与该第二工作队列缓存不同。In another possible implementation, the first work queue cache is different from the second work queue cache.
采用本申请实施例提供的命令传输方法,不同命令可以写入同一工作队列缓存中的不同存储地址,或者可以写入不同的工作队列缓存,能够提高命令读写的灵活性。Using the command transmission method provided by the embodiments of this application, different commands can be written to different storage addresses in the same work queue cache, or can be written to different work queue caches, which can improve the flexibility of command reading and writing.
可选地,本申请对该第一命令中包括的命令的数量或第二命令中包括的命令的数量不做限定。Optionally, this application does not limit the number of commands included in the first command or the number of commands included in the second command.
在一种可能的实现方式中,该第一命令中包括多个命令。 In a possible implementation, the first command includes multiple commands.
在另一种可能的实现方式中,该第二命令中包括多个命令。In another possible implementation, the second command includes multiple commands.
在又一种可能的实现方式中,该第一命令中包括多个命令,且该第二命令中包括多个命令。In yet another possible implementation, the first command includes multiple commands, and the second command includes multiple commands.
采用本申请实施例提供的命令传输方法,中央处理器可以通过一套消息接口采用异步模式批量下发多个命令,和/或,采用同步模式批量下发多个命令,能够提高命令传输的灵活性和效率。Using the command transmission method provided by the embodiments of this application, the central processor can issue multiple commands in batches in asynchronous mode through a set of message interfaces, and/or, issue multiple commands in batches in synchronous mode, which can improve the flexibility of command transmission. sex and efficiency.
S202.该中央处理器向该加速器发送该通知消息;相应地,该加速器接收来自该中央处理器的该通知消息。S202. The central processor sends the notification message to the accelerator; accordingly, the accelerator receives the notification message from the central processor.
可选地,若该传输模式信息用于指示该第一命令的传输模式为异步模式,在S202之后该方法200还可以包括:该处理器基于第一目标地址信息,将该第一命令写入内存,该第一目标地址信息用于指示该第一命令在该内存中的存储地址,其中,该内存可以包括至少一个工作队列缓存,该至少一个工作队列缓存包括该第一工作队列缓存。Optionally, if the transmission mode information is used to indicate that the transmission mode of the first command is asynchronous mode, after S202, the method 200 may also include: the processor writes the first command based on the first target address information. Memory, the first target address information is used to indicate the storage address of the first command in the memory, wherein the memory may include at least one work queue cache, and the at least one work queue cache includes the first work queue cache.
采用本申请提供的命令传输方法,中央处理器可以通过通知消息中的第一传输模式信息指示第一命令的传输模式,该中央处理器可以通过通知消息中的第一工作队列缓存的标识信息和第一地址信息指示该第一命令在内存中的存储地址,当该第一命令的传输模式为同步模式时,通过该通知消息可以承载该第一命令。相应地,该加速器可以基于该通知消息,获取该第一命令并执行该第一命令。也就是说,中央处理器和加速器之间可以通过一套消息接口采用异步模式或同步模式传输命令,这样,中央处理器可以根据命令的特性选择合适的方式进行下发,既可以保留命令下发的灵活性又可以获得快速处理短命令的收益。Using the command transmission method provided by this application, the central processor can indicate the transmission mode of the first command through the first transmission mode information in the notification message. The central processor can use the identification information cached by the first work queue in the notification message and The first address information indicates the storage address of the first command in the memory. When the transmission mode of the first command is the synchronous mode, the first command can be carried through the notification message. Correspondingly, the accelerator may obtain the first command and execute the first command based on the notification message. In other words, commands can be transmitted between the central processor and the accelerator through a set of message interfaces in asynchronous mode or synchronous mode. In this way, the central processor can choose the appropriate method to issue the command according to the characteristics of the command, and can retain the command issuance. The flexibility can gain the benefit of fast processing of short commands.
S203.该加速器基于该通知消息,获取该第一命令。S203. The accelerator obtains the first command based on the notification message.
可选地,S203可以包括:基于该第一工作队列缓存的标识信息、该第一地址信息和该第一传输模式信息,从该内存中读取该第一命令。Optionally, S203 may include: reading the first command from the memory based on the identification information cached in the first work queue, the first address information, and the first transmission mode information.
在一种可能的实现方式中,该基于该第一工作队列缓存的标识信息、该第一地址信息和该第一传输模式信息,从该内存中读取该第一命令,可以包括:当该第一传输模式信息用于指示该第一命令的传输模式为该异步模式时,基于该第一工作队列缓存的标识信息和该第一地址信息,从该内存中读取该第一命令。In a possible implementation, reading the first command from the memory based on the identification information cached by the first work queue, the first address information and the first transmission mode information may include: when the When the first transmission mode information is used to indicate that the transmission mode of the first command is the asynchronous mode, the first command is read from the memory based on the identification information cached in the first work queue and the first address information.
采用本申请实施例提供的命令传输方法,当该第一传输模式信息用于指示该第一命令的传输模式为该异步模式时,该加速器可以基于该第一工作队列缓存的标识信息和该第一地址信息,从该内存中读取该第一命令,可以降低对加速器的存储空间的要求,以及降低加速器的处理复杂度。Using the command transmission method provided by the embodiment of the present application, when the first transmission mode information is used to indicate that the transmission mode of the first command is the asynchronous mode, the accelerator can cache based on the identification information of the first work queue and the third Using address information and reading the first command from the memory can reduce the storage space requirements of the accelerator and reduce the processing complexity of the accelerator.
在另一种可能的实现方式中,该基于该第一工作队列缓存的标识信息、该第一地址信息和该第一传输模式信息,从该内存中读取该第一命令,可以包括:当该第一传输模式信息用于指示该第一命令的传输模式为该同步模式,但该第一命令不能写入该加速器的命令缓存队列时,基于该第一工作队列缓存的标识信息和该第一地址信息,从该内存中读取该第一命令。In another possible implementation, reading the first command from the memory based on the identification information cached by the first work queue, the first address information and the first transmission mode information may include: The first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, but when the first command cannot be written to the command cache queue of the accelerator, based on the identification information cached in the first work queue and the third An address information is used to read the first command from the memory.
采用本申请实施例提供的命令传输方法,当该第一命令的传输模式为同步模式,当该第一命令不能写入加速器的命令缓存队列时,可以进一步采用异步模式从内存中读取该第一命令。也就是说,可以通过异步模式解决在同步模式下由于加速器中的命令队列缓存的存储空间大小或加速器的处理速度的原因导致的命令传输失败的问题,从而提升中央处理 器的性能。Using the command transmission method provided by the embodiment of the present application, when the transmission mode of the first command is synchronous mode, and when the first command cannot be written into the command cache queue of the accelerator, the asynchronous mode can be further used to read the first command from the memory. One command. In other words, the asynchronous mode can be used to solve the problem of command transmission failure caused by the storage space size of the command queue cache in the accelerator or the processing speed of the accelerator in the synchronous mode, thereby improving central processing. performance of the device.
可选地,该加速器可以通过多种方式,基于该第一工作队列缓存的标识信息和该第一地址信息,从该内存中读取该第一命令,本申请对此不作限定。Optionally, the accelerator can read the first command from the memory based on the identification information cached in the first work queue and the first address information in various ways, which is not limited in this application.
在一种可能的实现方式中,该加速器可以基于该第一工作队列缓存的标识信息、该第一地址信息和预设的映射关系,确定第一目标地址信息,该映射关系用于指示该第一工作队列缓存的标识信息和该第一工作队列缓存在该内存中的存储地址之间的对应关系,该第一目标地址信息用于指示该第一命令在该内存中的存储地址;基于该第一目标地址信息,从该内存中读取该第一命令。In a possible implementation, the accelerator may determine the first target address information based on the identification information cached by the first work queue, the first address information and a preset mapping relationship, the mapping relationship being used to indicate the first A corresponding relationship between the identification information cached by the work queue and the storage address cached by the first work queue in the memory. The first target address information is used to indicate the storage address of the first command in the memory; based on the The first target address information is read from the memory and the first command is read.
可选地,在该基于该第一目标地址信息,从该内存中读取该第一命令之前,该加速器可以基于该第一目标地址信息,将该第一命令写入该内存中。Optionally, before reading the first command from the memory based on the first target address information, the accelerator may write the first command into the memory based on the first target address information.
可选地,S203可以包括:当该第一传输模式信息用于指示该第一命令的传输模式为该同步模式,且该第一命令能写入该加速器的命令缓存队列时,从该命令缓存队列中读取该第一命令。Optionally, S203 may include: when the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, and the first command can be written to the command cache queue of the accelerator, from the command cache The first command is read from the queue.
可选地,在从该命令缓存队列中读取该第一命令之前,该方法还包括:将该第一命令写入该命令缓存队列中。Optionally, before reading the first command from the command cache queue, the method further includes: writing the first command into the command cache queue.
采用本申请实施例提供的命令传输方法,当该第一传输模式信息用于指示该第一命令的传输模式为该同步模式,且该第一命令能写入该加速器的命令缓存队列时,从该命令缓存队列中读取该第一命令,可以减少交互开销,从而提高命令传输效率。Using the command transmission method provided by the embodiment of the present application, when the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, and the first command can be written into the command cache queue of the accelerator, from Reading the first command from the command cache queue can reduce interaction overhead, thereby improving command transmission efficiency.
S204.该加速器执行该第一命令。S204. The accelerator executes the first command.
下面将结合图4介绍本申请实施例提供的异步模式的命令传输方法。The command transmission method in the asynchronous mode provided by the embodiment of the present application will be introduced below with reference to FIG. 4 .
图4示出了本申请实施例提供的命令传输方法300的示意性流程图。该方法300可以应用于如图1中所示的系统100。如图4所示,该方法300可以包括以下步骤,需要说明的是,以下所列步骤可以以各种顺序执行和/或同时发生,不限于图4所示的执行顺序。Figure 4 shows a schematic flow chart of the command transmission method 300 provided by the embodiment of the present application. The method 300 may be applied to the system 100 as shown in FIG. 1 . As shown in FIG. 4 , the method 300 may include the following steps. It should be noted that the steps listed below may be executed in various orders and/or occur simultaneously, and are not limited to the execution order shown in FIG. 4 .
S301.中央处理器生成通知消息,该通知消息用于通知加速器执行第一命令,该通知消息包括第一工作队列缓存的标识信息、第一地址信息和第一传输模式信息,该第一工作队列缓存用于存储该第一命令,该第一地址信息用于指示该第一命令在该第一工作队列缓存内的存储地址,该第一传输模式信息用于指示该第一命令的传输模式为异步模式。S301. The central processor generates a notification message. The notification message is used to notify the accelerator to execute the first command. The notification message includes the identification information cached by the first work queue, the first address information and the first transmission mode information. The first work queue The cache is used to store the first command, the first address information is used to indicate the storage address of the first command in the first work queue cache, and the first transmission mode information is used to indicate that the transmission mode of the first command is Asynchronous mode.
S302.该中央处理器向该加速器发送该通知消息;相应地,该加速器接收来自该处理器的该通知消息。S302. The central processor sends the notification message to the accelerator; accordingly, the accelerator receives the notification message from the processor.
S303.该处理器基于第一目标地址信息,将该第一命令写入内存,该第一目标地址信息用于指示该第一命令在内存中的存储地址,该内存包括至少一个工作队列缓存,该至少一个工作队列缓存包括该第一工作队列缓存。S303. The processor writes the first command into the memory based on the first target address information. The first target address information is used to indicate the storage address of the first command in the memory. The memory includes at least one work queue cache, The at least one work queue cache includes the first work queue cache.
S304.该加速器根据该第一命令的传输模式为异步模式,基于该第一工作队列缓存的标识信息、预设的映射关系和第一地址信息,确定该第一目标地址信息,该映射关系用于指示该第一工作队列缓存的标识信息和该第一工作队列缓存在内存中的存储地址之间的对应关系。S304. According to the asynchronous mode of the transmission mode of the first command, the accelerator determines the first target address information based on the identification information cached in the first work queue, the preset mapping relationship and the first address information. The mapping relationship is used The corresponding relationship between the identification information indicating the first work queue cache and the storage address of the first work queue cache in the memory.
S305.该加速器基于该第一目标地址信息,从该内存中读取该第一命令。S305. The accelerator reads the first command from the memory based on the first target address information.
S306.该加速器执行该第一命令。S306. The accelerator executes the first command.
下面将结合图5介绍本申请实施例提供的同步模式的命令传输方法。 The command transmission method in synchronous mode provided by the embodiment of the present application will be introduced below with reference to FIG. 5 .
图5示出了本申请实施例提供的命令传输方法400的示意性流程图。该方法400可以应用与如图1中所示的系统100。如图5所示,该方法400可以包括以下步骤,需要说明的是,以下所列步骤可以以各种顺序执行和/或同时发生,不限于图5所示的执行顺序。Figure 5 shows a schematic flow chart of the command transmission method 400 provided by the embodiment of the present application. The method 400 may be applied to the system 100 as shown in FIG. 1 . As shown in FIG. 5 , the method 400 may include the following steps. It should be noted that the steps listed below may be executed in various orders and/or occur simultaneously, and are not limited to the execution order shown in FIG. 5 .
S401.中央处理器生成通知消息,该通知消息用于通知加速器执行第一命令,该通知消息包括第一工作队列缓存的标识信息、第一地址信息、第一传输模式信息和该第一命令,该第一工作队列缓存用于存储该第一命令,该第一地址信息用于指示该第一命令在该第一工作队列缓存内的存储地址,该第一传输模式信息用于指示该第一命令的传输模式为同步模式。S401. The central processor generates a notification message, which is used to notify the accelerator to execute the first command. The notification message includes the identification information cached by the first work queue, the first address information, the first transmission mode information and the first command, The first work queue cache is used to store the first command, the first address information is used to indicate the storage address of the first command in the first work queue cache, and the first transmission mode information is used to indicate the first The transmission mode of the command is synchronous mode.
S402.该中央处理器向该加速器发送该通知消息;相应地,该加速器接收来自该中央处理器的该通知消息。S402. The central processor sends the notification message to the accelerator; accordingly, the accelerator receives the notification message from the central processor.
S403.该加速器根据该第一命令的传输模式为同步模式,判断该第一命令能否写入该加速器的命令队列缓存中。若该第一命令不能写入该命令队列缓存中,继续执行S404~S406;若该第一命令能写入该命令队列缓存中,继续执行S407~S408。S403. The accelerator determines whether the first command can be written into the command queue cache of the accelerator based on the transmission mode of the first command being the synchronous mode. If the first command cannot be written into the command queue buffer, continue to execute S404-S406; if the first command can be written into the command queue buffer, continue to execute S407-S408.
S404.该加速器基于该第一工作队列缓存的标识信息、预设的映射关系和第一地址信息,确定第一目标地址信息,该第一目标地址信息用于指示该第一命令在内存中的存储地址,该映射关系用于指示该第一工作队列缓存的标识信息和该第一工作队列缓存在内存中的存储地址之间的对应关系,其中,该内存包括至少一个工作队列缓存,该至少一个工作队列缓存包括该第一工作队列缓存。S404. The accelerator determines the first target address information based on the identification information cached in the first work queue, the preset mapping relationship and the first address information. The first target address information is used to indicate the location of the first command in the memory. Storage address, the mapping relationship is used to indicate the correspondence between the identification information of the first work queue cache and the storage address of the first work queue cache in the memory, wherein the memory includes at least one work queue cache, the at least A work queue cache includes the first work queue cache.
S405.该加速器基于该第一目标地址信息,将该第一命令写入该内存中。S405. The accelerator writes the first command into the memory based on the first target address information.
S406.该加速器基于该第一目标地址信息,从该内存中读取该命令。S406. The accelerator reads the command from the memory based on the first target address information.
S407.该加速器将该第一命令写入该命令队列缓存中。S407. The accelerator writes the first command into the command queue cache.
S408.该加速器从该命令队列缓存中读取该第一命令。S408. The accelerator reads the first command from the command queue cache.
S409.该加速器执行该第一命令。S409. The accelerator executes the first command.
上面结合图2至图5介绍了本申请实施例提供的命令传输方法,下面将进一步介绍本申请实施例提供的命令传输装置。The command transmission method provided by the embodiment of the present application is introduced above with reference to Figures 2 to 5. The command transmission device provided by the embodiment of the present application will be further introduced below.
图6示出了本申请实施例提供的命令传输装置500的示意性框图。该装置500可以包括:生成模块501和发送模块502。FIG. 6 shows a schematic block diagram of the command transmission device 500 provided by the embodiment of the present application. The device 500 may include: a generating module 501 and a sending module 502.
可选地,该装置500可以用于上述系统100,进一步地,该装置500可以为上述系统100中的中央处理器110。Optionally, the device 500 can be used in the above-mentioned system 100. Further, the device 500 can be the central processor 110 in the above-mentioned system 100.
该生成模块501用于生成通知消息,所述通知消息用于通知加速器执行第一命令,所述通知消息包括第一工作队列缓存的标识信息、第一地址信息和第一传输模式信息,所述第一工作队列缓存用于存储所述第一命令,所述第一地址信息用于指示所述第一命令在所述第一工作队列缓存内的存储地址,所述第一传输模式信息用于指示所述第一命令的传输模式,所述传输模式包括同步模式或异步模式,其中,当所述第一命令的传输模式为所述同步模式时,所述通知消息还包括所述第一命令。The generation module 501 is used to generate a notification message. The notification message is used to notify the accelerator to execute the first command. The notification message includes the identification information cached by the first work queue, the first address information and the first transmission mode information. The first work queue cache is used to store the first command, the first address information is used to indicate the storage address of the first command in the first work queue cache, and the first transmission mode information is used to Indicates the transmission mode of the first command. The transmission mode includes a synchronous mode or an asynchronous mode. When the transmission mode of the first command is the synchronous mode, the notification message also includes the first command. .
该发送模块502用于向所述加速器发送所述通知消息。The sending module 502 is used to send the notification message to the accelerator.
在一种可能的实现方式中,所述通知消息还用于通知所述加速器执行第二命令,所述通知消息还包括第二工作队列缓存的标识信息、第二地址信息和第二传输模式信息,所述第二工作队列缓存用于存储所述第二命令,所述第二地址信息用于指示所述第二命令在所 述第二工作队列缓存内的存储地址,所述第二传输模式信息用于指示所述第二命令的传输模式,所述第一命令的传输模式与所述第二命令的传输模式不同,其中,当所述第二命令的传输模式为所述同步模式时,所述通知消息还包括所述第二命令。In a possible implementation, the notification message is also used to notify the accelerator to execute the second command, and the notification message also includes the identification information cached by the second work queue, the second address information and the second transmission mode information. , the second work queue cache is used to store the second command, and the second address information is used to indicate where the second command is located. The storage address in the second work queue cache, the second transmission mode information is used to indicate the transmission mode of the second command, the transmission mode of the first command is different from the transmission mode of the second command, wherein , when the transmission mode of the second command is the synchronization mode, the notification message further includes the second command.
在一种可能的实现方式中,该第一工作队列缓存与该第二工作队列缓存相同,该第一命令在该第一工作队列缓存内的存储地址与该第二命令在该第一工作队列缓存内的存储地址不同;或者,该第一工作队列缓存与该第二工作队列缓存不同。In a possible implementation, the first work queue cache and the second work queue cache are the same, and the storage address of the first command in the first work queue cache is the same as the storage address of the second command in the first work queue. The storage addresses in the cache are different; or, the first work queue cache and the second work queue cache are different.
在一种可能的实现方式中,该第一命令包括多个命令,和/或,该第二命令包括多个命令。In a possible implementation, the first command includes multiple commands, and/or the second command includes multiple commands.
在一种可能的实现方式中,该通知消息还包括第一标识字段、第一地址字段、第一传输模式字段和第一命令字段,该第一标识字段用于承载该第一工作队列缓存的标识信息、该第一地址字段用于承载该第一地址信息,该第一传输模式字段用于承载该第一传输模式信息,该第一命令字段用于承载该第一命令。In a possible implementation, the notification message also includes a first identification field, a first address field, a first transmission mode field, and a first command field. The first identification field is used to carry the first work queue cache. The identification information and the first address field are used to carry the first address information, the first transmission mode field is used to carry the first transmission mode information, and the first command field is used to carry the first command.
可选地,该装置500还包括写模块503。Optionally, the device 500 also includes a writing module 503.
在一种可能的实现方式中,该写模块503用于当该第一传输模式信息用于指示所述第一命令的传输模式为异步模式时,基于第一目标地址信息,将所述第一命令写入内存中,所述第一目标地址信息用于指示所述第一命令在所述内存中的存储地址。In a possible implementation, the writing module 503 is configured to write the first command based on the first target address information when the first transmission mode information is used to indicate that the transmission mode of the first command is an asynchronous mode. The command is written into the memory, and the first target address information is used to indicate the storage address of the first command in the memory.
需要说明的是,上述装置之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。在一个可选例子中,该装置500可以具体为上述方法200、方法300或方法400实施例中的中央处理器,装置500可以用于执行上述方法200、方法300或方法400实施例中与中央处理器对应的各个流程和/或步骤,为避免重复,在此不再赘述。It should be noted that the information interaction, execution process, etc. between the above devices are based on the same concept as the method embodiments of the present application. For details of their specific functions and technical effects, please refer to the method embodiments section, which will not be discussed here. Again. In an optional example, the device 500 may be specifically a central processing unit in the above-mentioned method 200, method 300 or method 400 embodiments, and the device 500 may be used to perform the above-mentioned method 200, method 300 or method 400 embodiments with the central processing unit. To avoid duplication, the various processes and/or steps corresponding to the processor will not be described again here.
图6所示实施例中的各个模块中的一个或多个可以通过软件、硬件、固件或其结合实现。所述软件或固件包括但不限于计算机程序指令或代码,并可以被硬件处理器所执行。所述硬件包括但不限于各类集成电路,如中央处理单元(CPU,Central Processing Unit)、数字信号处理器(DSP,Digital Signal Processor)、现场可编程门阵列(FPGA,Field Programmable Gate Array)或专用集成电路(ASIC,Application Specific Integrated Circuit)。One or more of the various modules in the embodiment shown in Figure 6 may be implemented through software, hardware, firmware, or a combination thereof. The software or firmware includes, but is not limited to, computer program instructions or code, and may be executed by a hardware processor. The hardware includes but is not limited to various types of integrated circuits, such as central processing unit (CPU), digital signal processor (DSP), field programmable gate array (FPGA) or field programmable gate array (FPGA). Application Specific Integrated Circuit (ASIC, Application Specific Integrated Circuit).
请参见图7,图7示出了本申请实施例提供的命令传输装置600的示意性框图,该装置600可以包括处理器601和通信接口602,该处理器601和该通信接口602耦合。Please refer to Figure 7. Figure 7 shows a schematic block diagram of a command transmission device 600 provided by an embodiment of the present application. The device 600 may include a processor 601 and a communication interface 602. The processor 601 is coupled to the communication interface 602.
该通信接口602用于从处理器601输出数据,如通知消息;该处理器601用于运行计算机程序或指令,以使该装置600实现上述方法200、方法300或方法400实施例所描述的方法。The communication interface 602 is used to output data, such as notification messages, from the processor 601; the processor 601 is used to run computer programs or instructions, so that the device 600 implements the method described in the above method 200, method 300 or method 400 embodiment. .
本申请实施例中的处理器601包括但不限于中央处理单元(Central Processing Unit,CPU)、通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)、分立门或者晶体管逻辑器件或分立硬件组件等。通用处理器可以是微处理器、微控制器或者是任何常规的处理器等。The processor 601 in the embodiment of this application includes but is not limited to a central processing unit (Central Processing Unit, CPU), a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC). ), off-the-shelf programmable gate array (Field Programmable Gate Array, FPGA), discrete gate or transistor logic devices or discrete hardware components, etc. A general-purpose processor can be a microprocessor, a microcontroller, or any conventional processor.
例如,该处理器601用于生成通知消息,该通知消息用于通知加速器执行第一命令,该通知消息包括第一工作队列缓存的标识信息、第一地址信息和第一传输模式信息,该第一工作队列缓存用于存储该第一命令,该第一地址信息用于指示该第一命令在该第一工作 队列缓存内的存储地址,该第一传输模式信息用于指示该第一命令的传输模式,该传输模式包括同步模式或异步模式,其中,当该第一命令的传输模式为该同步模式时,该通知消息还包括该第一命令;通过该通信接口602向该加速器发送该通知消息。For example, the processor 601 is used to generate a notification message. The notification message is used to notify the accelerator to execute the first command. The notification message includes the identification information cached by the first work queue, the first address information and the first transmission mode information. A work queue cache is used to store the first command, and the first address information is used to indicate that the first command is in the first work queue. The storage address in the queue cache. The first transmission mode information is used to indicate the transmission mode of the first command. The transmission mode includes a synchronous mode or an asynchronous mode. When the transmission mode of the first command is the synchronous mode, The notification message also includes the first command; the notification message is sent to the accelerator through the communication interface 602.
在一个可选例子中,本领域技术人员可以理解,该装置600可以具体为上述方法200、方法300或方法400实施例中的中央处理器,该装置600可以用于执行上述方法200、方法300或方法400实施例中与中央处理器对应的各个流程和/或步骤,为避免重复,在此不再赘述。In an optional example, those skilled in the art can understand that the device 600 can be specifically a central processing unit in the above method 200, method 300 or method 400 embodiment, and the device 600 can be used to execute the above method 200, method 300. Or the various processes and/or steps corresponding to the central processor in the method 400 embodiment will not be described again in order to avoid duplication.
可选地,该装置600还可以包括存储器603。Optionally, the device 600 may also include a memory 603.
该存储器603可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DR RAM)。The memory 603 may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Among them, non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electrically removable memory. Erase programmable read-only memory (Electrically EPROM, EEPROM) or flash memory. Volatile memory may be Random Access Memory (RAM), which is used as an external cache. By way of illustration, but not limitation, many forms of RAM are available, such as static random access memory (Static RAM, SRAM), dynamic random access memory (Dynamic RAM, DRAM), synchronous dynamic random access memory (Synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (Synchlink DRAM, SLDRAM) ) and direct memory bus random access memory (Direct Rambus RAM, DR RAM).
具体地,该存储器603用于存储该装置600的程序代码和指令。可选地,该存储器603还用于存储该处理器601执行上述方法200、方法300或方法400实施例过程中获得的数据,如通知消息或命令。Specifically, the memory 603 is used to store program codes and instructions of the device 600 . Optionally, the memory 603 is also used to store data obtained when the processor 601 executes the above-mentioned method 200, method 300 or method 400 embodiments, such as notification messages or commands.
可选地,存储器603可以为单独的器件或集成在处理器601中。Alternatively, the memory 603 may be a separate device or integrated in the processor 601.
需要说明的是,图7仅仅示出了装置600的简化设计。在实际应用中,该装置600还可以分别包含必要的其他元件,包含但不限于任意数量的通信接口、处理器、控制器、存储器等,而所有可以实现本申请的装置600都在本申请的保护范围之内。It should be noted that FIG. 7 only shows a simplified design of the device 600. In practical applications, the device 600 may also include other necessary components, including but not limited to any number of communication interfaces, processors, controllers, memories, etc., and all devices 600 that can implement the present application are included in the present application. within the scope of protection.
在一种可能的设计中,该装置600可以为芯片装置。可选地,该芯片装置还可以包括一个或多个存储器,用于存储计算机执行指令,当该芯片装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片装置执行上述命令传输方法。In a possible design, the device 600 may be a chip device. Optionally, the chip device can also include one or more memories for storing computer execution instructions. When the chip device is running, the processor can execute the computer execution instructions stored in the memory, so that the chip device executes the above command transmission method. .
可选地,该芯片装置可以为实现相关功能的现场可编程门阵列,专用集成芯片,系统芯片,中央处理器,网络处理器,数字信号处理电路,微控制器,还可以采用可编程控制器或其他集成芯片。Optionally, the chip device can be a field programmable gate array, a dedicated integrated chip, a system chip, a central processing unit, a network processor, a digital signal processing circuit, a microcontroller, or a programmable controller that implements related functions. or other integrated chips.
图8示出了本申请实施例提供的命令传输装置700的示意性框图。该装置700可以包括:接收模块701和读模块702和执行模块703。Figure 8 shows a schematic block diagram of the command transmission device 700 provided by the embodiment of the present application. The device 700 may include: a receiving module 701, a reading module 702, and an execution module 703.
可选地,该装置700可以用于上述系统100,进一步地,该装置700可以为上述系统100中的加速器120。Optionally, the device 700 can be used in the above-mentioned system 100. Further, the device 700 can be the accelerator 120 in the above-mentioned system 100.
该接收模块701用于接收来自处理器的通知消息,该通知消息用于通知加速器执行第一命令,该通知消息包括第一工作队列缓存的标识信息、第一地址信息和第一传输模式信息,该第一工作队列缓存用于存储该第一命令,该第一地址信息用于指示该第一命令在该 第一工作队列缓存内的存储地址,该第一传输模式信息用于指示该第一命令的传输模式,该传输模式包括同步模式或异步模式,其中,当该第一命令的传输模式为该同步模式时,该通知消息还包括该第一命令。The receiving module 701 is used to receive a notification message from the processor. The notification message is used to notify the accelerator to execute the first command. The notification message includes the identification information cached by the first work queue, the first address information and the first transmission mode information. The first work queue cache is used to store the first command, and the first address information is used to indicate that the first command is in the The storage address in the first work queue cache. The first transmission mode information is used to indicate the transmission mode of the first command. The transmission mode includes a synchronous mode or an asynchronous mode. When the transmission mode of the first command is the synchronous mode, mode, the notification message also includes the first command.
该读模块702用于基于所述通知消息,获取所述第一命令。The reading module 702 is used to obtain the first command based on the notification message.
该执行模块703用于执行所述第一命令。The execution module 703 is used to execute the first command.
在一种可能的实现方式中,该通知消息还用于通知该加速器执行第二命令,该通知消息还包括第二工作队列缓存的标识信息、第二地址信息和第二传输模式信息,该第二工作队列缓存用于存储该第二命令,该第二地址信息用于指示该第二命令在该第二工作队列缓存内的存储地址,该第二传输模式信息用于指示该第二命令的传输模式,该第一命令的传输模式与该第二命令的传输模式不同,其中,当该第二命令的传输模式为该同步模式时,该通知消息还包括该第二命令;该读模块702还用于基于该通知消息,获取该第二命令;该执行模块703还用于执行该第二命令。In a possible implementation, the notification message is also used to notify the accelerator to execute the second command. The notification message also includes the identification information cached by the second work queue, the second address information and the second transmission mode information. The second work queue cache is used to store the second command, the second address information is used to indicate the storage address of the second command in the second work queue cache, and the second transmission mode information is used to indicate the storage address of the second command. Transmission mode. The transmission mode of the first command is different from the transmission mode of the second command. When the transmission mode of the second command is the synchronous mode, the notification message also includes the second command; the reading module 702 It is also used to obtain the second command based on the notification message; the execution module 703 is also used to execute the second command.
在一种可能的实现方式中,该第一工作队列缓存与该第二工作队列缓存相同,但该第一命令在该第一工作队列缓存内的存储地址与该第二命令在该第一工作队列缓存内的存储地址不同;或者,该第一工作队列缓存与该第二工作队列缓存不同。In a possible implementation, the first work queue cache is the same as the second work queue cache, but the storage address of the first command in the first work queue cache is the same as the storage address of the second command in the first work queue cache. The storage addresses in the queue cache are different; or, the first work queue cache and the second work queue cache are different.
在一种可能的实现方式中,该第一命令包括多个命令,和/或,该第二命令包括多个命令。In a possible implementation, the first command includes multiple commands, and/or the second command includes multiple commands.
在一种可能的实现方式中,该通知消息还包括第一标识字段、第一地址字段、第一传输模式字段和第一命令字段,该第一标识字段用于承载该第一工作队列缓存的标识信息、该第一地址字段用于承载该第一地址信息,该第一传输模式字段用于承载该第一传输模式信息,该第一命令字段用于承载该第一命令。In a possible implementation, the notification message also includes a first identification field, a first address field, a first transmission mode field, and a first command field. The first identification field is used to carry the first work queue cache. The identification information and the first address field are used to carry the first address information, the first transmission mode field is used to carry the first transmission mode information, and the first command field is used to carry the first command.
在一种可能的实现方式中,所述读模块702具体用于:基于该第一工作队列缓存的标识信息、该第一地址信息和该第一传输模式信息,从该内存中读取该第一命令。In a possible implementation, the reading module 702 is specifically configured to read the first work queue cached identification information, the first address information and the first transmission mode information from the memory. One command.
在一种可能的实现方式中,所述读模块702具体用于:当该第一传输模式信息用于指示该第一命令的传输模式为该同步模式,但该第一命令不能写入该加速器的命令缓存队列时,基于该第一工作队列缓存的标识信息和该第一地址信息,从该内存中读取该第一命令。In a possible implementation, the reading module 702 is specifically used to: when the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, but the first command cannot be written to the accelerator When the command cache queue is cached, the first command is read from the memory based on the identification information cached in the first work queue and the first address information.
可选地,该装置700还包括:确定模块704。Optionally, the device 700 further includes: a determining module 704.
在一种可能的实现方式中,该确定模块704用于基于该第一工作队列缓存的标识信息、该第一地址信息和预设的映射关系,确定第一目标地址信息,该映射关系用于指示该第一工作队列缓存的标识信息和该第一工作队列缓存在该内存中的存储地址之间的对应关系,该第一目标地址信息用于指示该第一命令在该内存中的存储地址;所述读模块702具体用于:基于该第一目标地址信息,从该内存中读取该第一命令。In a possible implementation, the determining module 704 is configured to determine the first target address information based on the identification information cached by the first work queue, the first address information and a preset mapping relationship, and the mapping relationship is used for Indicates the correspondence between the identification information cached by the first work queue and the storage address cached by the first work queue in the memory. The first target address information is used to indicate the storage address of the first command in the memory. ; The reading module 702 is specifically configured to read the first command from the memory based on the first target address information.
可选地,该装置700还包括:写模块705。Optionally, the device 700 also includes: a writing module 705.
在一种可能的实现方式中,该写模块705用于在该基于该第一目标地址信息,从该内存中读取该第一命令之前,基于该第一目标地址信息,将该第一命令写入该内存中。In a possible implementation, the writing module 705 is configured to write the first command based on the first target address information before reading the first command from the memory based on the first target address information. Write to this memory.
在一种可能的实现方式中,该读模块702还用于:当该第一传输模式信息用于指示该第一命令的传输模式为该异步模式时,基于该第一工作队列缓存的标识信息和该第一地址信息,从该内存中读取该第一命令。In a possible implementation, the reading module 702 is also configured to: when the first transmission mode information is used to indicate that the transmission mode of the first command is the asynchronous mode, based on the identification information cached in the first work queue and the first address information, and reads the first command from the memory.
在一种可能的实现方式中,该读模块702还用于:当该第一传输模式信息用于指示该 第一命令的传输模式为该同步模式,且该第一命令能写入该加速器的命令缓存队列时,从该命令缓存队列中读取该第一命令。In a possible implementation, the reading module 702 is also used to: when the first transmission mode information is used to indicate the When the transmission mode of the first command is the synchronous mode, and the first command can be written into the command cache queue of the accelerator, the first command is read from the command cache queue.
在一种可能的实现方式中,该写模块705还用于:在从该命令缓存队列中读取该第一命令之前,将该第一命令写入该命令缓存队列中。In a possible implementation, the writing module 705 is also configured to write the first command into the command cache queue before reading the first command from the command cache queue.
需要说明的是,上述装置之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。在一个可选例子中,该装置700可以具体为上述方法200、方法300或方法400实施例中的加速器,装置700可以用于执行上述方法200、方法300或方法400实施例中与加速器对应的各个流程和/或步骤,为避免重复,在此不再赘述。It should be noted that the information interaction, execution process, etc. between the above devices are based on the same concept as the method embodiments of the present application. For details of their specific functions and technical effects, please refer to the method embodiments section, which will not be discussed here. Again. In an optional example, the device 700 may be specifically an accelerator in the above-mentioned method 200, method 300 or method 400 embodiments, and the device 700 may be used to execute the accelerator corresponding to the above-mentioned method 200, method 300 or method 400 embodiments. To avoid repetition, various processes and/or steps will not be described again here.
图8所示实施例中的各个模块中的一个或多个可以通过软件、硬件、固件或其结合实现。所述软件或固件包括但不限于计算机程序指令或代码,并可以被硬件处理器所执行。所述硬件包括但不限于各类集成电路,如中央处理单元(CPU,Central Processing Unit)、数字信号处理器(DSP,Digital Signal Processor)、现场可编程门阵列(FPGA,Field Programmable Gate Array)或专用集成电路(ASIC,Application Specific Integrated Circuit)。One or more of the various modules in the embodiment shown in Figure 8 may be implemented through software, hardware, firmware, or a combination thereof. The software or firmware includes, but is not limited to, computer program instructions or code, and may be executed by a hardware processor. The hardware includes but is not limited to various types of integrated circuits, such as central processing unit (CPU), digital signal processor (DSP), field programmable gate array (FPGA) or field programmable gate array (FPGA). Application Specific Integrated Circuit (ASIC, Application Specific Integrated Circuit).
请参见图9,图9示出了本申请实施例提供的命令传输装置800的示意性框图,该装置800可以包括处理器801和通信接口802,该处理器801和该通信接口802耦合。Please refer to Figure 9. Figure 9 shows a schematic block diagram of a command transmission device 800 provided by an embodiment of the present application. The device 800 may include a processor 801 and a communication interface 802. The processor 801 is coupled to the communication interface 802.
该通信接口802用于向处理器801提供数据,如通知消息;该处理器801用于运行计算机程序或指令,以使该装置800实现上述方法200、方法300或方法400实施例所描述的方法。The communication interface 802 is used to provide data, such as notification messages, to the processor 801; the processor 801 is used to run computer programs or instructions, so that the device 800 implements the method described in the above method 200, method 300 or method 400 embodiment. .
本申请实施例中的处理器801包括但不限于中央处理单元(Central Processing Unit,CPU)、通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)、分立门或者晶体管逻辑器件或分立硬件组件等。通用处理器可以是微处理器、微控制器或者是任何常规的处理器等。The processor 801 in the embodiment of this application includes but is not limited to a central processing unit (Central Processing Unit, CPU), a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC ), off-the-shelf programmable gate array (Field Programmable Gate Array, FPGA), discrete gate or transistor logic devices or discrete hardware components, etc. A general-purpose processor can be a microprocessor, a microcontroller, or any conventional processor.
例如,该处理器801用于通过该通信接口802接收来自处理器的通知消息,该通知消息用于通知加速器执行第一命令,该通知消息包括第一工作队列缓存的标识信息、第一地址信息和第一传输模式信息,该第一工作队列缓存用于存储该第一命令,该第一地址信息用于指示该第一命令在该第一工作队列缓存内的存储地址,该第一传输模式信息用于指示该第一命令的传输模式,该传输模式包括同步模式或异步模式,其中,当该第一命令的传输模式为该同步模式时,该通知消息还包括该第一命令;基于该通知消息,获取该第一命令;执行该第一命令。For example, the processor 801 is configured to receive a notification message from the processor through the communication interface 802. The notification message is used to notify the accelerator to execute the first command. The notification message includes the identification information and the first address information cached by the first work queue. and first transmission mode information, the first work queue cache is used to store the first command, the first address information is used to indicate the storage address of the first command in the first work queue cache, the first transmission mode The information is used to indicate the transmission mode of the first command. The transmission mode includes a synchronous mode or an asynchronous mode. When the transmission mode of the first command is the synchronous mode, the notification message also includes the first command; based on the Notify the message to obtain the first command; execute the first command.
在一个可选例子中,本领域技术人员可以理解,该装置800可以具体为上述方法200、方法300或方法400实施例中的加速器,该装置800可以用于执行上述方法200、方法300或方法400实施例中与加速器对应的各个流程和/或步骤,为避免重复,在此不再赘述。In an optional example, those skilled in the art can understand that the device 800 can be specifically an accelerator in the above method 200, method 300 or method 400 embodiment, and the device 800 can be used to execute the above method 200, method 300 or method. To avoid duplication, various processes and/or steps corresponding to the accelerator in the embodiment 400 will not be described again here.
可选地,该装置800还可以包括存储器803。Optionally, the device 800 may also include a memory 803.
该存储器803可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失 性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DR RAM)。The memory 803 may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electrically removable memory. Erase programmable read-only memory (Electrically EPROM, EEPROM) or flash memory. Volatile The permanent memory may be Random Access Memory (RAM), which is used as an external cache. By way of illustration, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (Dynamic RAM, DRAM), synchronous dynamic random access memory (Synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (Synchlink DRAM, SLDRAM) ) and direct memory bus random access memory (Direct Rambus RAM, DR RAM).
具体地,该存储器803用于存储该装置800的程序代码和指令。可选地,该存储器803还用于存储该处理器801执行上述方法200、方法300或方法400实施例过程中获得的数据,如通知消息或命令。Specifically, the memory 803 is used to store program codes and instructions of the device 800 . Optionally, the memory 803 is also used to store data obtained when the processor 801 executes the above-mentioned method 200, method 300 or method 400 embodiments, such as notification messages or commands.
可选地,存储器803可以为单独的器件或集成在处理器801中。Alternatively, the memory 803 may be a separate device or integrated in the processor 801.
需要说明的是,图9仅仅示出了装置800的简化设计。在实际应用中,该装置800还可以分别包含必要的其他元件,包含但不限于任意数量的通信接口、处理器、控制器、存储器等,而所有可以实现本申请的装置800都在本申请的保护范围之内。It should be noted that FIG. 9 only shows a simplified design of the device 800. In practical applications, the device 800 may also include other necessary components, including but not limited to any number of communication interfaces, processors, controllers, memories, etc., and all devices 800 that can implement the present application are included in the present application. within the scope of protection.
在一种可能的设计中,该装置800可以为芯片装置。可选地,该芯片装置还可以包括一个或多个存储器,用于存储计算机执行指令,当该芯片装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片装置执行上述命令传输方法。In one possible design, the device 800 may be a chip device. Optionally, the chip device can also include one or more memories for storing computer execution instructions. When the chip device is running, the processor can execute the computer execution instructions stored in the memory, so that the chip device executes the above command transmission method. .
可选地,该芯片装置可以为实现相关功能的现场可编程门阵列,专用集成芯片,系统芯片,中央处理器,网络处理器,数字信号处理电路,微控制器,还可以采用可编程控制器或其他集成芯片。Optionally, the chip device can be a field programmable gate array, a dedicated integrated chip, a system chip, a central processing unit, a network processor, a digital signal processing circuit, a microcontroller, or a programmable controller that implements related functions. or other integrated chips.
应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that in the various embodiments of the present application, the size of the sequence numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its functions and internal logic, and should not be used in the embodiments of the present application. The implementation process constitutes any limitation.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each specific application, but such implementations should not be considered beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be described again here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。 The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage media include: U disk, mobile hard disk, Read Only Memory (ROM), Random Access Memory (RAM), magnetic disk or optical disk and other media that can store program code.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应所述以权利要求的保护范围为准。 The above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application. should be covered by the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.

Claims (36)

  1. 一种命令传输方法,其特征在于,包括:A command transmission method, characterized by including:
    生成通知消息,所述通知消息用于通知加速器执行第一命令,所述通知消息包括第一工作队列缓存的标识信息、第一地址信息和第一传输模式信息,所述第一工作队列缓存用于存储所述第一命令,所述第一地址信息用于指示所述第一命令在所述第一工作队列缓存内的存储地址,所述第一传输模式信息用于指示所述第一命令的传输模式,所述传输模式包括同步模式或异步模式,其中,当所述第一命令的传输模式为所述同步模式时,所述通知消息还包括所述第一命令;Generate a notification message, the notification message is used to notify the accelerator to execute the first command, the notification message includes the identification information, the first address information and the first transmission mode information of the first work queue cache, and the first work queue cache uses When storing the first command, the first address information is used to indicate the storage address of the first command in the first work queue cache, and the first transmission mode information is used to indicate the first command. The transmission mode includes a synchronous mode or an asynchronous mode, wherein when the transmission mode of the first command is the synchronous mode, the notification message also includes the first command;
    向所述加速器发送所述通知消息。Send the notification message to the accelerator.
  2. 根据权利要求1所述的方法,其特征在于,所述通知消息还用于通知所述加速器执行第二命令,所述通知消息还包括第二工作队列缓存的标识信息、第二地址信息和第二传输模式信息,所述第二工作队列缓存用于存储所述第二命令,所述第二地址信息用于指示所述第二命令在所述第二工作队列缓存内的存储地址,所述第二传输模式信息用于指示所述第二命令的传输模式,所述第一命令的传输模式与所述第二命令的传输模式不同,其中,当所述第二命令的传输模式为所述同步模式时,所述通知消息还包括所述第二命令。The method according to claim 1, characterized in that the notification message is also used to notify the accelerator to execute the second command, and the notification message also includes the identification information cached by the second work queue, the second address information and the second command. Two transmission mode information, the second work queue cache is used to store the second command, the second address information is used to indicate the storage address of the second command in the second work queue cache, the The second transmission mode information is used to indicate the transmission mode of the second command. The transmission mode of the first command is different from the transmission mode of the second command. Wherein, when the transmission mode of the second command is the In the synchronous mode, the notification message also includes the second command.
  3. 根据权利要求2所述的方法,其特征在于,所述第一工作队列缓存与所述第二工作队列缓存相同,所述第一命令在所述第一工作队列缓存内的存储地址与所述第二命令在所述第一工作队列缓存内的存储地址不同;或者,所述第一工作队列缓存与所述第二工作队列缓存不同。The method of claim 2, wherein the first work queue cache is the same as the second work queue cache, and the storage address of the first command in the first work queue cache is the same as the first work queue cache. The storage address of the second command in the first work queue cache is different; or, the first work queue cache and the second work queue cache are different.
  4. 根据权利要求2或3所述的方法,其特征在于,所述第一命令包括多个命令,和/或,所述第二命令包括多个命令。The method according to claim 2 or 3, characterized in that the first command includes multiple commands, and/or the second command includes multiple commands.
  5. 根据权利要求1-4中任一项所述的方法,其特征在于,所述通知消息还包括第一标识字段、第一地址字段、第一传输模式字段和第一命令字段,所述第一标识字段用于承载所述第一工作队列缓存的标识信息、所述第一地址字段用于承载所述第一地址信息,所述第一传输模式字段用于承载所述第一传输模式信息,所述第一命令字段用于承载所述第一命令。The method according to any one of claims 1 to 4, characterized in that the notification message further includes a first identification field, a first address field, a first transmission mode field and a first command field, and the first The identification field is used to carry the identification information cached by the first work queue, the first address field is used to carry the first address information, and the first transmission mode field is used to carry the first transmission mode information, The first command field is used to carry the first command.
  6. 一种命令传输方法,其特征在于,包括:A command transmission method, characterized by including:
    接收来自中央处理器的通知消息,所述通知消息用于通知加速器执行第一命令,所述通知消息包括第一工作队列缓存的标识信息、第一地址信息和第一传输模式信息,所述第一工作队列缓存用于存储所述第一命令,所述第一地址信息用于指示所述第一命令在所述第一工作队列缓存内的存储地址,所述第一传输模式信息用于指示所述第一命令的传输模式,所述传输模式包括同步模式或异步模式,其中,当所述第一命令的传输模式为所述同步模式时,所述通知消息还包括所述第一命令;Receive a notification message from the central processor, the notification message is used to notify the accelerator to execute the first command, the notification message includes the identification information cached by the first work queue, the first address information and the first transmission mode information, and the first A work queue cache is used to store the first command, the first address information is used to indicate the storage address of the first command in the first work queue cache, and the first transmission mode information is used to indicate The transmission mode of the first command, the transmission mode includes a synchronous mode or an asynchronous mode, wherein when the transmission mode of the first command is the synchronous mode, the notification message also includes the first command;
    基于所述通知消息,获取所述第一命令;Based on the notification message, obtain the first command;
    执行所述第一命令。Execute the first command.
  7. 根据权利要求6所述的方法,其特征在于,所述通知消息还用于通知所述加速器执行第二命令,所述通知消息还包括第二工作队列缓存的标识信息、第二地址信息和第二传输模式信息,所述第二工作队列缓存用于存储所述第二命令,所述第二地址信息用于指 示所述第二命令在所述第二工作队列缓存内的存储地址,所述第二传输模式信息用于指示所述第二命令的传输模式,所述第一命令的传输模式与所述第二命令的传输模式不同,其中,当所述第二命令的传输模式为所述同步模式时,所述通知消息还包括所述第二命令,所述方法还包括:The method according to claim 6, characterized in that the notification message is also used to notify the accelerator to execute the second command, and the notification message also includes the identification information cached by the second work queue, the second address information and the second command. Two transmission mode information, the second work queue cache is used to store the second command, and the second address information is used to indicate indicates the storage address of the second command in the second work queue cache, the second transmission mode information is used to indicate the transmission mode of the second command, and the transmission mode of the first command is the same as the first command. The transmission modes of the two commands are different, and when the transmission mode of the second command is the synchronization mode, the notification message also includes the second command, and the method further includes:
    基于所述通知消息,获取所述第二命令;Based on the notification message, obtain the second command;
    执行所述第二命令。Execute the second command.
  8. 根据权利要求7所述的方法,其特征在于,所述第一工作队列缓存与所述第二工作队列缓存相同,但所述第一命令在所述第一工作队列缓存内的存储地址与所述第二命令在所述第一工作队列缓存内的存储地址不同;或者,所述第一工作队列缓存与所述第二工作队列缓存不同。The method according to claim 7, characterized in that the first work queue cache and the second work queue cache are the same, but the storage address of the first command in the first work queue cache is the same as the storage address of the first work queue cache. The storage address of the second command in the first work queue cache is different; or the first work queue cache and the second work queue cache are different.
  9. 根据权利要求7或8所述的方法,其特征在于,所述第一命令包括多个命令,和/或,所述第二命令包括多个命令。The method according to claim 7 or 8, characterized in that the first command includes multiple commands, and/or the second command includes multiple commands.
  10. 根据权利要求6-9中任一项所述的方法,其特征在于,所述通知消息还包括第一标识字段、第一地址字段、第一传输模式字段和第一命令字段,所述第一标识字段用于承载所述第一工作队列缓存的标识信息、所述第一地址字段用于承载所述第一地址信息,所述第一传输模式字段用于承载所述第一传输模式信息,所述第一命令字段用于承载所述第一命令。The method according to any one of claims 6-9, characterized in that the notification message further includes a first identification field, a first address field, a first transmission mode field and a first command field, and the first The identification field is used to carry the identification information cached by the first work queue, the first address field is used to carry the first address information, and the first transmission mode field is used to carry the first transmission mode information, The first command field is used to carry the first command.
  11. 根据权利要求6-10中任一项所述的方法,其特征在于,所述基于所述通知消息,获取所述第一命令,包括:The method according to any one of claims 6-10, characterized in that, obtaining the first command based on the notification message includes:
    基于所述第一工作队列缓存的标识信息、所述第一地址信息和所述第一传输模式信息,从所述内存中读取所述第一命令。The first command is read from the memory based on the identification information cached in the first work queue, the first address information and the first transmission mode information.
  12. 根据权利要求11所述的方法,其特征在于,所述基于所述第一工作队列缓存的标识信息、所述第一地址信息和所述第一传输模式信息,从所述内存中读取所述第一命令,包括:The method according to claim 11, characterized in that, based on the identification information cached by the first work queue, the first address information and the first transmission mode information, reading all data from the memory is The first order mentioned above includes:
    当所述第一传输模式信息用于指示所述第一命令的传输模式为所述同步模式,但所述第一命令不能写入所述加速器的命令缓存队列时,基于所述第一工作队列缓存的标识信息和所述第一地址信息,从所述内存中读取所述第一命令。When the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, but the first command cannot be written to the command cache queue of the accelerator, based on the first work queue The cached identification information and the first address information are used to read the first command from the memory.
  13. 根据权利要求12所述的方法,其特征在于,所述基于所述第一工作队列缓存的标识信息和所述第一地址信息,从所述内存中读取所述第一命令,包括:The method of claim 12, wherein reading the first command from the memory based on the identification information cached by the first work queue and the first address information includes:
    基于所述第一工作队列缓存的标识信息、所述第一地址信息和预设的映射关系,确定第一目标地址信息,所述映射关系用于指示所述第一工作队列缓存的标识信息和所述第一工作队列缓存在所述内存中的存储地址之间的对应关系,所述第一目标地址信息用于指示所述第一命令在所述内存中的存储地址;The first target address information is determined based on the identification information cached by the first work queue, the first address information and a preset mapping relationship, the mapping relationship is used to indicate the identification information cached by the first work queue and The first work queue caches the corresponding relationship between the storage addresses in the memory, and the first target address information is used to indicate the storage address of the first command in the memory;
    基于所述第一目标地址信息,从所述内存中读取所述第一命令。Based on the first target address information, the first command is read from the memory.
  14. 根据权利要求13所述的方法,其特征在于,在所述基于所述第一目标地址信息,从所述内存中读取所述第一命令之前,所述方法还包括:The method according to claim 13, characterized in that, before reading the first command from the memory based on the first target address information, the method further includes:
    基于所述第一目标地址信息,将所述第一命令写入所述内存中。Based on the first target address information, the first command is written into the memory.
  15. 根据权利要求11所述的方法,其特征在于,所述基于所述第一工作队列缓存的标识信息、所述第一地址信息和所述第一传输模式信息,从所述内存中读取所述第一命令, 包括:The method according to claim 11, characterized in that, based on the identification information cached by the first work queue, the first address information and the first transmission mode information, reading all data from the memory is stating the first command, include:
    当所述第一传输模式信息用于指示所述第一命令的传输模式为所述异步模式时,基于所述第一工作队列缓存的标识信息和所述第一地址信息,从所述内存中读取所述第一命令。When the first transmission mode information is used to indicate that the transmission mode of the first command is the asynchronous mode, based on the identification information cached in the first work queue and the first address information, from the memory Read the first command.
  16. 根据权利要求6-10中任一项所述的方法,其特征在于,所述基于所述通知消息,获取所述第一命令,包括:The method according to any one of claims 6-10, characterized in that, obtaining the first command based on the notification message includes:
    当所述第一传输模式信息用于指示所述第一命令的传输模式为所述同步模式,且所述第一命令能写入所述加速器的命令缓存队列时,从所述命令缓存队列中读取所述第一命令。When the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, and the first command can be written to the command cache queue of the accelerator, from the command cache queue Read the first command.
  17. 根据权利要求16所述的方法,其特征在于,在从所述命令缓存队列中读取所述第一命令之前,所述方法还包括:The method according to claim 16, characterized in that, before reading the first command from the command cache queue, the method further includes:
    将所述第一命令写入所述命令缓存队列中。Write the first command into the command cache queue.
  18. 一种命令传输装置,其特征在于,包括:处理器和通信接口,所述处理器和所述通信接口耦合,所述处理器用于:A command transmission device, characterized in that it includes: a processor and a communication interface, the processor is coupled to the communication interface, and the processor is used for:
    生成通知消息,所述通知消息用于通知加速器执行第一命令,所述通知消息包括第一工作队列缓存的标识信息、第一地址信息和第一传输模式信息,所述第一工作队列缓存用于存储所述第一命令,所述第一地址信息用于指示所述第一命令在所述第一工作队列缓存内的存储地址,所述第一传输模式信息用于指示所述第一命令的传输模式,所述传输模式包括同步模式或异步模式,其中,当所述第一命令的传输模式为所述同步模式时,所述通知消息还包括所述第一命令;Generate a notification message, the notification message is used to notify the accelerator to execute the first command, the notification message includes the identification information, the first address information and the first transmission mode information of the first work queue cache, and the first work queue cache uses When storing the first command, the first address information is used to indicate the storage address of the first command in the first work queue cache, and the first transmission mode information is used to indicate the first command. The transmission mode includes a synchronous mode or an asynchronous mode, wherein when the transmission mode of the first command is the synchronous mode, the notification message also includes the first command;
    通过所述通信接口向所述加速器发送所述通知消息。Send the notification message to the accelerator through the communication interface.
  19. 根据权利要求18所述的装置,其特征在于,所述通知消息还用于通知所述加速器执行第二命令,所述通知消息还包括第二工作队列缓存的标识信息、第二地址信息和第二传输模式信息,所述第二工作队列缓存用于存储所述第二命令,所述第二地址信息用于指示所述第二命令在所述第二工作队列缓存内的存储地址,所述第二传输模式信息用于指示所述第二命令的传输模式,所述第一命令的传输模式与所述第二命令的传输模式不同,其中,当所述第二命令的传输模式为所述同步模式时,所述通知消息还包括所述第二命令。The device according to claim 18, characterized in that the notification message is also used to notify the accelerator to execute the second command, and the notification message also includes the identification information cached by the second work queue, the second address information and the second command. Two transmission mode information, the second work queue cache is used to store the second command, the second address information is used to indicate the storage address of the second command in the second work queue cache, the The second transmission mode information is used to indicate the transmission mode of the second command. The transmission mode of the first command is different from the transmission mode of the second command. Wherein, when the transmission mode of the second command is the In the synchronous mode, the notification message also includes the second command.
  20. 根据权利要求19所述的装置,其特征在于,所述第一工作队列缓存与所述第二工作队列缓存相同,所述第一命令在所述第一工作队列缓存内的存储地址与所述第二命令在所述第一工作队列缓存内的存储地址不同;或者,所述第一工作队列缓存与所述第二工作队列缓存不同。The device according to claim 19, characterized in that the first work queue cache and the second work queue cache are the same, and the storage address of the first command in the first work queue cache is the same as the storage address of the first work queue cache. The storage address of the second command in the first work queue cache is different; or, the first work queue cache and the second work queue cache are different.
  21. 根据权利要求19或20所述的装置,其特征在于,所述第一命令包括多个命令,和/或,所述第二命令包括多个命令。The device according to claim 19 or 20, wherein the first command includes a plurality of commands, and/or the second command includes a plurality of commands.
  22. 根据权利要求18-21中任一项所述的装置,其特征在于,所述通知消息还包括第一标识字段、第一地址字段、第一传输模式字段和第一命令字段,所述第一标识字段用于承载所述第一工作队列缓存的标识信息、所述第一地址字段用于承载所述第一地址信息,所述第一传输模式字段用于承载所述第一传输模式信息,所述第一命令字段用于承载所述第一命令。The device according to any one of claims 18-21, wherein the notification message further includes a first identification field, a first address field, a first transmission mode field and a first command field, and the first The identification field is used to carry the identification information cached by the first work queue, the first address field is used to carry the first address information, and the first transmission mode field is used to carry the first transmission mode information, The first command field is used to carry the first command.
  23. 一种命令传输装置,其特征在于,包括:处理器和通信接口,所述处理器和所述通信接口耦合,所述处理器用于:A command transmission device, characterized in that it includes: a processor and a communication interface, the processor is coupled to the communication interface, and the processor is used for:
    通过所述通信接口接收来自中央处理器的通知消息,所述通知消息用于通知加速器执 行第一命令,所述通知消息包括第一工作队列缓存的标识信息、第一地址信息和第一传输模式信息,所述第一工作队列缓存用于存储所述第一命令,所述第一地址信息用于指示所述第一命令在所述第一工作队列缓存内的存储地址,所述第一传输模式信息用于指示所述第一命令的传输模式,所述传输模式包括同步模式或异步模式,其中,当所述第一命令的传输模式为所述同步模式时,所述通知消息还包括所述第一命令;A notification message from the central processor is received through the communication interface, and the notification message is used to notify the accelerator to execute Execute the first command, the notification message includes the identification information, the first address information and the first transmission mode information of the first work queue cache, the first work queue cache is used to store the first command, the first The address information is used to indicate the storage address of the first command in the first work queue cache, and the first transmission mode information is used to indicate the transmission mode of the first command. The transmission mode includes a synchronous mode or Asynchronous mode, wherein when the transmission mode of the first command is the synchronous mode, the notification message also includes the first command;
    基于所述通知消息,获取所述第一命令;Based on the notification message, obtain the first command;
    执行所述第一命令。Execute the first command.
  24. 根据权利要求23所述的装置,其特征在于,所述通知消息还用于通知所述加速器执行第二命令,所述通知消息还包括第二工作队列缓存的标识信息、第二地址信息和第二传输模式信息,所述第二工作队列缓存用于存储所述第二命令,所述第二地址信息用于指示所述第二命令在所述第二工作队列缓存内的存储地址,所述第二传输模式信息用于指示所述第二命令的传输模式,所述第一命令的传输模式与所述第二命令的传输模式不同,其中,当所述第二命令的传输模式为所述同步模式时,所述通知消息还包括所述第二命令,所述处理器还用于:The device according to claim 23, characterized in that the notification message is also used to notify the accelerator to execute the second command, and the notification message also includes the identification information cached by the second work queue, the second address information and the second command. Two transmission mode information, the second work queue cache is used to store the second command, the second address information is used to indicate the storage address of the second command in the second work queue cache, the The second transmission mode information is used to indicate the transmission mode of the second command. The transmission mode of the first command is different from the transmission mode of the second command. Wherein, when the transmission mode of the second command is the In synchronous mode, the notification message further includes the second command, and the processor is further configured to:
    基于所述通知消息,获取所述第二命令;Based on the notification message, obtain the second command;
    执行所述第二命令。Execute the second command.
  25. 根据权利要求24所述的装置,其特征在于,所述第一工作队列缓存与所述第二工作队列缓存相同,但所述第一命令在所述第一工作队列缓存内的存储地址与所述第二命令在所述第一工作队列缓存内的存储地址不同;或者,所述第一工作队列缓存与所述第二工作队列缓存不同。The device according to claim 24, wherein the first work queue cache and the second work queue cache are the same, but the storage address of the first command in the first work queue cache is the same as the storage address of the first work queue cache. The storage address of the second command in the first work queue cache is different; or, the first work queue cache and the second work queue cache are different.
  26. 根据权利要求24或25所述的装置,其特征在于,所述第一命令包括多个命令,和/或,所述第二命令包括多个命令。The device according to claim 24 or 25, wherein the first command includes a plurality of commands, and/or the second command includes a plurality of commands.
  27. 根据权利要求23-26中任一项所述的装置,其特征在于,所述通知消息还包括第一标识字段、第一地址字段、第一传输模式字段和第一命令字段,所述第一标识字段用于承载所述第一工作队列缓存的标识信息、所述第一地址字段用于承载所述第一地址信息,所述第一传输模式字段用于承载所述第一传输模式信息,所述第一命令字段用于承载所述第一命令。The device according to any one of claims 23-26, wherein the notification message further includes a first identification field, a first address field, a first transmission mode field and a first command field, and the first The identification field is used to carry the identification information cached by the first work queue, the first address field is used to carry the first address information, and the first transmission mode field is used to carry the first transmission mode information, The first command field is used to carry the first command.
  28. 根据权利要求23-27中任一项所述的装置,其特征在于,所述处理器具体用于:The device according to any one of claims 23-27, characterized in that the processor is specifically configured to:
    基于所述第一工作队列缓存的标识信息、所述第一地址信息和所述第一传输模式信息,从所述内存中读取所述第一命令。The first command is read from the memory based on the identification information cached in the first work queue, the first address information and the first transmission mode information.
  29. 根据权利要求28所述的装置,其特征在于,所述处理器具体用于:The device according to claim 28, wherein the processor is specifically configured to:
    当所述第一传输模式信息用于指示所述第一命令的传输模式为所述同步模式,但所述第一命令不能写入所述加速器的命令缓存队列时,基于所述第一工作队列缓存的标识信息和所述第一地址信息,从所述内存中读取所述第一命令。When the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, but the first command cannot be written to the command cache queue of the accelerator, based on the first work queue The cached identification information and the first address information are used to read the first command from the memory.
  30. 根据权利要求29所述的装置,其特征在于,所述处理器具体用于:The device according to claim 29, wherein the processor is specifically configured to:
    基于所述第一工作队列缓存的标识信息、所述第一地址信息和预设的映射关系,确定第一目标地址信息,所述映射关系用于指示所述第一工作队列缓存的标识信息和所述第一工作队列缓存在所述内存中的存储地址之间的对应关系,所述第一目标地址信息用于指示所述第一命令在所述内存中的存储地址; The first target address information is determined based on the identification information cached by the first work queue, the first address information and a preset mapping relationship, the mapping relationship is used to indicate the identification information cached by the first work queue and The first work queue caches the corresponding relationship between the storage addresses in the memory, and the first target address information is used to indicate the storage address of the first command in the memory;
    基于所述第一目标地址信息,从所述内存中读取所述第一命令。Based on the first target address information, the first command is read from the memory.
  31. 根据权利要求30所述的装置,其特征在于,所述处理器还用于:The device of claim 30, wherein the processor is further configured to:
    在所述基于所述第一目标地址信息,从所述内存中读取所述第一命令之前,基于所述第一目标地址信息,将所述第一命令写入所述内存中。Before reading the first command from the memory based on the first target address information, writing the first command into the memory based on the first target address information.
  32. 根据权利要求28所述的装置,其特征在于,所述处理器具体用于:The device according to claim 28, wherein the processor is specifically configured to:
    当所述第一传输模式信息用于指示所述第一命令的传输模式为所述异步模式时,基于所述第一工作队列缓存的标识信息和所述第一地址信息,从所述内存中读取所述第一命令。When the first transmission mode information is used to indicate that the transmission mode of the first command is the asynchronous mode, based on the identification information cached in the first work queue and the first address information, from the memory Read the first command.
  33. 根据权利要求23-27中任一项所述的装置,其特征在于,所述处理器具体用于:The device according to any one of claims 23-27, characterized in that the processor is specifically configured to:
    当所述第一传输模式信息用于指示所述第一命令的传输模式为所述同步模式,且所述第一命令能写入所述加速器的命令缓存队列时,从所述命令缓存队列中读取所述第一命令。When the first transmission mode information is used to indicate that the transmission mode of the first command is the synchronous mode, and the first command can be written to the command cache queue of the accelerator, from the command cache queue Read the first command.
  34. 根据权利要求33所述的装置,其特征在于,所述处理器还用于:The device of claim 33, wherein the processor is further configured to:
    在从所述命令缓存队列中读取所述第一命令之前,将所述第一命令写入所述命令缓存队列中。Before reading the first command from the command cache queue, the first command is written into the command cache queue.
  35. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序,所述计算机程序被至少一个处理器执行时用于实现如权利要求1-17中任一项所述的方法。A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, and when the computer program is executed by at least one processor, it is used to implement any one of claims 1-17. method described.
  36. 一种计算机程序产品,其特征在于,当所述计算机程序产品被至少一个处理器执行时用于实现如权利要求1-17中任一项所述的方法。 A computer program product, characterized in that when the computer program product is executed by at least one processor, it is used to implement the method according to any one of claims 1-17.
PCT/CN2023/083662 2022-04-28 2023-03-24 Command transmission method and apparatus WO2023207456A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210460670.6A CN117008812A (en) 2022-04-28 2022-04-28 Command transmission method and device
CN202210460670.6 2022-04-28

Publications (1)

Publication Number Publication Date
WO2023207456A1 true WO2023207456A1 (en) 2023-11-02

Family

ID=88517282

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/083662 WO2023207456A1 (en) 2022-04-28 2023-03-24 Command transmission method and apparatus

Country Status (2)

Country Link
CN (1) CN117008812A (en)
WO (1) WO2023207456A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090006657A1 (en) * 2007-06-26 2009-01-01 Asad Azam Enabling consecutive command message transmission to different devices
CN107454634A (en) * 2016-06-01 2017-12-08 中兴通讯股份有限公司 A kind of method being switched fast, the device being switched fast, terminal and base station
CN110569653A (en) * 2019-08-28 2019-12-13 华为技术有限公司 Data processing method, related device and computer storage medium
CN111930678A (en) * 2020-08-14 2020-11-13 山东云海国创云计算装备产业创新中心有限公司 Data transmission method and device, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090006657A1 (en) * 2007-06-26 2009-01-01 Asad Azam Enabling consecutive command message transmission to different devices
CN107454634A (en) * 2016-06-01 2017-12-08 中兴通讯股份有限公司 A kind of method being switched fast, the device being switched fast, terminal and base station
CN110569653A (en) * 2019-08-28 2019-12-13 华为技术有限公司 Data processing method, related device and computer storage medium
CN111930678A (en) * 2020-08-14 2020-11-13 山东云海国创云计算装备产业创新中心有限公司 Data transmission method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN117008812A (en) 2023-11-07

Similar Documents

Publication Publication Date Title
US11500810B2 (en) Techniques for command validation for access to a storage device by a remote client
US9940980B2 (en) Hybrid LPDDR4-DRAM with cached NVM and flash-nand in multi-chip packages for mobile devices
US10116746B2 (en) Data storage method and network interface card
US20200050551A1 (en) Data Access Method and Apparatus
CN106326140B (en) Data copying method, direct memory access controller and computer system
WO2018041074A1 (en) Method, apparatus, and system for accessing memory device
CN114662136B (en) PCIE (peripheral component interface express) channel-based high-speed encryption and decryption system and method for multi-algorithm IP (Internet protocol) core
CN114945009B (en) Method, device and system for communication between devices connected by PCIe bus
US20220091780A1 (en) Memory access method and intelligent processing apparatus
US10963295B2 (en) Hardware accelerated data processing operations for storage data
US20230105771A1 (en) Network adapter and data processing method of network adapter
CN110677220B (en) RDMA (remote direct memory Access) message mechanism based on multi-track redundant response and implementation device thereof
CN109478171B (en) Improving throughput in openfabics environment
CN114285676B (en) Intelligent network card, network storage method and medium of intelligent network card
WO2023207456A1 (en) Command transmission method and apparatus
CN112799723A (en) Data reading method and device and electronic equipment
KR20140108861A (en) Method and apparatus for copying memory between domains
US8959303B2 (en) Information processor and multi-core system
WO2023185230A1 (en) Data processing method and apparatus
CN116455849B (en) Concurrent communication method, device, equipment and medium for many-core processor
JP2013539577A (en) Interrupt-based command processing
US11895043B2 (en) Method for accessing system memory and associated processing circuit within a network card
CN117389915B (en) Cache system, read command scheduling method, system on chip and electronic equipment
US20230106923A1 (en) Storage system
CN113835831A (en) Data memory mapping method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23794891

Country of ref document: EP

Kind code of ref document: A1