DeepSeek V4 Flash on a Single AMD MI300X
Deploying DeepSeek V4 Flash on a Single AMD MI300X
This repository provides the specialized configuration, patches, and tuning parameters required to deploy deepseek-ai/DeepSeek-V4-Flash-0731 on a single AMD MI300X GPU for production environments.
The setup utilizes a Docker Compose stack, SHA-256 pinned file overlays, reference diffs against the upstream source, and optimized tuning tables. Notably, the checkpoint is executed exactly as shipped, meaning no additional weight quantization and no weight offloading are required.
🚀 Performance Benchmarks
The following results were obtained using the pinned stack (AITER 0.1.19 and vLLM ROCm nightly 0.26.1rc1.dev229+g124154a88.rocm723):
| Metric | Result |
|---|---|
| Single-stream decode (median per-stream, DSpark-7) | |
| Prefill (Tuned Kernels) | |
| Prefill (Fresh prompts, shipping profile) | |
| 8 Concurrent Streams | aggregate ( median) |
| 64-Stream Burst | aggregate (No OOM or engine errors) |
| Validated Context | (Architecture supports up to ) |
| HBM Weight Footprint |
🛠️ Technical Rationale: Why the MI300X?
The AMD MI300X is uniquely suited for this 304B-parameter model due to its massive memory specifications:
- HBM3 Capacity: (approximately the capacity of an H100 SXM5).
- Memory Bandwidth: .
According to Doubleword, the MI300X's list price is roughly half that of competing high-end NVIDIA hardware, making it a highly cost-effective choice for large-scale deployments.
Because the model weights occupy , the MI300X allows for a simplified single-GPU deployment. There is no need for PCIe weight streaming or layer offloading. This leaves ample room for:
- A 20 GB GPU KV pool.
- A 96 GiB CPU tier for managing evicted prefix-cache entries.
The FP8 Challenge
A critical nuance of the MI300X (CDNA3) is its implementation of the fnuz variant of E4M3 (AMD/Graphcore). In contrast, the MI325X and newer models utilize the OCP-standard FP8.
Warning: If a kernel assumes OCP semantics on an MI300X, the scale domain can be incorrect by a factor of two. Consequently, ensuring FP8 correctness was the primary objective before performance tuning began.
🔍 Enhancements & Prior Art
While previous work by Fergus Finn and Doubleword identified issues like missing AITER fast paths on gfx942, HIP-graph hazards in sparse MLA decode, and MoE routing bugs, the official vLLM recipe only targets NVIDIA and newer AMD GPUs (like the MI325X/MI355X).
This repository fills the gap for single-MI300X production by adding:
- Correctness Overlays: Patches for the pinned ROCm nightly that are not yet upstreamed in vLLM.
- Serving Configuration: A validated setup featuring:
- Probabilistic DSpark drafting.
- Block rejection and a static .
- A -token scheduler budget and -token long-prefill cap to prevent "cold prompt" stalls.
- AITER Tuning: GEMM tuning tables for
gfx942shapes and an OGS geometry override for MXFP4 experts. - Hybrid KV Strategy: A combination of
fp8_ds_mlaGPU cache and native CPU offload, including a fix for the load-path fencing issue (documented in issue #47282).
📂 Repository Structure
compose.yaml: The digest-pinned production stack (vLLM ROCm + Caddy).Caddyfile.example: Template for the HTTPS proxy (requires hostname/email/CIDR).vllm-entrypoint.sh: Script to clear stale CPU-KV mmaps from/dev/shm.SHA256SUMS: Integrity pins for all runtime artifacts.patches/: Production overlays and unified diffs against the base revision.tuning/: AITER A8W8 blockscale tuning tables forgfx942.
⚙️ Runtime Configuration
The stack utilizes a pinned vLLM ROCm nightly with the following settings:
- Model Logic:
--trust-remote-codeenabled; uses DeepSeek V4 tokenizer and reasoning parsers. - KV Cache:
fp8_ds_mla(UE8M0 block-scaled FP8) with -token blocks. - Backend:
VLLM_ROCM_USE_AITER=1and--moe-backend triton.- Triton OGS Grouped MXFP4 experts.
- AITER Attention and dense linear layers.
- Decoding: DSpark-7 speculative decoding with probabilistic drafting.
- Optimization: Full/breakable CUDA graph capture for single-graph launch per token.
- Proxy: Caddy serves as an IP-allowlisted HTTPS gateway.
🚀 Deployment Guide
1. Host Requirements
- GPU: 1x AMD MI300X (
gfx942, 304 CUs, HBM). - Driver: Working AMD kernel driver.
- Software: Recent Docker Compose.
- RAM: (for the CPU KV tier).
- Disk: (Model cache is ).
2. Pulling the Runtime and Model
Run the following commands to fetch the pinned image and model weights:
VLLM_IMAGE='vllm/vllm-openai-rocm@sha256:e68d18b2ba50298661bfc49baf01158fbf036645c2362cccf3e8a7a79fe6c69a'
MODEL='deepseek-ai/DeepSeek-V4-Flash-0731'
REVISION='7872f01b1d1fe23eabc4c98b48bffcef5a386062'
docker pull "$VLLM_IMAGE"
docker run --rm --entrypoint hf \
-v /root/.cache/huggingface:/root/.cache/huggingface \
"$VLLM_IMAGE" download "$MODEL" --revision "$REVISION"
3. Final Preparation
# Setup the proxy configuration
cp Caddyfile.example Caddyfile
# Edit Caddyfile to set your hostname, email, and remote_ip CIDR
# Create necessary directories
mkdir -p aiter-cache crash-dumps ch