mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 22:48:43 +00:00
- 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
152 lines
8.3 KiB
Python
152 lines
8.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Diff the HAL bindings report against the revision before the 2026-11-19 correction.
|
|
|
|
The earlier revision of tools/gpu_engine_hal_bindings.py ran every binder and
|
|
property initializer as (object, chip owner, RM owner) with the display IP
|
|
index word left 0. reports/gv100-engine-hal-bindings-before-2026-11-19.json is
|
|
that revision's output, kept unchanged. This lists every property and HAL slot
|
|
whose recorded value differs, per class, with the cause.
|
|
"""
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
OLD = ROOT / "reports/gv100-engine-hal-bindings-before-2026-11-19.json"
|
|
NEW = ROOT / "reports/gv100-engine-hal-bindings.json"
|
|
# Hand-written: where the repository relied on a value that changed.
|
|
AUDIT = ROOT / "reports/gv100-engine-hal-bindings-correction-audit.json"
|
|
old, new = json.loads(OLD.read_text()), json.loads(NEW.read_text())
|
|
|
|
|
|
def causes(routine, conventions, old_entry):
|
|
convention = conventions.get(routine)
|
|
if convention is None:
|
|
return ["routine no longer attributed"]
|
|
found = []
|
|
ran_before = routine in old_entry.get("binders", ()) or \
|
|
routine in old_entry.get("property_binders", ())
|
|
if not ran_before:
|
|
found.append("routine was not run by the earlier revision")
|
|
if convention.get("order") == "RM, chip" and any(
|
|
item.startswith("rm") for item in convention["selectors_read"]) and any(
|
|
item.startswith("chip") for item in convention["selectors_read"]):
|
|
found.append("argument order: the caller passes (object, RM owner, chip owner)")
|
|
elif convention.get("order") == "RM, chip":
|
|
found.append("argument order: the caller passes (object, RM owner, chip owner); "
|
|
"the routine reads one owner only")
|
|
if convention.get("object_argument") not in ("object+0x0", None):
|
|
found.append(f"sub-object: the caller passes {convention['object_argument']}")
|
|
return found or ["store order or attribution"]
|
|
|
|
|
|
def property_bytes(table):
|
|
"""Expand property stores to single bytes, so a different store width is not a change."""
|
|
expanded = {}
|
|
for offset, entry in table.items():
|
|
for index in range(entry["bytes"]):
|
|
expanded[int(offset, 16) + index] = {
|
|
"value": f"{(int(entry['value'], 16) >> (8 * index)) & 0xff:#04x}",
|
|
"binder": entry["binder"]}
|
|
return expanded
|
|
|
|
|
|
def compare(label, before, after):
|
|
conventions = after.get("argument_conventions", {})
|
|
result = {"class_label": label}
|
|
counts = {}
|
|
views = {"properties": (property_bytes(before["hal_properties"]),
|
|
property_bytes(after["hal_properties"]), "value"),
|
|
"slots": ({int(offset, 16): entry for offset, entry in before["hal_slots"].items()},
|
|
{int(offset, 16): entry for offset, entry in after["hal_slots"].items()},
|
|
"function")}
|
|
for name, (first_table, second_table, key) in views.items():
|
|
other_table = views["slots" if name == "properties" else "properties"][1]
|
|
changed, added, removed = {}, {}, {}
|
|
for offset in sorted(set(first_table) | set(second_table)):
|
|
first, second = first_table.get(offset), second_table.get(offset)
|
|
if first and second:
|
|
if first[key] != second[key]:
|
|
changed[f"{offset:#x}"] = {
|
|
"old": first[key], "new": second[key],
|
|
"old_binder": first["binder"], "binder": second["binder"],
|
|
"causes": causes(second["binder"], conventions, before)}
|
|
elif second:
|
|
added[f"{offset:#x}"] = {key: second[key], "binder": second["binder"],
|
|
"causes": causes(second["binder"], conventions, before)}
|
|
else:
|
|
# Recorded before and absent now: the routine stores elsewhere
|
|
# (sub-object, other branch) or the other kind of entry is here.
|
|
covering = other_table.get(offset if name == "slots" else offset & ~7)
|
|
if name == "slots" and covering is None:
|
|
covering = next((other_table[offset + index] for index in range(8)
|
|
if offset + index in other_table), None)
|
|
removed[f"{offset:#x}"] = {
|
|
key: first[key], "old_binder": first["binder"],
|
|
"now": ({"kind": "property" if name == "slots" else "slot", **covering}
|
|
if covering else "no store at this offset"),
|
|
"causes": causes(first["binder"], conventions, before)}
|
|
result[f"{name}_changed"], result[f"{name}_added"], result[f"{name}_removed"] = (
|
|
changed, added, removed)
|
|
counts[name] = {"changed": len(changed), "added": len(added), "removed": len(removed)}
|
|
result["counts"] = counts
|
|
result["argument_conventions"] = {
|
|
routine: {key: value for key, value in convention.items() if key != "evidence"}
|
|
for routine, convention in conventions.items()}
|
|
return result
|
|
|
|
|
|
entries = [compare("OBJGPU", old["gpu_object"], new["gpu_object"])]
|
|
old_other = {entry["class_label"]: entry for entry in old["other_objects"]}
|
|
for entry in new["other_objects"]:
|
|
entries.append(compare(entry["class_label"], old_other[entry["class_label"]], entry))
|
|
old_classes = {entry["class_vtable_rodata_offset"]: entry for entry in old["classes"]}
|
|
for entry in new["classes"]:
|
|
label = entry["class_label"] or f"ordinal{entry['engine_ordinals0'][0]}"
|
|
entries.append(compare(label, old_classes[entry["class_vtable_rodata_offset"]], entry))
|
|
wrappers = {}
|
|
for entry in new["classes"]:
|
|
before = old_classes[entry["class_vtable_rodata_offset"]].get("stage_bodies_via_hal", {})
|
|
for stage, body in entry.get("stage_bodies_via_hal", {}).items():
|
|
if before.get(stage) != body:
|
|
wrappers.setdefault(entry["class_label"], {})[stage] = {
|
|
"old": before.get(stage), "new": body}
|
|
totals = {kind: {change: sum(entry["counts"][kind][change] for entry in entries)
|
|
for change in ("changed", "added", "removed")}
|
|
for kind in ("properties", "slots")}
|
|
report = {
|
|
"date": "2026-11-19",
|
|
"old_report": {"path": str(OLD.relative_to(ROOT)),
|
|
"sha256": hashlib.sha256(OLD.read_bytes()).hexdigest()},
|
|
"new_report": {"path": str(NEW.relative_to(ROOT)),
|
|
"sha256": hashlib.sha256(NEW.read_bytes()).hexdigest()},
|
|
"defect": "The earlier revision ran every routine as (object, chip owner, RM owner), ran "
|
|
"binders of a parent class on the object instead of the sub-object their caller "
|
|
"passes, left the display IP index word 0, and missed routines that call "
|
|
"sibling binders.",
|
|
"meaning": {"properties": "compared byte by byte; offsets are single bytes",
|
|
"changed": "an offset recorded in both revisions with a different value",
|
|
"added": "an offset only the corrected revision records",
|
|
"removed": "an offset only the earlier revision recorded; `now` says what the "
|
|
"corrected revision has there"},
|
|
"display_ip_index": "The earlier revision left the display IP index word (RM owner +0x12) 0; "
|
|
"it is 20 at object creation. Only _nv005967rm (OBJDPAUX) reads it "
|
|
"among the routines of this report, and isolated runs of that routine "
|
|
"store the same values for index 0, 8, 9, 10 and 20, so no recorded "
|
|
"difference is due to it.",
|
|
"totals": totals,
|
|
"classes_with_changed_values": [entry["class_label"] for entry in entries
|
|
if entry["counts"]["properties"]["changed"]
|
|
or entry["counts"]["slots"]["changed"]],
|
|
"stage_bodies_via_hal_changed": wrappers,
|
|
"impact_audit": json.loads(AUDIT.read_text()) if AUDIT.exists() else None,
|
|
"classes": entries,
|
|
}
|
|
(ROOT / "reports/gv100-engine-hal-bindings-correction.json").write_text(
|
|
json.dumps(report, indent=1) + "\n")
|
|
for entry in entries:
|
|
counts = entry["counts"]
|
|
if any(counts[kind][change] for kind in counts for change in counts[kind]):
|
|
print(f"{entry['class_label']:20} properties {counts['properties']} slots {counts['slots']}")
|
|
print(totals)
|