Parallel multi-threaded processing

A parallel, multi-threaded processor system and technique for arbitrating command requests is described. The system includes a plurality of microengines, a plurality of shared system resources and a global command arbiter. The global command arbiter uses a command request protocol that is based on the shared system resources and command type to grant or deny a microengine command request for a shared resource.

BACKGROUND OF THE INVENTION

This invention relates to a protocol for providing parallel, multi-threaded processors with high bandwidth access to shared resources.

Parallel processing is an efficient form of computer information processing of concurrent events. Certain problems may be solved by applying parallel computer processing, which demands concurrent execution of many programs to do more than one thing at the same time. Unlike a serial paradigm where all tasks are performed sequentially at a single station, or a pipelined machine where tasks are performed at specialized stations, parallel processing requires that a plurality of stations have the capability to perform all tasks. In general, all or a plurality of the stations work simultaneously and independently on the same or common elements of a problem.

Types of computer processing include single instruction stream, single data stream, which is the conventional serial von Neumann computer that includes a single stream of instructions. A second processing type is the single instruction stream, multiple data streams process (SIMD). This processing scheme may include multiple arithmetic-logic processors and a single control processor. Each of the arithmetic-logic processors performs operations on the data in lock step and are synchronized by the control processor. A third type is multiple instruction streams, single data stream (MISD) processing which involves processing the same data stream flows through a linear array of processors executing different instruction streams. A fourth processing type is multiple instruction streams, multiple data streams (MIMD) processing which uses multiple processors, each executing its own instruction stream to process a data stream fed to each of the processors. MIMD processors may have several instruction processing units and therefore several data streams.

SUMMARY OF THE INVENTION

According to an aspect of the present invention, a parallel, hardware-based, multi-threaded processor includes a global command arbiter for determining the allocation of access to system resources. The multi-threaded processor system includes a plurality of microengines, a plurality of shared system resources and a global command arbiter. The global command arbiter uses a command request protocol based on the shared system resources and command type to grant or deny a microengine command request for a shared resource. The processor system may be advantageously realized on an integrated circuit chip with minimal wiring and buffer storage elements.

The technique according to the invention provides each microengine with fair access to the shared system resources based on command priority and resource utilization. Consequently, the microengines have high bandwidth access to the shared system resources.

DESCRIPTION

FIG. 1illustrates a communication system10that includes a parallel, hardware-based multithreaded processor12. The system10is especially useful for tasks that can be broken into parallel subtasks or functions, and the hardware-based multithreaded processor12is particularly useful for tasks that are bandwidth oriented rather than latency oriented.

The hardware-based multithreaded processor12may be an integrated circuit, and may be coupled to a bus such as a PCI bus14, a memory system16and a second bus18. In the illustrated implementation, the hardware-based multi-threaded processor12has multiple microengines22a to22f that each includes multiple hardware-controlled threads that can be simultaneously active and that may independently work on a task. The multithreaded processor12also includes a central or core controller20that assists in loading microcode control for other resources and performs other general purpose computer-type functions such as handling protocols, handling exceptions, and providing extra support for packet processing, which may occur if the microengines pass the packets off for more detailed processing. In one embodiment, the core controller20is a Strong Arm® (Arm is a trademark of ARM Limited, United Kingdom) based architecture embedded general-purpose microprocessor, which includes an operating system. The operating system enables the core processor20to call functions to operate on the microengines22a-22f. The core processor20can use any supported operating system but preferably utilizes a real time operating system. Suitable operating systems for a core processor implemented as a Strong Arm architecture microprocessor may include Microsoft NT real-time, VXWorks and μCUS, which is a freeware operating system available over the Internet.

