mirror of
https://github.com/deepseek-ai/DeepInfer.git
synced 2026-11-18 19:42:28 +00:00
Run DeepSeek-V4.1-Flash offline inference on SM120 GPUs (RTX PRO 6000 Blackwell) with the same entry points as SM100. SM100 and Ascend paths are unchanged. - Build: SM120 is detected from the first visible GPU (scripts/nvidia_arch.sh). It builds DeepEP and DeepGEMM from its nv_dev branch (vendor/DeepGEMM-sm120), and no FlashMLA or DeepSelect; FlashInfer is installed from a pinned commit (requirements-nvidia-sm120.txt). - Attention: V4.1 sparse MLA runs on FlashInfer's SM120 sparse MLA kernels, reading the inline-scale KV records as stored; KV blocks are aligned to 512 bytes. - Indexer: FlashInfer's fused DSA indexer scores the index keys and selects their top-k in one call, for decode on every indexer layer (candidate source and consumer layers included) and for prefill outside the candidate layers. The remaining selections (prefill of the candidate layers, the sampler) use FlashInfer's top-k behind DeepSelect's interface (model_executor/layers/topk.py), in deterministic mode. - MoE EP: DeepEP over NCCL GIN by default, or NCCL collectives (DEEPINFER_SM120_EP_BACKEND=nccl); NCCL settings known to break the EP paths are rejected. EPLB, including decode-only draft-layer EPLB, and per-layer YoCo MoE dispatch. - Engram tables live in page-locked host shared memory; killed workers leave nothing in /dev/shm. - Features: attention DP + MoE EP, DSpark/nextn speculative decoding, CUDA graphs, async scheduling, decoder SWA bounded replay, structured outputs, image inputs, multi-node deployments. Features without an SM120 implementation (CP > 1, MTP varlen, batch-invariant mode, GPU-resident Engram tables) are refused at engine start. - Eval: chat GSM8K and CV-Bench; tests for the SM120 kernels and their DeepInfer call sites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
63 lines
2.4 KiB
Python
63 lines
2.4 KiB
Python
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Generator
|
|
|
|
import pytest
|
|
|
|
from deep_cluster.hardware import device, nvidia
|
|
|
|
|
|
@pytest.fixture
|
|
def capability(monkeypatch: pytest.MonkeyPatch) -> Generator[list[tuple[int, int] | None]]:
|
|
"""Pretend to be an NVIDIA host whose first visible GPU reports the capability stored in the returned cell."""
|
|
cell: list[tuple[int, int] | None] = [None]
|
|
monkeypatch.setattr(device, "accelerator_kind", lambda **_: "nvidia")
|
|
monkeypatch.setattr(nvidia, "compute_capability", lambda **_: cell[0])
|
|
monkeypatch.setenv("CUDA_VISIBLE_DEVICES", "0")
|
|
caches = (device.is_sm_major_10, device.is_sm_major_12, device.visible_device_env_name)
|
|
for fn in caches:
|
|
fn.cache_clear()
|
|
yield cell
|
|
for fn in caches:
|
|
fn.cache_clear()
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
("cap", "sm100", "sm120"),
|
|
[((10, 0), True, False), ((10, 3), True, False), ((12, 0), False, True), ((9, 0), False, False), (None, False, False)],
|
|
)
|
|
def test_sm_major_detection(capability: list[tuple[int, int] | None], cap: tuple[int, int] | None, sm100: bool, sm120: bool) -> None:
|
|
capability[0] = cap
|
|
assert device.is_sm_major_10() is sm100
|
|
assert device.is_sm_major_12() is sm120
|
|
|
|
|
|
def test_bf16_tflops_limit_known_for_sm120(capability: list[tuple[int, int] | None]) -> None:
|
|
capability[0] = (12, 0)
|
|
assert device.get_bf16_tflops_limit() > 0
|
|
|
|
|
|
def test_bf16_tflops_limit_rejects_unknown_gpu(capability: list[tuple[int, int] | None]) -> None:
|
|
capability[0] = (9, 0)
|
|
with pytest.raises(RuntimeError, match="unknown GPU type"):
|
|
device.get_bf16_tflops_limit()
|
|
|
|
|
|
@pytest.mark.parametrize(("visible", "probed"), [("3,1", ["3"]), ("GPU-1234abcd,0", ["GPU-1234abcd"]), ("", [])])
|
|
def test_sm_major_probes_first_visible_device(
|
|
capability: list[tuple[int, int] | None], monkeypatch: pytest.MonkeyPatch, visible: str, probed: list[str]
|
|
) -> None:
|
|
seen: list[int | str] = []
|
|
|
|
def fake_capability(*, index: int | str = 0) -> tuple[int, int]:
|
|
seen.append(index)
|
|
return (12, 0)
|
|
|
|
monkeypatch.setattr(nvidia, "compute_capability", fake_capability)
|
|
monkeypatch.setenv("CUDA_VISIBLE_DEVICES", visible)
|
|
assert device.is_sm_major_12() is bool(probed)
|
|
assert seen == probed
|