# Patent

## Title
Systems and methods for maintaining the coherency of a store coalescing cache and a load cache

## Abstract

A method for maintaining the coherency of a store coalescing cache and a load cache is disclosed. As a part of the method, responsive to a write-back of an entry from a level one store coalescing cache to a level two cache, the entry is written into the level two cache and into the level one load cache. The writing of the entry into the level two cache and into the level one load cache is executed at the speed of access of the level two cache.

## Background
RELATED U.S. APPLICATIONS
This application is a continuation of, claims the benefit of, and priority to the copending non-provisional patent application Ser. No. 13/561,441, entitled “SYSTEMS AND METHODS FOR MAINTAINING THE COHERENCY OF A STORE COALESCING CACHE AND A LOAD CACHE,” with filing date Jul. 30, 2012, and hereby incorporated by reference in its entirety.


BACKGROUND
A cache in a central processing unit is a data storage structure that is used by the central processing unit of a computer to reduce the average time that it takes to access memory. It is a memory which stores copies of data that is located in the most frequently used main memory locations. Moreover, cache memory is memory that is smaller and that may be accessed more quickly than main memory. There are several different types of caches.
In computing, cache coherence refers to the consistency of data stored in local caches of a shared resource. In a shared memory system that includes separate cache memory components, it is possible to have many copies of data: one copy in the main memory and one in one or more cache memory components. When one copy of data stored in the cache system is changed, the other copies of the data must be changed also. Cache coherence ensures that changes in the values of shared data are propagated throughout a cache system in a timely fashion. A cache system is coherent if whenever data is read, the returned value for the data is the value that is most recently written.
A coherency protocol is a protocol which maintains consistency between all the caches in a system of distributed shared memory. The protocol maintains memory coherence according to a specific consistency model. Choosing the appropriate consistency model is critical to the design of a cache coherent system. However, consistency models differ in performance and scalability. Accordingly, they should be evaluated for every cache system design for which they are considered. Designers can add features to address particular challenges presented by specific designs. Consequently, a challenge of cache system design is implementing a protocol to have features that best suit the specific design of the cache system in which it is used.
SUMMARY
This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
A challenge of cache system design is implementing a protocol to have features that best suit the design of the cache system. A method for maintaining consistency between a level one store coalescing cache and a level one load cache is disclosed that includes such features. However, the claimed embodiments are not limited to implementations that address any or all of the aforementioned shortcomings. In one embodiment, loads access both the store coalescing cache and the load cache and stores do not write into the load cache. If a load access hits in the store coalescing cache, a load is able to secure both a possibly stale copy of data from the load cache and the latest copy of data from the store coalescing cache and consume the latest copy. Consequently, the copy of data for an address in the load cache can remain stale as long as the latest copy of the data for that address is also present in the store coalescing cache. When the store coalescing cache is no longer able to maintain the address and its data therein, a write-back of the address and data to the level two cache is executed. This write-back from the store coalescing cache updates both the level two cache and the load cache as part of a single continuous transaction. In one embodiment, the address and its data is written into the level two cache and into the level one load cache at the speed of access of the level two cache. Moreover, the writing of the entry into the level two cache and into the load cache is executed at the speed of access of the level two cache. As such, the load cache is kept coherent with the store coalescing cache at the time of write-back.



BRIEF DESCRIPTION OF THE DRAWINGS
The invention, together with further advantages thereof, may best be understood by reference to the following description taken in conjunction with the accompanying drawings in which:
FIG. 1A shows an exemplary operating environment of a system for maintaining the coherency of a store coalescing cache and a load cache at the time of write-back according to one embodiment.
FIG. 1B shows a level one cache that is configured to include two separate cache portions according to one embodiment.
FIG. 1C illustrate operations performed by a system for maintaining the coherency of a store coalescing cache and a load cache at the time of write-back according to one embodiment.
FIG. 2 shows components of a system for maintaining the coherency of a store coalescing cache and a load cache at the time of write-back according to one embodiment.
FIG. 3 shows a flowchart of the steps performed in a method for maintaining the coherency of a store coalescing cache and a load cache at the time of write-back according to one embodiment.



