gpu-kernel-benchmark / kernel_bench /preflight_h100.py
code-roamer's picture
Publish GPU Kernel Benchmark v0.8.1 public edition
5d12def verified
Raw History Blame Contribute Delete
2.28 kB
"""Verify the pinned H100 runtime before running or comparing any kernels."""
import importlib.metadata as metadata
import json
from pathlib import Path
import platform
import subprocess
import torch
import triton
def main():
import deep_gemm
import flashinfer
import flash_mla
import sgl_kernel
expected={'torch':'2.9.1+cu128','triton':'3.5.1','flashinfer-python':'0.7.2.post1',
'fla-core':'0.6.0','sgl-kernel':'0.3.21','torch-c-dlpack-ext':'0.1.5',
'deep-gemm':'2.8.2+5081f85','flash-mla':'1.0.0+ba89a34'}
actual={name:metadata.version(name) for name in expected}
errors=[f'{name}: expected {version}, got {actual[name]}' for name,version in expected.items() if actual[name]!=version]
if platform.python_version_tuple()[:2]!=('3','11'):errors.append('Python 3.11 required')
if torch.cuda.get_device_capability()!=(9,0):errors.append('This calibrated profile requires an H100 SM90 GPU')
if 'H100' not in torch.cuda.get_device_name():errors.append('GPU model is not H100; recalibration required')
if getattr(deep_gemm,'__version__',None)!='2.8.2' or not hasattr(deep_gemm,'fp8_fp4_mqa_logits'):
errors.append('Wrong DeepGEMM module imported (SGL wheel also bundles an older module)')
root=Path(__file__).resolve().parents[1]
for relative in ('ops/triton/ssd_combined.py','utils/torch.py'):
if not (root/'third_party/Mamba-e9594ce1/mamba_ssm'/relative).exists():
errors.append('Pinned Mamba dependency is missing: '+relative)
compiler=subprocess.run(['nvcc','--version'],capture_output=True,text=True)
if compiler.returncode or 'release 12.9' not in compiler.stdout:errors.append('CUDA toolkit 12.9 nvcc required for the frozen profile')
result={'status':'failed' if errors else 'passed','errors':errors,'python':platform.python_version(),
'packages':actual,'gpu':torch.cuda.get_device_name(),'capability':torch.cuda.get_device_capability(),
'torch_cuda':torch.version.cuda,'compiler':compiler.stdout,
'module_paths':{m.__name__:m.__file__ for m in (torch,triton,deep_gemm,flashinfer,flash_mla,sgl_kernel)}}
print(json.dumps(result,indent=2))
return bool(errors)
if __name__=='__main__':raise SystemExit(main())