"""Run audited and function-only frozen CUDA gates from one command. This is a replay orchestrator, not a new compiler implementation. It does not weaken either existing gate, execute predicted bytes, or claim GPU residency. """ import argparse import json from pathlib import Path import subprocess import sys ROOT = Path(__file__).resolve().parent def run(*args): command = [sys.executable, *map(str, args)] print(subprocess.list2cmdline(command), flush=True) subprocess.run(command, cwd=ROOT, check=True) def require_report(path, flags): report = json.loads(path.read_text(encoding='utf-8')) if (report.get('selected') != 598 or report.get('matched') != 598 or report.get('errors') != [] or report.get('failed') != [] or any(report.get(f) is not True for f in flags)): raise RuntimeError(f'Frozen qualification failed: {path}') return report def main(): p = argparse.ArgumentParser(description=__doc__) p.add_argument('--runner', type=Path, required=True, help='Completed phase compiler driver, relative to repository or absolute') p.add_argument('--data', type=Path, required=True) p.add_argument('--baseline', type=Path, default=Path('runs/phase_c_frozen_all')) p.add_argument('--out', type=Path, required=True, help='Fresh output directory') p.add_argument('--batch', type=int, default=16) p.add_argument('--span-chunk', type=int, default=16) p.add_argument('--encoder-chunk', type=int, default=2048) a = p.parse_args() runner, data, baseline, out = (x.resolve() for x in (a.runner, a.data, a.baseline, a.out)) for f in (runner, ROOT/'phase_d1_compare.py', ROOT/'phase_d3b_function_gate.py', baseline/'phase_c_gate.json', baseline/'assembly_comparison.json', baseline/'summary.json'): if not f.is_file(): p.error(f'Missing file: {f}') if not data.is_dir(): p.error(f'Missing data directory: {data}') if out.exists(): p.error(f'Output already exists: {out}; use a fresh path') out.mkdir(parents=True) common = [runner, '--data', data, '--device', 'cuda', '--compact', '--batch', a.batch, '--span-chunk', a.span_chunk, '--encoder-chunk', a.encoder_chunk] audited, functions = out/'audited', out/'functions' run(*common, '--out', audited) run(ROOT/'phase_d1_compare.py', '--run', audited, '--baseline', baseline) audit = require_report(audited/'phase_d1_parity.json', ('parity_pass', 'full_frozen_parity', 'qualified_baseline', 'qualification_inherited')) run(*common, '--function-only', '--out', functions) run(ROOT/'phase_d3b_function_gate.py', '--run', functions, '--baseline', baseline) func = require_report(functions/'phase_d3b_function_parity.json', ('byte_equivalent_to_qualified_baseline', 'baseline_verified')) result = dict(scope='Frozen 598-program parity only; no new native execution or generalization proof', runner=str(runner), full_frozen_parity=True, function_byte_equivalence=True, audited=audit, function_only=func) (out/'qualification.json').write_text(json.dumps(result,indent=2)+'\n', encoding='utf-8') print(json.dumps(result,indent=2)) if __name__ == '__main__': main()