mirror of
https://github.com/deepseek-ai/DeepInfer.git
synced 2026-10-31 16:56:21 +08:00
norm, map_lookup, expand_sampling_params, prepare_verification_metadata, copy_block_tables. Plus the measured parameterisation that made the port tractable: `DEEPINFER_TRACE_KERNEL_ARGS=1` records each factory's construction arguments, which showed that e.g. `norm_tl` is only ever built as one combination on this path (d=5120, bf16 source, fp8 out, per-128 fp32 scales, col-major, round_sf, no residual) rather than the dozen the signature allows. Three findings worth keeping: `norm` has to round the fp32 normalised value back to bf16 *before* computing the per-block amax and the scale. That is what makes its fp8 output bit-identical to quantising the bf16 result separately, which is how the engine defines the reference. Without it the fp8 bytes scatter by an ulp wherever a value lands on a rounding boundary -- which looked like a scale bug at first (224 vs 240) and was not. With `round_sf=True`, which is the production setting, fp8 output and every scale factor come out byte-identical. With `round_sf=False` 240 of 327680 bytes differ by one ulp, because `amax/448` depends on the order of a 5120-element reduction and two compilers will not agree on that order. For the same reason the bf16 output differs on 10 of 655360 elements by one ulp. Both are documented, and the A/B harness now picks its tolerance from the dtype instead of one global pair. `map_lookup` resolves duplicate keys by taking the last match, not the maximum: the TileLang kernel overwrites on every hit while its own Python reference uses `max`, and the two agree only when keys are unique. Top-k indices always are, so the Triton version matches the kernel -- and the case generator now produces unique keys, with a comment saying why. 13 kernels and 53 cases now agree with the baseline. |
||
|---|---|---|
| .. | ||
| ab_cases.py | ||
| build_vendor.sh | ||
| build.sh | ||
| compare_layers.py | ||
| format_csrc.sh | ||
| gen_stub.sh | ||
| h20_ask.py | ||
| h20_attn_check.py | ||
| h20_engram_check.py | ||
| h20_expert_weight_check.py | ||
| h20_index_decode_check.py | ||
| h20_kv_roundtrip.py | ||
| h20_ops_ab.py | ||
| h20_quant_check.py | ||
| h20_real_requant_check.py | ||
| h20_recipe_probe.py | ||
| h20_smoke_check.py | ||
| h20_topk_check.py | ||
| ref_layer_dump.py | ||
| ref_next_token.py | ||