Files
nvdriver/tools/gpu_generate_clock_cache_data.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

21 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""Exact selected020153 base-level cache-prefix stores from original inference."""
from pathlib import Path
import re,json,argparse,hashlib,subprocess
r=Path(__file__).resolve().parent.parent;p=argparse.ArgumentParser();p.add_argument('--check',action='store_true');a=p.parse_args()
s=next(Path('/home/geodd/nvidia-driver/analysis-580.178.04/decompiled/kernel-rm-all/functions').glob('*/*__nv020153rm.c')).read_text();s=s[:s.index(' lVar11 = *(long *)(param_1 + 0x1ec0);')]
rows=[]
for index,value in re.findall(r'(?:\*param_5|param_5\[([^]]+)\]) = (0x[0-9a-f]+);',s):
i=0 if not index else int(index,0);assert i%4==0;rows.append((i//4,int(value,16)))
flags=[int(off,16)//16 for off in re.findall(r'\*\(undefined1 \*\)\(\(long\)param_5 \+ (0x[0-9a-f]+)\) = 0;',s)]
assert [i for i,v in rows]==list(range(66))+list(range(67,75)) and flags==list(range(66))
code='// Generated from literal original020153 base-level cache prefix.\nconst ADDRESS_STORES: &[(usize,u32)] = &[\n'+''.join(f' ({i},0x{v:x}),\n' for i,v in rows)+'];\n'
toolchain=re.search(r'channel\s*=\s*"([^"]+)"',(r/'rust-toolchain.toml').read_text()).group(1)
code=subprocess.run([str(Path.home()/'.rustup/toolchains'/f'{toolchain}-x86_64-unknown-linux-gnu/bin/rustfmt'),'--edition','2021'],input=code,text=True,capture_output=True,check=True).stdout
report={'source_sha256':'5269a23ffba19a17fe16f076463e7ad4151254659441d1711bee6c6221ff6f4b','inferred_prefix_sha256':hashlib.sha256(s.encode()).hexdigest(),'address_stores':rows,'clear_byte_d_rows':flags,'untouched_address_rows':[66]+list(range(75,130)),'limits':'Only actual constructor stores; all other record fields retain caller-provided state. No empty/default records or hardware access.'}
for out,text in [(r/'src/nvidia/src/gpu/clock_cache_data.rs',code),(r/'reports/gpu-clock-cache-data.json',json.dumps(report,indent=2)+'\n')]:
if a.check:
if out.read_text()!=text:raise SystemExit('Stale '+str(out))
else:out.write_text(text)
print('Original020153cache:74address stores,66byteD clears; record66 address untouched')