The plurality of functional microengines22a-22f each maintain a plurality of program counters in hardware, and maintain states associated with the program counters. Each of the six microengines22a-22f is capable of processing four independent hardware threads. Such processing allows one thread to start executing just after another thread issues a memory reference and then waits until that reference completes before doing more work. This behavior is critical to maintaining efficient hardware execution of the microegines because memory latency may be significant. Stated differently, if only a single thread execution was supported, the microengines would sit idle for a significant number of cycles waiting for references to return and thereby reduce overall computational throughput. Multi-threaded execution allows the microengines to mask memory latency by performing useful independent work across several threads. Effectively, a corresponding plurality of sets of threads can be simultaneously active on each of the microengines22a-22f while only one is actually operating at any one time.

The six microengines22a-22f operate with shared system resources including the memory system16, the PCI bus14and the FBUS18. The memory system16may be accessed via a Synchronous Dynamic Random Access Memory (SDRAM) controller26a and a Static Random Access Memory (SRAM) controller26b. SDRAM memory16a and SDRAM controller26a may be typically used for processing large volumes of data or high bandwidth data, such as processing network payloads from network packets. The SRAM controller26b and SRAM memory16b may be used in a networking implementation for low latency, fast access tasks or low bandwidth data, such as accessing look-up tables, memory for the core processor20, and so forth.

The six microengines22a-22f access either the SDRAM16a or SRAM16b based on characteristics of the data. Low latency, low bandwidth data is stored in and fetched from SRAM16b, whereas higher bandwidth data for which latency is not as important is stored in and fetched from SDRAM16a. The microengines22a-22f can execute memory reference instructions to either the SDRAM controller26a or SRAM controller26b.

Advantages of hardware multithreading can be explained in the context of SRAM or SDRAM memory accesses. For example, an SRAM access requested by a Thread_0from a microengine will cause the SRAM controller26b to initiate an access to the SRAM memory16b. The SRAM controller26b controls arbitration for the SRAM bus15, accesses the SRAM16b, fetches the data from the SRAM16b, and returns data to a requesting microengine22a-22b. During a SRAM access, if the microengine22a had only a single thread that could operate, that microengine would be dormant until data was returned from the SRAM. By employing hardware context swapping within each of the microengines22a-22f, another thread such as Thread_1can function while the first thread, Thread_0, is awaiting the read data to return. Hardware context swapping enables other contexts with unique program counters to execute in that same microengine. Continuing the example, during execution Thread_1may access the SDRAM memory16a. While Thread_1operates on the SDRAM unit, and Thread_0is operating on the SRAM unit, a new thread such as Thread_2can now operate in the microengine22a. Thread_2can operate for a certain amount of time until it needs to access memory or perform some other long latency operation, such as making an access to a bus interface. Therefore, the processor12can simultaneously perform a bus operation, SRAM operation and SDRAM operation with all being completed or operated upon by one microengine22a, which microengine22a has one more thread available to process more work in the data path.

The hardware context swapping also synchronizes completion of tasks. For example, it is possible that two threads could hit the same-shared resource such as the SRAM16b. Each one of the separate functional units, such as the interface28, the SRAM controller26a, and the SDRAM controller26b, reports back a flag signaling completion of an operation when a requested task from one of the microengine thread contexts is completed. When the flag is received by the microengine, the microengine can determine which thread to turn on.

The processor12includes a bus interface28that couples the processor to a second bus18. In an implementation, an FBUS interface28couples the processor12to the so-called FBUS18(FIFO bus). The FBUS is a 64-bit wide FIFO bus, used to interface to Media Access Controller (MAC) devices. The FBUS interface28is responsible for controlling and interfacing the processor12to the FBUS18.

The processor12also includes a PCI bus interface24that couples other system components that reside on the PCI bus14to the processor12. The PCI bus interface24also provides a high-speed data path24a to the SDRAM memory16a. The data path24a permits data to be moved quickly from the SDRAM16a to the PCI bus14, via direct memory access (DMA) transfers. The hardware based multithreaded processor12can employ a plurality of DMA channels so if one target of a DMA transfer is busy, another one of the DMA channels can take over the PCI bus14to deliver information to another target to maintain high processor12efficiency. The PCI bus interface24supports image transfers, target operations and master operations. Target operations are operations where slave devices on bus14access the SDRAM through reads and writes that are serviced as a slave to target operation. In master operations, the processor core20sends data directly to or receives data directly from the PCI interface24.