It should be noted that like reference numbers refer to like elements in the figures.
DETAILED DESCRIPTION
Although the present invention has been described in connection with one embodiment, the invention is not intended to be limited to the specific forms set forth herein. On the contrary, it is intended to cover such alternatives, modifications, and equivalents as can be reasonably included within the scope of the invention as defined by the appended claims.
In the following detailed description, numerous specific details such as specific method orders, structures, elements, and connections have been set forth. It is to be understood however that these and other specific details need not be utilized to practice embodiments of the present invention. In other circumstances, well-known structures, elements, or connections have been omitted, or have not been described in particular detail in order to avoid unnecessarily obscuring this description.
References within the specification to “one embodiment” or “an embodiment” are intended to indicate that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. The appearance of the phrase “in one embodiment” in various places within the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Moreover, various features are described which may be exhibited by some embodiments and not by others. Similarly, various requirements are described which may be requirements for some embodiments but not other embodiments.
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 electrical or magnetic signals of a computer readable storage medium and are capable of being stored, transferred, combined, compared, and otherwise manipulated in 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 “receiving” or “searching” or “identifying” or “providing” 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 and other computer readable media into other data similarly represented as physical quantities within the computer system memories or registers or other such information storage, transmission or display devices.
Exemplary Operating Environment of a System for Maintaining the Coherency of a Store Coalescing Cache and a Load Cache According to One Embodiment
FIG. 1A shows an exemplary operating environment 100 of a system 101 for maintaining the coherency of a store coalescing cache and a load cache at the time of write-back according to one embodiment. System 101 enables, in response to a request to write-back data from a level one store coalescing cache to a level two cache, a writing of the data to a level two cache and to a level one load cache. Consequently, a level one load only cache is kept coherent with a level one store only cache at the time of write-back. FIG. 1A shows system 101, L1 cache 103, L1 store coalescing cache 103a, L1 load cache 103b, CPU 105, L2 cache 107, L2 cache controller 107a, main memory 109 and system interface 111.
Referring FIG. 1A, L1 cache 103 is a level one cache and L2 cache 107 is a level two cache. In one embodiment, the contents of L1 cache 103 are not included in L2 cache 107. In one embodiment, L1 cache 103 can be a part of CPU 105. As is shown in FIG. 1B, in one embodiment, level one cache 103 is configured to include two separate cache portions, store coalescing cache 103a and load cache 103b. Load cache 103b has a single write port (see FIG. 1B) which is under the control of L2 cache 107. In one embodiment, this write port becomes available for writing data to load cache 103b during write-back operations. Load cache 103b maintains entries that are accessed by load requests and store coalescing cache 103a maintains entries that are accessed by store requests. In one embodiment, the separation of level one cache 103, as described above, into caches exclusively for loads and stores enables the accommodation of a throughput of a plurality of loads and stores in a single clock cycle.
In one embodiment, stores that update entries in store coalescing cache 103a may not update copies of the entries that are maintained in load cache 103b. Accordingly, in one embodiment, at the time of a request to write-back a data entry that resides in store coalescing cache 103a, a corresponding data entry that is then present in load cache 103b can be stale. In one embodiment, when this occurs, requests to replace data in store coalescing cache 103a are used to trigger the writing of L2 cache 107 to include the entry that is to be replaced in store coalescing cache 103a as part of the requested write-back. Thereafter, the entry can be written to load cache 103b in the same clock cycle. In one embodiment, when the entry from store coalescing cache 103a is in the queue to be written to L2 cache 107, the write port of load cache 103b that is under the control of L2 cache 107 is made available for the write from L2 cache 107 to load cache 103b. 
Referring again to FIG. 1A, system 101, responsive to a write-back of an entry maintained in store coalescing cache 103a to level two cache 107, directs a writing of the entry to level two cache 107 and to load cache 103b in a single cycle. In one embodiment, system 101 maintains the coherency of store coalescing cache 103a and load cache 103b at the time of write-back. In one embodiment, system 101 can be located in cache controller 107a. In other embodiments, system 101 can be separate from cache controller 107a, but operate cooperatively therewith.
Main memory 111 includes physical addresses that store the information that is copied into cache memory. In one embodiment, when the information that is contained in the physical addresses of main memory that have been cached is changed, the corresponding cached information is updated to reflect the changes made to the information stored in main memory. Also shown in FIG. 1A is system interface 111.
Operation
FIG. 1C illustrates operations performed by system 101 for maintaining the coherency of a store coalescing cache and a load cache at the time of write-back according to one embodiment. These operations, which relate to maintaining the coherency of a store coalescing cache and a load cache are illustrated for purposes of clarity and brevity. It should be appreciated that other operations not illustrated by FIG. 1C can be performed in accordance with one embodiment.
Referring to FIG. 1C, at A (e.g., time 0), load A writes A with value 0 into a load cache (e.g., 103b in FIG. 1A). In one embodiment, load A is an instruction to write the data value 0 into an index of a load cache (e.g., 103b in FIG. 1A).
At B (e.g., time 1), store A writes A with value 1 into a store coalescing cache (e.g., 103a in FIG. 1A). In one embodiment, store A is an instruction to write the data value 1 into an index of a store coalescing cache (e.g., 103a in FIG. 1A).
At C (e.g., time 2), store B requests a write-back of A from the store coalescing cache to the L2 cache by requesting that a data of value X corresponding to address B replace the data of value 1 that corresponds to address A that is present in the aforementioned index of the store coalescing cache. In one embodiment, store B is a request to write-back the data value 1 corresponding to address A into an index of the L2 cache (e.g., 107 in FIG. 1A).
At D (e.g., time 3), the L2 cache writes itself for A with data value 1. Because in one embodiment, the L2 cache does not include the contents of store coalescing cache, the entry corresponding to address A is newly written into an index of the L2 cache.
At E (e.g., time 4), the L2 cache also writes the load cache for A with value 1. The addresses and values used in the description of the operation of the embodiment of FIG. 1C are only exemplary and other addresses and values can be involved.
In one embodiment, as is discussed herein, because stores that are received by the store coalescing cache that update the data that is maintained therein may not immediately update the copies of the data that are maintained in the load cache, a copy of the data that is maintained by the load cache can be stale. Consequently, providing the load cache with the most up to date (most recent) version of the data is undertaken such that at the time of write-back, the load cache is cache coherent with the store coalescing cache with respect to the data that is written-back (the data that is removed from the store coalescing cache).
Components of System for Maintaining Coherency of a Store Coalescing Cache and a Load Cache According to One Embodiment
FIG. 2 shows components of a system 101 for maintaining coherency of a store coalescing cache and a load cache at the time of write-back according to one embodiment. In one embodiment, components of system 101 implement an algorithm for maintaining coherency of a store coalescing cache and a load cache. In the FIG. 2 embodiment, components of system 101 include write-back accessor 201 and data writer 203.
Write-back request accessor 201 accesses a write-back request that seeks to replace an entry that is maintained in a level one store coalescing cache (e.g., store coalescing cache 103a in FIG. 1A) with other data. In one embodiment, the write-back request can cause the entry to be written back to a level two cache (e.g., cache 107 in FIG. 1A). In one embodiment, this can occur when there is no space available in the level one store coalescing cache for additional entries.
Write-back component 201, responsive to a write-back or an authorization of a write-back of an entry from a level one store coalescing cache to a level two cache, writes the entry into the level two cache and then writes the entry into the level one load cache (e.g., load cache 103b in FIG. 1A). In one embodiment, the aforementioned writing the entry into the level two cache and the subsequent writing the entry into the level one load cache is executed at the speed of access of the level two cache. In one embodiment, the level two cache controls a port for writing data to the level one load cache, whereas the store coalescing cache does not. As such, in order for the entry that is written back to the level two cache to be written to the level one load cache, the entry is initially written to the level two cache as discussed herein, from whence it can be written to the level one load cache using the level two cache write port.
It should be appreciated that the aforementioned components of system 101 can be implemented in hardware or software or in a combination of both. In one embodiment, components and operations of system 101 can be encompassed by components and operations of one or more computer components or programs (e.g., cache controller 107a in FIG. 1A). In another embodiment, components and operations of system 101 can be separate from the aforementioned one or more computer components or programs but can operate cooperatively with components and operations thereof.
Method for Maintaining Coherency of a Store Coalescing Cache and a Load Cache According to One Embodiment
FIG. 3 shows a flowchart 300 of the steps performed in a method for maintaining coherency of a store coalescing cache and a load cache at the time of write-back according to one embodiment according to one embodiment. The flowchart includes processes that, in one embodiment can be carried out by processors and electrical components under the control of computer-readable and computer-executable instructions. Although specific steps are disclosed in the flowcharts, such steps are exemplary. That is the present embodiment is well suited to performing various other steps or variations of the steps recited in the flowchart.
Referring to FIG. 3, at 301, a write-back request is accessed that seeks to replace an entry that is maintained in a level one store coalescing cache (e.g., store coalescing cache 103a in FIG. 1A) with other data. In one embodiment, the write-back request can cause the entry to be written back to a level two cache (e.g., cache 107 in FIG. 1A). In one embodiment, this can occur when there is no space available in the level one store coalescing cache for additional entries.
At 303, responsive to a write-back of an entry or an authorization of a write-back from a level one store coalescing cache to a level two cache, the entry is written into the level two cache. In one embodiment, the level two cache (e.g., L2 cache 107) does not include the contents of the store coalescing cache or the load cache (e.g., store coalescing cache 103a and load cache 103b), accordingly it must be first written to the level two cache before the load cache can be updated.
At 305, the entry is written into the level one load cache. In one embodiment, the aforementioned writing the entry into the level two cache and the writing the entry into the level one load cache is executed at the speed of access of the level two cache. In one embodiment, the level two cache controls a port for writing data to level one load cache, whereas the level one store coalescing cache does not. As such, in order for the entry that is written back to the level two cache to be written to the level one load cache, the entry is initially written to the level two cache as discussed, from whence it can be written to the level one load cache using the level two cache write port.
With regard to exemplary embodiments thereof, a method for maintaining the coherency of a store coalescing cache and a load cache is disclosed. As a part of the method, responsive to a write-back of an entry from a level one store coalescing cache to a level two cache, the entry is written into the level two cache and into the level one load cache. The writing of the entry into the level two cache and into the level one load cache is executed at the speed of access of the level two cache.
Although many of the components and processes are described above in the singular for convenience, it will be appreciated by one of skill in the art that multiple components and repeated processes can also be used to practice the techniques of the present invention. Further, while the invention has been particularly shown and described with reference to specific embodiments thereof, it will be understood by those skilled in the art that changes in the form and details of the disclosed embodiments may be made without departing from the spirit or scope of the invention. For example, embodiments of the present invention may be employed with a variety of components and should not be restricted to the ones mentioned above. It is therefore intended that the invention be interpreted to include all variations and equivalents that fall within the true spirit and scope of the present invention.

