mirror of
https://github.com/deepseek-ai/DeepInfer.git
synced 2026-11-01 01:06:23 +08:00
No behaviour change. `CONTRIBUTING.md` requires `ruff check --no-cache` and `ruff format --check --no-cache` to pass, and the SM90 branch predates that requirement: 72 findings, all in the files added here. Most of it is mechanical (`ruff format`), plus: - annotations for the helper signatures (`torch.Tensor` / `int` / `Generator` / return types); hooks are typed as `Callable[[nn.Module, tuple, object], None]` rather than left bare; - two `if`/`else` assignments become ternaries (SIM108), and the index read in `h20_real_requant_check.py` uses a context manager (SIM115). Also corrects the `sparse_mla_fwd` docstring, which still described the old `0 <= idx <= q_position` masking contract. Passing `is_causal=True` there is what produced the all-NaN layer 0: indices address the assembled `[swa cache | current swa | compressed]` buffer, so the row number is not a valid causal bound and the engine must pass False.
38 lines
848 B
Python
38 lines
848 B
Python
"""Public hardware-neutral discovery functions."""
|
|
|
|
from deep_cluster.hardware.device import (
|
|
accelerator_kind,
|
|
assign_visible_devices,
|
|
device_numa_node,
|
|
get_actual_num_gpus,
|
|
get_bf16_tflops_limit,
|
|
is_sm_major_9,
|
|
is_sm_major_10,
|
|
num_gpus,
|
|
physical_device_count,
|
|
physical_device_id,
|
|
set_visible_devices,
|
|
visible_device_count,
|
|
visible_device_env_name,
|
|
visible_device_ids,
|
|
visible_devices,
|
|
)
|
|
|
|
__all__ = [
|
|
"accelerator_kind",
|
|
"assign_visible_devices",
|
|
"device_numa_node",
|
|
"get_actual_num_gpus",
|
|
"get_bf16_tflops_limit",
|
|
"is_sm_major_10",
|
|
"is_sm_major_9",
|
|
"num_gpus",
|
|
"physical_device_count",
|
|
"physical_device_id",
|
|
"set_visible_devices",
|
|
"visible_device_count",
|
|
"visible_device_env_name",
|
|
"visible_device_ids",
|
|
"visible_devices",
|
|
]
|