Each of the functional units of the processor12are coupled to one or more internal buses. In an implementation, the internal buses are dual 32-bit buses (i.e., one bus for read and one for write). The multithreaded processor12also is constructed such that the sum of the bandwidths of the internal buses exceeds the bandwidth of external buses coupled to the processor12. The internal core processor bus32may be an Advanced System Bus (ASB bus) that couples the processor core20to the memory controllers26a and26b and to an ASB translator30. The ASB bus is a subset of an “AMBA” bus that is used with the Strong Arm processor core. The processor12also includes a private bus34that couples the microengine units to SRAM controller26b, ASB translator30and FBUS interface28. A memory bus38couples the SDRAM controller26a, the PCI bus interface24, the FBUS interface28and memory system16together, including Flash ROM16c which is used for boot operations and the like.

The hardware-based multithreaded processor12may be utilized as a network processor. As a network processor, the hardware-based multithreaded processor12interfaces to network devices such as a media access controller (MAC) device such as a 10/100BaseT Octal MAC13a or a Gigabit Ethernet device13b. In general, the hardware-based multi-threaded processor12can interface to any type of communication device or interface that receives/sends large amount of data. The communication system10functioning in a networking application could receive a plurality of network packets from the devices13a,13b and process each of those packets independently in a parallel manner.

The processor12may also be utilized as a print engine for a postscript processor, as a processor for a storage subsystem such as RAID disk storage, or as a matching engine. In the securities industry for example, the advent of electronic trading requires the use of electronic matching engines to match orders between buyers and sellers. These and other parallel types of tasks can be accomplished on the system10.

FIG. 2shows a global arbitration system40for use with the multithreaded processor12ofFIG. 1. Aglobal command arbiter42is connected to each of the microengines22a-22f, to the SDRAM controller26a, to the SRAM controller26b, to the interface28and to the PCI interface24. The global command arbiter42functions to provide high bandwidth access to the shared system resources utilizing a minimal amount of buffer storage elements and minimal wiring. The global command arbiter provides each microengine22a-22f with fair access to the common system resources of the SDRAM, SRAM, PCI interface registers and FBUS interface registers based on command priority and resource utilization, which is explained below.

In an implementation, each microengine22a-22f has a two-command deep first-in, first-out (FIFO) register for issuing command requests for SDRAM16a and SRAM16b memory access, and for issuing command requests for access to registers in the PCI interface24and FBUS interface28. The SDRAM controller26a queues commands from the microengines in one of four FIFO command queue structures: an eight-entry high-priority queue44, a sixteen-entry odd bank queue46, a sixteen-entry even bank queue48, and a twenty-four entry maintain order queue50. A single physical random access memory (RAM) structure with four input pointers and four output pointers may be used to implement the SDRAM queues44,46,48,50. A reference request from a microengine may include a bit set called the “optimized MEM bit” which will be sorted into either the odd bank queue46or the even bank queue48. If the memory reference request does not have a memory optimization bit set, the default will be to go into the order queue50. The order queue50maintains the order of reference requests from the microengines22a-22f. With a series of odd and even banks references it may be required that a signal is returned to both the odd and even banks. If the microengine22f sorts the memory references into odd bank and even bank references and one of the banks, for example the even bank, is drained of memory references before the odd bank but the signal is asserted on the last even reference, the SDRAM controller26a could conceivably signal back to a microengine that the memory request had completed, even though the odd bank reference had not been serviced. This occurrence could cause a coherency problem. The situation is avoided by providing the order queue50which permits a microengine to have multiple memory references outstanding, of which only its last memory reference needs to signal a completion.