## Claims

1. A method for maintaining a cache, the method comprising:
writing an entry from a level one store coalescing cache into a level two cache; and
writing the entry into a level one load cache, wherein the writing of the entry into the level two cache and the writing of the entry into the level one load cache maintain coherency of the store coalescing cache and the level one load cache, wherein the writing of the entry into the level two cache and the writing of the entry into the level one load cache are performed in a single clock cycle and executed at a speed of access of the level two cache.

2. The method of claim 1, wherein the writing of the entry from the level one store coalescing cache into a level two cache is performed in response to a write-back request.

3. The method of claim 1, wherein the writing of the entry into the level one load cache is performed with a write port of the level one load cache.

4. The method of claim 3, wherein the level two cache is configured to control the write port of the level one load cache.

5. The method of claim 1, wherein the writing of the entry into the level one load cache updates a stale entry in the level one load cache.

6. The method of claim 1, wherein an address associated with the entry has a value associated therewith in the level one store coalescing cache that is different from a corresponding value in the level one load cache before the writing of the entry from the level one store coalescing cache into the level two cache.

7. A cache system comprising:
a level one cache comprising:
a store coalescing cache; and
a load cache;

a level two cache comprising:
a cache controller comprising:
a write-back accessing component for accessing a write-back request to the store coalescing cache; and
a writing component configured for writing an entry into the level two cache and writing the entry into the load cache, wherein the writing of the entry into the level two cache and the writing of the entry into the load cache are configured to maintain coherency of the store coalescing cache and the load cache, wherein the writing of the entry into the level two cache and the writing of the entry into the load cache are performed in a single clock cycle and executed at a speed of access of the level two cache.

