The present application is related to U.S. patent application Ser. No. 12/424,681, which is filed concurrently herewith and incorporated herein by reference in its entirety.
1. Technical Field
The present invention relates generally to data processing systems and specifically to prefetching data to a cache. Still more particularly, the present invention relates to an improved system and method of identifying and prefetching a cache block to a cache memory.
2. Description of the Related Art
A conventional symmetric multiprocessor (SMP) computer system, such as a server computer system, includes multiple processing units all coupled to a system interconnect, which typically comprises one or more address, data and control buses. Coupled to the system interconnect is a system memory, which represents the lowest level of volatile memory in the multiprocessor computer system and generally is accessible for read and write access by all processing units. In order to reduce access latency to instructions and data residing in the system memory, each processing unit is typically further supported by a respective multi-level cache hierarchy, the lower level(s) of which may be shared by one or more processor cores.
Because multiple processor cores may request write access to a same cache line of data and because modified cache lines are not immediately synchronized with system memory, the cache hierarchies of multiprocessor computer systems typically implement a cache coherency protocol to ensure at least a minimum level of coherence among the various processor core's “views” of the contents of system memory. In particular, cache coherency requires, at a minimum, that after a processing unit accesses a copy of a memory block and subsequently accesses an updated copy of the memory block, the processing unit cannot again access the old copy of the memory block.
In some systems, the cache hierarchy includes multiple levels, with each lower level generally having a successively longer access latency. Thus, a level one (L1) cache generally has a lower access latency than a level two (L2) cache, which in turn has a lower access latency than a level three (L3) cache.
The level one (L1) or upper-level cache is usually a private cache associated with a particular processor core in an MP system. Because of the low access latencies of L1 caches, a processor core first attempts to service memory access requests in its L1 cache. If the requested data is not present in the L1 cache or is not associated with a coherency state permitting the memory access request to be serviced without further communication, the processor core then transmits the memory access request to one or more lower-level caches (e.g., level two (L2) or level three (L3) caches) for the requested data.
Typically, when a congruence class of an upper-level cache becomes full, cache lines are removed (“evicted”) and may be written to a lower-level cache or to system memory for storage. In some cases, a lower level cache (e.g., an L3 cache) is configured as a “victim” cache, which conventionally means that the lower level cache is entirely populated with cache lines evicted from one or more higher level caches in the cache hierarchy rather than by memory blocks retrieved by an associated processor. Data is typically managed in conventional victim caches using a least recently used (LRU) cast-out mechanism, as the structure is prefetched into the cache, the oldest data blocks of a target set are cast out. Eventually, all data that previously resided in the set is replaced by the prefetched data. Because the use of the data structure is temporally limited, casting out the oldest data is not the optimal choice, since the newest prefetched data is not used again in the near future. Furthermore, when an access pattern exhibits low spacial locality, much of the memory bus bandwidth required to prefetch an entire cache block is waste, as a portion of the data passed over the memory bus may never be used. When a systems performance is bus-bandwidth limited, the advantage of prefetching may be negated by the latency introduced by inefficient bus utilization.
Disclosed is a system and method for specifying an access hint for prefetching only a subsection of cache block data, for more efficient system interconnect usage by the processor core. A processing unit receives a data cache block touch (DCBT) instruction containing an access hint and identifying a specific size portion of data to be prefetched. Both the access hint and a value corresponding to an amount of data to be prefetched are contained in separate subfields of the DCBT instruction. In response to detecting that the code point is set to a specific value, only the specific size of data identified in a sub-field of the DCBT and addressed in the DCBT instruction is prefetched into an entry in the lower level cache.
The above as well as additional objects, features, and advantages of the present invention will become apparent in the following detailed written description.
The novel features believed characteristic of the invention are set forth in the appended claims. The invention itself however, as well as a preferred mode of use, further objects and advantages thereof, will best be understood by reference to the following detailed description of an illustrative embodiment when read in conjunction with the accompanying drawings, wherein:
With reference now to the figures, wherein like reference numerals refer to like and corresponding parts throughout, and in particular with reference to
In the depicted embodiment, each processing node 102 is realized as a multi-chip module (MCM) containing four processing units 104a-104d, each preferably realized as a respective integrated circuit. The processing units 104 within each processing node 102 are coupled for communication to each other and system interconnect 110 by a local interconnect 114, which, like system interconnect 110, may be implemented, for example, with one or more buses and/or switches or as a hybrid interconnect.
As described below in greater detail with reference to
Those skilled in the art will appreciate that SMP data processing system 100 of
With reference now to
The operation of processor core 202 is supported by a cache memory hierarchy including a store-through level one (L1) cache 204 within each processor core 202, a store-in level two (L2) cache 230, and a lookaside L3 cache 232 that is utilized as a victim cache for L2 cache 230 and accordingly is filled by cache lines evicted from L2 cache 230. Processing unit 104 further includes an integrated I/O (input/output) controller 214 supporting the attachment of one or more I/O devices (not depicted) and is supported by a shared system memory 218 accessed via an integrated memory controller 215. In contrast to many conventional victim cache arrangements, the contents of L3 cache 232 are not exclusive of the contents of L2 cache 230, meaning that a given memory block may be held concurrently in L2 cache 230 and L3 cache 232.
Each processor core 202 includes at least an instruction sequencing unit (ISU) 207 for prefetching and demand fetching instructions, including data cache block touch (DCBT) instructions, and for ordering instructions for execution. A further description of the implementation of DCBT instructions is described in detail in U.S. Pat. No. 6,957,305, which is incorporated herein by reference.
Processor core 202 may also include a load-store unit (LSU) 208 for executing memory access instructions that references a memory block or cause the generation of an operation referencing a memory block. In at least some embodiments, each processor core 202 is capable of simultaneously executing instructions within two or more hardware threads of execution.
In at least some embodiments, processor core 202 further includes a streaming prefetcher 203 that generates and transmits to the memory hierarchy prefetch requests requesting data to be staged into its cache memory hierarchy in advance of need (e.g., prior to a demand load or store). In preferred embodiments, streaming prefetcher 203 supports multiple concurrent prefetching streams, and in at least some cases, supports multiple concurrent prefetching stream types having differing behaviors. For example, in one exemplary embodiment, streaming prefetcher 203 includes a load prefetch stream to prefetch memory blocks that may be the target of load requests, a store prefetch stream to prefetch memory blocks that may be targets of store requests, and a load/store prefetch stream to prefetch memory blocks that may be target of load and/or store requests. These different prefetch streams may have different associated strides, stream depths, caching rules, etc., as discussed further below. In other embodiments, processor core 202 may implement prefetching without streaming, that is, without fetching from a sequence of addresses linked by a common stride.
In order to support prefetching while limiting the associated cost and latency impact on the cache memory hierarchy, L3 cache 232 includes at least one and preferably many prefetch machines (PFMs) 234a-234n that, in response to prefetch requests issued by streaming prefetcher 203 that miss in the cache memory hierarchy, manage the transmission of the prefetch requests to the system for service and the installation of prefetch data in the cache memory hierarchy.
Although the illustrated cache hierarchy includes only three levels of cache, those skilled in the art will appreciate that alternative embodiments may include additional levels (L4, L5, etc.) of on-chip or off-chip in-line or lookaside cache, which may be fully inclusive, partially inclusive, or non-inclusive of the contents the upper levels of cache. Further, any of the various levels of the cache hierarchy may be private to a particular processor core 202 or shared by multiple processor cores 202. For example, in some implementations, the cache hierarchy includes an L2 cache 230 for each processor core 202, with multiple of the L2 caches 230 sharing a common L3 cache 232.
Referring now to
Array and directory 282 includes a set associative cache array 284 including multiple ways 286a-286n. Each way 286 includes multiple entries 288, which in the depicted embodiment each provide temporary storage for up to a full memory block of data, e.g., 128 bytes. Each cache line or memory block of data is logically formed of multiple sub-blocks 290 (in this example, four sub-blocks of 32 bytes each) that may correspond in size, for example, to the smallest allowable access to system memories 108a-108d. In at least some embodiments, sub-blocks 290 may be individually accessed and cached in cache array 284.
Array and directory 282 also includes a cache directory 292 of the contents of cache array 284. As in conventional set associative caches, memory locations in system memories 108 are mapped to particular congruence classes within cache arrays 284 utilizing predetermined index bits within the system memory (real) addresses. The particular cache lines stored within cache array 284 are recorded in cache directory 292, which contains one directory entry for each cache line in cache array 284. As understood by those skilled in the art, each directory entry in cache directory 292 comprises at least a tag field 294, which specifies the particular cache line stored in cache array 284 utilizing a tag portion of the corresponding real address, a LRU (Least Recently Used) field 298 indicating a replacement order for the cache line with respect to other cache lines in the same congruence class, and a state field 296, which indicates the coherence state (also referred to as cache state) of the cache line. Each cache line may also comprise a validity vector 297. Validity vector 297 contains a portion for identifying a subsection of data that has been prefetched. Accordingly, the validity vector 297 may be set in an entry in the cache directory for the target memory block within the cache array to indicate the presence of a fetched subsection of the cache block being accessed by a PFM 234a-n.
To support the transfer of castout cache lines, array and directory 282 includes at least one and preferably multiple castout (CO) buffers 295a-295n, which are each preferably identified with a unique respective CO buffer ID. While a CO buffer 295 is allocated to master 284 for a castout operation, the CO buffer 295 has a “busy” state, and when the CO buffer is released or deallocated by master 284, then the CO 295 buffer has a “done” state.
In a preferred embodiment, a DCBT instruction is received by the processor core. The DCBT instruction includes an OPCODE field, a TH field, and an RA/RB field. The opcode field identifies an operation to be initiated. The TH field specifies whether the DCBT identifies the type of touch (normal or enhanced) of the DCBT instruction. The RA/RB field form the effective address of the instruction. In the main embodiment, the TH field includes a code point that instructs the processing unit to perform one or more functions related to data prefetching. For example, a code value of 10000 in the TH field provides an access hint indicating that a program may soon access an entire cache block addressed by the DCBT instruction. Upon detecting a code value of 10000, the address data may be prefetched into L2 Cache 230 or L3 Cache 232.
Similarly, a code value of 11000 in the TH field provides an access hint indicating that a program may soon access only a portion of a cache block addressed by the DCBT instruction. In this embodiment, a first subfield of the RA/RB field is used to provide the effective address while a 2-bit second subfield is used to specify the size of the portion data to prefetch. A binary value of 00 indicates 8 bytes should be prefetched, 01 indicates 16 bytes, 10 indicates 32 bytes, and 11 indicates 64 bytes. Upon detecting a code value of 11000, the address data may be prefetched into L2 Cache 230 or L3 Cache 232. The size of the data prefetched is dependent on the value stored in the second subfield. The cache coherence is maintained on prefetched cache block boundary. Accordingly, the entire cache block is reserved in the processor cache, but the specified portion of the cache block that was not prefetched is marked as invalid. In this manner a demand load or store operation to the unprefetched portion will be processed as though the cache block were not present. The state of the block in the cache is marked as exclusive.
Still in an alternate embodiment, prefetched data may be fully stored in the L2 cache and partially stored in the L3 cache. In this embodiment prefetched data may be stored where cache resources are most readily available.
Referring now to
Block 344 depicts a determination by L3 cache 232 whether or not the leading prefetch request hits in cache directory 292 of L3 cache 232. If so, the leading prefetch request is aborted, and the process terminates at block 350. If, however, the leading prefetch request misses in L3 cache 232, the process proceeds to block 345. Block 345 illustrates L3 cache 232 allocating a prefetch machine 234 to manage the leading prefetch request, which in turn initiates the process of evicting a victim entry from L3 cache 232 in preparation for receiving the prefetch data requested by the leading prefetch request. The victim entry of the L3 cache is the LRU entry.
Next, at block 346, the prefetch machine 234 allocated to the leading prefetch request determines the cache block and the subsection thereof addressed by the DCBT instruction. Prefetch machine 234 then prefetches only the indicated subsection of the addressed data into the cache (block 347). In addition, once eviction of the L3 victim entry is complete and prefetch data is received, prefetch machine 234 updates cache array 284 of L3 cache 232 with the target memory block (block 348). At block 349, the validity vector of the cache block is set; the cache directory entry for the target memory block within the cache array is then updated with an indication of the fetched subsection. Thereafter, the process ends at block 350.
In the flow charts above, one or more of the methods are embodied such that a series of steps are performed when the computer readable code is executed on a computing device. In some implementations, certain steps of the methods are combined, performed simultaneously or in a different order, or perhaps omitted, without deviating from the spirit and scope of the invention. Thus, while the method steps are described and illustrated in a particular sequence, use of a specific sequence of steps is not meant to imply any limitations on the invention. Changes may be made with regards to the sequence of steps without departing from the spirit or scope of the present invention. Use of a particular sequence is therefore, not to be taken in a limiting sense, and the scope of the present invention is defined only by the appended claims.
Although aspects of the present invention have been described with respect to a computer processor and program application/logic, it should be understood that at least some aspects of the present invention may alternatively be implemented as a program product for use with a data storage system or computer system. Programs defining functions of the present invention can be delivered to a data storage system or computer system via a variety of signal-bearing media, which include, without limitation, non-writable storage media (e.g. CD-ROM), writable storage media (e.g. network attached storages, hard disk drive, read/write CD-ROM, optical media), and communication media, such as computer and telephone networks including Ethernet. It should be understood, therefore, that such signal-bearing media, when carrying or encoding computer readable instructions that direct method functions of the present invention, represent alternative embodiments of the present invention. Further, it is understood that the present invention may be implemented by a system having means in the form of hardware, software, or a combination of software and hardware as described herein or their equivalent. Additionally, the present invention may be implemented in a machine in the form of a computer-readable storage medium having a plurality of instructions embodied executing on a processing device.
Having thus described the invention of the present application in detail and by reference to illustrative embodiments thereof, it will be apparent that modifications and variations are possible without departing from the scope of the invention defined in the appended claims. In addition, many modifications may be made to adapt a particular system, device or component thereof to the teachings of the invention without departing from the essential scope thereof. Therefore, it is intended that the invention not be limited to the particular embodiments disclosed for carrying out this invention, but that the invention will include all embodiments falling within the scope of the appended claims. Moreover, the use of the terms first, second, etc. do not denote any order or importance, but rather the terms first, second, etc. are used to distinguish one element from another.
This invention was made with United State Government support under Agreement No. HR0011-07-9-002, awarded by DARPA. THE GOVERNMENT HAS CERTAIN RIGHTS IN THE INVENTION.
Number | Name | Date | Kind |
---|---|---|---|
4694395 | Young et al. | Sep 1987 | A |
5210842 | Sood | May 1993 | A |
5276850 | Sakaue | Jan 1994 | A |
5418916 | Hall et al. | May 1995 | A |
5555391 | De Subijana et al. | Sep 1996 | A |
5778438 | Merchant | Jul 1998 | A |
5802572 | Patel et al. | Sep 1998 | A |
5893147 | Deng | Apr 1999 | A |
5893151 | Merchant | Apr 1999 | A |
5926829 | Hagersten et al. | Jul 1999 | A |
6058456 | Arimilli et al. | May 2000 | A |
6122729 | Tran | Sep 2000 | A |
6131145 | Matsubara et al. | Oct 2000 | A |
6195735 | Krueger et al. | Feb 2001 | B1 |
6199107 | Dujari | Mar 2001 | B1 |
6216219 | Cai et al. | Apr 2001 | B1 |
6321306 | Arimilli et al. | Nov 2001 | B1 |
6345341 | Arimilli et al. | Feb 2002 | B1 |
6345342 | Arimilli et al. | Feb 2002 | B1 |
6353877 | Duncan et al. | Mar 2002 | B1 |
6356980 | Arimilli et al. | Mar 2002 | B1 |
6360297 | Arimilli et al. | Mar 2002 | B1 |
6446167 | Mayfield et al. | Sep 2002 | B1 |
6460115 | Kahle et al. | Oct 2002 | B1 |
6470427 | Arimilli et al. | Oct 2002 | B1 |
6499085 | Bogin et al. | Dec 2002 | B2 |
6557080 | Burger et al. | Apr 2003 | B1 |
6564302 | Yagi et al. | May 2003 | B1 |
6571319 | Tremblay et al. | May 2003 | B2 |
6571322 | Arimilli et al. | May 2003 | B2 |
6615321 | Arimilli et al. | Sep 2003 | B2 |
6643744 | Cheng | Nov 2003 | B1 |
6647466 | Steely, Jr. | Nov 2003 | B2 |
6681296 | Liao et al. | Jan 2004 | B2 |
6704860 | Moore | Mar 2004 | B1 |
6763433 | Arimilli et al. | Jul 2004 | B1 |
6763434 | Arimilli et al. | Jul 2004 | B2 |
6772288 | Flake et al. | Aug 2004 | B1 |
6785772 | Venkumahanti et al. | Aug 2004 | B2 |
6823447 | Hay et al. | Nov 2004 | B2 |
6848071 | Chaudhry et al. | Jan 2005 | B2 |
6957305 | Ray et al. | Oct 2005 | B2 |
6971000 | Sinharoy et al. | Nov 2005 | B1 |
6978351 | Osbourne et al. | Dec 2005 | B2 |
7028159 | Matsubara et al. | Apr 2006 | B2 |
7062609 | Trehus et al. | Jun 2006 | B1 |
7065548 | Van Oldenborgh et al. | Jun 2006 | B2 |
7234040 | Berg et al. | Jun 2007 | B2 |
7237068 | Wallin et al. | Jun 2007 | B2 |
7350032 | Stenstrom | Mar 2008 | B2 |
7380047 | Emma et al. | May 2008 | B2 |
7533242 | Moll et al. | May 2009 | B1 |
7600143 | Neuman | Oct 2009 | B1 |
7958309 | Arimilli et al. | Jun 2011 | B2 |
20020087801 | Bogin et al. | Jul 2002 | A1 |
20020087809 | Arimilli et al. | Jul 2002 | A1 |
20020092029 | Smith | Jul 2002 | A1 |
20020112124 | Arimilli et al. | Aug 2002 | A1 |
20020133674 | Martin et al. | Sep 2002 | A1 |
20020138698 | Kalla | Sep 2002 | A1 |
20020174253 | Hayter et al. | Nov 2002 | A1 |
20030046356 | Alvarex et al. | Mar 2003 | A1 |
20030084250 | Gaither et al. | May 2003 | A1 |
20030110117 | Saidenberg et al. | Jun 2003 | A1 |
20030159005 | Augsburg et al. | Aug 2003 | A1 |
20030177320 | Sah et al. | Sep 2003 | A1 |
20030208665 | Pier et al. | Nov 2003 | A1 |
20040037276 | Henderson et al. | Feb 2004 | A1 |
20040039879 | Gaither | Feb 2004 | A1 |
20040049615 | Liang | Mar 2004 | A1 |
20040117510 | Arimilli et al. | Jun 2004 | A1 |
20040205298 | Bearden et al. | Oct 2004 | A1 |
20040260879 | Barroso et al. | Dec 2004 | A1 |
20040268051 | Berg et al. | Dec 2004 | A1 |
20050027911 | Hayter et al. | Feb 2005 | A1 |
20050053057 | Deneroff et al. | Mar 2005 | A1 |
20050080994 | Cohen et al. | Apr 2005 | A1 |
20050204113 | Harper et al. | Sep 2005 | A1 |
20050210203 | Stenstrom | Sep 2005 | A1 |
20050240729 | Van Berkel et al. | Oct 2005 | A1 |
20050240736 | Shaw | Oct 2005 | A1 |
20060080511 | Hoover et al. | Apr 2006 | A1 |
20060085600 | Miyashita et al. | Apr 2006 | A1 |
20060173851 | Singh et al. | Aug 2006 | A1 |
20060174228 | Radhakrishnan et al. | Aug 2006 | A1 |
20060179239 | Fluhr et al. | Aug 2006 | A1 |
20060179254 | Clark et al. | Aug 2006 | A1 |
20060184607 | Le Leannec et al. | Aug 2006 | A1 |
20060184746 | Guthrie et al. | Aug 2006 | A1 |
20060184772 | Dooley et al. | Aug 2006 | A1 |
20060212648 | Cox et al. | Sep 2006 | A1 |
20060251092 | Matterne et al. | Nov 2006 | A1 |
20060259707 | Freytag | Nov 2006 | A1 |
20060265552 | David et al. | Nov 2006 | A1 |
20070038846 | Kadambi et al. | Feb 2007 | A1 |
20070050592 | Gschwind et al. | Mar 2007 | A1 |
20070058531 | Dierks et al. | Mar 2007 | A1 |
20070079073 | Rosenbluth et al. | Apr 2007 | A1 |
20070083716 | Rajamony et al. | Apr 2007 | A1 |
20070088919 | Shen et al. | Apr 2007 | A1 |
20070094450 | Vanderwiel | Apr 2007 | A1 |
20070136374 | Guedalia | Jun 2007 | A1 |
20070168619 | Hutton et al. | Jul 2007 | A1 |
20070214335 | Bellows et al. | Sep 2007 | A1 |
20070220208 | Nomura et al. | Sep 2007 | A1 |
20070294264 | Bayardo, Jr. et al. | Dec 2007 | A1 |
20080056051 | Mayer et al. | Mar 2008 | A1 |
20080086602 | Guthrie et al. | Apr 2008 | A1 |
20080104330 | Deshpanda | May 2008 | A1 |
20080183972 | Dieffenderfer | Jul 2008 | A1 |
20080244185 | O'Krafka et al. | Oct 2008 | A1 |
20080256303 | Croxford et al. | Oct 2008 | A1 |
20090198865 | Arimilli et al. | Aug 2009 | A1 |
20090198912 | Arimilli et al. | Aug 2009 | A1 |
20090198914 | Arimilli et al. | Aug 2009 | A1 |
20090198960 | Arimilli et al. | Aug 2009 | A1 |
Number | Date | Country | |
---|---|---|---|
20100268886 A1 | Oct 2010 | US |