mirror of
https://github.com/deepseek-ai/DeepInfer.git
synced 2026-10-31 16:56:21 +08:00
The import-time line only counts kernels the selected backend does not export, which says nothing
about whether a running configuration reaches them. `_FallbackNotice` wraps each inherited kernel
and prints once, on first call, so an end-to-end run states the answer itself. On 8xH20 with
speculative decoding off that answer is a single line:
[ops] kernel 'fused_sample_tl' used from 'cuda': 'triton' does not implement it
Eighteen of the nineteen kernels on that path are Triton and produce exactly the same tokens as the
pure TileLang run. The nineteenth is left there on purpose.
A probe of the engine's own sampling parameters (`DEEPINFER_PROBE_SAMPLING=1`, which stages an
async D2H copy and reports at exit so it does not synchronise inside the forward) settles what
`fused_sample` is being asked to do:
temperatures: [1.0, 1.0] top_ps: [0.99, 0.99] top_ks: [-1, -1]
That is a real nucleus sample over 4096 candidates, not an argmax, so the draw matters. Two things
stand in the way of reproducing it bit for bit, both internal to TileLang: `T.rng_init`/`T.rng_rand`
are a Philox stream implemented in its C++ codegen, so a Triton kernel draws a different stream and
every sampled token at temperature > 0 would change; and the baseline pins the layout of its LSE
accumulator precisely to fix the summation order, after which probabilities are quantised into a
2^31-scaled uint32 CDF where a one-ulp difference can move a column across a boundary.
Swapping it anyway would be a behaviour change reported as a kernel swap. The per-kernel fallback
exists for exactly this case, so the sampler stays on TileLang and the rest of the path does not.
`triton/__init__.py` records this so the gap is not mistaken for an oversight, along with the order
in which porting it later would have to proceed: a Philox that matches the stream exactly, then the
radix filter, then the fixed-point CDF and the two-level search.
|
||
|---|---|---|
| .. | ||
| asc | ||
| cuda | ||
| triton | ||
| __init__.py | ||
| cache_common.py | ||
| candidate_blocks.py | ||
| common.py | ||
| compress.py | ||
| compute_seqlens_k_zos.py | ||
| conftest.py | ||
| dflash_copy.py | ||
| dflash.py | ||
| flash_mla_utils.py | ||
| fused_sample.py | ||
| fused_transform.py | ||
| gather_engram_tokens_zos.py | ||
| gather_input_ids_zos.py | ||
| gather.py | ||
| get_kv_index.py | ||
| image_embed_ops.py | ||
| kv_index_cat.py | ||
| load_paged_kv_cache.py | ||
| norm.py | ||
| ops.py | ||
| outlier_detection.py | ||
| prepare_cp_mirror.py | ||
| prepare_v4_decode_metadata.py | ||
| random_sampling.py | ||
| sampler.py | ||
| schedule_mtp_varlen.py | ||
| state_cache.py | ||
| store_kv_cache.py | ||
| store_mtp_info.py | ||
| structure_output.py | ||
| sum_smaller_probs.py | ||
| swa_index.py | ||