mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 06:28:39 +00:00
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Generate or verify original LSF whole-image outputs in isolated private RAM."""
|
|
import argparse
|
|
import hashlib
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT / "tools"))
|
|
from _lsf_oracle_elf import ( # noqa: E402
|
|
ENGINE_SPECS,
|
|
LsfUnicornHarness,
|
|
discover_rm_object,
|
|
load_relocated_rm_object,
|
|
retain_json,
|
|
)
|
|
|
|
|
|
def main(argv=None) -> int:
|
|
parser = argparse.ArgumentParser(
|
|
description="Run or verify LSF whole-image oracle."
|
|
)
|
|
parser.add_argument("--rm-object", type=Path, default=None)
|
|
parser.add_argument("--check", action="store_true")
|
|
opt = parser.parse_args(argv)
|
|
|
|
loaded = load_relocated_rm_object(discover_rm_object(opt.rm_object))
|
|
harness = LsfUnicornHarness(loaded)
|
|
netlist = (ROOT / "analysis/gr-580/gv100-netlist.bin").read_bytes()
|
|
out_dir = ROOT / "analysis/lsf-580"
|
|
records = [
|
|
harness.run_engine_image(
|
|
engine, setter, initializer, body, code_region, data_region, netlist, out_dir, opt.check
|
|
)
|
|
for engine, setter, initializer, body, code_region, data_region in ENGINE_SPECS
|
|
]
|
|
report = {
|
|
"artifact_sha256": loaded["digest"],
|
|
"actual_selected_netlist_sha256": hashlib.sha256(netlist).hexdigest(),
|
|
"constructor_lsfm_190_from_actual005835": 0,
|
|
"scripted_services": [
|
|
"CPU allocation/free/memcpy/memset",
|
|
"validprocesscontext",
|
|
"systemfixture000333",
|
|
"diagnostics",
|
|
],
|
|
"records": records,
|
|
"physical_gpu_access": False,
|
|
"signature_authenticated": False,
|
|
}
|
|
retain_json(ROOT / "reports/gpu-lsf-whole-image-oracle.json", report, opt.check)
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|