mirror of
https://github.com/deepseek-ai/DeepInfer.git
synced 2026-10-31 00:36:20 +08:00
`DEEPINFER_USE_NEXTN_DECODE` defaults to 5, so speculative decoding is on unless someone turns it off, and these four ran on every decode step. On a host without TileLang the first step failed; on the H20 they were the only kernels still answering from the other backend during a normal run. The interesting one is `remap_draft_topk`. Its TileLang form builds a vocabulary-windowed lookup table in shared memory and reads the logprobs back out of it. Triton has no equivalent primitive, so the table is gone and each target index is matched against the draft indices directly: draft indices are unique per token id, so at most one candidate can match and a max over the block is well defined. That is O(topk^2) instead of O(vocab/pool_size * topk), which would be the wrong trade at a large `force_topk` -- but `force_topk` defaults to 0, so this kernel is off the default path and correctness comes first. Worth revisiting if a deployment turns it on. The other three adapt rather than change shape: * `get_accept_result`'s prefix scan becomes a bounded loop over the widest span in the block; lanes with a shorter span hold their value on the extra iterations. MTP packs at most num_steps+1 rows per request, so the bound stays small. * `finalize_verification` reduces `batch_confidence_error` within the program and issues one atomic instead of one per row, because a scalar pointer with a vector value is not valid in this Triton version. Accumulating in a different order changes the last bits, so its cases compare with a tolerance and say why. * `get_fused_dflash_get_input` rounds its column loop up. `padded_kv_len` is a multiple of 64 but not necessarily of the tile width, and flooring leaves the tail of every row unwritten. 33 new A/B cases across the four, covering each constexpr variant the engine builds. The full run is green and an end-to-end pass is token-for-token identical to the run before the change, with the MTP fallback notices gone. |
||
|---|---|---|
| .. | ||
| _C | ||
| distributed | ||
| engine | ||
| entrypoints | ||
| h20_ops | ||
| hugging_face | ||
| model_executor | ||
| npu_ops | ||
| structure_output | ||
| ve | ||
| worker | ||
| __init__.py | ||
| attrdict.py | ||
| config.py | ||
| debug_dump.py | ||
| environ.py | ||
| load_class.py | ||
| logger.py | ||
| model_config_loader.py | ||
| multimodal_tokens.py | ||
| platform.py | ||
| py.typed | ||
| sampling_params.py | ||
| sequence.py | ||
| shared_memory.py | ||
| testing.py | ||
| timer.py | ||
| utils.py | ||