MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / compile

Method compile

src/driver/main.cpp:614–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 }

Callers 10

run_refFunction · 0.45
run_targetFunction · 0.45
runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
MIGRAPHX_PYBIND11_MODULEFunction · 0.45
prepareMethod · 0.45
migraphx_program_compileFunction · 0.45

Calls 10

is_offload_copy_setFunction · 0.85
quantize_int4_weightsFunction · 0.85
is_compiledMethod · 0.80
get_targetMethod · 0.80
quantize_fp16Function · 0.50
quantize_bf16Function · 0.50
quantize_int8Function · 0.50
quantize_fp8Function · 0.50
loadMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected