Files
nvdriver/tools/generate_rmapi_class_db.py
nvidia-driver-rs 4526e6a816 Baseline: validated 30/30 tree with passing Level 7 hardware regression
- Updated tools/post_reboot.sh to check kernel oops taint bit and stuck driver tasks instead of <86400s uptime
- Level 7 hardware regression passed on 0000:b3:00.0 (module 37e6fa430835eee2b426019db3ad70eeb7a9e9070c09c84bd9b973cf56cbe529, 107 inventory words, 0 static mismatches, CUDA baseline verified before and after)
- Updated .gitignore to exclude build archives (*.a, *.rlib), __pycache__, and raw trace dumps
2026-11-23 23:48:38 +00:00

35 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""Generate src/nvidia/src/rmapi/providers/class_db_gv100.rs.
Source: the "descriptors" line of target/rmapi/original-rmapi-gpu.txt (case gpu-slice3b),
which tools/check_rmapi_binary.py reads out of the GPU object after the original's own
attach: the class descriptor list its engine-table constructor built for a GV100 (GPU+0xd90,
count GPU+0xd98; public gpuConstructEngineTable: generic classes, the chip's engine-less
classes, then the chip's class-to-engine list). `--check` verifies the checked-in file.
"""
from pathlib import Path
import sys
ROOT = Path(__file__).resolve().parents[1]
RECORD = ROOT / "target/rmapi/original-rmapi-gpu.txt"
TARGET = ROOT / "src/nvidia/src/rmapi/providers/class_db_gv100.rs"
line = next(line for line in RECORD.read_text().splitlines() if line.startswith("descriptors "))
records = [tuple(int(part, 16) for part in field.split(":")) for field in line.split()[1:]]
lines = [
"//! Class descriptor list of a GV100: (external class, engine descriptor) in the order of",
"//! the original's engine-table constructor (GPU+0xd90 after `gpumgrAttachGpu`).",
"//! Generated by tools/generate_rmapi_class_db.py from the oracle record; do not edit.",
"",
"#[rustfmt::skip]",
f"pub static DESCRIPTORS: [(u32, u32); {len(records)}] = [",
]
lines += [f" ({klass:#x}, {engine:#x})," for klass, engine in records]
lines += ["];", ""]
text = "\n".join(lines)
if "--check" in sys.argv:
assert TARGET.read_text() == text, "class descriptor table differs from the oracle record"
else:
TARGET.write_text(text)
print(f"{len(records)} class descriptors")