Dockerfile 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # syntax=docker/dockerfile:1.7
  2. # DeepSeek-V4-Flash-DSpark on aidendle94 sparkrun-vllm-ds4-gb10:production-3.8,
  3. # with a root-cause patch for BUG-2026-08-03T204037.
  4. #
  5. # The REAL blocker (found by boot-testing on ds4) is NOT the DeepGEMM
  6. # `t.dim() == N` assertion from the original bug write-up. On this image the
  7. # DSV4 target + drafter load cleanly via the b12x MoE backend — DeepGEMM scale
  8. # packing never fires. Boot instead crashes during KV-cache profiling
  9. # (profile_run -> dummy forward, under torch.compile/AOT), inside
  10. # b12x/integration/residual_kernels.py `_to_kernel_tensor`:
  11. #
  12. # from_dlpack(tensor, ...) -> tensor.__dlpack__()
  13. # BufferError: Can't export tensors that require gradient, use tensor.detach()
  14. #
  15. # Under torch.compile the norm parameter carries requires_grad=True (inductor
  16. # keeps an autograd graph), and cutlass's from_dlpack refuses grad-requiring
  17. # tensors. Fix: detach the tensor before dlpack export — a no-op for the
  18. # requires_grad=False case, correct for the compiled case.
  19. FROM aidendle94/sparkrun-vllm-ds4-gb10:production-3.8
  20. # Patch 1: b12x cutlass from_dlpack rejects grad-requiring tensors under
  21. # torch.compile (BufferError during KV-cache profiling). detach() before export.
  22. RUN sed -i \
  23. 's/from_dlpack(tensor, assumed_align=assumed_align)/from_dlpack(tensor.detach(), assumed_align=assumed_align)/' \
  24. /opt/env/lib/python3.12/site-packages/b12x/integration/residual_kernels.py \
  25. && grep -n 'from_dlpack(tensor' /opt/env/lib/python3.12/site-packages/b12x/integration/residual_kernels.py
  26. # Patch 2: route the DSpark drafter's wo_a through the fused b12x WO
  27. # projection (same as the main model) so the drafter's numerics are correct and
  28. # DSpark draft acceptance is real (replaces the broken DeepGEMM fp8_einsum).
  29. COPY patches/patch_dspark_b12xwoa.py /tmp/patch_dspark_b12xwoa.py
  30. RUN /opt/env/bin/python3 /tmp/patch_dspark_b12xwoa.py
  31. # Patch 3: DSpark mixed-context batch — pad shorter requests to the batch-max
  32. # effective length so a parallel benchmark (tool-eval-bench --parallel 4) with
  33. # divergent request contexts doesn't kill the engine (see patch script).
  34. COPY patches/patch_dspark_uniform.py /tmp/patch_dspark_uniform.py
  35. RUN /opt/env/bin/python3 /tmp/patch_dspark_uniform.py