mirror of
https://github.com/deepseek-ai/DeepInfer.git
synced 2026-10-31 00:36:20 +08:00
The illegal memory access was not in `expand_sampling_params` at all, though that is where `CUDA_LAUNCH_BLOCKING` pointed. It was the metadata kernel leaving its output unwritten. `prepare_verification_metadata_tl` sized its second grid dimension from `num_steps`, i.e. `max_MTP_value`. With speculative decoding off that value is 0, and a zero-sized grid dimension launches nothing, so `row_to_req` -- a `torch.empty` buffer -- kept whatever the allocator handed out. `expand_sampling_params` then used those values as request indices, and the reads went off the end of the parameter arrays. The kernel now launches one program per request and loops the tiles at runtime, mirroring the TileLang version, so the row count comes from device memory and no host read is needed (which would have been rejected as a synchronising operation anyway). `num_steps` is accepted and ignored. The A/B case for this kernel is also fixed, in two ways that matter: - it used a fixed `total_q` while the request lengths were random, so it allocated more rows than were ever written and the comparison was meaningless; - it pre-filled the outputs with a sentinel but never required them to be overwritten, so both backends could write nothing and still agree with each other. The case now asserts every row was written, and covers `num_steps=0` plus a request longer than one tile. With that, `DEEPINFER_OPS_BACKEND=triton` runs end to end and produces exactly the same tokens as the pure TileLang run, `[17607, 2793, 3139, 666, 6127, 666, 320, 1]`, identical on all eight ranks. Fifteen of the required kernels are Triton; the remainder still come from TileLang through the fallback while they are ported. |
||
|---|---|---|
| .. | ||
| _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 | ||