The present invention relates generally to verification of cache coherency in a computer system, and more specifically, to cache coherency verification using ordered lists.
Operations in a cache of a computer system may be modeled, and the model compared to the actual state of the cache, in order to determine coherency of the cache. Cache coherency in out-of-order, virtual multi-threaded, multi-core, or multiprocessor computer systems can be relatively complex to model, as the coherency specifications for such devices may have strict rules regarding how each component in the device observes and updates data, but may not dictate how those operations are actually achieved. The goal of the coherency model is to enforce the coherency rules. Micro-architectures may make use of the flexibility of the coherency rules, and even appear to violate the coherency rules in the short term, in order to increase performance. The coherency modeling system will dictate the granularity of the coherency modeling, the design variance and amount of change that can be tolerated, the types of errors that can be caught by the coherency modeling system, and overall ease of debugging.
Some coherency modeling systems utilize one or more timestamps for each cache line access, and a system to update and compare those timestamps to prevent violation of the coherency rules. Use of timestamps requires a very thorough understanding of the access times of the microarchitecture, and may not be very resilient to any changes that affect that timing. Other coherency modeling systems comprise finite state machines, in which coherency events transition the model from one legal state to another, either as a state by state simulation, or as a formal state space exploration of the implemented logic. These approaches are often high-level and may require generalizations for each state, and may preclude some lower level checking of the implementation that may be beneficial during the design phase. Further coherency modeling systems create a graph of all cache accesses and ensure that the vertices followed from the beginning of execution to the end are all legal.
Embodiments include a method, system, and computer program product for cache coherency verification using ordered lists. An aspect includes maintaining a plurality of ordered lists, each ordered list corresponding to a respective thread that is executed by a processor, wherein each ordered list comprises a plurality of atoms, each atom corresponding to a respective operation performed in a cache by the respective thread that corresponds to the ordered list in which the atom is located, wherein the plurality of atoms in an ordered list are ordered based on program order. Another aspect includes determining a state of an atom in an ordered list of the plurality of ordered lists. Another aspect includes comparing the state of the atom in an ordered list to a state of an operation corresponding to the atom in the cache. Yet another aspect includes, based on the comparing, determining that there is a coherency violation in the cache.
The subject matter which is regarded as embodiments is particularly pointed out and distinctly claimed in the claims at the conclusion of the specification. The forgoing and other features, and advantages of the embodiments are apparent from the following detailed description taken in conjunction with the accompanying drawings in which:
Embodiments of cache coherency verification using ordered lists are provided, with exemplary embodiments being discussed below in detail. A system for modeling cache coherency uses a set of ordered lists, which may also be referred to as coherency stacks. Each ordered list corresponds to a respective thread in the system. Each ordered list holds atoms corresponding to individual lower-level operations in the cache that are performed by the thread corresponding to the ordered list. Each ordered list may be ordered based on the program order of operations, as given by the application that performed each operation, and operation dependencies between atoms. The cache is modeled using insertions and deletions of atoms in the ordered lists, and atoms are evaluated to determine any coherency violations in the cache. Embodiments of cache coherency verification using ordered lists may also include a reference model, which gives a state of the cache including operations that cannot be rolled back.
Each ordered execution path, or thread, has a respective ordered list, yielding a model that maintains as many ordered lists as there are threads, cores, and/or processors in the system. Each ordered list has a bottom and top, and the atoms within the list are ordered from oldest to youngest operational age. The atoms correspond to the smallest atomic operations that can occur in the cache per the architecture of the machine. Each atom may include data regarding the relative program order, operational state, and content of the operation corresponding to the atom. Examples of cache operations that may correspond to individual atoms include a load operation, a store operation, an invalidate, and a snoop. Some atoms, such as atoms corresponding to a snoop or an invalidate, may not have a program order in some embodiments. By maintaining an ordered list through insertions, deletions, and evaluation of atoms in the ordered list, the coherency rules are maintained implicitly by the order of the list. New atoms are inserted at the top of an ordered list and moved into the correct location in the ordered list by comparison to other atoms that are already in the ordered list. The movements of atoms in an ordered list may vary based upon the specific architecture that is being modeled; various embodiments may implement top insertion, evaluation, and deletion of atoms. For embodiments that include a reference model, removal of atoms from the ordered lists to the reference model may also be performed. For embodiments that model a simultaneous multithreaded (SMT) architecture having more than one ordered list, bottom insertion of atoms across ordered lists may also be performed for cross-thread coherency operations such as stores.
Each ordered list may comprise an ordered list, list, deque or any appropriate similar structure which may contain zero or more entries. Each ordered list corresponds to a respective thread, virtual thread, or core in the design being modeled. The atoms may comprise any appropriate objects that represent atomic cache operations, where the granularity of each object is dictated by the design architecture, or if objects of a smaller granularity are employed an additional mechanism is used to bind those objects into atomic cache operations. The reference model comprises a base or flat version of the cache being modeled, and may comprise, for example, a hash, dictionary, list, array, or any appropriate similar structure. The reference model may be omitted in some embodiments, as all information that would comprise the reference model can be obtained from the ordered lists. An intermediary synchronization stack may be used in conjunction with the reference model for systems that allow atoms to occur on one thread visible to another thread. The synchronization stack may comprise any appropriate structure, such as an ordered list, list, deque, or other appropriate structure. While the synchronization stack is most often used for stores, the synchronization stack may be used for any type of coherency operation in various embodiments.
Atoms that are directly related to an ordered list may be inserted at the top of an ordered list, move downwards during execution of the thread, and evaluated toward the bottom of the ordered list. Atoms that are indirectly related to the ordered list may be inserted at the bottom of the ordered list and evaluated toward the top. The coherency of any atom in the ordered lists can be verified by combining data from the reference model, synchronization stack, and the atoms below the atom being evaluated in the ordered list. Atoms corresponding to transactions may also be tracked using the ordered lists, and the atoms corresponding to a transaction may be retired or deleted as a group from the ordered list based on committing or aborting of the transaction.
Embodiments of a cache coherency verification module 200 may further include a reference model 202. At a certain point in execution, the processor has completed executing some of the operations, and these operations can no longer be unwound. Such operations may be referred to as retired. Since no newly inserted atoms can effect a retired operation, the atom corresponding to the retired operation may be removed from the ordered list. The result of the retired atom is placed into the reference model 202, or, in some embodiments, into the synchronization stack 203. The reference model 202 gives a state of the cache that reflects these retired operations. For a cache that is used in conjunction with a plurality of threads, a single reference model 202 is used in conjunction with the plurality of ordered lists 201A-N corresponding to the threads.
In some embodiments, a synchronization stack 203 may also be used in conjunction with the reference model 202. For systems with more than one ordered list, cross-list operations (which may be handled via bottom insertion) may not align at the bottom of each ordered list 201A-N. If the reference model 202 is shared between multiple ordered lists 201A-N, the synchronization stack 203 is required between the ordered lists 201A-N and the reference model 202 to realign those shared atoms. In some embodiments the synchronization stack 203 may contain only stores; in further embodiments, a synchronization stack may contain other types of atoms. As atoms retire and the result of their respective operations can no longer be unwound, the synchronization stack 203 tracks the ordered lists 201A-N from which the retired atoms have been removed. When an atom representing the single operation has been removed from each of the ordered lists 201A-N covered by the reference model 202, the operation can be committed to the reference model 202. In this way, if a cross-thread store is considered younger than some operations in an ordered list, the reference model 202 is not polluted by the other threads retiring the cross-thread store.
In block 502, an atom in ordered list 300 is evaluated in order to determine whether there have been any coherency violations. Block 502 is performed as part of block 403 of
In block 503, in embodiments that include a reference model such as reference model 202, an atom corresponding to a completed operation that cannot be unwound may be removed from the ordered list 300 and committed to the reference model 202, as discussed above with respect to
In block 504, an atom that corresponds to an operation that was executed speculatively and is being unwound, or flushed, before completion by the thread corresponding to the ordered list 300 is deleted from the ordered list 300. For example, atoms corresponding to operations performed in a branch down a wrong path may have been added to the ordered list in block 501, and as a result of unwinding at branch evaluation time, must be removed in block 504. Deletion may performed by traversing the ordered list 300 and removing any identified atoms corresponding to the path that is being unwound. Block 504 may be performed whenever any operation is unwound by the thread corresponding to ordered list 300.
In block 505, in embodiments that comprise an SMT system, an atom corresponding to a store that has completed in a first thread, but that affects one or more other threads, is added to the bottom 303 of the one or more ordered lists of the one or more other threads via bottom insertion. Since the atom corresponding to the store originated from a first thread, it is not possible to evaluate the atom based on program order information in the ordered list corresponding to a second thread. Instead the atom is inserted at the bottom 303 of the ordered list of the second thread, and is evaluated against the content of each successive atom above the bottom-inserted atom, and moved up until a dependency is found (and insertion completes), or until the atom is at the top of the ordered list. Bottom insertion is discussed in further detail below with respect to
Technical effects and benefits include modeling and verification of cache coherency with relatively low overhead.
The present invention may be a system, a method, and/or a computer program product. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.
The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.
Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device.
Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the āCā programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention
Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.
These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention.
In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts or carry out combinations of special purpose hardware and computer instructions.
The descriptions of the various embodiments of the present invention have been presented for purposes of illustration, but are not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen to best explain the principles of the embodiments, the practical application or technical improvement over technologies found in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.
This application is a continuation of U.S. patent application Ser. No. 14/841,783 filed Sep. 1, 2015 and assigned U.S. Publication No. US20160092358A1, published on Mar. 31, 2016; which is a continuation of U.S. patent application Ser. No. 14/502,153, filed Sep. 30, 2014, and assigned U.S. Publication No. US20160092368A1, published on Mar. 31, 2016; and all the benefits accruing therefrom under 35 U.S.C §119, the contents of which is herein incorporated by reference in its entirety.
Number | Date | Country | |
---|---|---|---|
Parent | 14841783 | Sep 2015 | US |
Child | 15485453 | US | |
Parent | 14502153 | Sep 2014 | US |
Child | 14841783 | US |