1. Field of the Invention
The present invention relates generally to the field of processor or computer design and operation. In one aspect, the present invention relates to memory operations in a multi-threaded processor and, in particular, to an improved method and apparatus for improving translation look-aside buffer reload performance.
2. Description of the Related Art
Computer systems are constructed of many components, typically including one or more processors that are connected for access to one or more memory devices (such as RAM) and secondary storage devices (such as hard disks and optical discs). For example,
Because processor clock frequency is increasing more quickly than memory speeds, there is an ever increasing gap between processor speed and memory access speed. In fact, memory speeds have only been doubling every six years—one-third the rate of microprocessors. In many commercial computing applications, this speed gap results in a large percentage of time elapsing during pipeline stalling and idling, rather than in productive execution, due to cache misses and latency in accessing external caches or external memory following the cache misses. Stalling and idling are most detrimental, due to frequent cache misses, in database handling operations such as OLTP, DSS, data mining, financial forecasting, mechanical and electronic computer-aided design (MCAD/ECAD), web servers, data servers, and the like. Thus, although a processor may execute at high speed, much time is wasted while idly awaiting data.
One technique for reducing stalling and idling is hardware multithreading to achieve processor execution during otherwise idle cycles.
b is a highly schematic timing diagram showing execution flow 24 of similar database operations by a multithread processor. Applications, such as database applications, have a large amount of inherent parallelism due to the heavy throughput orientation of database applications and the common database functionality of processing several independent transactions at one time. The basic concept of exploiting multithread functionality involves using processor resources efficiently when a thread is stalled by executing other threads while the stalled thread remains stalled. The execution flow 24 depicts a first thread 25, a second thread 26, a third thread 27 and a fourth thread 28, all of which are labeled to show the execution (C) and stalled or memory (M) phases. As one thread stalls, for example first thread 25, another thread, such as second thread 26, switches into execution on the otherwise unused or idle pipeline. There may also be idle times (not shown) when all threads are stalled. Overall processor utilization is significantly improved by multithreading. The illustrative technique of multithreading employs replication of architected registers for each thread and is called “vertical multithreading.”
Vertical multithreading is advantageous in processing applications in which frequent cache misses result in heavy clock penalties. When cache misses cause a first thread to stall, vertical multithreading permits a second thread to execute when the processor would otherwise remain idle. The second thread thus takes over execution of the pipeline. A context switch from the first thread to the second thread involves saving the useful states of the first thread and assigning new states to the second thread. When the first thread restarts after stalling, the saved states are returned and the first thread proceeds in execution. Vertical multithreading imposes costs on a processor in resources used for saving and restoring thread states, and may involve replication of some processor resources, for example replication of architected registers, for each thread. In addition, vertical multithreading complicates any ordering and coherency requirements for memory operations when multiple threads and/or multiple processors are vying for access to any shared memory resources.
Modern processor architectures commonly support multiple virtual memory page sizes in order to efficiently map both large and small memory regions into processes' address spaces. The mapping of virtual to physical memory is accomplished via software-programmed tables in physical memory referred to as TSBs (Translation Storage Buffers). These tables are cached in hardware structures referred to as TLBs (Translation Look-aside Buffers). Each processor access that requires an address translation (typically each instruction fetch and data access) looks up the virtual address of the access in the TLB. If the address tag hits in the TLB, the TLB returns the physical address where the item resides. If the address misses in the TLB, the TLB contents need to be updated. Operating system software can update the TLB. While flexible, this approach requires a trap to a software TLB reload handler whose latency can be quite large. Another alternative commonly employed in higher performance implementations is to reload the TLB contents via hardware. This is less flexible since the hardware has to understand the TSB format. However, it has the advantage of minimizing the TLB reload latency.
In a highly threaded processor, the TLB miss rate increases, and the cumulative effect of TLB misses for both instruction and data references can significantly reduce performance. Threads vie for limited space in the TLBs, increasing TLB miss rates. Furthermore, if only software reload is available, many threads spend time executing the TLB reload handler which takes execution resources away from doing more useful work.
In a TLB architecture which supports multiple page sizes, and allows complete flexibility for any virtual address to be statically mapped to any page size, there is an additional performance consideration. The TLB reload handler must search the virtual-to-physical mappings for each page size. In general it does not know, given a virtual address, which page size applies to the address. Thus, the TLB reload process, either in hardware or software, needs to predict the page size to minimize the time spent searching for the proper address translation. This is especially important in a high performance implementation, such as that required for a highly-threaded processor with hardware tablewalk.
Accordingly, improved memory operations for multithreading and/or multi-core processors and operating methods are needed that are economical in resources and avoid costly overhead which reduces processor performance. In particular, there is a need for an improved method and apparatus for improving translation look-aside buffer reload performance in multithreading and/or multi-core processors. Further limitations and disadvantages of conventional systems will become apparent to one of skill in the art after reviewing the remainder of the present application with reference to the drawings and detailed description which follow.
The method and apparatus of the present invention provides improved performance for reloading translation look-aside buffers in multithreading, multi-core processors. In the present invention, TSB prediction is accomplished by hashing a plurality of data parameters, including the virtual address, and generating an index that is provided as an input to a predictor array to predict the TSB page size. In one embodiment of the invention, the predictor array comprises two-bit saturating up-down counters that are used to enhance the accuracy of the TSB prediction. The saturating up-down counters are configured to avoid making rapid changes in the TSB prediction upon detection of an error. Specifically, the output of the prediction array is not changed upon detection of a first miss. Instead, multiple misses must occur before the prediction output is changed. In particular, in the present invention, the high-order bit of the two-bit counter is used for the TSB table size prediction. If the prediction based on the high-order bit is erroneous, the lower bit is incremented or decremented to register the fact that there was a misprediction. For each TSB miss request, a hash function is performed to generate a predictor index that is used as an input to a predictor array comprising the two-bit saturating up-down counters. The page size specified by the predictor index is searched first. If the prediction is correct, the counter value is either incremented (if originally “1x”) or decremented (if originally “0x”), to reinforce the correct prediction. Otherwise, the counter value is decremented (if originally “1x”) or incremented (if originally “0x”) to adjust the counter for the misprediction. Each two-bit counter saturates at a value of either “00” or “11.” Using the technique described herein, errors are minimized because the counter will lead to the correct result at least half the time rather than creating the possibility that each prediction will lead to the wrong value. In practical implementations of the method and apparatus described herein, significant performance increases are achieved for reloading translation look-aside buffers in multithreaded, multi-core processors.
a and 2b are timing diagrams respectively illustrating execution flows of a single-thread processor and a vertical multithread processor.
As explained herein, when multiple thread and/or processor operations are using a shared memory system, the memory operations must be coordinated so that each thread can access the memory in an ordered and coherent way with minimal delay or latency. For purposes of providing an exemplary and not limiting description, it will be useful to describe the various aspects and embodiments of the invention herein in the context of memory operations for an on-chip cache memory system that is constructed with CMOS SRAM memory cells. However, the present invention is not limited to CMOS-based processes and may be used in connection with other categories of memory products, including without limitation, DRAM, ROM, flash, PLA and the like, whether integrated within a VLSI system, cache or non-cache, or a stand alone memory device.
A selected embodiment of the present invention is shown in
Cores 36 may be configured to execute instructions and to process data according to a particular instruction set architecture (ISA). In one embodiment, cores 36 may be configured to implement the SPARC V9 ISA, although in other embodiments, it is contemplated that any desired ISA may be employed, such as x86, PowerPC, or MIPS, for example. In a selected embodiment, a highly suitable example of a processor design for the processor core is a SPARC processor core, UltraSPARC processor core or other processor core based on the SPARC V9 architecture. Those of ordinary skill in the art also understand the present invention is not limited to any particular manufacturer's microprocessor design. The processor core may be found in many forms including, for example, the 64-bit SPARC RISC microprocessor from Sun Microsystems, or any 32-bit or 64-bit microprocessor manufactured by Motorola, Intel, AMD, or IBM. However, any other suitable single or multiple microprocessors, microcontrollers, or microcomputers may be utilized. In the illustrated embodiment, each of cores 36 may be configured to operate independently of the others, such that all cores 36 may execute in parallel. In some embodiments, each of cores 36 may be configured to execute multiple threads concurrently, where a given thread may include a set of instructions that may execute independently of instructions from another thread. (For example, an individual software process, such as an application, may consist of one or more threads that may be scheduled for execution by an operating system.) Such a core may also be referred to as a multithreaded (MT) core. In an example embodiment shown in
Each processor core 36a-36h is in communication with crossbar 34 which manages data flow between cores 36 and the shared L2 cache 33 and may be optimized for processor traffic where it is desirable to obtain extremely low latency. The crossbar 34 may be configured to concurrently accommodate a large number of independent accesses that are processed on each clock cycle, and enables communication data requests from cores 36 to L2 cache 33, as well as data responses from L2 cache 33 to cores 36. In one embodiment, crossbar 34 may include logic (such as multiplexers or a switch fabric, for example) that allows any core 36 to access any bank of L2 cache 33, and that conversely allows data to be returned from any L2 bank to any core. Crossbar 34 may also include logic to queue data requests and/or responses, such that requests and responses may not block other activity while waiting for service. Additionally, in one embodiment crossbar 34 may be configured to arbitrate conflicts that may occur when multiple cores attempt to access a single bank of L2 cache 33 or vice versa. Thus, the multiple processor cores 36a-36h share a second level (L2) cache 33 through a crossbar bus 34 (processor to cache and cache to processor, a.k.a. PCX and CPX).
In connection with the example described herein, each processor core (e.g., 36f) shares an L2 cache memory 33 to speed memory access and to overcome the delays imposed by accessing remote memory subsystems (e.g., 31). Cache memory comprises one or more levels of dedicated high-speed memory holding recently accessed data, designed to speed up subsequent access to the same data. When data is read from main memory (e.g., 31), a copy is also saved in the L2 cache 33, and an L2 tag array stores an index to the associated main memory. The L2 cache 33 then monitors subsequent requests for data to see if the information needed has already been stored in the L2 cache. If the data had indeed been stored in the cache (i.e., a “hit”), the data is delivered immediately to the processor core 36 and the attempt to fetch the information from main memory 31 is aborted (or not started). If, on the other hand, the data had not been previously stored in the L2 cache (i.e., a “miss”), the data is fetched from main memory 31 and a copy of the data and its address is stored in the L2 cache 33 for future access.
The shared L2 cache 33 accepts requests from the processor cores 36 on the processor to cache crossbar (PCX) 34 and responds on the cache to processor crossbar (CPX) 34. As described herein, the L2 cache 33 is also responsible for maintaining coherency across all caches on the chip by keeping a copy of all L1 tags in a directory structure.
In some embodiments, L2 cache 50 may implement an input queue 51 for holding requests arriving from the crossbar, and an output queue 52 for buffering results to be sent to the crossbar. Additionally, in some embodiments, L2 cache 50 may implement a fill buffer 59 configured to store fill data arriving from memory controller 32, a writeback buffer 60 configured to store dirty evicted data to be written to memory, an I/O write buffer 58 configured to store incoming data from the crossbar in the event of multi-cycle memory write operations, and/or a miss buffer 57 configured to store L2 cache accesses that cannot be processed as simple cache hits (e.g., L2 cache misses, cache accesses matching older misses, accesses such as atomic operations that may require multiple cache accesses, etc.). L2 cache 50 may variously be implemented as single-ported or multi-ported (i.e., capable of processing multiple concurrent read and/or write accesses). In either case, L2 cache 50 may implement arbitration logic 53 to prioritize cache access among various cache read and write requestors. While the L2 cache 50 may include a tag array 54 for holding the memory addresses of the L2 cache data array 55, the L2 cache 50 may also advantageously include an additional tag array 54 for holding the memory addresses of each L1 cache data array in each processor core. The additional tag array 54 is referred to as the L1 directory because it maintains a copy of the L1 tags for coherency management and also ensures that the same line is not resident in both the instruction cache and data cache (across all cores). Thus, the L1 directory 56 is split into an instruction cache directory and a data cache directory. On certain data accesses, the L1 directory 56 is CAMed to determine whether the data is resident in L1 caches. The result of this CAM operation is a set of match bits which is used to create an invalidation vector to be sent back to the processor cores.
Referring again to
In the illustrated embodiment, processor chip 30 may be configured to receive data from sources other than system memory 31. I/O interface 37 may be configured to provide a central interface for such sources to exchange data with cores 36 and/or L2 cache 33 via crossbar 34. In some embodiments, I/O interface 37 may be configured to coordinate Direct Memory Access (DMA) transfers of data between network interface 39 or peripheral interface 38 and system memory 31 via memory controller 32. In addition to coordinating access between crossbar 34 and other interface logic, in one embodiment, I/O interface 37 may be configured to couple processor chip 30 to external boot and/or service devices. For example, initialization and startup of processor chip 30 may be controlled by an external device (such as, e.g., a Field Programmable Gate Array (FPGA)) that may be configured to provide an implementation- or system-specific sequence of boot instructions and data. Such a boot sequence may, for example, coordinate reset testing, initialization of peripheral devices and initial execution of processor chip 30, before the boot process proceeds to load data from a disk or network device. Additionally, in some embodiments, such an external device may be configured to place processor chip 30 in a debug, diagnostic, or other type of service mode upon request.
Peripheral interface 38 may be configured to coordinate data transfer between processor chip 30 and one or more peripheral devices. Such peripheral devices may include, without limitation, storage devices (e.g., magnetic or optical media-based storage devices including hard drives, tape drives, CD drives, DVD drives, etc.), display devices (e.g., graphics subsystems), multimedia devices (e.g., audio processing subsystems), or any other suitable type of peripheral device. In one embodiment, peripheral interface 38 may implement one or more instances of an interface such as Peripheral Component Interface Express (PCI-Express), although it is contemplated that any suitable interface standard or combination of standards may be employed. For example, in some embodiments, peripheral interface 38 may be configured to implement a version of Universal Serial Bus (USB) protocol or IEEE 1394 (Firewire) protocol in addition to or instead of PCI-Express.
Network interface 39 may be configured to coordinate data transfer between processor chip 30 and one or more devices (e.g., other computer systems) coupled to processor chip 30 via a network. In one embodiment, network interface 39 may be configured to perform the data processing necessary to implement an Ethernet (IEEE 802.3) networking standard such as Gigabit Ethernet or 10-gigabit Ethernet, for example, although it is contemplated that any suitable networking standard may be implemented. In some embodiments, network interface 39 may be configured to implement multiple discrete network interface ports.
The multiprocessor chip 30 described herein and exemplified in
In accordance with a selected embodiment of the present invention, the processor cores can be replicated a number of times in the same area. This is also illustrated in
In the illustrative embodiment depicted in
As illustrated, each threaded core (e.g. C636f) includes a first level (L1) cache (e.g., 35f) which includes a data cache (dcache) segment 42 an an instruction cache (icache) segment 43. In operation, the instruction fetch unit (IFU) 44 retrieves instructions for each thread and stores them in an instruction cache 43 and instruction buffers (not shown). IFU 44 then selects two instructions to execute among eight different threads, and provides the instructions to the decode unit which decodes one instruction each from two thread groups per cycle and supplies the pre-decoded instruction to the execution units 48. Each integer execution unit includes an arithmetic logic unit (ALU), shifter, and integer register files for processing and storing thread status information. Execution unit results are supplied via selection circuits to the processor core, the L1 data cache and the L2 cache. A single data cache 42 may also be provided in the LSU 58. For additional details concerning the design and operation of the processor core and its constituent resources, see co-pending U.S. patent application Ser. No. 10/880,488, entitled “Apparatus And Method For Fine-Grained Multithreading In A Multi-Pipelined Processor Core,” filed Jun. 30, 2004, and assigned to Sun Microsystems, which is hereby incorporated by reference in its entirety.
As was discussed hereinabove, modern processor architectures commonly support multiple virtual memory page sizes in order to efficiently map both large and small memory regions into processes' address spaces. The mapping of virtual to physical memory is accomplished via software-programmed tables in physical memory referred to as translation storage buffers (TSBs). These tables are cached in hardware structures referred to as TLBs (Translation Look-aside Buffers). Each processor access that requires an address translation (typically each instruction fetch and data access) looks up the virtual address of the access in the TLB. If the address tag hits in the TLB, the TLB returns the physical address where the item resides, If the address misses in the TLB, the TLB contents need to be updated.
In one embodiment of the present invention, the multithreaded, multi-core processor supports four page sizes ranging in size from 8 KB to 256 MB. In a TLB architecture which supports multiple page sizes, and allows complete flexibility for any virtual address to be statically mapped to any page size, the TLB reload handler must search the virtual-to-physical mappings for each page size. In general it does not know, given a virtual address, which page size applies to the address. Thus, the TLB reload process can predict the page size to minimize the time spent searching for the proper address translation.
In an embodiment of the present invention, a sequential search approach is employed for TLB reload. When a TLB miss occurs, hardware chooses a candidate page size by predicting the page size of the virtual address. It then searches the TSB for that page size. If a match is found, the matching entry is reloaded into the TLB. If no match is found, hardware continues predicting each remaining page size, until either a match is found, or no matching entry is found.
In the present invention, the TSB prediction is accomplished by hashing the virtual address and indexing into a table to predict the TSB page size. While various data parameters can be chosen for the hashing function depending on the table size and the virtual address architectural details, the 64 entries, of 2 bits each, shown below in Table 1, is used in an embodiment of the present invention. The particular parameters shown in Table 1 are components of the Sun Microsystems SPARC MMU architecture. Other MMU architectures, such as Power PC, x86, or MIPS, may have different virtual address parameters which could be used in a hash. The particular hash detailed in Table 1 below was shown via extensive simulation to provide near-optimal performance while having a small hardware cost.
The use of the above-referenced parameters to predict the TSB page size can be understood by referring to
In the present invention, the high-order bit of the two-bit counter from the prediction array 72 is used for the TSB table size prediction. If the prediction based on the high-order bit is erroneous, then the lower order bit is incremented or decremented to register the fact that there was a missed prediction. For each TSB miss, the hash function is performed, and the corresponding table is consulted. The page size specified by the predictor entry is searched first. If the prediction was correct, the counter value is either incremented (if originally “1x”) or decremented (if originally “0x”), to reinforce the correct prediction. Otherwise, the table entry is decremented (if originally “1x”) or incremented (if originally “0x”) to adjust the counter for the misprediction. Each 2-bit counter saturates at a value of either “00” or “11.”
This principle can be understood by referring to the state diagrams illustrated in
Using the technique described herein, errors will be minimized because the counter will lead to the correct result at least half the time rather than creating the possibility that each prediction will lead to the wrong value. In practice, however, the accuracy is substantially higher. In summary, the present invention uses hysterisis principles by relying on the high-order bit to predict the value of the table. The lower bit is used to register the fact that there was a missed prediction. The fact that there was a missed prediction is not necessarily used. Specifically, in the method and apparatus of the present invention, at least two mispredictions are required before a prediction will be changed.
As set forth above, a method and apparatus for improving translation look-aside buffer reload performance is described. For clarity, only those aspects of the chip multithreading (CMT) processor system germane to the invention are described, and product details well known in the art are omitted. For the same reason, the computer hardware is not described in further detail. It should thus be understood that the invention is not limited to any specific logic implementation, computer language, program, or computer. While various details are set forth in the following description, it will be appreciated that the present invention may be practiced without these specific details. For example, selected aspects are shown in block diagram form, rather than in detail, in order to avoid obscuring the present invention. Some portions of the detailed descriptions provided herein are presented in terms of algorithms or operations on data within a computer memory. Such descriptions and representations are used by those skilled in the field of microprocessor design to describe and convey the substance of their work to others skilled in the art. In general, an algorithm refers to a self-consistent sequence of steps leading to a desired result, where a “step” refers to a manipulation of physical quantities which may, though need not necessarily, take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared, and otherwise manipulated. It is common usage to refer to these signals as bits, values, elements, symbols, characters, terms, numbers, or the like. These and similar terms may be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless specifically stated otherwise as apparent from the following discussion, it is appreciated that throughout the description, discussions using terms such as “processing” or “computing” or “calculating” or “determining” or “displaying” or the like, refer to the action and processes of a computer system, or similar electronic computing device, that manipulates and transforms data represented as physical (electronic) quantities within the computer system's registers and memories into other data similarly represented as physical quantities within the computer system memories or registers or other such information storage, transmission or display devices.
While the present invention has been particularly described with reference to
Number | Name | Date | Kind |
---|---|---|---|
5446854 | Khalidi et al. | Aug 1995 | A |
5465337 | Kong | Nov 1995 | A |
5479627 | Khalidi et al. | Dec 1995 | A |
5526504 | Hsu et al. | Jun 1996 | A |
5712791 | Lauterbach | Jan 1998 | A |
5717885 | Kumar et al. | Feb 1998 | A |
5742792 | Yanai et al. | Apr 1998 | A |
5761707 | Aiken et al. | Jun 1998 | A |
5802341 | Kline et al. | Sep 1998 | A |
5802561 | Fava et al. | Sep 1998 | A |
5828860 | Miyaoku et al. | Oct 1998 | A |
5842225 | Kohn | Nov 1998 | A |
5862450 | Mandal et al. | Jan 1999 | A |
5899994 | Mohamed et al. | May 1999 | A |
5933627 | Parady | Aug 1999 | A |
5956756 | Khalidi et al. | Sep 1999 | A |
6006312 | Kohn et al. | Dec 1999 | A |
6016542 | Gottlieb et al. | Jan 2000 | A |
6044446 | Joy et al. | Mar 2000 | A |
6092154 | Curtis et al. | Jul 2000 | A |
6098169 | Ranganathan | Aug 2000 | A |
6138209 | Krolak et al. | Oct 2000 | A |
6141692 | Loewenstein et al. | Oct 2000 | A |
6247121 | Akkary et al. | Jun 2001 | B1 |
6272520 | Sharangpani et al. | Aug 2001 | B1 |
6295600 | Parady | Sep 2001 | B1 |
6308279 | Toll et al. | Oct 2001 | B1 |
6314563 | Agesen et al. | Nov 2001 | B1 |
6374349 | McFarling | Apr 2002 | B1 |
6408368 | Parady | Jun 2002 | B1 |
6535905 | Kalafatis et al. | Mar 2003 | B1 |
6574725 | Kranich et al. | Jun 2003 | B1 |
6578137 | Parady | Jun 2003 | B2 |
6581140 | Sullivan et al. | Jun 2003 | B1 |
6609193 | Douglas et al. | Aug 2003 | B1 |
6625654 | Wolrich et al. | Sep 2003 | B1 |
6633984 | Susser et al. | Oct 2003 | B2 |
6647458 | Glynn | Nov 2003 | B1 |
6671707 | Hudson et al. | Dec 2003 | B1 |
6700410 | Ebergen | Mar 2004 | B2 |
6700825 | Ebergen | Mar 2004 | B1 |
20010047468 | Parady | Nov 2001 | A1 |
20020052926 | Bush et al. | May 2002 | A1 |
20020078122 | Joy et al. | Jun 2002 | A1 |
20020129309 | Floyd et al. | Sep 2002 | A1 |
20020199070 | Chaudhry et al. | Dec 2002 | A1 |
20030088610 | Kohn et al. | May 2003 | A1 |
20030088713 | Mandal et al. | May 2003 | A1 |
20030097518 | Kohn et al. | May 2003 | A1 |
20030105756 | Daynes | Jun 2003 | A1 |
20030105907 | Kohn et al. | Jun 2003 | A1 |
20030120825 | Avvari et al. | Jun 2003 | A1 |
20030149861 | Becker | Aug 2003 | A1 |
20030163645 | Tremblay et al. | Aug 2003 | A1 |
20030191927 | Joy et al. | Oct 2003 | A1 |
20030212874 | Alderson | Nov 2003 | A1 |
20040002974 | Kravitz et al. | Jan 2004 | A1 |
20040003208 | Damron | Jan 2004 | A1 |
20040003211 | Damron | Jan 2004 | A1 |
20040006633 | Chandra et al. | Jan 2004 | A1 |
20040034853 | Gibbons et al. | Feb 2004 | A1 |
20040073906 | Chamdani et al. | Apr 2004 | A1 |
20040117600 | Bodas et al. | Jun 2004 | A1 |
20040123028 | Kanai et al. | Jun 2004 | A1 |
20050027961 | Zhang | Feb 2005 | A1 |