The SDRAM controller26a also included a high priority queue44. If an incoming memory reference from one of the microengines goes directly to the high priority queue then it is operated upon at a higher priority than other memory references in the other queues.

A feature of the SDRAM controller26a is that when a memory reference is stored in the queues, in addition to the optimized MEM bit that may be set, a “chaining bit” may be set to require special handling of contiguous memory references. A microengine context may issue chained memory references when the second and/or third reference of the chain must be scheduled by the SDRAM controller26a immediately after the initial chained memory request. The global command arbiter42must ensure that chained references are delivered to consecutive locations of the same SDRAM controller queue.

The SRAM controller26b also has four command queues: an eight-entry high priority queue62, a sixteen-entry read queue64, a sixteen-entry write order queue66and a twenty-four entry read-lock fail queue68. A single physical RAM structure may be used to implement the four queues. The SRAM controller26b is optimized based on the type of memory operation; i.e., a read or a write operation, and the predominant function that the SRAM performs is read operations.

The read lock fail queue68is used to hold read memory reference requests that fail because of a lock existing on a portion of memory. That is, one of the microengines issues a memory request that has a read lock request that is processed in an address and control queue. The memory request will operate on either the write order queue66or the read queue64and will recognize it as a read lock request. The SRAM controller26b will access a lock lookup device to determine whether this memory location is already locked. If this memory location is locked from any prior read lock request, then this memory lock request will fail and will be stored in the read lock fail queue68. If it is unlocked or if the lock lookup device shows no lock on that address, then the address of that memory reference will be used by the SRAM interface26b to perform a traditional SRAM address read/write request to SRAM memory16b. A command controller and address generator will also enter the lock into the lock look up device so that subsequent read lock requests will find the memory location locked. A memory location is unlocked by clearing a valid bit in a content addressable memory (CAM) of the SRAM controller. After an unlock, the read lock fail queue68becomes the highest priority queue giving all queued read lock misses a chance to issue a memory lock request. The read-lock miss queue is loaded by the SRAM controller itself and not directly from a microengine output buffer. The global arbiter42ensures that a command from a microengine to a SRAM queue is not selected on the same cycle that the SRAM controller must write a read-lock miss entry.

The FBUS interface28includes three command queues: an eight-entry push queue72, an eight-entry pull queue74and an eight-entry hash queue76. The pull queue is used when data is moved from a microengine to an FBUS interface resource, the push queue is used for reading data from the FBUS interface to a microengine, and the hash queue is used for sending from one to three hash arguments to a polynomial hash unit within the FBUS interface and for getting the hash result returned. The FBUS interface28in a network application can perform header processing of incoming packets from the FBUS18. A key function performed by the FBUS interface28is extraction of packet headers, and a hashed lookup of microprogrammable source/destination/protocol in SRAM memory16b. If the hash does not successfully resolve, then the packet header is subjected to more sophisticated processing.

The PCI bus interface24includes a single, two-entry direct memory access (DMA) command register78. The DMA register provides a completion signal to the initiating microengine thread.

The global command arbiter42operates to select commands from the two-deep output command queues of each microengine for transmission to a destination queue in one of the functional units. The functional units include the core controller20, the PCI interface24, the SDRAM controller26a, the SRAM controller26b, the FBUS interface28and the microengines22a to22f. Each microengine request to the global command arbiter42is a three-bit encoded field that specifies the command type and destination. Each microengine global command arbiter request is serviced with the following priority:

The global arbiter maintains a pointer that indicates the last microengine request granted. If more than one request is present at the same priority, the global command arbiter selects the next higher numbered microengine (with a wrap-around feature). For example, the microengines22a to22f may be numbered from 1 to 6 in an implementation so that if a request from microengine 6 was the last one granted, then when priority is not an issue a request from microengine 1 is next up for consideration.

