-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add adaptive replacement cache #118
Conversation
Check the build system of linux-list for building test programs. |
Does the test programs here means new test case for testing cache? |
Exactly. These test programs should be built and verified before we integrate ARC into rv32emu core. |
810c16d
to
18bfefa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- All test cases should be built from top-level Makefile.
- Test specific file should be placed in tests directory, and there are no file names in upper case.
- Show report of test cases and integrate into GitHub Actions.
ea22aad
to
f835ab1
Compare
mk/tests.mk
Outdated
$(VECHO) " CC\t$@\n" | ||
$(Q)$(CC) $^ -o $(CACHE_BUILD_DIR)/$(TARGET) | ||
|
||
$(CACHE_BUILD_DIR)/cache.o: src/cache.c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can unify the rules by the following:
$(CACHE_BUILD_DIR)/%.o: $(CACHE_TEST_DIR)/%.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The directory of cache.c
is src
, but the directory of test_cache.c
is tests/cache
. So I cannot nuify the rules to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you don't have to build $(CACHE_BUILD_DIR)/cache.o
. Instead, only $(CACHE_BUILD_DIR)/test_cache.o
should be built here. The test oriented rules always depend on the generation of $(OBJS)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, cache.o
would be built by make all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, the GitHub Action fails now, because we don't integrate the cache and it does not build cache.o
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The appropriate sequence would be
make
make tests
Alternatively, you can extend item check
to perform make tests
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, the next tests would be associated with #94 .
8e1e19f
to
14f79c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the consistency, file name would use dash (-
) rather than underscores (_
). One exception is to emphasize the items you want to validate. e.g., test-cache_t
. In this pull request, we can safely enforce the replacement for all underscores.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolve CI pipeline failure.
Current basic block management consumes a significant amount of memory, which leads to unnecessary waste due to frequent map allocation and release. Adaptive Replacement Cache (ARC) is a page replacement algorithm with better performance than least recently used (LRU). After the translated blocks are handled by ARC, better memory usage and hit rates can be achieved by keeping track of frequently used and recently used pages, as well as a recent eviction history for both. According to the cache information obtained while running CoreMark, the cache hit rate of ARC can reach over 99%.
Current basic block management consumes a significant amount of memory, which leads to unnecessary waste due to frequent map allocation and release. Adaptive Replacement Cache (ARC) is a page replacement algorithm with better performance than least recently used (LRU). After the translated blocks are handled by ARC, better memory usage and hit rates can be achieved by keeping track of frequently used and recently used pages, as well as a recent eviction history for both.
According to the cache information obtained while running CoreMark, the cache hit rate of ARC can reach over 99%.
see #105