MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / print_report

Function print_report

profile.py:748–819  ·  view source on GitHub ↗

Pretty-print the profiling results to the terminal.

(
    records: List[KernelRecord],
    report: Dict[str, Any],
    model_desc: str,
)

Source from the content-addressed store, hash-verified

746# ---------------------------------------------------------------------------
747
748def print_report(
749 records: List[KernelRecord],
750 report: Dict[str, Any],
751 model_desc: str,
752) -> None:
753 """Pretty-print the profiling results to the terminal."""
754 print()
755 print("=" * 60)
756 print(" AutoKernel Profiler")
757 print("=" * 60)
758 print(f" Model: {model_desc}")
759 print(f" Input: shape={report['input_shape']}, dtype={report['dtype']}")
760 print(f" GPU: {report['gpu_name']}")
761 print(f" Total GPU time: {report['total_gpu_time_ms']:.3f} ms "
762 f"({report['total_kernels']} kernels, {PROFILE_ITERS} iterations)")
763 print()
764
765 # Kernel ranking table
766 print("=" * 60)
767 print(" KERNEL RANKING (by GPU time)")
768 print("=" * 60)
769 header = (
770 f"{'Rank':>4} | {'Op Type':<20} | {'GPU Time (ms)':>13} | "
771 f"{'Calls':>5} | {'Pct':>6} | {'Cumul':>6} | Supported"
772 )
773 print(header)
774 print("-" * len(header))
775
776 display_count = min(len(records), 20)
777 for i in range(display_count):
778 k = report["top_kernels"][i]
779 sup_label = "YES" if k["autokernel_supported"] else "no"
780 print(
781 f"{k['rank']:>4} | {k['op_type']:<20} | "
782 f"{k['gpu_time_ms']:>13.3f} | "
783 f"{k['call_count']:>5} | "
784 f"{k['pct_total']:>5.1f}% | "
785 f"{k['cumulative_pct']:>5.1f}% | "
786 f"{sup_label}"
787 )
788
789 remaining = len(records) - display_count
790 if remaining > 0:
791 remaining_pct = sum(
792 report["top_kernels"][i]["pct_total"]
793 for i in range(display_count, len(report["top_kernels"]))
794 )
795 print(f" ... ({remaining} more kernels, {remaining_pct:.1f}% of total)")
796
797 # Optimization summary
798 summary = report["optimization_summary"]
799 print()
800 print("=" * 60)
801 print(" OPTIMIZATION PLAN")
802 print("=" * 60)
803
804 supported_types = set()
805 for r in records:

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected