Fix CBO load hazard granularity - #3565
Open
124107157-KV wants to merge 1 commit into
Open
124107157-KV wants to merge 1 commit into
124107157-KV wants to merge 1 commit into
Conversation
Signed-off-by: 124107157-KV <124107157@umail.ucc.ie>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why is this PR needed?
The store-buffer hazard check currently treats all pending store-buffer
entries at the existing 8-byte address granularity using address bits
[11:3].
This is sufficient for ordinary stores, but it is too fine-grained for
CBO.INVAL, CBO.CLEAN, and CBO.FLUSH. These operations affect an entire
cache block.
As a result, when a CBO is pending for one address, a younger load to a
different 8-byte word within the same cache block can fail the existing
[11:3] comparison and issue before the CBO has completed.
For example, with a 16-byte cache block:
The addresses differ in bit 3, so the previous [11:3] comparison does
not detect a hazard even though both accesses belong to the same cache
block.
This is the behavior reported in #3432.
What does this PR change?
Add a CBO-aware store-buffer address-matching helper.
For ordinary stores, the existing behavior is preserved:
For cache-block operations, the comparison instead uses the configured
D-cache block granularity:
The CBO-aware comparison is applied consistently to all three places
examined by the store-buffer hazard logic:
This keeps ordinary-store behavior unchanged while ensuring that a
younger load to any word in the same cache block stalls while
CBO.INVAL, CBO.CLEAN, or CBO.FLUSH is pending.
Regression test
Add
store_buffer_cbo_hazard_test.svtogether with a unit-testMakefile target.
The regression checks ordinary stores as well as CBO.INVAL,
CBO.CLEAN, and CBO.FLUSH.
For each operation it checks the relevant store-buffer locations:
The address cases include:
The ordinary-store cases also verify that the existing 8-byte hazard
granularity is preserved and is not unnecessarily widened to the whole
cache block.
Verification
The CBO-enabled CVA6 target successfully elaborates with the change:
The focused regression passes with the fix:
Result:
The same regression was also run against the original upstream
store_buffer.sv. It fails on the reported case:Restoring the patched RTL makes the regression pass again.
The final changes also pass:
Limitations
The focused unit test uses the CBO-enabled
cv64a6_imafdc_sv39_hpdcache_wbconfiguration, which has a 16-byteD-cache block.
The RTL change itself does not hard-code that block size. It uses
CVA6Cfg.DCACHE_OFFSET_WIDTH, so the hazard comparison follows theconfigured D-cache block granularity.
Fixes #3432