Documentation
¶
Overview ¶
Package cache provides the basic commonly used utility data structures for cache implementation.
Index ¶
- type Block
- type Directory
- type DirectoryImpl
- func (d *DirectoryImpl) FindVictim(addr uint64) *Block
- func (d *DirectoryImpl) GetSets() []Set
- func (d *DirectoryImpl) Lookup(PID vm.PID, reqAddr uint64) *Block
- func (d *DirectoryImpl) Reset()
- func (d *DirectoryImpl) TotalSize() uint64
- func (d *DirectoryImpl) Visit(block *Block)
- func (d *DirectoryImpl) WayAssociativity() int
- type FlushReq
- type FlushReqBuilder
- func (b FlushReqBuilder) Build() *FlushReq
- func (b FlushReqBuilder) DiscardInflight() FlushReqBuilder
- func (b FlushReqBuilder) InvalidateAllCacheLines() FlushReqBuilder
- func (b FlushReqBuilder) PauseAfterFlushing() FlushReqBuilder
- func (b FlushReqBuilder) WithDst(dst sim.Port) FlushReqBuilder
- func (b FlushReqBuilder) WithSendTime(t sim.VTimeInSec) FlushReqBuilder
- func (b FlushReqBuilder) WithSrc(src sim.Port) FlushReqBuilder
- type FlushRsp
- type FlushRspBuilder
- func (b FlushRspBuilder) Build() *FlushRsp
- func (b FlushRspBuilder) WithDst(dst sim.Port) FlushRspBuilder
- func (b FlushRspBuilder) WithRspTo(id string) FlushRspBuilder
- func (b FlushRspBuilder) WithSendTime(t sim.VTimeInSec) FlushRspBuilder
- func (b FlushRspBuilder) WithSrc(src sim.Port) FlushRspBuilder
- type LRUVictimFinder
- type MSHR
- type MSHREntry
- type RestartReq
- type RestartReqBuilder
- type RestartRsp
- type RestartRspBuilder
- func (b RestartRspBuilder) Build() *RestartRsp
- func (b RestartRspBuilder) WithDst(dst sim.Port) RestartRspBuilder
- func (b RestartRspBuilder) WithRspTo(id string) RestartRspBuilder
- func (b RestartRspBuilder) WithSendTime(t sim.VTimeInSec) RestartRspBuilder
- func (b RestartRspBuilder) WithSrc(src sim.Port) RestartRspBuilder
- type Set
- type VictimFinder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { PID vm.PID Tag uint64 WayID int SetID int CacheAddress uint64 IsValid bool IsDirty bool ReadCount int IsLocked bool DirtyMask []bool }
A Block of a cache is the information that is associated with a cache line
type Directory ¶
type Directory interface { Lookup(pid vm.PID, address uint64) *Block FindVictim(address uint64) *Block Visit(block *Block) TotalSize() uint64 WayAssociativity() int GetSets() []Set Reset() }
A Directory stores the information about what is stored in the cache.
type DirectoryImpl ¶
type DirectoryImpl struct { NumSets int NumWays int BlockSize int AddrConverter mem.AddressConverter Sets []Set // contains filtered or unexported fields }
A DirectoryImpl is the default implementation of a Directory
The directory can translate from the request address (can be either virtual address or physical address) to the cache based address.
func NewDirectory ¶
func NewDirectory( set, way, blockSize int, victimFinder VictimFinder, ) *DirectoryImpl
NewDirectory returns a new directory object
func (*DirectoryImpl) FindVictim ¶
func (d *DirectoryImpl) FindVictim(addr uint64) *Block
FindVictim returns a block that can be used to stored data at address addr.
If it is valid, the cache controller need to decide what to do to evict the the data in the block
func (*DirectoryImpl) GetSets ¶
func (d *DirectoryImpl) GetSets() []Set
GetSets returns all the sets in a directory
func (*DirectoryImpl) Lookup ¶
func (d *DirectoryImpl) Lookup(PID vm.PID, reqAddr uint64) *Block
Lookup finds the block that reqAddr. If the reqAddr is valid in the cache, return the block information. Otherwise, return nil
func (*DirectoryImpl) Reset ¶
func (d *DirectoryImpl) Reset()
Reset will mark all the blocks in the directory invalid
func (*DirectoryImpl) TotalSize ¶
func (d *DirectoryImpl) TotalSize() uint64
TotalSize returns the maximum number of bytes can be stored in the cache
func (*DirectoryImpl) Visit ¶
func (d *DirectoryImpl) Visit(block *Block)
Visit moves the block to the end of the LRUQueue
func (*DirectoryImpl) WayAssociativity ¶
func (d *DirectoryImpl) WayAssociativity() int
WayAssociativity returns the number of ways per set in the cache.
type FlushReq ¶
type FlushReq struct { sim.MsgMeta InvalidateAllCachelines bool DiscardInflight bool PauseAfterFlushing bool }
FlushReq is the request send to a cache unit to request it to flush all the cache lines.
type FlushReqBuilder ¶
type FlushReqBuilder struct {
// contains filtered or unexported fields
}
FlushReqBuilder can build flush requests.
func (FlushReqBuilder) Build ¶
func (b FlushReqBuilder) Build() *FlushReq
Build creates a new FlushReq
func (FlushReqBuilder) DiscardInflight ¶
func (b FlushReqBuilder) DiscardInflight() FlushReqBuilder
DiscardInflight allows the flush request to build to discard all inflight requests.
func (FlushReqBuilder) InvalidateAllCacheLines ¶
func (b FlushReqBuilder) InvalidateAllCacheLines() FlushReqBuilder
InvalidateAllCacheLines allows the flush request to build to invalidate all the cachelines in a cache unit.
func (FlushReqBuilder) PauseAfterFlushing ¶
func (b FlushReqBuilder) PauseAfterFlushing() FlushReqBuilder
PauseAfterFlushing sets the flush request to build to pause the cache unit from processing future request until restart request is received.
func (FlushReqBuilder) WithDst ¶
func (b FlushReqBuilder) WithDst(dst sim.Port) FlushReqBuilder
WithDst sets the destination of the message to build.
func (FlushReqBuilder) WithSendTime ¶
func (b FlushReqBuilder) WithSendTime(t sim.VTimeInSec) FlushReqBuilder
WithSendTime sets the send time of the message to build.
func (FlushReqBuilder) WithSrc ¶
func (b FlushReqBuilder) WithSrc(src sim.Port) FlushReqBuilder
WithSrc sets the source of the message to build
type FlushRspBuilder ¶
type FlushRspBuilder struct {
// contains filtered or unexported fields
}
FlushRspBuilder can build data ready responds.
func (FlushRspBuilder) Build ¶
func (b FlushRspBuilder) Build() *FlushRsp
Build creates a new FlushRsp
func (FlushRspBuilder) WithDst ¶
func (b FlushRspBuilder) WithDst(dst sim.Port) FlushRspBuilder
WithDst sets the destination of the request to build.
func (FlushRspBuilder) WithRspTo ¶
func (b FlushRspBuilder) WithRspTo(id string) FlushRspBuilder
WithRspTo sets ID of the request that the respond to build is replying to.
func (FlushRspBuilder) WithSendTime ¶
func (b FlushRspBuilder) WithSendTime( t sim.VTimeInSec, ) FlushRspBuilder
WithSendTime sets the send time of the message to build.
func (FlushRspBuilder) WithSrc ¶
func (b FlushRspBuilder) WithSrc(src sim.Port) FlushRspBuilder
WithSrc sets the source of the request to build.
type LRUVictimFinder ¶
type LRUVictimFinder struct { }
LRUVictimFinder evicts the least recently used block to evict
func NewLRUVictimFinder ¶
func NewLRUVictimFinder() *LRUVictimFinder
NewLRUVictimFinder returns a newly constructed lru evictor
func (*LRUVictimFinder) FindVictim ¶
func (e *LRUVictimFinder) FindVictim(set *Set) *Block
FindVictim returns the least recently used block in a set
type MSHR ¶
type MSHR interface { Query(pid vm.PID, addr uint64) *MSHREntry Add(pid vm.PID, addr uint64) *MSHREntry Remove(pid vm.PID, addr uint64) *MSHREntry AllEntries() []*MSHREntry IsFull() bool Reset() }
MSHR is an interface that controls MSHR entries
type MSHREntry ¶
type MSHREntry struct { PID vm.PID Address uint64 Requests []interface{} Block *Block ReadReq *mem.ReadReq DataReady *mem.DataReadyRsp Data []byte }
MSHREntry is an entry in MSHR
type RestartReq ¶
RestartReq is the request send to a cache unit to request it unpause the cache
func (*RestartReq) Meta ¶
func (r *RestartReq) Meta() *sim.MsgMeta
Meta returns the meta data associated with the message.
type RestartReqBuilder ¶
type RestartReqBuilder struct {
// contains filtered or unexported fields
}
RestartReqBuilder can build data ready responds.
func (RestartReqBuilder) Build ¶
func (b RestartReqBuilder) Build() *RestartReq
Build creates a new RestartReq
func (RestartReqBuilder) WithDst ¶
func (b RestartReqBuilder) WithDst(dst sim.Port) RestartReqBuilder
WithDst sets the destination of the request to build.
func (RestartReqBuilder) WithSendTime ¶
func (b RestartReqBuilder) WithSendTime( t sim.VTimeInSec, ) RestartReqBuilder
WithSendTime sets the send time of the message to build.
func (RestartReqBuilder) WithSrc ¶
func (b RestartReqBuilder) WithSrc(src sim.Port) RestartReqBuilder
WithSrc sets the source of the request to build.
type RestartRsp ¶
RestartRsp is the respond sent from the a cache unit for finishing a cache flush
func (*RestartRsp) Meta ¶
func (r *RestartRsp) Meta() *sim.MsgMeta
Meta returns the meta data associated with the message.
type RestartRspBuilder ¶
type RestartRspBuilder struct {
// contains filtered or unexported fields
}
RestartRspBuilder can build data ready responds.
func (RestartRspBuilder) Build ¶
func (b RestartRspBuilder) Build() *RestartRsp
Build creates a new RestartRsp
func (RestartRspBuilder) WithDst ¶
func (b RestartRspBuilder) WithDst(dst sim.Port) RestartRspBuilder
WithDst sets the destination of the request to build.
func (RestartRspBuilder) WithRspTo ¶
func (b RestartRspBuilder) WithRspTo(id string) RestartRspBuilder
WithRspTo sets ID of the request that the respond to build is replying to.
func (RestartRspBuilder) WithSendTime ¶
func (b RestartRspBuilder) WithSendTime( t sim.VTimeInSec, ) RestartRspBuilder
WithSendTime sets the send time of the message to build.
func (RestartRspBuilder) WithSrc ¶
func (b RestartRspBuilder) WithSrc(src sim.Port) RestartRspBuilder
WithSrc sets the source of the request to build.
type VictimFinder ¶
A VictimFinder decides with block should be evicted
Directories
¶
Path | Synopsis |
---|---|
Package writearound provides a GCN3 GPU L1 cache implementation.
|
Package writearound provides a GCN3 GPU L1 cache implementation. |
Package writeback implements a writeback cache.
|
Package writeback implements a writeback cache. |
Package writeevict provides a RDNA GPU L1 cache implementation.
|
Package writeevict provides a RDNA GPU L1 cache implementation. |
Package writethrough provides a GCN3 GPU L1 cache implementation.
|
Package writethrough provides a GCN3 GPU L1 cache implementation. |