Skip to content

Commit

Permalink
Allocate blocks from id=1 for HPU (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdamaszk authored Aug 6, 2024
1 parent 14c20a3 commit b43c7f9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vllm/core/block/cpu_gpu_block_allocator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
DeviceAwareBlockAllocator)
from vllm.core.block.naive_block import NaiveBlock, NaiveBlockAllocator
from vllm.core.block.prefix_caching_block import PrefixCachingBlockAllocator
from vllm.utils import Device
from vllm.utils import Device, is_hpu


class CpuGpuBlockAllocator(DeviceAwareBlockAllocator):
Expand Down Expand Up @@ -52,7 +52,9 @@ def create(
- The block IDs are assigned contiguously, with GPU block IDs coming
before CPU block IDs.
"""
block_ids = list(range(num_gpu_blocks + num_cpu_blocks))
# For HPU block ids cannot be equal to 0
start_id = 1 if is_hpu() else 0
block_ids = list(range(start_id, num_gpu_blocks + num_cpu_blocks))
gpu_block_ids = block_ids[:num_gpu_blocks]
cpu_block_ids = block_ids[num_gpu_blocks:]

Expand Down

0 comments on commit b43c7f9

Please sign in to comment.