The present invention is generally related to computer systems.
Modern processors reorder memory operations to increase performance. The reason for such reordering might be that some of the operands to some of the memory operations (i.e. addresses for loads and stores, store data for stores) are available at different times, and executing said memory instructions in program order would result in reduced performance and utilization, as the operands to a younger operation might be available earlier than the operands to an older operation.
Such reordering, however, is not always safe. For example, if the machine reorders a younger load to location X ahead of an older store to location X, the load will produce the wrong value, and the machine will operate incorrectly unless it detects such a condition and initiates recovery actions which ultimately result in the younger load effectively executing after the older store.
Some machines reorder operations only after their addresses are known, thereby preventing unsafe re-orderings, but reducing throughput and performance if the address operands are late. For example, a single store with an unresolved address can prevent many younger loads and stores from executing early even though the likelihood of such a conflict is often very low.
The memory reordering unit (MRU) is a unit that detects conflicts between loads and stores that have been reordered by the machine and initiates recovery action when an unsafe reordering is detected. The memory reordering unit is informed of the program order (or ordering constraints) of the loads and stores, and on a violation of order, initiates recovery. The memory reordering unit is either a part of or coupled to a load-store unit, but is not itself involved in the data portion of the execution of loads and stores—it only cares about addresses and sizes to detect overlap conditions that may constitute a violation of order.
In addition to such local violations of order (where a single-threaded program would operate incorrectly), depending on the architecture being implemented, there can also be violations of global order, where the consistency model for the architecture requires that some operations not be observably reordered by CPU cores such that other agents (e.g, device Direct Memory Access (DMA) or Central Processing Unit (CPU) cores running other threads in a multi-threaded program) can detect that reordering occurred.
The MRU can also detect such violations (potential or actual) of global order if snoops are sent to the MRU as well as to the caches. The MRU can effectively implement Fray's algorithm or variants as required by the consistency model for the architecture.
Typically such a reordering unit is based on physical addresses, as two different memory operations can use different virtual addresses that resolve to the same physical address, and if only virtual addresses are compared, two memory instructions (e.g., a load and a store) may appear not to overlap because the virtual addresses used are different, even though they both actually access the same location because the physical addresses are the same. Physical addresses, however, are known later than virtual addresses, making some overlap comparisons more difficult or introducing additional recovery situations.
It would be advantageous to use virtual addresses in the memory reordering unit and somehow handle the virtual address alias problem (two virtual addresses mapping to the same physical address) and the global ordering problem (if it matters for the architecture) by some other means.
Although virtual aliases have to be handled correctly, they are very rarely used in close proximity, hence the likelihood of an incorrect reordering detection based on virtual addresses is low, but correctness demands that it be detected.
Embodiments of the present invention advantageously utilize the feature whereby physical addresses are known later than virtual addresses. Embodiments of the present invention advantageously utilize virtual addresses in the memory reordering unit and efficiently handle a virtual address alias problem where two virtual addresses map to the same physical address, in addition to any global ordering problem.
In one embodiment, the present invention implements a method for detecting an instruction ordering violation in a CPU. The method includes receiving a reordered stream of instructions and detecting whether an ordering violation has occurred by using virtual addresses. The method further includes transferring results of the reordered stream of instructions from a load store buffer into a cache and detecting whether an ordering violation has occurred by using physical addresses. Subsequently, a recovery is initiated upon detection of an ordering violation.
The foregoing is a summary and thus contains, by necessity, simplifications, generalizations and omissions of detail; consequently, those skilled in the art will appreciate that the summary is illustrative only and is not intended to be in any way limiting. Other aspects, inventive features, and advantages of the present invention, as defined solely by the claims, will become apparent in the non-limiting detailed description set forth below.
The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar elements.
Reference will now be made in detail to the preferred embodiments of the present invention, examples of which are illustrated in the accompanying drawings. While the invention will be described in conjunction with the preferred embodiments, it will be understood that they are not intended to limit the invention to these embodiments. On the contrary, the invention is intended to cover alternatives, modifications and equivalents, which may be included within the spirit and scope of the invention as defined by the appended claims. Furthermore, in the following detailed description of embodiments of the present invention, numerous specific details are set forth in order to provide a thorough understanding of the present invention. However, it will be recognized by one of ordinary skill in the art that the present invention may be practiced without these specific details. In other instances, well-known methods, procedures, components, and circuits have not been described in detail as not to unnecessarily obscure aspects of the embodiments of the present invention.
Notation and Nomenclature:
Some portions of the detailed descriptions, which follow, are presented in terms of procedures, steps, logic blocks, processing, and other symbolic representations of operations on data bits within a computer memory. These descriptions and representations are the means used by those skilled in the data processing arts to most effectively convey the substance of their work to others skilled in the art. A procedure, computer executed step, logic block, process, etc., is here, and generally, conceived to be a self-consistent sequence of steps or instructions leading to a desired result. The steps are those requiring physical manipulations of physical quantities. Usually, though not necessarily, these quantities take the form of non-transitory electrical or magnetic signals capable of being stored, transferred, combined, compared, and otherwise manipulated in a computer readable storage medium of a computer system. It has proven convenient at times, principally for reasons of common usage, to refer to these signals as bits, values, elements, symbols, characters, terms, numbers, or the like.
It should be borne in mind, however, that all of these and similar terms are to 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 discussions, it is appreciated that throughout the present invention, discussions utilizing terms such as “processing” or “accessing” or “executing” or “storing” or “rendering” or the like, refer to the action and processes of a computer system (e.g., computer system 100 of
Embodiments of the present invention advantageously utilize the feature whereby physical addresses are known later than virtual addresses. Embodiments of the present invention advantageously utilize virtual addresses in the memory reordering unit and efficiently handle a virtual address alias problem where two virtual addresses map to the same physical address, in addition to any global ordering problem.
The virtual-address based version (VMRU for virtual memory reordering unit) detects ordering violations by using only virtual addresses. As such, it can be very early in the pipeline since it does not need to wait for the TLB results. It compares the virtual addresses and sizes of loads and stores, and taking into account their program order (or otherwise-specified ordering constraints) it performs overlap detection and triggers recovery when a violation of order is detected.
A physical-address based version (PMRU for physical memory reordering unit) does not detect ordering violations per-se, but detects virtual aliases instead. As such, only cache line addresses need to be compared. The purpose of the physical-address version is to detect situations under which the virtual-address based reordering unit may have failed to report an ordering violation due to the use of virtual aliases in close-enough proximity. As such, the PMRU may be conservative (depending on the actual implementation used) as the particular virtual aliases detected may not have resulted in a violation of order. For example, the older store may have stored to some bytes in a cache line while the younger load may have loaded from different bytes in the same cache line.
In one embodiment, it should be noted that unlike the VMRU, which detects precise overlap, the physical-address based version can be implemented such that it does not need byte-overlap comparison and only examines cache line addresses. It can also execute later in the pipeline, once Translation Lookaside Buffer (TLB) results (physical addresses) are known. In particular, in one embodiment, all it needs to do is prevent the commitment or retirement (depending on the micro-architecture) of the younger operation that may have a virtual alias problem.
This decoupling off the MRU into VMRU and PMRU is particularly advantageous when using a virtually-indexed cache that resolves aliases as if they were misses, as virtual aliases will be detected as part of miss conditions, and the PMRU only needs to be queried when resolving such misses. In fact, if such virtual alias conflicts are resolved by evicting the line and re-fetching it (e.g. from L2), the PMRU only needs to be queried on cache line evictions (whether prompted by a virtual alias detection or not), since an eviction (and re-fetch) is required before a line can be accessed under a different virtual address.
It should be further noted that, in one embodiment, querying the PMRU on evictions caused by coherence snoops also results in detection of violations of global memory order (between different agents) if the architecture in question has any such constraints.
Thus the VMRU detects local violations of order assuming that there are no virtual aliases, while the PMRU detects both potential virtual alias conflicts and potential violations of global order due to local reordering. The VMRU performs precise overlap comparisons, while the PMRU only needs to perform comparisons of cache line addresses.
Additionally, it should be noted that the particular details of the decomposition into VMRU and PMRU depend on the rest of the implementation of the machine, and can be adapted to both transactional and non-transactional micro-architectures, to both in-order and out-of-order micro-architectures, and to scalar, superscalar, and very long instruction word (VLIW) micro-architectures.
Process 300 begins in step 301 where a reordered stream of instructions are received. The instructions are annotated with an encoding corresponding to their original order so that the VMRU can determine which have been incorrectly reordered (locally). As described above, the stream of instructions has been reordered in order to exploit instruction level parallelism and increase the efficiency of execution. In step 302, the VMRU functions by detecting whether an ordering violation has occurred by using virtual addresses as described above. In step 303, the results of the reordered stream of instructions are transferred from the load store buffer into the cache. In step 304, the PMRU functions by detecting whether an ordering violation has occurred by using physical addresses as described above. The PMRU is informed when instructions commit or retire and detects ordering violations for not yet committed/retired instructions. And subsequently, in step 305, a recovery is initiated upon detection of an ordering violation (e.g., causing a cache miss, flushing the cache, re-executing the stream of instructions in program order, or the like).
It should be noted that depending on whether the machine can recover from miss-speculation, step 303 may only happen after it is known that no recovery will take place. Additionally, it should be noted that in one implementation where the cache is used to implement the PMRU and it provides good filtering so that we only check evictions in a PMRU, embodiments of the present invention could also be implemented by sending everything to a PMRU, or by performing some other filter.
Computer System Platform:
It should be appreciated that the GPU 410 can be implemented as a discrete component, a discrete graphics card designed to couple to the computer system 400 via a connector (e.g., Accelerated Graphics Port (AGP) slot, Peripheral Component Interconnect-Express (PCI-Express) slot, etc.), a discrete integrated circuit die (e.g., mounted directly on a motherboard), or as an integrated GPU included within the integrated circuit die of a computer system chipset component (not shown). Additionally, a local graphics memory 414 can be included for the GPU 410 for high bandwidth graphics data storage.
The foregoing descriptions of specific embodiments of the present invention have been presented for purposes of illustration and description. They are not intended to be exhaustive or to limit the invention to the precise forms disclosed, and many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the invention and its practical application, to thereby enable others skilled in the art to best utilize the invention and various embodiments with various modifications as are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the claims appended hereto and their equivalents.
Number | Name | Date | Kind |
---|---|---|---|
4620217 | Songer | Oct 1986 | A |
4648045 | Demetrescu | Mar 1987 | A |
4700319 | Steiner | Oct 1987 | A |
4862392 | Steiner | Aug 1989 | A |
4901224 | Ewert | Feb 1990 | A |
5185856 | Alcorn et al. | Feb 1993 | A |
5268995 | Diefendorff et al. | Dec 1993 | A |
5285323 | Hetherington et al. | Feb 1994 | A |
5357604 | San et al. | Oct 1994 | A |
5392393 | Deering | Feb 1995 | A |
5487022 | Simpson et al. | Jan 1996 | A |
5488687 | Rich | Jan 1996 | A |
5491496 | Tomiyasu | Feb 1996 | A |
5577213 | Avery et al. | Nov 1996 | A |
5579473 | Schlapp et al. | Nov 1996 | A |
5579476 | Cheng et al. | Nov 1996 | A |
5581721 | Wada et al. | Dec 1996 | A |
5600584 | Schlafly | Feb 1997 | A |
5604824 | Chui et al. | Feb 1997 | A |
5613050 | Hochmuth et al. | Mar 1997 | A |
5615350 | Hesson et al. | Mar 1997 | A |
5655132 | Watson | Aug 1997 | A |
5701444 | Baldwin | Dec 1997 | A |
5727177 | McMinn et al. | Mar 1998 | A |
5748937 | Abramson et al. | May 1998 | A |
5764228 | Baldwin | Jun 1998 | A |
5777628 | Buck-Gengler | Jul 1998 | A |
5831640 | Wang et al. | Nov 1998 | A |
5850572 | Dierke | Dec 1998 | A |
5864342 | Kajiya et al. | Jan 1999 | A |
5941940 | Prasad et al. | Aug 1999 | A |
5995121 | Alcorn et al. | Nov 1999 | A |
6166743 | Tanaka | Dec 2000 | A |
6173366 | Thayer et al. | Jan 2001 | B1 |
6222550 | Rosman et al. | Apr 2001 | B1 |
6229553 | Duluk, Jr. et al. | May 2001 | B1 |
6259460 | Gossett et al. | Jul 2001 | B1 |
6288730 | Duluk, Jr. et al. | Sep 2001 | B1 |
6333744 | Kirk et al. | Dec 2001 | B1 |
6351806 | Wyland | Feb 2002 | B1 |
6353439 | Lindholm et al. | Mar 2002 | B1 |
6407740 | Chan | Jun 2002 | B1 |
6411130 | Gater | Jun 2002 | B1 |
6411301 | Parikh et al. | Jun 2002 | B1 |
6417851 | Lindholm et al. | Jul 2002 | B1 |
6466222 | Kao et al. | Oct 2002 | B1 |
6496537 | Kranawetter et al. | Dec 2002 | B1 |
6525737 | Duluk, Jr. et al. | Feb 2003 | B1 |
6526430 | Hung et al. | Feb 2003 | B1 |
6542971 | Reed | Apr 2003 | B1 |
6557022 | Sih et al. | Apr 2003 | B1 |
6597363 | Duluk, Jr. et al. | Jul 2003 | B1 |
6604188 | Coon et al. | Aug 2003 | B1 |
6624818 | Mantor et al. | Sep 2003 | B1 |
6636221 | Morein | Oct 2003 | B1 |
6664958 | Lather et al. | Dec 2003 | B1 |
6717577 | Cheng et al. | Apr 2004 | B1 |
6718542 | Kosche et al. | Apr 2004 | B1 |
6731288 | Parsons et al. | May 2004 | B2 |
6734861 | Van Dyke et al. | May 2004 | B1 |
6778181 | Kilgariff et al. | Aug 2004 | B1 |
6806886 | Zatz | Oct 2004 | B1 |
6839828 | Gschwind et al. | Jan 2005 | B2 |
6924808 | Kurihara et al. | Aug 2005 | B2 |
6947053 | Malka et al. | Sep 2005 | B2 |
6980209 | Donham et al. | Dec 2005 | B1 |
6980222 | Marion et al. | Dec 2005 | B2 |
6999100 | Leather et al. | Feb 2006 | B1 |
7034828 | Drebin et al. | Apr 2006 | B1 |
7089404 | Rozas et al. | Aug 2006 | B1 |
7158141 | Chung et al. | Jan 2007 | B2 |
7187383 | Kent | Mar 2007 | B2 |
7257814 | Melvin et al. | Aug 2007 | B1 |
7280112 | Hutchins | Oct 2007 | B1 |
7298375 | Hutchins | Nov 2007 | B1 |
7430654 | Huang et al. | Sep 2008 | B2 |
7450120 | Hakura et al. | Nov 2008 | B1 |
7477260 | Nordquist | Jan 2009 | B1 |
7590825 | Krimer et al. | Sep 2009 | B2 |
7634635 | Holscher et al. | Dec 2009 | B1 |
7659909 | Hutchins | Feb 2010 | B1 |
7710427 | Hutchins et al. | May 2010 | B1 |
7928990 | Jiao et al. | Apr 2011 | B2 |
7941645 | Riach et al. | May 2011 | B1 |
7969446 | Hutchins et al. | Jun 2011 | B2 |
8537168 | Steiner et al. | Sep 2013 | B1 |
8773447 | Donham | Jul 2014 | B1 |
8860722 | Cabral et al. | Oct 2014 | B2 |
20020105519 | Lindholm et al. | Aug 2002 | A1 |
20020126126 | Baldwin | Sep 2002 | A1 |
20020129223 | Takayama et al. | Sep 2002 | A1 |
20020169942 | Sugimoto | Nov 2002 | A1 |
20030115233 | Hou et al. | Jun 2003 | A1 |
20030189565 | Lindholm et al. | Oct 2003 | A1 |
20040012597 | Zatz et al. | Jan 2004 | A1 |
20040012599 | Laws | Jan 2004 | A1 |
20040012600 | Deering et al. | Jan 2004 | A1 |
20040024260 | Winkler et al. | Feb 2004 | A1 |
20040100474 | Demers et al. | May 2004 | A1 |
20040114813 | Boliek et al. | Jun 2004 | A1 |
20040119710 | Piazza et al. | Jun 2004 | A1 |
20040126035 | Kyo | Jul 2004 | A1 |
20040130552 | Duluk, Jr. et al. | Jul 2004 | A1 |
20040194084 | Matsunami et al. | Sep 2004 | A1 |
20040246260 | Kim et al. | Dec 2004 | A1 |
20050086644 | Chkodrov et al. | Apr 2005 | A1 |
20050122330 | Boyd et al. | Jun 2005 | A1 |
20050134588 | Aila et al. | Jun 2005 | A1 |
20050135433 | Chang et al. | Jun 2005 | A1 |
20050162436 | Van Hook et al. | Jul 2005 | A1 |
20050223195 | Kawaguchi | Oct 2005 | A1 |
20050231506 | Simpson et al. | Oct 2005 | A1 |
20050237337 | Leather et al. | Oct 2005 | A1 |
20050280655 | Hutchins et al. | Dec 2005 | A1 |
20060007234 | Hutchins et al. | Jan 2006 | A1 |
20060028469 | Engel | Feb 2006 | A1 |
20060152519 | Hutchins et al. | Jul 2006 | A1 |
20060155964 | Totsuka | Jul 2006 | A1 |
20060177122 | Yasue | Aug 2006 | A1 |
20060288195 | Ma et al. | Dec 2006 | A1 |
20070030278 | Prokopenko et al. | Feb 2007 | A1 |
20070165029 | Lee et al. | Jul 2007 | A1 |
20070236495 | Gruber et al. | Oct 2007 | A1 |
20070279408 | Zheng et al. | Dec 2007 | A1 |
20070285427 | Morein et al. | Dec 2007 | A1 |
20070288902 | Lev et al. | Dec 2007 | A1 |
20100023707 | Hohmuth et al. | Jan 2010 | A1 |
20100211933 | Kiel et al. | Aug 2010 | A1 |
20140181404 | Chaudhary et al. | Jun 2014 | A1 |
20140372990 | Strauss | Dec 2014 | A1 |
Number | Date | Country |
---|---|---|
1954338 | May 2004 | CN |
101091203 | May 2004 | CN |
1665165 | May 2004 | EP |
1745434 | May 2004 | EP |
1771824 | May 2004 | EP |
05150979 | Jun 1993 | JP |
11053187 | Feb 1999 | JP |
2000047872 | Feb 2000 | JP |
2002073330 | Mar 2002 | JP |
2002171401 | Jun 2002 | JP |
2004199222 | Jul 2004 | JP |
2006196004 | Jul 2006 | JP |
2008161169 | Jul 2008 | JP |
2005112592 | May 2004 | WO |
2006007127 | May 2004 | WO |
2005114582 | Dec 2005 | WO |
2005114646 | Dec 2005 | WO |
Entry |
---|
Bright; “Transactional memory going mainstream with Intel Haswell”; Feb. 8, 2012; arstechnica.com. |
“Transactional Memory”; Oct. 15, 2012; wikipedia. |
“Transactional Memory”; Dec. 22, 2015; wikipedia. |
Reinders; “Transactional Synchronization in Haswell”; Feb. 7, 2012; Intel Developer Zone. |
Herlihy et al.; “Transactional memory: architectural support for lock-free data structures”; May 1993; ACM SIGARCH; vol. 21 Issue 2; pp. 289-300. |
PCT Notificaiton of Transmittal of The International Search Report and The Written Opinion of the International Searching Authority, or the Declaration. PCT/US05/17032; Applicant NVIDA Corporation; dated Nov. 9, 2005. |
PCT Notificaiton of Transmittal of The International Search Report or the Declaration. PCT/US05/17526; Applicant Hutchins, Edward A; dated Jan. 17, 2006. |
PCT Notificaiton of Transmittal of The International Search Report and The Written Opinion of the International Searching Authority, or the Declaration. PCT/US05/17031; Applicant NVIDA Corporation; dated Feb. 9, 2007. |
“Interleaved Memory.” http://www.webopedia.com/TERM/I/interleaved_memory.html; Sep. 9, 2008; pp. 3. (authors name not provided). |
Moller, et al.; Real-Time Rendering, 2nd ed., 2002, A K Peters Ltd., pp. 92-99, Jul. 2002. |
The Free Online Dictionary, Thesaurus and Encyclopedia, definition for cache; http://www.thefreedictionary.com/cache; retrieved Nov. 3, 2012; pp. 3. (authors name not provided). |
Zaharieva-Stoyanova E I: “Data-flow analysis in superscalar computer architecture execution”, Telecommunications in Modern Satellite, Cable and Broadcasting Services, Nov. 2003; pp. 4. |
“Sideband,” http://www.encyclopedia.com/html/s1/sideband.asp; Aug. 2006, pp. 4. (authors name not provided). |
Number | Date | Country | |
---|---|---|---|
20140181462 A1 | Jun 2014 | US |