Patent Description:
Efficiently maintaining cache coherence is a central requirement for obtaining high performance shared memory multiprocessor systems.

Shared memory multiprocessor systems usually contain one or more shared main memory agents in addition to a series of local memory agents, called cache agents, or just cache. The cache agents may belong only to a local processor or to a node of processors and are characterized by their high speed and small size compared with the main memory. Storing data in a local cache agent that e.g. belongs to a working set of a local CPU will thus largely improve the overall performance of the multiprocessor system as the frequently used data in the working set can be more quickly accessed by the local CPU.

Having a series of local cache agents each holding data locally gives rise to the problem with how to maintain cache coherence. If a CPU modifies a cache line in a local cache agent through e.g. a write-operation, other cache agents holding a copy of the same cache line will be unaware of this write operation, and their copy of the respective cache line will consequently be out of date. These out of date cache lines may then be defined as stale. A cache line is generally considered as a combination of a block of data and an address belonging to this block of data. The address may for example comprise a cache line identifier/tag.

In order to obtain cache coherence, i.e. eliminating stale data, a wide variety of techniques and procedures have been implemented. This involves implementing a variety of cache coherence protocols, like the MSI, MESI, MOESI protocols, as well as implementing a variety of cache coherence mechanisms, like snoopy bus-based methods.

Snoopy bus-based methods usually involve what is called a snooper that snoops transactions that are being communicated across a bus, and updates the local cache accordingly. The snooper may belong to a cache agent, or group of cache agents, and the bus may run between various agents in the computer system, including cache agents, cache elements, cache nodes, CPUs etc. Whenever a transaction that modifies a cache line is being communicated on the bus, the snooper snoops this transaction, checks whether its respective cache agent holds a copy of this cache line, and modifies the cache line according to the transaction communicated across the bus.

One problem with snoopy bus-based cache coherence mechanisms is that every time a transaction occurs on the bus, the snooper has to check its appurtenant cache agents/elements for a copy of the cache line communicated across the bus. This action is commonly called a lookup action and involves a series of procedural steps having to be performed.

The concept of a snoop filter has been developed in order to improve on the efficiency of snoopy based cache coherence mechanisms. A snoop filter is a directory-based structure that maintains information related to a series of cache lines stored in the cache. In a multi-processor system, a snoop filter may for example monitor the bus traffic and filter out the transactions on the bus not relating to a cache line that is stored in any of its appurtenant cache agents. This results in the snooper having to perform fewer power and time-consuming lookups, and hence improves the efficiency of the snoopy based cache coherence mechanism.

A snoop filter is commonly structured in order to maintain information as entries stored in a series of snoop filter storage locations. Each snoop filter storage location is commonly configured to store an entry comprising at least a tag that identifies an appurtenant cache line, and optionally various additional information such as state bits, and a series of presence vectors that indicate which cache agents in the system that holds a copy of the cache line identified by the tag. The fraction of each snoop filter storage location associated with presence bits may often be large, resulting in a large overhead. An entry is often defined as the collective information stored in the snoop filter which relate to one specific tag.

Most snoop filters are sized such that they can store a limited amount of information, e.g. a fixed number of entries. The large number of presence vectors in snoop filter entries thus results in a storage capacity problem, consequently limiting the number of snoop filter entries that the snoop filter can maintain. It is desirable to have a snoop filter that covers, i.e. contains information regarding the presence of, as many cache lines as possible per snoop filter storage.

The limited size of a snoop filter will eventually lead to the snoop filter filling up, making it unable to store additional entries. In order to make room for a new entry, the snoop filter will have to dispose of one of its entries through what is called an eviction process. During an eviction process the snoop filter evicts one of its entries and sends a back-invalidation signal to the cache agents in the system that are indicated as holding a copy of the cache line identified by the snoop filter entry being evicted. This back-invalidation signal causes the cache agents to mark the relevant cache line as invalid in order to avoid future problems related to stale data. A problem with this process is that the invalidated cache lines may be in use when invalidated, leading e.g. to additional reloading operations having to be performed.

