[MP][UX][L2] Support configuring L2 store/prefetch policy via command line#2773
[MP][UX][L2] Support configuring L2 store/prefetch policy via command line#2773ApostaC merged 3 commits intoLMCache:devfrom
Conversation
Signed-off-by: ApostaC <yihua98@uchicago.edu>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the flexibility and extensibility of L2 cache management by introducing a configurable policy system. Instead of relying on hardcoded default behaviors, users can now specify L2 store and prefetch policies via command-line arguments. The core change involves setting up a robust, name-based registry with automatic module discovery, which simplifies the process of adding new policy implementations in the future. This change empowers developers to easily experiment with and deploy custom L2 caching strategies, improving overall system adaptability. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a well-designed and flexible mechanism for configuring L2 store and prefetch policies via command-line flags. The use of a registry pattern with auto-discovery is an excellent choice for extensibility. The code is clean, and the documentation updates are thorough for both users and developers. I've identified one high-severity issue where the policy auto-discovery may not run in time for command-line argument parsing, which would prevent custom policies from being used. A code suggestion is provided to resolve this. The rest of the implementation is solid.
Signed-off-by: ApostaC <yihua98@uchicago.edu>
maobaolong
left a comment
There was a problem hiding this comment.
Thanks for this refactor and make l2 store/prefetch policy configurable. It LGTM.
|
@ApostaC The failed ut seems related to this pr E ImportError: cannot import name 'EvictionConfig' from partially initialized module 'lmcache.v1.distributed.config' (most likely due to a circular import) (/var/lib/buildkite-agent/builds/lmcache-unit-test-build-1/lmcache/unit-tests/lmcache/v1/distributed/config.py) |
Signed-off-by: ApostaC <yihua98@uchicago.edu>
… line (LMCache#2773) Signed-off-by: Aaron Wu <aaron.wu@dell.com>
What this PR does / why we need it:
Adds
--l2-store-policyand--l2-prefetch-policyCLI flags so users can select L2 store and prefetch policies by name. This prepares for upcoming new policy implementations — adding a new policy only requires creating a single file instorage_controllers/with aregister_store_policy()orregister_prefetch_policy()call; auto-discovery handles the rest.Changes:
store_policy.pyandprefetch_policy.py(register_*_policy,create_*_policy)pkgutil.iter_modules()auto-discovery tostorage_controllers/__init__.pystore_policy/prefetch_policyfields toStorageManagerConfigand corresponding CLI argsDefaultStorePolicy()/DefaultPrefetchPolicy()inStorageManagerwith registry-based creationSpecial notes for your reviewers:
Default behavior is unchanged — both flags default to
"default", matching the existingDefaultStorePolicyandDefaultPrefetchPolicy.If applicable: