Dockerfile 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # syntax=docker/dockerfile:1.7
  2. # dsv41-flash-b12x + Aiden's DCP2 stack (production-1.1 overlay, extracted
  3. # 2026-09-12): a thin FROM wrapper that replaces 23 vLLM files in
  4. # site-packages with their final (baked) versions — the DCP2 (decode
  5. # context parallelism) port of Aiden's aidendle94 image onto our
  6. # clone-at-pin tree.
  7. #
  8. # The file set (dcp2-files/, vllm-package-relative paths; provenance +
  9. # per-file triage in top-level dcp2/README.md) is a strict superset of our
  10. # current files: it carries the DCP2 machinery (sharded KV + per-rank
  11. # attention, dcp_replicated spec flags, a2a all-to-all combine, DCP-aware
  12. # dflash speculator, engram mmap/prefetch) AND independently converged
  13. # copies of our own fixes (SM12x top-k guard, get_swa_block_size,
  14. # get_compressed_block_size, DSV41_ENGRAM_DISK, the kai pread thread pool).
  15. # Verified 2026-09-12 by diffing every file (our baked image vs theirs).
  16. #
  17. # Runtime (recipe dsv41-flash-4x-dcp2):
  18. # --decode-context-parallel-size 2 (4 TP ranks = 2 DCP groups of 2)
  19. # --dcp-comm-backend a2a (the new all-to-all + LSE path)
  20. # DCP2 env (DSV41_DCP_*/DSV41_ENGRAM_MMAP/PREFETCH) stay at the image
  21. # defaults (all OFF) — the sharding is driven by the CLI flags.
  22. #
  23. # A/B verdict the variant exists to test (see dcp2/README.md): on Aiden's
  24. # own stack DCP2 bought 2.5M-token KV @300K (vs our 167/176 baseline) but
  25. # lost 9 points of quality and single-stream speed. This variant checks the
  26. # same trade on our fresher tree + b12x.
  27. ARG BASE_IMAGE
  28. FROM ${BASE_IMAGE}
  29. # The 23 final files, package-relative (distributed/… v1/… models/…
  30. # model_executor/…). One COPY layer; no pip, no compile.
  31. COPY dcp2-files/ /usr/local/lib/python3.12/dist-packages/vllm/
  32. # Fail the build (not the first serve) on a syntax or import regression.
  33. RUN set -eux; \
  34. python3 -m compileall -q \
  35. /usr/local/lib/python3.12/dist-packages/vllm/v1/attention/backends/mla/sparse_swa.py \
  36. /usr/local/lib/python3.12/dist-packages/vllm/models/deepseek_v4_1/attention.py \
  37. /usr/local/lib/python3.12/dist-packages/vllm/models/deepseek_v4_1/common/engram.py \
  38. /usr/local/lib/python3.12/dist-packages/vllm/models/deepseek_v4_1/nvidia/flashinfer_sparse.py \
  39. /usr/local/lib/python3.12/dist-packages/vllm/v1/worker/gpu/model_runner.py; \
  40. python3 - <<'PY'
  41. # Symbol checks: the DCP2 machinery must be importable, and our own fixes
  42. # (present in the superset) must still be there.
  43. import importlib
  44. mods = {
  45. "vllm.v1.kv_cache_interface": ["is_dcp_replicated_spec", "is_dcp_sharded_spec"],
  46. "vllm.v1.core.kv_cache_utils": ["dcp_world_size_for_kv_cache_spec"],
  47. "vllm.v1.attention.backends.utils": ["get_dcp_local_seq_lens"],
  48. "vllm.distributed": ["get_dcp_group"],
  49. "vllm.models.deepseek_v4_1.common.engram": ["Engram", "EngramDiskStager", "NgramHashState", "_kai_pool", "DiskEngramTable"],
  50. }
  51. for name, syms in mods.items():
  52. mod = importlib.import_module(name)
  53. for s in syms:
  54. assert hasattr(mod, s), f"{name} missing {s}"
  55. print("DCP2 file set OK: all symbols present")
  56. PY