Several patent documents describes snoop filters among them is <CIT>. The patent application describes a method and system for managing data coherency in multiprocessor systems using a snoop filter. The snoop filter maintains a cache coherency state representation of data stored in processor caches, ensuring data consistency across multiple processors. The method involves receiving data requests, determining cache entry locations, and storing data and coherency records in corresponding cache affinities. The system aims to reduce back invalidations and improve bandwidth efficiency by using a line swapping scheme and way-hint replacement policies. This approach minimizes the impact on bus bandwidth and processor utilization, enhancing overall system performance.

Another example of a snoop filter solution is described in <CIT>, the patent describes a method and system for managing aliasing in a Virtually Indexed Physically Tagged (VIPT) cache. The VIPT cache uses a virtual set address (VSA) to index cache sets and a physical address (PA) for tag comparison. A cache coherency circuit detects aliasing when different virtual addresses map to the same physical address but different cache sets. The system employs a snoop filter to maintain coherency information across potential aliasing sets, ensuring accurate data retrieval and consistency. This approach mitigates data errors, performance degradation, and power consumption issues associated with cache aliasing.

Yet another example is found in <CIT> which describes a pseudo least recently used (LRU) replacement/allocation scheme for a set-associative snoop filter in multiprocessor systems. The snoop filter is divided into subsets, each associated with a processor, to manage cache coherency efficiently. When new data is loaded into a processor's cache, the snoop filter updates its entries to reflect this change, ensuring data consistency across the system. The scheme aims to reduce unnecessary cache invalidations and improve system performance by using a pseudo-LRU algorithm to select entries for replacement. This method enhances resource allocation and maintains optimal cache coherency in shared-memory multiprocessor environments.

The document <CIT> a snoop filter with sharer presence bitmap, indicating contiguous lines as well.

It is the goal of the present invention to improve the structure of a snoop filter in order to reduce the negative impact of an eviction as well as to increase the efficiency of the snoop filter.

The invention provides a snoop filter device connectable with a plurality of cache elements, the snoop filter device comprising a plurality of snoop filter storage locations, each configured to store a tag that identifies a cache line storable in a cache agent, where each snoop filter storage location is mapped to one cache element wherein each cache element is uniquely identified by one cache identifier and each cache element comprises a plurality of cache agents, wherein each cache agent is a physical cache memory hardware unit.

Each snoop filter storage location is in one embodiment of the invention configured to additionally store an identifier for a cache element. Each snoop filter storage location may be mapped to one cache element identified by the identifier stored at that snoop filter storage location.

Each snoop filter storage location is in another embodiment of the invention implicitly associated with one cache element. Each snoop filter storage location may be mapped to one cache element using hard wiring.

Each snoop filter storage location is according to yet another embodiment of the invention configured to additionally store zero or more presence bits, where each presence bit stored at a snoop filter storage location indicates whether a cache line identified by a tag associated with the snoop filter storage location is present in the one cache element to which the snoop filter storage location is mapped.

Each snoop filter storage location is according to yet another embodiment of the invention configured to store up to one presence bit, where a presence bit stored at a snoop filter storage location indicates whether a cache line identified by a tag stored at the snoop filter storage location is present in the cache element to which the snoop filter storage location is mapped.

Each snoop filter storage location is according to yet another embodiment of the invention sectored into a plurality of snoop filter sectors. Each snoop filter sector may be configured to store a tag that identifies a cache line storable in a cache agent. Each snoop filter sector may be configured to additionally store up to one presence bit, where a presence bit stored in a snoop filter sector of a snoop filter storage location indicates whether a cache line identified by a tag stored in the snoop filter sector is present in the cache element to which the snoop filter storage location is mapped.

The snoop filter sectors of a snoop filter storage location may according to yet another embodiment of the invention comprise a first snoop filter sector that is configured to store one tag or a fraction of one tag, and one presence bit, and one or more consecutive snoop filter sectors, each configured to store zero tags and one presence bit, where a presence bit stored in the first snoop filter sector and a presence bit in each one of the consecutive snoop filter sectors indicate the presence of separate cache lines in the same cache element. A presence bit stored in the first snoop filter sector may indicate whether a cache line identified by a tag stored in the first snoop filter sector is present in the cache element to which the snoop filter storage location is mapped, and a presence bit stored in each consecutive snoop filter sector to the first snoop filter sector may indicate whether a cache line identified by a respective consecutive tag to the tag stored in the first snoop filter sector of the snoop filter storage location is present in the cache element to which the snoop filter storage location is mapped.

