[ROCm][AMD][Installation] add LMCache kv-connector installation and runtime packages to docker image - #51208
Conversation
82cd88a to
df2315f
Compare
|
cc @vllmellm Can you help me to verify on your end? |
2d8260d to
69d439f
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
jamesETsmith
left a comment
There was a problem hiding this comment.
Would it also be worth adding a comment about the PYTHONHASHSEED=0 here? I'm not an lmcache expert, but for people running with TP>1 they might have poor performance out of the box here. I'm going of this blog about that env variable. I'm trying to test it locally now
| @@ -5,6 +5,10 @@ ARG VLLM_BRANCH="main" | |||
| ARG COMMON_WORKDIR=/app | |||
| ARG BASE_IMAGE=rocm/vllm-dev:base | |||
| ARG CI_BASE_IMAGE=rocm/vllm-dev:ci_base | |||
| # Umbrella for all KV connectors; each also has its own arg for opting into a | |||
| # subset. Booleans, not a list, because stages select via FROM <stage>_${ARG}. | |||
| ARG INSTALL_KV_CONNECTORS=false | |||
There was a problem hiding this comment.
Should we set this to true here or update the buildkite release pipelines here to set it to true?
There was a problem hiding this comment.
yes, added to the release pipeline now
…cker image Signed-off-by: Hongxia Yang <hongxia.yang@amd.com>
Signed-off-by: Hongxia Yang <hongxia.yang@amd.com>
Signed-off-by: Hongxia Yang <hongxia.yang@amd.com>
Signed-off-by: Hongxia Yang <hongxia.yang@amd.com>
69d439f to
c297403
Compare
Mirror the CUDA path (docker/Dockerfile:1008): try the published v0.5.3-rocm wheel first, fall back to a source build when the effective arch set is wider than it covers (it has no gfx90a). Also strip consumer archs, matching what vLLM does for its own wheel in Dockerfile.rocm_base:244 — LMCache was building for 9 archs where vLLM builds for 3. Signed-off-by: Hongxia Yang <hongxia.yang@amd.com>
COPY only the digest and bind-mount the wheel: the previous COPY committed a 7.8MB blob that rm -rf could only whiteout. Move the install ahead of the vLLM wheel so vLLM changes don't invalidate it, and assert the built wheel carries every requested gfx target instead of just some .so. Signed-off-by: Hongxia Yang <hongxia.yang@amd.com>
Intersect the inherited arch set with the archs LMCache publishes ROCm wheels for, logging anything dropped, and fail if nothing supported remains. The release base yields gfx942;gfx950, which the published wheel covers, so the release build downloads it instead of compiling. gfx90a is dropped: vLLM builds for it but LMCache has no wheel, so the released image will not carry LMCache for MI200. Override with LMCACHE_ROCM_ARCH="gfx90a;gfx942;gfx950" to build it from source. Arch lists use PYTORCH_ROCM_ARCH-style ';' separators, normalised so space and ',' forms also work. Signed-off-by: Hongxia Yang <hongxia.yang@amd.com>
|
Documentation preview: https://vllm--51208.org.readthedocs.build/en/51208/ |
172dcc4 to
4687481
Compare
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
|
/ci run |
|
✅ Triggered Buildkite CI #83990 for commit |
|
A note, I used to do -no-deps so it keeps our vllm's numpy 2.3.5 (non-pined). The way the build work now after @AndreasKaratzas 's latest two commits is to installed LMCache numpy pined version, which is 2.2.6. So basically, the numpy consumers may see the difference. Thoughts @AndreasKaratzas ? |
|
Yeah, I can restore that part. Indeed numpy is too central. Give me a sec and will be following up |
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
|
Hi @hongxiayang, the pre-commit checks have failed. Please run: uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, |
|
/ci run |
|
✅ Triggered Buildkite CI #84254 for commit |
…runtime packages to docker image (vllm-project#51208) Signed-off-by: Hongxia Yang <hongxia.yang@amd.com> Signed-off-by: Andreas Karatzas <akaratza@amd.com> Co-authored-by: Andreas Karatzas <akaratza@amd.com> Signed-off-by: Zhu, Zufang <zufang.zhu@intel.com>
Purpose
Ship the LMCache KV connector in the ROCm image so it works out of the box.
Note:
vLLM's CUDA
docker/Dockerfileinstalls LMCache whenINSTALL_KV_CONNECTORS=true,and the release pipeline sets that for every published
vllm/vllm-openaitag.docker/Dockerfile.rocm never referenced that arg, so vllm/vllm-openai-rocm ships without LMCache and users must build and install it themselves. This adds it so the ROCm release pipeline can enable it the same way.
What this does
Adds a
build_lmcachestage that obtains the wheel one of two ways, mirroringthe CUDA path (
docker/Dockerfiletries a prebuilt wheel first and falls backto a source build):
(
v0.5.3-rocm), which PyPI does not carry. When the effective arch set iscovered by that wheel it is downloaded — no clone, no compile. This is what
the release build does.
--no-indexis deliberate: with a plain--extra-index-url, pip silentlyfalls back to the CUDA wheel on PyPI.
(
BUILD_WITH_HIP=1,CXX=hipcc,TORCH_DONT_CHECK_COMPILER_ABI=1), socoverage is never silently narrowed.
PyPI remains CUDA-only and ships no sdist for
>=0.4, so--no-binarycannotforce a HIP build — hence a source path is still required.
Architecture selection. The image's
PYTORCH_ROCM_ARCHis inherited, minusthe consumer archs vLLM itself strips for its own wheel
(
Dockerfile.rocm_base), then intersected with the archs LMCache publishesROCm wheels for. Anything dropped is named in the build log, and a set with no
supported arch fails the build rather than shipping an unusable connector.
On the release base this resolves to
gfx942;gfx950— MI300X/MI325X andMI350X/MI355X.
gfx90a(MI200) is not covered. vLLM builds for it, LMCache publishes noROCm wheel for it. Rather than ship non-runnable device code, it is skipped
and logged. To build it from source instead:
--build-arg LMCACHE_ROCM_ARCH="gfx90a;gfx942;gfx950".The wheel is bind-mounted for install while its
sha256digest isCOPYd, soa changed
LMCACHE_REFor arch set invalidates the install layer instead ofreusing a stale wheel — without committing the 7.8 MB wheel blob to a layer.
The install is placed before the vLLM wheel install, so vLLM source changes
do not invalidate this otherwise stable connector layer.
The build asserts the wheel actually carries code objects for every requested
arch, rather than only that some
.soexists.The source build opts into the sccache HIP wrappers when
USE_SCCACHE=1(thecontract documented in
Dockerfile.rocm_base) and shares the ccache mount.Installs the wheel with
--no-depsplus four runtime packages.sortedcontainers— hard requirement; without itimport lmcache.integration.vllm.lmcache_mp_connectorfails outright.opentelemetry-exporter-prometheus—lmcache servercallsinit_observability()unconditionally, which importsPrometheusMetricReader(
mp_observability/otel_init.py:96). Omitting it builds fine but the serverdies at startup.
cupy-rocm-7-0— GPU cache-registration path.aiofile— local-disk storage tier.--no-depsis required, not a convenience. The published ROCm wheel declaresnumpy<=2.2.6,opentelemetry-api<=1.40.0andopentelemetry-exporter-prometheus<=0.61b0. The numpy ceiling isunsatisfiable — vLLM requires 2.3.5 — so resolving it would downgrade vLLM's
own dependency. The two OpenTelemetry ceilings are upper bounds rather than
known breakages; the image runs 1.44.0/0.65b0 and
lmcache serverstarts andserves through
init_observability()on those versions (see Test Result 2).Worth raising upstream so the declared ranges match what is tested.
Gates everything behind
INSTALL_LMCACHE, defaulting to off.Build-arg selection
INSTALL_LMCACHEis an independent boolean rather than being derived from anumbrella arg, so it is not an input to the cache key of unrelated stages. The
release pipeline sets it explicitly.
INSTALL_LMCACHE=trueA boolean rather than a list because the build stage is selected via
FROM <stage>_${ARG}, which needs the value in the stage name. With a list thestage would run on every build and be discarded.
Arch lists (
LMCACHE_ROCM_ARCH,LMCACHE_SUPPORTED_ARCHS,LMCACHE_PREBUILT_ARCHS) usePYTORCH_ROCM_ARCH-style;separators; space and,forms are normalised so a mismatched separator cannot silently drop archs.Test Plan
Test Result
Built and verified on 8x MI355X (gfx950), ROCm 7.2.3, torch 2.11.
(1) Arch selection and both wheel paths.
The release default inherits the base's nine architectures and resolves them
down, taking the published wheel:
An explicit wider set falls back to a source build:
lmcache-0.5.3-cp312-cp312-manylinux_2_35_x86_64.whl...-linux_x86_64.whlc_opsgfx942,gfx950gfx90a,gfx942,gfx950DT_NEEDEDlibamdhip64— no CUDA libs...whl: OK...whl: OKThe arch assertion was negative-tested: forcing the published wheel to be
selected for a
gfx90abuild fails the build withwheel has no code objects for: gfx90a(exit 1, nothing exported).All three separator forms (
;,,, space) resolve identically.(2) LMCache server starts out of the box, nothing installed at runtime:
Startup log shows shm capacity checked against the L1 request, L1 + L2 eviction
controllers started, SessionManager cleanup thread, DeviceHostFuncDispatcher,
mp-worker-reaper, and an 8-slot affinity pool matching
--max-workers 8.This exercises
init_observability()on opentelemetry 1.44.0 / exporter 0.65b0.(3) No dependency downgrades — the reason for
--no-deps:Added:
lmcache 0.5.3,sortedcontainers 2.4.0,aiofile 3.12.3,cupy-rocm-7-0 14.1.1,opentelemetry-exporter-prometheus 0.65b0.Unchanged after moving the install ahead of the vLLM wheel.
(4) Connectors register:
['LMCacheConnectorV1', 'LMCacheMPConnector'].(5) Layer and cache behaviour.
docker historyshows the LMCacheinstall layer at 118 B (the digest) rather than 7.82 MB.
rebuild unchanged (layers cached), then change the wheel content — the install
layer re-runs and picks up the new wheel.
INSTALL_LMCACHE=falsethe stage is pruned entirely(
--target export_lmcacheproduces empty output — no clone, no download,no compile).
(6) Image size: 42.00 → 42.92 GB, +921 MB (+2.19%) — ~366 MB of that is CuPy,
required by the GPU cache-registration path; the compiled extension is <8 MB.
AI-assisted.
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.