The three SRAM controller command queues62,64and66are loaded directly from microengine commands. Since an SRAM command could be granted every cycle, it is possible that up to 6 additional SRAM commands will be granted and are in the pipeline, all of which could be destined for the same SRAM queue before a signal indicating that the queue is full is received by the global command arbiter. Thus, the SRAM controller asserts an SRAM_queue_full signal to the global command arbiter42if there is less than seven (7) empty entries in any SRAM command queue loaded from the microengines. For example, if the high priority queue has two entries filled then the SRAM_queue_full signal is asserted (because eight entries minus two entries is six). Similarly, if the read queue or the order queue contains ten entries then the SRAM_queue_full signal is asserted. This protocol is followed because a six cycle minimum latency exists from the assertion of a command request from a microengine and the command actually being stored in a destination queue.

The following diagram illustrates the timing of a request for a command destined for a queue in a system resource:

123456789ReqarbgatbuscmdrcvfullarbNOGNTreqarbgntbuscmdrcvfullarbreqarbgntbuscmdrcvfullreqarbgatbuscmdrcvreqarbgntbuscmdreqarbgntbusreqarbNOGNT
Where: req=bus request from the microengine;arb=arbitrate requests;gnt=drive grant to appropriate microengine;bus=enable tri-state bus driver;cmd=drive command onto fx_cmd_bus;rcv=receiving box queues command;full=full_status_que signal driven if necessary;nognt=a grant is not sent to queues that sent “full” by cycle 7.

Referring to the above timing diagram, in the first cycle, a request is sent to the global command arbiter. In cycle two, arbitration is performed and in cycle three the request is granted to the requesting microengine. In cycle four, a bus is enabled and in cycle five the command is driven onto the bus. In cycle six the receiving unit (SDRAM controller, SRAM controller, PCI bus interface or FBUS interface) queues the command. In cycle seven a full_status_que command is driven if necessary (e.g. that queue contains less than a minimum number of available entry spaces). In cycle eight, the global command arbiter is deciding whether another request should be granted to that system resource, but sees that the full_status_queue signal was generated. The arbiter then acts to deny requests (nognt) to the queue which sent a full signal by the seventh cycle.

The FBUS interface28has 3 command queues (pull, hash, push) which all contain eight (8) entries. Commands to the FBUS interface are not granted in consecutive cycles. Thus, when any of the 3 FBUS interface queues reaches four (4) entries (instead of the two discussed above for an eight entry queue) a FBUS_queue_full signal is sent to the global command arbiter since only a maximum of 3 commands can be in transit to the FBUS interface queues prior to the global arbiter detecting FBUS_queue_full.

The SDRAM controller26a has 4 command queues (high=8, even=16, odd=16, order=24). The threshold for asserting SDRAM_queue_full is the same as for the SRAM, i.e. less than 7 entries available in any queue. However, commands to the SDRAM controller are not granted on consecutive cycles. This insures queue entry space for any SDRAM chained commands from a particular microengine, which must be granted, even after SDRAM_queue_full asserts. It is necessary to always transfer SDRAM chained commands to avoid a live-lock condition, in which the SDRAM controller is waiting for the chained command in one queue while the command is “stuck” in a microengine because the global arbiter is no longer granting SDRAM commands since a different SDRAM queue is “full”. A limit is placed on the chain length of SDRAM commands to three as a coding restriction. In addition, when a chained SDRAM command is granted to a microengine, the next SDRAM command to be granted must also come from the same microengine so that the paired commands arrive in the selected SDRAM queue contiguously.

The restrictions of not sending commands to the FBUS on consecutive cycles, and not sending commands to the SDRAM on consecutive cycles do not degrade system performance since each command requires many cycles to actually execute. The restriction is not placed on SRAM commands since the SRAM queue sizing is more than adequate, and more SRAM references requiring fewer cycles with lower latency are issued in most applications.

