feat: add DeepSeek V4 long-context inference - #773
Conversation
205ac4e to
a601640
Compare
a601640 to
ae1f9e6
Compare
ae1f9e6 to
ed563b4
Compare
c/Makefile appears in most open PRs, and any two that each append a target name to the single shared .PHONY conflict on that line by construction -- which is exactly what happens between this branch and the DeepSeek V4 work (JustVugg#772/JustVugg#773), and between this and the other two lint branches. The TEST_RULES block above already documents this failure mode for TEST_BINS and fixes it by deriving the list instead of hand-maintaining one line. .PHONY had the same problem and not the same treatment. make accumulates multiple .PHONY declarations, so a new target now adds a line rather than editing a line everyone else is also editing.
c/Makefile appears in most open PRs, and any two that each append a target name to the single shared .PHONY conflict on that line by construction. That is exactly what happens between this branch, the env-registry branch, the sanitizer branch and the DeepSeek V4 work (JustVugg#772/JustVugg#773) -- four branches, one line, four conflicts that are pure bookkeeping. The TEST_RULES block above already documents this failure mode for TEST_BINS and fixes it by deriving the list rather than hand-maintaining a line. .PHONY had the same problem and never got the same treatment. make accumulates multiple .PHONY declarations, so adding a target now means adding a line instead of editing a line every other branch is also editing.
The section added here credits the research the expert-placement and routing
work draws on. It does not credit the code -- the containers, tokenizers,
codecs and compat layers this engine reimplements or links against, several
of which are named in the sources and nowhere else.
Every entry points at where it is used, because a credit nobody can check is
decoration:
safetensors c/st.h, 13 references, including its fp8 and I64 dtypes
tiktoken c/tok.h reimplements byte_pair_encode exactly
llama.cpp grammar.h:14 (GBNF subset + set-of-stacks PDA),
colibri.c:1956 (Metal newBufferWithBytesNoCopy residency)
vLLM colibri.c:5903 -- where the final norm lands vs the LM head
transformers tools/oracle-requirements.txt, the token-exact CI oracle
DietGPU 6 references in Makefile, the COLI_ANS compressed tier
rocWMMA backend_gpu_compat.h maps nvcuda::wmma onto it, which is what
lets one .cu compile for both vendors
Deliberately NOT listed: SGLang and FlashAttention. Both are obvious names to
put in a file like this, and neither appears anywhere in the tree -- no
reference, no reimplementation, no comparison. Listing them would be
flattering and false. FlashInfer, DeepGEMM and TileLang do appear, but only
on the DeepSeek V4 branches (JustVugg#772/JustVugg#773); they belong in this list when that
work lands, not before.
|
Closing this in favour of #772, as @JustVugg asked in #772. He is right that this is the same PR. #773 carries #772's 25 commits verbatim plus one — #772 is the one with the review on it, so that is the one that stays. The long-context commit is not lost: it goes back up on its own once #772's shape is settled, which is not a small caveat right now — the blocking request there is an offload path, and the file layout is likely to move so the engine file belongs to #165's streaming implementation. A long-context cache built on top of the current layout would need redoing anyway. Better to rebuild it on whatever #772 becomes than to keep a stale superset open. |
The section added here credits the research the expert-placement and routing
work draws on. It does not credit the code -- the containers, tokenizers,
codecs and compat layers this engine reimplements or links against, several
of which are named in the sources and nowhere else.
Every entry points at where it is used, because a credit nobody can check is
decoration:
safetensors c/st.h, 13 references, including its fp8 and I64 dtypes
tiktoken c/tok.h reimplements byte_pair_encode exactly
llama.cpp grammar.h:14 (GBNF subset + set-of-stacks PDA),
colibri.c:1956 (Metal newBufferWithBytesNoCopy residency)
vLLM colibri.c:5903 -- where the final norm lands vs the LM head
transformers tools/oracle-requirements.txt, the token-exact CI oracle
DietGPU 6 references in Makefile, the COLI_ANS compressed tier
rocWMMA backend_gpu_compat.h maps nvcuda::wmma onto it, which is what
lets one .cu compile for both vendors
Deliberately NOT listed: SGLang and FlashAttention. Both are obvious names to
put in a file like this, and neither appears anywhere in the tree -- no
reference, no reimplementation, no comparison. Listing them would be
flattering and false. FlashInfer, DeepGEMM and TileLang do appear, but only
on the DeepSeek V4 branches (JustVugg#772/JustVugg#773); they belong in this list when that
work lands, not before.
Summary
Stacked on #772. This PR contains only the long-context allocation foundation:
The branch was restacked after #772 was rebased; its delta is now limited to
c/backend_cuda_dsv4.cuandc/deepseek_v4.c.Correctness boundary
index_topk=512Verification
Status
Draft and dependent on #772. Keep it stacked until the base backend merges; then rebase and implement the FP8 Lightning Indexer query/key cache, MQA logits, top-512 selection, and real long-context A/B validation.