According to yet another embodiment of the invention a presence bit stored in the first snoop filter sector indicates whether a cache line identified by a reconstructed tag is present in the cache element to which the snoop filter storage location is mapped, and a presence bit stored in each consecutive snoop filter sector to the first snoop filter sector indicates whether a cache line identified by a respective consecutive tag to the reconstructed tag is present in the cache element to which the snoop filter storage location is mapped, the reconstructed tag being reconstructed from a fraction of a tag stored in the first snoop filter sector, and from the number of sectors in the snoop filter storage location. The most significant bits of the reconstructed tag may consist of the fractional tag, and the least significant bits of the reconstructed tag may consist of a log<NUM>(n) number of zeros, n being the number of sectors in the snoop filter storage location.

Other advantageous features will be apparent from the accompanying claims.

In order to make the invention more readily understandable, the discussion that follows will refer to the accompanying drawings, in which:.

In the following, general embodiments as well as particular exemplary embodiments of the invention will be described. References and possible numerals will be made to the accompanying drawings.

The present invention relates to a snoop filter device for use in maintaining cache coherence across a multi-processor computer system. <FIG> is a schematic illustration of an example of a multiprocessor system that comprises a snoop filter device <NUM>. Here, the snoop filter device <NUM> is located between a shared memory, cache agent <NUM> / cache element <NUM> and processors in a multi-processor system and is connected to these components via one or more busses <NUM>. A snoop filter device <NUM> can generally be considered as a directory-based device that monitors and filters bus traffic in order to reduce unnecessary snoops in the system. A snoop filter device <NUM> comprises as schematically illustrated in <FIG> a plurality of snoop filter storage locations <NUM> making up a directory. Each snoop filter storage location <NUM> is configured to store at least one tag <NUM>, where each tag identifies a cache line stored in a cache agent <NUM> in the multiprocessor system. The snoop filter device <NUM> may thus be considered as maintaining an overview of which cache lines that are stored where in a computer system.

The present invention relates to a snoop filter device that is connectable to a plurality of cache elements, where each cache element comprises a plurality of cache agents. A cache element may be interpreted as an arbitrary collection of cache agents. Cache agents in each cache element may be connected directly, collectively or a combination of directly and collectively to the snoop filter device. It will be appreciated by a person skilled in the art that any cache element is uniquely identified by one cache identifier.

A cache agent in the context of the present invention is considered as a physical cache memory hardware unit.

The snoop filter device comprises according to the invention a plurality of snoop filter storage locations, where each snoop filter storage location is configured to at least store a tag that identifies a cache line storable in a cache agent. Any storage location of the snoop filter device may thus during operation of the snoop filter device store a tag that identifies a cache line stored in a cache agent that belongs to a certain cache element connected to the snoop filter device. The information stored at a snoop filter storage location is often referred to as an entry, and a snoop filter storage location may therefore be interpreted as configured to store an entry. An entry may be considered as information stored in a snoop filter storage location. An entry may thus be considered to comprise a tag, while a tag may alternatively be considered as an entry. Each snoop filter storage location may in addition to a tag store other data, such as state bits, last recently used bits, etc. These other data may be considered as a part of an entry.

<FIG> illustrates a snoop filter device <NUM> that stores a tag <NUM> in one of its storage locations <NUM>, where the tag <NUM> identifies a cache line stored in a cache agent in a cache element <NUM>. The cache agent may here be considered as included in the cache element <NUM> connected to the snoop filter device. A cache line stored in a cache element may be considered as stored in any cache agent in that particular cache element.

A snoop filter device may be considered as configured to track at least a plurality of cache lines, and a plurality of cache elements connected to the snoop filter device. Tracking a cache line by a snoop filter device here means that the snoop filter device maintains information related to which cache elements that hold a copy of the cache line. Tracking a cache element by a snoop filter device here means that the snoop filter device maintains information related to which cache lines that are stored in cache agents belonging to that cache element.

