You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
update_replacement_state is not called for misses at fill time #598
Describe the bug
The documentation describes update_replacement_state as:
This function has different behavior depending on whether replacement_cache_fill() is defined. If it is defined, this function is called when a tag check completes, whether the check is a hit or a miss. If it is not defined, this function is called on hits and when a miss is filled (that is, with the same timing as replacement_cache_fill()).
However, when replacement_cache_fill is absent, it doesn't look like update_replacement_state is called for misses at fill time. This occurs for DRRIP which doesn't have replacement_cache_fill.
To Reproduce
Steps to reproduce the behavior:
Configure champsim_config.json to have DRRIP as a replacement policy.
Modify DRRIP to log misses.
Compile
Run
Expected behavior
update_replacement_state is called at cache fills
Output
If applicable, add the output from ChampSim to help explain your problem.
Desktop (please complete the following information):
OS: [e.g. iOS]
Compiler [e.g. GCC, LLVM]
Version [e.g. 22]
Additional context
The issue appears to be at cache.h:515.
It calls impl_update_replacement_state, but since that just checks for hits and whether the replacement policy has replacement_cache_fill, nothing happens.
I believe this is being done since update_replacement_state() would be called when the replacement state needs to update itself.
Since replacement_cache_fill is not defined (we aren't tracking fills), we must be assuming that update_replacement_state() doesn't need called on fills.
It would make some sense the way it is, but I wonder if the original intent was to do the opposite (not call update_replacement_state for fills if replacement_cache_fill() was defined).
I think this was brought up in another issue (and there may be an open PR).
The intent of the change in #434 was to retain the existing behavior of update_state(), where it was called on fills and on hits. If cache_fill() was defined, we would instead call it on fills and update_state() on hits or misses.
It looks like #571 has gone dormant. I think it's important to see the tests for this, as mentioned in that thread. I thought we had a test for this behavior here. Is it not working as expected?
@ngober
From what I can tell, that test only shows that the interface is either the same as the previous call or not called at all. I am guessing it is actually the latter instead of the former.
Is there a place where the update_interface_discerner is reset? That might solve this problem.
Hi, @Quangmire , @maccoymerrell As you have updated DRRIP , SHIP for proper set sampling and also properly defined update_replacement_state and replacement_cache_fill fns #603 . I think SRRIP policy also should have both repl_cache_fill and update_replacement_state otherwise when repl_cache_fill not defined for SRRIP then only hits will call update_repl_st not misses, so rrpv array updation won't be properly done.
That behavior is being changed alongside the runtime config module rework. Hooks should always be invoked, without conditionality of other hooks being defined.
Under that system, update_replacement_state should be called for hits and misses.
Activity
maccoymerrell commentedon Feb 21, 2025
I believe this is being done since update_replacement_state() would be called when the replacement state needs to update itself.
Since replacement_cache_fill is not defined (we aren't tracking fills), we must be assuming that update_replacement_state() doesn't need called on fills.
It would make some sense the way it is, but I wonder if the original intent was to do the opposite (not call update_replacement_state for fills if replacement_cache_fill() was defined).
I think this was brought up in another issue (and there may be an open PR).
maccoymerrell commentedon Feb 21, 2025
Issue #570
PR #571
ngober commentedon Feb 21, 2025
The intent of the change in #434 was to retain the existing behavior of
update_state(), where it was called on fills and on hits. Ifcache_fill()was defined, we would instead call it on fills andupdate_state()on hits or misses.It looks like #571 has gone dormant. I think it's important to see the tests for this, as mentioned in that thread. I thought we had a test for this behavior here. Is it not working as expected?
maccoymerrell commentedon Feb 21, 2025
@ngober
From what I can tell, that test only shows that the interface is either the same as the previous call or not called at all. I am guessing it is actually the latter instead of the former.
Is there a place where the update_interface_discerner is reset? That might solve this problem.
ngober commentedon Feb 21, 2025
I think you're right. Resetting
update_interface_discernermight expose a bug. I wonder if the state is being preserved between test sections.seemakurthi-anand commentedon Apr 1, 2026
Hi,
@Quangmire , @maccoymerrell As you have updated DRRIP , SHIP for proper set sampling and also properly defined update_replacement_state and replacement_cache_fill fns #603 . I think SRRIP policy also should have both repl_cache_fill and update_replacement_state otherwise when repl_cache_fill not defined for SRRIP then only hits will call update_repl_st not misses, so rrpv array updation won't be properly done.
maccoymerrell commentedon Apr 1, 2026
That behavior is being changed alongside the runtime config module rework. Hooks should always be invoked, without conditionality of other hooks being defined.
Under that system, update_replacement_state should be called for hits and misses.
seemakurthi-anand commentedon Apr 1, 2026
Where can I find the updated code, is it part of some develop branch or it is yet to be commited to repo?
maccoymerrell commentedon Apr 1, 2026
#564
Hits and misses on cache access will be caught by update_replacement_state. Fills are logged exclusively through cache_fill