Optimizing vLLM Inference on AMD GPUs with ROCm and AITER

Optimizing vLLM Inference on AMD GPUs with ROCm and AITER

Introduction

Large Language Model (LLM) inference requires efficient GPU utilization, memory management, and high-performance communication between worker processes. When running vLLM on AMD GPUs, the ROCm software stack provides the foundation for GPU acceleration, while technologies such as AITER can further optimize critical GPU kernels.

In this article, we’ll explore some important configuration options for running and optimizing vLLM workloads on AMD GPUs.

1. Why --ipc=host Matters

When running vLLM inside Docker, the following option is commonly used:

--ipc=host

This allows containers to use the host’s IPC namespace and shared memory.

PyTorch-based workloads can use shared memory for communication between multiple worker processes, particularly when tensors and intermediate data need to be exchanged efficiently.

Example:

docker run --ipc=host ...

For LLM inference workloads, sufficient shared memory can help avoid IPC-related bottlenecks and errors.

2. Accessing the AMD GPU with /dev/kfd

For ROCm-based containers, GPU-related device access commonly includes:

--device=/dev/kfd

/dev/kfd provides access to the AMD Kernel Fusion Driver (KFD), which is used for GPU compute workloads.

A typical ROCm container configuration may also expose the DRM devices:

--device=/dev/kfd
--device=/dev/dri

This allows applications inside the container to communicate with the AMD GPU through the ROCm stack.

3. Tensor Parallelism in vLLM

vLLM supports distributing a model across multiple GPUs using:

--tensor-parallel-size

For example:

--tensor-parallel-size 2

This tells vLLM to use two GPUs for tensor parallel execution.

This is particularly useful when a model cannot efficiently fit into the memory of a single GPU or when additional GPU parallelism is required.

4. HIP Graphs

AMD ROCm provides HIP, which is AMD’s GPU programming environment.

vLLM can use HIP Graphs to capture GPU operations and replay them efficiently. Instead of repeatedly launching the same sequence of GPU operations from the CPU, captured operations can be replayed with lower launch overhead.

This can improve inference performance for workloads with compatible execution patterns.

However, graph capture has constraints. Parameters such as:

max_seq_len_to_capture

define the sequence-length range for which graph capture is used.

For workloads outside the captured range, vLLM can fall back to eager execution rather than using the captured graph.

5. AITER on AMD GPUs

AITER is an AMD-focused optimization project providing high-performance kernels for AI workloads.

vLLM can enable AITER-related optimizations using environment variables such as:

export VLLM_ROCM_USE_AITER=1

This allows vLLM to take advantage of optimized AITER kernels where supported.

A particularly important area is attention computation.

For example:

export VLLM_ROCM_USE_AITER_MHA=1

Here, MHA means Multi-Head Attention.

Attention is one of the most computationally important components of Transformer-based LLMs, so optimized attention kernels can have a significant impact on inference performance.

6. GLOO and NCCL

Distributed LLM inference requires efficient communication between processes and GPUs.

Two important communication libraries are:

GLOO

GLOO provides distributed communication primitives that can be used for process coordination and collective communication.

NCCL

NCCL is designed specifically for efficient GPU communication and collective operations.

In multi-GPU vLLM deployments, communication performance can become an important part of overall inference performance.

7. A Practical AMD ROCm Configuration

A simplified example could look like:

docker run --rm \
  --ipc=host \
  --device=/dev/kfd \
  --device=/dev/dri \
  -e VLLM_ROCM_USE_AITER=1 \
  -e VLLM_ROCM_USE_AITER_MHA=1 \
  <vllm-rocm-image>

For multi-GPU inference:

--tensor-parallel-size 2

can be added to the vLLM server configuration.

The exact configuration should be validated against the specific AMD GPU, ROCm version, vLLM version, model architecture, and supported AITER kernels.

8. Performance Optimization Checklist

When optimizing vLLM on AMD GPUs, consider:

  • :white_check_mark: ROCm version compatibility

  • :white_check_mark: vLLM version compatibility

  • :white_check_mark: AMD GPU architecture

  • :white_check_mark: /dev/kfd and /dev/dri access

  • :white_check_mark: Container shared memory with --ipc=host

  • :white_check_mark: Tensor parallelism configuration

  • :white_check_mark: HIP Graph compatibility

  • :white_check_mark: AITER optimizations

  • :white_check_mark: Multi-Head Attention kernels

  • :white_check_mark: GLOO/NCCL communication configuration

  • :white_check_mark: GPU memory utilization

  • :white_check_mark: Sequence length and batch-size characteristics

9. Key Takeaway

Optimizing LLM inference on AMD GPUs isn’t simply about adding more GPUs. The complete stack matters:

AMD GPU → ROCm → HIP → vLLM → AITER → Optimized Kernels → Distributed Communication

Understanding how these components interact makes it easier to diagnose performance bottlenecks and build efficient production-grade LLM inference systems.

The combination of vLLM, ROCm, and AITER provides an interesting foundation for running high-performance open-source LLM inference on AMD GPU infrastructure.

Discussion

What optimizations have you tested with vLLM + AMD ROCm?

Have you seen measurable improvements from AITER or HIP Graphs on your workloads? Share your GPU model, ROCm version, vLLM version, and benchmark results with the community.

Artificial Intelligence (AI) AI Development > Performance Tuning rocm vllm

2 Likes