A snoop filter storage location may be considered as configured to track a cache element, and a cache line. This means that the snoop filter storage location maintains information related to whether the cache element that it is tracking holds a copy of the cache line that it is tracking. Which cache line/lines that a snoop filter storage location is/are configured to track may be given by which tag/tags that are stored in the snoop filter storage location.

<FIG> illustrates a snoop filter device <NUM>, where each snoop filter storage location <NUM> is mapped to one cache element <NUM>. This means that any one snoop filter storage location <NUM> may only track the cache element <NUM> to which it is mapped. Any one snoop filter storage location <NUM> may in other words only contain information that relates to cache lines that are stored in the cache element <NUM> to which that snoop filter storage location <NUM> is mapped. Each snoop filter storage location <NUM> may thus be said to be bijectively mapped to one cache element <NUM>. A snoop filter storage location <NUM> storing a given tag <NUM> may consequently indicate that the cache element <NUM> to which that snoop filter storage location <NUM> is mapped holds a copy of the cache line identified by that tag <NUM>. The same snoop filter storage location <NUM> may consequently not contain any information regarding which part of the cache element, e.g. which cache agent, that holds a copy of the cache line. The same snoop filter storage location <NUM> may not contain information regarding the presence of the cache line in other cache elements in the system. Each snoop filter storage location of the snoop filter device may according to any embodiment of the invention be considered as being configured to be mapped to one cache element. <FIG> illustrates a snoop filter device where multiple snoop filter storage locations are mapped to the same cache element <NUM>. This means that the snoop filter device <NUM> may employ multiple snoop filter storage locations <NUM> in order to track multiple cache lines in one cache element <NUM>.

In operation, a snoop filter device is connected to a plurality of cache elements, where each cache element comprises a plurality of cache agents as previously described. When a cache line is loaded into one of the cache elements, e.g. from main memory, the snoop filter device updates its directory by storing the tag related to the newly loaded cache line in one of its storage locations. In the event where all the snoop filter storage locations mapped to the cache element that loaded the cache line already stores an entry, the snoop filter device will have to evict an entry from a snoop filter storage location before it can store a new entry comprising the tag related to the newly loaded cache line. Which snoop filter storage location to evict from will according to the present invention depend on which cache element that loaded the cache line from main memory. The snoop filter device may only store the tag of the newly loaded cache line in a snoop filter storage location that is mapped to the cache element that loaded the new cache line. In other words, when a snoop filter evicts an old entry in favour of a new entry, it can only choose to evict an entry stored in a snoop filter storage location that is mapped to the cache element where the cache line identified by the tag in the new entry was loaded.

Each snoop filter storage location <NUM> is as previously described mapped to one cache element <NUM>. Which cache element <NUM> that a snoop filter storage location <NUM> is mapped to may in one embodiment of the invention be determined by an identifier <NUM> explicitly stored in the snoop filter storage location <NUM>. <FIG> and <FIG> are schematic illustrations of a directory in a snoop filter device <NUM> where each snoop filter storage location <NUM> stores an identifier <NUM> for a cache element <NUM> in addition to a tag <NUM>. An identifier <NUM> stored in a snoop filter storage location <NUM> may generally be considered as being fixed throughout an operation of the snoop filter device <NUM>, e.g. throughout the execution of one program, and may for example only be allowed to be changed on a reboot of a program or by executing a certain reset procedure. This consequently means that the identifier <NUM> in each snoop filter storage location <NUM> may remain the same over a certain time period, e.g. determined by the time it takes to execute a certain program.

Which cache element <NUM> that a snoop filter storage location <NUM> is mapped to may be determined implicitly by the snoop filter storage location <NUM> itself. This implicit determination is schematically illustrated in <FIG>. Here, each snoop filter storage location <NUM> is implicitly related to a cache identifier <NUM> for a cache element <NUM>. In this figure, each snoop filter storage location <NUM> is associated directly with one cache element <NUM>, e.g. through its location in the snoop filter directory. The first snoop filter storage location in the directory of a snoop filter device <NUM> may for example be configured to be mapped to cache element A, while the second snoop filter storage location may be configured to be mapped to cache element D. This means that this first snoop filter storage location may only contain information regarding the presence of cache lines in cache element A, while the second snoop filter storage location may only contain information regarding the presence of cache lines in cache element D.

