1a1a11a / libCacheSim

a high performance library for building cache simulators
GNU General Public License v3.0
159 stars 34 forks source link

Support Mithril #16

Closed zztaki closed 1 year ago

zztaki commented 1 year ago

I will add the Mithril algorithm that was mentioned in the previous issue.

Since Mithril is intended to enhance a cache for block storage or on-chip storage, there is a confusing problem in the original algorithm (block_size and all objects are of equal size), which conflicts with most algorithms that support variable object sizes in this project.

So I have done these changes.

  1. The block_size is 1 in the default setting, otherwise, set block_size in eviction_params such as -e "block-size=65536".
  2. For variable size, I set a hash_table cache_size_map that maps all requested objects to their size in order to set req->obj_size in prefetching. There seems to be a better approach here, like keeping track of object sizes in recording_table, mining_table and prefetch_table.
  3. Oh, Mithril supports the second-chance mechanism, so the base cache should provide {base_cache}_to_evict interface.

Based on the above, I will submit a pull request. 😀