lmcache-device-example is a minimal out-of-tree LMCache device backend
distributed as a Python wheel.
It exists to verify that LMCache can discover a third-party DeviceSpec
through the lmcache.v1.device_specs entry-point group after the wheel is
installed into the same environment as LMCache.
- registers
device_type="example_cpu"from outside the LMCache repository - reuses LMCache's CPU cache context, IPC wrapper, and baseline ops
- stays disabled by default
- becomes discoverable only when
LMCACHE_DEVICE_EXAMPLE_ENABLE=1
This makes it safe to install for packaging tests without changing normal LMCache behavior on hosts that do not opt in to the example backend.
This example intentionally binds to torch.cpu so it can run on any machine.
That is enough to validate:
- wheel packaging
- entry-point discovery
- LMCache backend registration
DEVICE_TYPE=example_cpuexplicit selection
It is not a real accelerator backend, so it should not be used as the
basis for a vLLM hardware e2e test. For a real device package, the next stage
would be to install the vendor wheel into a true <device> + LMCache + vLLM
environment and verify real tensors flow through that backend.
uv buildThe resulting wheel is written under dist/.
This is the recommended smoke test, because it matches the real deployment shape: install the wheel into a Python environment where LMCache already works.
uv build
scripts/validate_with_existing_env.sh \
/path/to/python \
/path/to/LMCacheThe script will:
- install the built wheel into the supplied interpreter
- switch into the supplied LMCache checkout
- set
LMCACHE_DEVICE_EXAMPLE_ENABLE=1andDEVICE_TYPE=example_cpu - run
lmcache-device-example-validate
Use an LMCache checkout that already contains third-party device entry-point discovery support.
scripts/build_and_validate_local.sh /path/to/LMCacheThe script will:
- build this wheel
- create a fresh Python 3.12 virtual environment
- install
torch - install LMCache from the supplied checkout with
NO_NATIVE_EXT=1 - install the built wheel
- run
lmcache-device-example-validate
This path is convenient for packaging checks, but it assumes the supplied LMCache install path can import all required native modules on that host.
This repository includes a GitHub Actions workflow that:
- builds the wheel
- clones a target LMCache repository and ref
- installs LMCache into a fresh Python 3.12 environment
- installs this wheel
- runs
lmcache-device-example-validate
The workflow currently defaults to validating against:
- repository:
https://github.com/maobaolong/LMCache.git - ref:
mbl/device-spec-entrypoint-discovery
That default should be updated once entry-point discovery lands on a stable LMCache branch.
In a fresh temporary environment, the validation treats missing
lmcache.lmcache_native as a signal to skip the deeper DeviceOps
instantiation checks and keep the CI focused on wheel packaging,
entry-point discovery, and explicit device selection. The
validate_with_existing_env.sh path remains the stronger check when you
already have a working LMCache environment.
After installing LMCache and this wheel into the same environment:
export LMCACHE_DEVICE_EXAMPLE_ENABLE=1
export DEVICE_TYPE=example_cpu
lmcache-device-example-validateSuccessful validation confirms that LMCache discovered the out-of-tree backend
and bound the example DeviceSpec and DeviceOps.