Each snoop filter storage location <NUM> is according to one embodiment of the invention mapped to one cache element <NUM> using hard wiring. In this case, each snoop filter storage location <NUM> is connected to one cache element <NUM> such that each snoop filter storage location <NUM> is permanently associated with the cache element <NUM> to which it is mapped. The mapping is in this embodiment in other words permanently set out in the device itself and cannot be changed after the device has been produced.

<FIG> is a schematic illustration of a snoop filter device <NUM>, where each snoop filter storage location <NUM> is configured to store a presence bit <NUM> in addition to a tag <NUM>. A presence bit <NUM> stored together with a tag <NUM> in a snoop filter storage location <NUM> may indicate whether a cache line identified by the tag <NUM> is present in the cache element <NUM> to which the snoop filter storage location <NUM> is mapped. The presence bit <NUM> may here be set as true if the cache line is present in the cache element <NUM>, or false if the cache line is not present. The number of presence bits stored in a snoop filter storage location <NUM> may according to one embodiment of the invention be limited to maximum one.

<FIG> is a schematic illustration of a snoop filter device where each snoop filter storage location <NUM> is sectored into a plurality of sectors <NUM>. A sector <NUM> may here be considered as a part of a snoop filter storage location <NUM> that may store information, e.g. information relating to a given tag <NUM>. The number of sectors <NUM> can in principle be any number, but is preferably a power of <NUM>. A snoop filter storage location may comprise one sector.

In one embodiment of the invention each sector <NUM> of a snoop filter storage location <NUM> is configured to store a tag <NUM> that identifies a cache line storable in a cache agent. This means that one snoop filter storage location <NUM> may store as many tags <NUM> as it contains sectors <NUM>. One snoop filter storage location <NUM> is mapped to one single cache element, meaning that each sector <NUM> of the snoop filter storage location <NUM> is mapped to the same cache element. Each snoop filter storage location <NUM> may in this embodiment consequently track multiple cache lines - one for each sector. <FIG> is a schematic illustration of a snoop filter device comprising sectored snoop filter storage locations <NUM>, where each sector <NUM> is configured to store one tag <NUM> and one presence bit <NUM>. A presence bit <NUM> stored together with a tag within a sector <NUM> of a snoop filter storage may here indicate whether a cache line identified by the tag <NUM> is present in the cache element to which the snoop filter storage location <NUM> is mapped. The number of presence bits <NUM> stored in each sector <NUM> may in any embodiment of the invention be limited to one.

<FIG>, <FIG> illustrate an embodiment where each snoop filter storage location <NUM> is sectored into a plurality of sectors. Here, the first sector <NUM> of each snoop filter storage location <NUM> is configured to store one tag <NUM> and one presence bit <NUM>, while each consecutive sector <NUM> after the first <NUM> is configured to store one presence bit <NUM>, but no tag. A presence bit <NUM> stored together with a tag <NUM> in a first sector <NUM> in a snoop filter storage location <NUM> may in this embodiment of the invention indicate whether a cache line identified by the tag <NUM> is present in the cache element to which the snoop filter storage location <NUM> is mapped. The presence bit <NUM> of each consecutive sector <NUM> after the first <NUM> may indicate the presence of cache lines identified by tags with a certain iterative relationship to the tag <NUM> stored in the first sector <NUM>. If the tag <NUM> in the first sector <NUM> is 0x0001, the presence bit <NUM> stored with this tag <NUM> in a first sector <NUM> in a snoop filter storage location <NUM> may indicate the presence of a cache line identified by the tag 0x0001 in the cache element to which the snoop filter storage location <NUM> is mapped. The presence bits <NUM> of the consecutive second, third, and fourth sector <NUM> after the first <NUM> may here for example indicate the presence of cache lines identified by the tags 0x0002, 0x0003 and 0x0004 in the cache element to which the snoop filter storage location <NUM> is mapped. The tags 0x0002, 0x0003 and 0x0004 are in <FIG> given implicitly through their relationship with the first tag, meaning that neither one of the tags 0x0002, 0x0003 and 0x0004 are stored in any sector but are implicitly given by the tag <NUM> in the first sector <NUM> and the number of the consecutive sector. The relationship between the explicitly given tag in the first sector and the implicitly given tags in the consecutive sectors may in principle take any form. Following the example with a tag in the first sector being 0x0001, the implicitly given tags of each consecutive sector may e.g. follow a formula such that the tag in sector m is given by a function of m. The tag in a sector m may for example equals the tag in the first sector multiplied by a function of m, e.g. m, <NUM>, m<NUM>, etc. <FIG> illustrates an example where separate storage locations, each mapped to different cache elements, may store the same tag.

