Creating New Coherence Policies
Appendix: RISC-V Memory Opcodes
TileLink is a protocol designed to be a substrate for cache coherence transactions implementing a particular cache coherence policy within an on-chip memory hierarchy. Its purpose is to orthogonalize the design of the on-chip network and the implementation of the cache controllers from the design of the coherence protocol itself. Any cache coherence protocol that conforms to TileLink’s transaction structure can be used interchangeably with the physical networks and cache controllers we provide.
This document describes the API available to implementers of client caches, manager caches or manager directories. The abstraction provided by the API separates the concerns of the controller design from the concerns of the protocol design, while the TileLink substrate ensures forward progress of protocol transactions. By making calls against this object-oriented API, cache controller designers can create state machines that clearly and correctly implement metadata updates. Conversely, designers of new coherence protocols are provided a framework within which to implement their protocol: filling out the response to each API call.
Metadata objects are the fundamental abstraction used in this API. These objects are opaque sets of bits which are processed and mutated by the coherence policy API. Metadata are divided into client-side and manager-side classes, and any particular cache controller can store either or both types.
ClientMetadata is a set of bits that abstracts the “state” of a certain cache block, w.r.t. the permissions available on that block inside this particular client cache controller. The metadata may also store other information about the cache block, for example whether it has been dirtied by a store operation. The complete API for ClientMetadata can be found in the scaladoc, but we provide a summary here. There are three types of calls that a controller can make against the API: permissions checks, message creations, and metadata updates.
These boolean functions answer questions about the permissions on a cache line, and in particular are used to determine what actions to take relative to specific memory operations.
These functions return TileLink channel bundles based on the combination of current metadata state and particular memory operations.
These functions return new ClientMetadata objects whose internal state has been updated based on a particular coherence event or message received.
We provide the ClientMetadata.onReset function to initialize any metadata storage arrays within a particular cache.
ManagerMetadata is a set of bits that abstracts the “state” of certain cache block, w.r.t. the existence of copies of that block in all the client caches managed by this manager cache controller. The metadata may also store other information about the cache block, for example a information about its movement pattern or ownership. The complete API for MasterMetadata can be found in the scaladoc, but we provide a summary here. There are three types of calls that a controller can make against the API: permissions checks, message creations, and metadata updates.
These boolean functions answer questions about the permissions on a cache line, and in particular are used to determine what actions to take relative to specific memory operations.
These functions return TileLink channel bundles to use as responses to Clients based on the combination of current metadata state and particular TileLink messages.
These functions return new ManagerMetadata objects whose internal state has been updated based on a particular coherence event or message.
We provide the ManagerMetadata.onReset function to initialize any metadata storage arrays within a particular cache. This function can also be used to generate an empty ManagerMetadata object for API use within controllers that do not store any metadata (for example a bus controller).
We give designers planning to implement new coherence protocols several Scala traits containing abstract members. By filling in the missing functions, they can provide a complete coherence policy that will interoperate with our supplied cache controllers and TileLink networks. These functions are a superset of the previous APIs and are called from within the ClientMetadata and ManagerMetadata member methods.
We also provide an API for accessing and maintaining directory information on the propagation of cache blocks across all the clients under the purview of a particular manager. These functions are intended to be called from within the CoherencePolicy’s functions, and abstract the details of the storage format used in the directory.
These are the operations inserted into the op_code field of Acquire transactions.
name | code | operation |
M_XRD | "b00000" | integer load |
M_XWR | "b00001" | integer store |
M_PFR | "b00010" | prefetch with intent to read |
M_PFW | "b00011" | prefetch with intent to write |
M_XA_SWAP | "b00100" | atomic swap |
M_NOP | "b00101" | no op |
M_XLR | "b00110" | load release |
M_XSC | "b00111" | store conditional |
M_XA_ADD | "b01000" | atomic add |
M_XA_XOR | "b01001" | atomic xor |
M_XA_OR | "b01010" | atomic or |
M_XA_AND | "b01011" | atomic and |
M_XA_MIN | "b01100" | atomic min |
M_XA_MAX | "b01101" | atomic max |
M_XA_MINU | "b01110" | atomic min unsigned |
M_XA_MAXU | "b01111" | atomic max unsigned |
M_FLUSH | "b10000" | write back dirty data and cede RW permissions |
M_PRODUCE | "b10001" | write back dirty data and cede W permissions |
M_CLEAN | "b10011" | writeback dirty data and retain RW permissions |