FIGS. 3A and 3Billustrate an implementation of a global command arbiter protocol process100. The global command arbiter reviews102the command requests in the FIFO registers of the microengines22a-22f. If all of the requests have the same priority104, a pointer is checked106to determine the identity of the last microengine that had a request granted, and then the request of the next higher microengine is considered. Before granting the command request, the arbiter checks108to see if a queue_full_signal has been asserted. If so, the command request is denied110and the pointer is incremented111so that the next microengine's request will be considered. However, if no queue_full_signal has been asserted, then the command request is granted112and the flow returns to102.

Referring again to step104ofFIG. 3A, if the command requests in the microengines22a to22f have different priorities, then the global command arbiter checks114to see if a SDRAM request with a chained bit set has been granted previously. If so, then the SDRAM request from the same microengine that sent the previous SDRAM request with a chained bit is granted116. Next, the SDRAM queues are checked118to determine if any contain less than “N” empty entries, where N is equal to the number of microengines plus one. In the implementation described above, the SDRAM_queue_full signal will be asserted120if any SDRAM queue contains less than seven (7) empty entries and then the flow returns to102. If checking the queues118determines that the SDRAM queues have space for seven or more entries, then the flow returns to102.

If there was no history of an SDRAM command request with a chained bit set114, the global command arbiter determines122if there is a SRAM command request. If there is a SRAM request, the SRAM queues are checked124to see if any SRAM queue contains less than N empty entries. If so, then a SRAM_queue_full signal is asserted126, the command request is denied and the flow moves to134where the arbiter determines if a SDRAM request has been made. However, if the answer124is no, then the arbiter checks128to see if the SRAM controller26b needs to write a read_lock_miss entry. If so, then the command request is denied in step130and the flow moves to134; if not, then the command request is granted132and the flow returns to102.

If the answer was no at122, then the arbiter checks134(seeFIG. 3B) to see if a SDRAM request is being made. If so, the arbiter determines136if the last granted request was also a SDRAM command request. If it was, then the request is denied138and the flow goes to146where the arbiter determines if an FBUS command request has been made. Commands are not granted to the SDRAM controller in consecutive cycles to ensure that there is adequate queue entry space for a SDRAM chained command which is always granted when it occurs (even after a SDRAM_queue_full signal has been asserted). If the last granted command request was not an SDRAM command the SDRAM queues are checked140to see if any contains less than N entries. If so, then an SDRAM_queue_full signal is asserted142, access is denied138and the flow moves to146. If the SDRAM queues have adequate entry space, then the command request is granted144and the flow returns to102.

If a SDRAM request is not being made134, then the arbiter checks146to see if an FBUS command request has been made. If so, the arbiter checks148to see if the last granted request was a FBUS request. If so, then the request is denied150and the flow moves to160where the arbiter determines if a PCI command request has been made. Command requests to the FBUS are not granted in consecutive cycles to improve processing efficiency of the system. If the last granted request was not an FBUS command request148, then the FBUS queues are checked152to see if any contain less than “F” empty entries. For the example discussed above where there are six microengines and each of the FBUS command queues (pull, hash, push) contains eight entries, F equals five (5) since only a maximum of three (3) commands can be in transit to the FBI queues. Thus, if four or fewer entries are available in any FBUS queue, then the FBUS_queue_full signal is asserted154, the command is denied150and the flow moves to160. However, if the FBUS queues have adequate space, the request is granted156and the flow returns to102.

If an FBUS request is not made146, a PCI command request has been asserted160. Direct memory access is granted and a completion signal is sent, then the flow returns to102.

It is to be understood that while implementations of the invention have been described, the foregoing description is intended to illustrate and not limit the invention, which is defined by the scope of the appended claims. For example, the flow chart depicted inFIGS. 3A and 3Bcould be modified to accommodate more, less or different system resources. Other aspects, advantages, and modifications are within the scope of the following claims.