mirror of
https://github.com/deepseek-ai/DeepInfer.git
synced 2026-10-31 08:46:21 +08:00
gather, gather_input_ids_zos, gather_engram_tokens_zos, expand_swa_index, kv_index_cat, convert_kv_index, load_kv_index, store_mtp_info. 45 cases, every one bitwise identical to the TileLang baseline through the shared interface function. `scripts/h20_ops_ab.py` swaps `ops.<name>_tl` between the two backends and runs the public call once per side, so the comparison exercises the interface layer's shape handling too, not just the kernel. `scripts/ab_cases.py` holds the cases: real engine widths and dtypes, negative indices for gather, -1 padding for the index kernels, page-boundary lengths, the slot-0 no-write path, and the engram image-sentinel rule. Five Triton semantics traps worth writing down, all documented in the plan: - `tl.where` evaluates both arms, so `tl.where(i == 0, 0, LOAD(i - 1))` really reads `LOAD[-1]`; that was an illegal memory access, fixed by clamping the index instead. - A scalar pointer cannot carry a block-shaped mask; it has to be broadcast with `+ tl.zeros((BLOCK,), tl.int32)` first. - Two arms of one kernel cannot use different tile shapes, which is why `kv_index_cat` became two launches rather than one fused kernel with a column-block branch. - Triton's `data_ptr()` already includes a view's storage offset, so passing `out[:, w:w+k]` and adding `w` again double-counts -- that showed up as 0x01010101 in the second half. - Test-case capacity matters: `store_mtp_info` addresses `slot * nextn + step`, so the pool needs `(max_slot + 1) * nextn` rows; too few rows let both backends write out of bounds and disagree. |
||
|---|---|---|
| .. | ||
| _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 | ||