Skip to content

Fix LoRA prefix cache corruption by using lora_int_id#31069

Open
westers wants to merge 4 commits intovllm-project:mainfrom
westers:fix-lora-cache-corruption
Open

Fix LoRA prefix cache corruption by using lora_int_id#31069
westers wants to merge 4 commits intovllm-project:mainfrom
westers:fix-lora-cache-corruption

Conversation

@westers
Copy link
Contributor

@westers westers commented Dec 20, 2025

Summary

Fixes #30931 - LoRA prefix cache corruption

The KV cache hash was incorrectly using lora_name instead of lora_int_id for LoRA requests. This caused different LoRA configurations with the same name but different IDs to incorrectly share cache blocks, leading to wrong outputs.

Changes

  • Changed _gen_lora_extra_hash_keys() in vllm/v1/core/kv_cache_utils.py to use lora_int_id instead of lora_name
  • Updated docstring to reflect the change

Rationale

The LoRARequest class documentation states that "lora_int_id must be globally unique for a given adapter", making it the correct identifier for cache differentiation.

Testing

  • All existing LoRA tests will run in CI
  • This fix ensures different LoRA configs don't share cache even if they have the same name

🤖 Generated with Claude Code

westers and others added 4 commits December 19, 2025 22:21
Fixes issue vllm-project#28052 where AMD Radeon 780M (gfx1103) users encounter
'HIP error: invalid device function' when using official Docker images.

The Docker image was built without gfx1103 in PYTORCH_ROCM_ARCH,
causing PyTorch to lack compiled kernels for this architecture.

This fix adds gfx1103 to the default GPU targets, enabling support for:
- AMD Radeon 780M (gfx1103)
- Other RDNA 3 integrated graphics with gfx1103

Tested on: AMD Radeon 780M successfully reproduces and identifies root cause

Signed-off-by: Steve Westerhouse <westers@gmail.com>
Addresses code review feedback. Without this, the build would fail
because gfx1103 is not recognized as a GFX11 architecture, causing
compilation to fall into an assert(false) code path.

Signed-off-by: Steve Westerhouse <westers@gmail.com>
All pre-commit hooks pass. clang-format applied to C++ files.

Signed-off-by: Steve Westers <westers@gmail.com>
Signed-off-by: westers <steve.westerhouse@origami-analytics.com>
Fixes vllm-project#30931

The KV cache hash was incorrectly using lora_name instead of
lora_int_id for LoRA requests. This caused different LoRA
configurations with the same name but different IDs to
incorrectly share cache blocks, leading to wrong outputs.

Changed _gen_lora_extra_hash_keys() to use lora_int_id instead
of lora_name, since lora_int_id is documented as "must be
globally unique for a given adapter".

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: westers <steve.westerhouse@origami-analytics.com>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly fixes a bug in the LoRA prefix cache by using lora_int_id instead of lora_name for generating the KV cache hash. This change prevents cache corruption when different LoRA configurations share the same name. The implementation is sound and aligns with the documented purpose of lora_int_id as a unique identifier. Additionally, the pull request includes updates to support the gfx1103 ROCm architecture, which are consistent across the CUDA source and the Docker build configuration. The changes are well-justified and improve both correctness and hardware support.

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

Labels

ci/build rocm Related to AMD ROCm v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Prefix Cache Corruption with LoRA with the same name but different id

1 participant