()
| 605 | # --------------------------------------------------------------------------- |
| 606 | |
| 607 | def main() -> None: |
| 608 | parser = argparse.ArgumentParser( |
| 609 | description="AutoKernel Kernel Extractor -- Generate baseline kernels from profiling results.", |
| 610 | ) |
| 611 | parser.add_argument( |
| 612 | "--report", |
| 613 | type=str, |
| 614 | default=DEFAULT_REPORT_PATH, |
| 615 | help="Path to profile_report.json (default: workspace/profile_report.json)", |
| 616 | ) |
| 617 | parser.add_argument( |
| 618 | "--top", |
| 619 | type=int, |
| 620 | default=None, |
| 621 | help="Extract only the top-N kernels by rank", |
| 622 | ) |
| 623 | parser.add_argument( |
| 624 | "--kernel-type", |
| 625 | type=str, |
| 626 | default=None, |
| 627 | help="Extract only kernels of this type (e.g., matmul, flash_attention)", |
| 628 | ) |
| 629 | parser.add_argument( |
| 630 | "--backend", |
| 631 | type=str, |
| 632 | choices=["triton", "cuda"], |
| 633 | default="triton", |
| 634 | help="Backend for starter kernels: 'triton' (default) or 'cuda' (native CUDA C++)", |
| 635 | ) |
| 636 | |
| 637 | args = parser.parse_args() |
| 638 | |
| 639 | extract_kernels( |
| 640 | report_path=args.report, |
| 641 | top_n=args.top, |
| 642 | kernel_type_filter=args.kernel_type, |
| 643 | backend=args.backend, |
| 644 | ) |
| 645 | |
| 646 | |
| 647 | if __name__ == "__main__": |
no test coverage detected