#!/usr/bin/env python3 """Original inferred-C clock object deactivation oracle with replacement callbacks, no GPU IO.""" from pathlib import Path import argparse,subprocess,json,hashlib r=Path(__file__).resolve().parent.parent;p=argparse.ArgumentParser();p.add_argument('--check',action='store_true');a=p.parse_args() c=r/'tools/gpu_clock_objects_oracle.c';binary=r/'target/clock-objects-oracle';binary.parent.mkdir(exist_ok=True) subprocess.run(['cc','-std=gnu11','-O0','-fno-strict-aliasing',str(c),'-o',str(binary)],check=True) n,h=subprocess.check_output([str(binary)],text=True).strip().split() code=f'// Generated from literal original inferred C clock object deactivation.\nconst ORIGINAL_CASES: usize = {n};\nconst ORIGINAL_HASH: u64 = 0x{h};\n' report={'source_sha256':'5269a23ffba19a17fe16f076463e7ad4151254659441d1711bee6c6221ff6f4b','oracle_c_sha256':hashlib.sha256(c.read_bytes()).hexdigest(),'cases':int(n),'fnv1a64':h,'domain':'17actual entries x8list counts x2mutation modes x32alias/null/conditional seeds; forward/reverse live list mutations, shared records and reentrant temporary method8','assertion_service':'Original020158 is not executed; fixture records assertion invocation. Production diagnostic service remains mandatory.','pointer_layout_normalization':'Compare owned record/list identities, not ASLR host pointer bits in overlapping layout fields.','limits':'Literal original inferred021082/021087/021096/021084/021089/021090/021095/021080/021094/021085/021088/021079/021081/021083/021086/021091/021092/021093 C only. Leaf callback bodies are recorders, not claimed original external method behavior. No original machine code or hardware runs.'} for out,text in [(r/'src/nvidia/src/gpu/clock_objects_oracle.rs',code),(r/'reports/gpu-clock-objects-oracle.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(f'Original clock-object deactivation oracle:{n} cases;{h}')