8. The cache system of claim 7, wherein the writing component is configured to write the entry into the level two cache and into the load cache in response to the write-back request.

9. The cache system of claim 7, wherein the writing of the entry into the level two cache and the writing of the entry into the load cache are executed at a pipeline speed of the level two cache.

10. The cache system of claim 7, wherein of the writing the entry into the load cache is performed with a write port of the load cache.

11. The cache system of claim 10, wherein the level two cache is configured to control the write port of the load cache.

12. The cache system of claim 7, wherein the writing of the entry into the load cache updates a stale entry in the load cache.

13. The cache system of claim 7, wherein an address associated with the entry has a value associated therewith in the store coalescing cache that is different from a corresponding value in the load cache before the writing of the entry into the level two cache.

14. A processor, comprising:
a cache system, comprising:
a level one cache comprising:
a first cache portion; and
a second cache portion;

a level two cache comprising:
a cache controller comprising:
a write-back accessing component for accessing a write-back request to the first cache portion; and
a writing component for configured for writing an entry into the level two cache and writing the entry into the second cache portion, wherein the writing of the entry into the level two cache and the writing of the entry into the second cache portion are configured to maintain coherency of the first cache portion and the second cache portion, wherein the writing of the entry into the level two cache and the writing of the entry into the load cache are performed in a single clock cycle and executed at a speed of access of the level two cache.

15. The processor of claim 14, wherein writing component is configured to write the entry into the level two cache and write the entry into the second cache portion in response to the write-back request.