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

Method perf_report

src/program.cpp:932–1050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

930}
931
932void program::perf_report(
933 std::ostream& os, std::size_t n, parameter_map params, std::size_t batch, bool detailed) const
934{
935 auto& ctx = this->impl->contexts;
936 // Run once by itself
937 eval(params);
938 this->finish();
939 // Run and time entire program
940 std::vector<double> total_vec;
941 total_vec.reserve(n);
942 for(std::size_t i = 0; i < n; i++)
943 {
944 total_vec.push_back(time<milliseconds>([&] {
945 eval(params);
946 this->finish();
947 }));
948 }
949 std::sort(total_vec.begin(), total_vec.end());
950 std::unordered_map<instruction_ref, std::vector<double>> ins_vec;
951 // Fill the map
952 generic_eval(*this, ctx, params, [&](auto ins, auto) {
953 ins_vec[ins].reserve(n);
954 return argument{ins->get_shape(), nullptr};
955 });
956
957 // Run and time each instruction
958 for(std::size_t i = 0; i < n; i++)
959 {
960 generic_eval(*this, ctx, params, [&](auto ins, auto f) {
961 argument result;
962 ins_vec[ins].push_back(time<milliseconds>([&] {
963 result = f();
964 this->impl->contexts[ins->get_target_id()].finish();
965 }));
966 return result;
967 });
968 }
969 for(auto&& p : ins_vec)
970 std::sort(p.second.begin(), p.second.end());
971 // Run and time implicit overhead
972 std::vector<double> overhead_vec;
973 overhead_vec.reserve(n);
974 for(std::size_t i = 0; i < n; i++)
975 {
976 overhead_vec.push_back(time<milliseconds>([&] { dry_run(params); }));
977 }
978 double total_time = common_average(total_vec);
979 double min_time = total_vec.front();
980 double max_time = total_vec.back();
981 double mean_time = mean(total_vec);
982 double median_time = median(total_vec);
983 double percentile_90_time = percentile(total_vec, 0.90);
984 double percentile_95_time = percentile(total_vec, 0.95);
985 double percentile_99_time = percentile(total_vec, 0.99);
986 double rate = 1000.0 / total_time;
987 double overhead_time = common_average(overhead_vec);
988 double overhead_percent = overhead_time * 100.0 / total_time;
989 double total_instruction_time = 0.0;

Callers 2

TEST_CASEFunction · 0.80
runMethod · 0.80

Calls 15

finishMethod · 0.95
printMethod · 0.95
generic_evalFunction · 0.85
common_averageFunction · 0.85
medianFunction · 0.85
percentileFunction · 0.85
perf_groupFunction · 0.85
ceilClass · 0.85
get_target_idMethod · 0.80
frontMethod · 0.80
backMethod · 0.80
atMethod · 0.80

Tested by

no test coverage detected