The first sector <NUM> of each snoop filter storage location may according to one embodiment of the invention be configured to store a fraction of a tag, and one presence bit. A fraction of a tag/fractional tag may here be interpreted as a subset of the Y number of bits required to write out a full tag. Sectoring of a snoop filter storage location into multiple sectors allows for the tag in the first sector <NUM> to be identified using X fewer bits than the Y number of bits required to write out the full tag. Here, X = log<NUM>(n), where n equals the number of sectors in the snoop filter storage location. <FIG> illustrates a snoop filter storage location where a full <NUM> bit tag, <NUM>, is stored in the first sector <NUM>, and where each consecutive sector <NUM> is associated with the consecutive tags <NUM> to <NUM>. The linear consecutive relationship between the first tag and the consecutive tags allows the tag in the first sector <NUM> to be shortened by its <NUM> least significant bits. These bits are then implicitly given by the number of sectors. <FIG> illustrates a snoop filter storage location where a Y = <NUM> bit tag <NUM> is stored in the first sector <NUM> of a snoop filter storage location as <NUM>. The X = log<NUM>(# of sectors) = log<NUM>(<NUM>) = <NUM> least significant bits of the <NUM> bit tag is not explicitly stored in the first sector <NUM> as these can be implicitly deduced from the fact that there are <NUM> sectors in the snoop filter storage location. The full Y bit tag can here be reconstructed by adding the fraction of a tag/fractional tag stored in the first sector <NUM> and a log<NUM>(n) number of zeros. The full Y bit tag may in other words be reconstructed such that the fractional tag makes up the most significant bits while the log<NUM>(n) number of zeros make up the least significant bits. A snoop filter storage location may consequently be considered as storing a full Y bit reconstructed tag, where the full Y bit reconstructed tag is given partly by the explicitly stored fractional tag, and partly implicit by the number of sectors in the snoop filter storge location. The full Y bit reconstructed tag can in other words be considered as being stored in the snoop filter storage location.

Sectoring of snoop filter storage locations may consequently be used in order to optimize the number of cache lines that can be tracked per storage in the snoop filter. This can be seen directly from <FIG>. The <NUM> bits required to write out the information in the storage location illustrated in <FIG> may be be reduced by <NUM> bits by replacing the tag with a fractional tag. The full tag may here be reconstructed from merging the fractional tag <NUM> with log<NUM>(number of sectors), i.e. <NUM> merged with <NUM> = <NUM>.

The relationship between the explicitly given tag <NUM> in the first sector <NUM> and the implicitly given tags in the consecutive sectors <NUM> may be programmed or alternatively be hard wired.

Claim 1:
A snoop filter device (<NUM>) connectable with a plurality of cache elements, where the snoop filter device comprising:
- a plurality of snoop filter storage locations, each configured to store a tag (<NUM>) that identifies a cache line storable in a cache agent (<NUM>),
where each snoop filter storage location (<NUM>) is mapped to one cache element (<NUM>)
characterised in that each cache element is uniquely identified by one cache identifier (<NUM>) and each cache element (<NUM>) comprises a plurality of cache agents (<NUM>), wherein each cache agent (<NUM>) is a physical cache memory hardware unit.