Skip to content

Conversation

@tomlintbl
Copy link
Contributor

Summary:

  • We need an elegant way to dynamically swap registration of KV implementation.
  • A solution is to abstract the current KV wrappers and make them inherit the same interface.
  • The original DramKVWrapper is the bridge of Python and C++ code. By delegating the actual functionality through a impl_ member, which has the type of the aforementioned interface, we can keep the registration as is but swap out detailed impl_ at runtime.

V2:

  • Move set_dram_kv and get_dram_kv into IKVEmbeddingInference
  • Add lazy-initialization in DramImpl::init
  • Add TORCH_CHECK to throw when impl is not set before accessing
  • Rename IKVEmbeddingInference to KVEmbeddingInferenceInterface

Differential Revision: D85162982

@netlify
Copy link

netlify bot commented Oct 27, 2025

Deploy Preview for pytorch-fbgemm-docs ready!

Name Link
🔨 Latest commit 467870b
🔍 Latest deploy log https://app.netlify.com/projects/pytorch-fbgemm-docs/deploys/68ffae100ef729000837c2f7
😎 Deploy Preview https://deploy-preview-5057--pytorch-fbgemm-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@meta-cla meta-cla bot added the cla signed label Oct 27, 2025
@meta-codesync
Copy link
Contributor

meta-codesync bot commented Oct 27, 2025

@tomlintbl has exported this pull request. If you are a Meta employee, you can view the originating Diff in D85162982.

Summary:

- We need an elegant way to dynamically swap registration of KV implementation.
- A solution is to abstract the current KV wrappers and make them inherit the same interface.
- The original DramKVWrapper is the bridge of Python and C++ code. By delegating the actual functionality through a impl_ member, which has the type of the aforementioned interface, we can keep the registration as is but swap out detailed impl_ at runtime.

V2:
- Move set_dram_kv and get_dram_kv into IKVEmbeddingInference
- Add lazy-initialization in DramImpl::init
- Add TORCH_CHECK to throw when impl is not set before accessing
- Rename IKVEmbeddingInference to KVEmbeddingInferenceInterface

Differential Revision: D85162982
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant