| 17 | class PerfReport: |
| 18 | @staticmethod |
| 19 | def print_panel(metrics: Dict[str, Any]): |
| 20 | print(f"\n\t{metrics['tip']}") |
| 21 | print(f"{'============ RL-Kernel Serving Benchmark ============':^60}") |
| 22 | PerfReport._row("Hardware Device", metrics["device"]) |
| 23 | PerfReport._row("Model Architecture", f"Vocab={metrics['vocab']}, Seq={metrics['seq']}") |
| 24 | PerfReport._row("Dtype Precision", str(metrics["dtype"])) |
| 25 | |
| 26 | print(f"{'---------------Throughput & Efficiency----------------':^60}") |
| 27 | PerfReport._row("Max VRAM Reduction (GB)", f"{metrics['vram_saved']:.2f}") |
| 28 | PerfReport._row("Logp Compute Speedup", f"{metrics['logp_speedup']}") |
| 29 | PerfReport._row("Sampling Speedup (Fused)", f"{metrics['sample_speedup']}") |
| 30 | |
| 31 | print(f"{'---------------Latency Statistics (ms)----------------':^60}") |
| 32 | PerfReport._row("Mean Logp Latency", f"{metrics['avg_logp_ms']:.2f}") |
| 33 | PerfReport._row("Mean Sampling Latency", f"{metrics['avg_sample_ms']:.2f}") |
| 34 | PerfReport._row("Zero-Copy Sync Latency", f"{metrics['sync_ms']:.4f}") |
| 35 | |
| 36 | status = "PASSED (Industrial Grade)" if metrics["sync_ms"] < 100 else "OPTIMIZATION NEEDED" |
| 37 | PerfReport._row("System Sync Status", status) |
| 38 | |
| 39 | print("=" * 60) |
| 40 | |
| 41 | @staticmethod |
| 42 | def _row(key: str, value: Any): |