Skip to content

Drrip set dueling - with tests#689

Merged
ngober merged 15 commits intoChampSim:developfrom
maccoymerrell:drrip_set_dueling
Feb 14, 2026
Merged

Drrip set dueling - with tests#689
ngober merged 15 commits intoChampSim:developfrom
maccoymerrell:drrip_set_dueling

Conversation

@maccoymerrell
Copy link
Copy Markdown
Contributor

Extension of PR from @Quangmire with the following improvements:

  1. set sampling duel counter type (dscounter) added, which implements the set sampling duel counter feature utilized by many replacement policies and prefetchers
  2. categorizer type, which implements the sampling utilized by 1 as a categorizer, evenly splitting a given value into a sampled number of categories (where 0 and 1 are used as indicators by the dscounter of those sets to be sampled). How input values are translated to integers to be sampled relies on a user-defined projection object.
  3. static inlines of get_num_samples() and get_sample_rate() which when provided a population? provides the recommended number of samples and the corresponding sample rate.
  4. The addition of a new msl/stat_methods.h header which includes 1, 2, and 3 (and in the future could include other structures like this)
  5. Tests for features introduced in 1, 2, and 3

@maccoymerrell
Copy link
Copy Markdown
Contributor Author

I don't know what is causing this? The includes seem correct.

@ngober
Copy link
Copy Markdown
Collaborator

ngober commented Feb 14, 2026

The problem is that you've got #include "msl/bits.h". That defines champsim::msl::lg2() and friends. So, you either need to spell it champsim::msl::lg2() (fully-qualified) or lg2() (since you're already in the champsim::msl namespace.

Good idea to pull the set sampling into the MSL, by the way. I anticipate that could be useful.

@maccoymerrell
Copy link
Copy Markdown
Contributor Author

Before we consider merging this, I should probably do some performance comparisons between lru, drrip, and ship to make sure these are working right.

@maccoymerrell
Copy link
Copy Markdown
Contributor Author

maccoymerrell commented Feb 14, 2026

Realized how I was using the new class in DRRIP was leading to a double-inversion and correlating positively on miss instead of negatively.

DRRIP updates on miss, so an update from a set with one policy should increment the counter towards the other policy. If I just flip the duel result that doesn't work, since the sample sets will get inverted as well so the entire system ends up behaving exactly the same.

Instead, I added a flag to the update() method to invert the way each category increments the counter, which seems to be the most-elegant solution to this problem. Settings the inv flag to true means you train against the policy, and leaving it unspecified/false means you count towards the policy.

Performance checks seem to confirm that this is correct, I am seeing a strong lru < DRRIP < SHiP relationship on the workloads I grabbed from the SHiP paper.

@coveralls
Copy link
Copy Markdown

coveralls commented Feb 14, 2026

Coverage Status

coverage: 68.912% (+0.7%) from 68.197%
when pulling 6f778c5 on maccoymerrell:drrip_set_dueling
into afd7c0f on ChampSim:develop.

@ngober
Copy link
Copy Markdown
Collaborator

ngober commented Feb 14, 2026

Hot take: boolean parameters are an antipattern because they leak a function's control flow to the caller. I think it may actually be a more clear API design to have two update functions: dscounter::update_good() and dscounter::update_bad(). Calling the parameter "invert" isn't very clear what we should be inverting. Calling it "good" and "bad" tells the user how to use it, rather than what it does.

Copy link
Copy Markdown
Collaborator

@ngober ngober left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one final pass of cleanup feedback, but I think this is good to go.

Comment thread inc/msl/stat_methods.h Outdated
Comment thread replacement/drrip/drrip.cc Outdated
Comment thread src/modules.cc
@ngober ngober merged commit 117e44e into ChampSim:develop Feb 14, 2026
32 checks passed
github-actions Bot added a commit that referenced this pull request Feb 14, 2026
Author: maccoymerrell
Committer: GitHub

Drrip set dueling - with tests (#689)

Extension of PR from @Quangmire with the following improvements:
1. set sampling duel counter type (dscounter) added, which implements
the set sampling duel counter feature utilized by many replacement
policies and prefetchers
2. categorizer type, which implements the sampling utilized by 1 as a
categorizer, evenly splitting a given value into a sampled number of
categories (where 0 and 1 are used as indicators by the dscounter of
those sets to be sampled). How input values are translated to integers
to be sampled relies on a user-defined projection object.
3. static inlines of get_num_samples() and get_sample_rate() which when
provided a population? provides the recommended number of samples and
the corresponding sample rate.
4. The addition of a new msl/stat_methods.h header which includes 1, 2,
and 3 (and in the future could include other structures like this)
5. Tests for features introduced in 1, 2, and 3

---------

Co-authored-by: Quang Duong <[email protected]>
@maccoymerrell maccoymerrell deleted the drrip_set_dueling branch February 14, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants