| 612 | } |
| 613 | |
| 614 | program compile() |
| 615 | { |
| 616 | auto p = l.load(); |
| 617 | // Dont compile if its already been compiled |
| 618 | |
| 619 | if(p.is_compiled()) |
| 620 | { |
| 621 | if(ct.target_name == "gpu") |
| 622 | { |
| 623 | if(is_offload_copy_set(p) and not co.offload_copy) |
| 624 | { |
| 625 | std::cerr |
| 626 | << "[WARNING]: MIGraphX program was likely compiled with offload_copy " |
| 627 | "set, Try " |
| 628 | "passing " |
| 629 | "`--enable-offload-copy` if program run fails.\n"; |
| 630 | } |
| 631 | else if(not is_offload_copy_set(p) and co.offload_copy) |
| 632 | { |
| 633 | std::cerr << "[WARNING]: MIGraphX program was likely compiled without " |
| 634 | "offload_copy set, Try " |
| 635 | "removing " |
| 636 | "`--enable-offload-copy` if program run " |
| 637 | "fails.\n"; |
| 638 | } |
| 639 | } |
| 640 | |
| 641 | std::cout << "The program is already compiled, skipping compilation ..." << std::endl; |
| 642 | if(to_fp16 or to_bf16 or to_int8 or to_fp8 or to_int4) |
| 643 | { |
| 644 | std::cerr |
| 645 | << "[WARNING]: Quantization options are ignored as the program is already " |
| 646 | "compiled." |
| 647 | << std::endl; |
| 648 | } |
| 649 | return p; |
| 650 | } |
| 651 | auto t = ct.get_target(); |
| 652 | if(to_fp16) |
| 653 | { |
| 654 | std::cout << "Quantizing to fp16 ... " << std::endl; |
| 655 | quantize_fp16(p); |
| 656 | } |
| 657 | if(to_bf16) |
| 658 | { |
| 659 | std::cout << "Quantizing to bf16 ... " << std::endl; |
| 660 | quantize_bf16(p); |
| 661 | } |
| 662 | if(to_int8) |
| 663 | { |
| 664 | std::cout << "Quantizing to int8 ... " << std::endl; |
| 665 | quantize_int8(p, t, {host_params(p)}); |
| 666 | } |
| 667 | if(to_fp8) |
| 668 | { |
| 669 | std::cout << "Quantizing to fp8 ... " << std::endl; |
| 670 | quantize_fp8(p, t, {host_params(p)}); |
| 671 | } |
no test coverage detected