mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-04-20 14:58:54 +00:00
Convert states into a key-value mapping.
This commit is contained in:
committed by
Allison Vacanti
parent
0491e9c17f
commit
c2868dfa35
@@ -175,11 +175,11 @@ void json_printer::do_print_benchmark_results(const benchmark_vector &benches)
|
||||
auto &states = bench["states"];
|
||||
for (const auto &exec_state : bench_ptr->get_states())
|
||||
{
|
||||
const auto state_index = states.size();
|
||||
auto &st = states[state_index];
|
||||
auto &st = states[exec_state.get_axis_values_as_string()];
|
||||
|
||||
st["index"] = state_index;
|
||||
st["description"] = exec_state.get_axis_values_as_string();
|
||||
// TODO: Determine if these need to be part of the state key as well
|
||||
// for uniqueness. The device already is, but the type config index is
|
||||
// not.
|
||||
st["device"] = exec_state.get_device()->get_id();
|
||||
st["type_config_index"] = exec_state.get_type_config_index();
|
||||
|
||||
|
||||
@@ -32,13 +32,6 @@ def find_matching_bench(needle, haystack):
|
||||
return None
|
||||
|
||||
|
||||
def find_matching_state(needle, haystack):
|
||||
for hay in haystack:
|
||||
if hay["description"] == needle["description"]:
|
||||
return hay
|
||||
return None
|
||||
|
||||
|
||||
def find_named_value(name, named_values):
|
||||
for named_value in named_values:
|
||||
if named_value["name"] == name:
|
||||
@@ -52,15 +45,11 @@ def get_row(cmp_benches, ref_benches):
|
||||
if not ref_bench:
|
||||
continue
|
||||
|
||||
for cmp_state in cmp_bench["states"]:
|
||||
ref_state = find_matching_state(cmp_state, ref_bench["states"])
|
||||
for cmp_state_description, cmp_state in cmp_bench["states"].items():
|
||||
ref_state = ref_bench["states"].get(cmp_state_description)
|
||||
if not ref_state:
|
||||
continue
|
||||
|
||||
# TODO this should just be the parameterization. Refactor NVBench lib so
|
||||
# this can happen.
|
||||
state_description = cmp_state["description"]
|
||||
|
||||
cmp_summaries = cmp_state["summaries"]
|
||||
ref_summaries = ref_state["summaries"]
|
||||
|
||||
@@ -86,7 +75,7 @@ def get_row(cmp_benches, ref_benches):
|
||||
ref_noise = find_named_value("value", ref_noise_summary["values"])["value"]
|
||||
|
||||
# Relative time comparison
|
||||
yield [cmp_bench['name'], state_description] + f"{cmp_time - ref_time} {cmp_time} {ref_time} {cmp_noise:0.6f}% {ref_noise:0.6f}%\n".split()
|
||||
yield [cmp_bench['name'], cmp_state_description] + f"{cmp_time - ref_time} {cmp_time} {ref_time} {cmp_noise:0.6f}% {ref_noise:0.6f}%\n".split()
|
||||
|
||||
|
||||
print(tabulate.tabulate((row for row in get_row(cmp_benches, ref_benches)),
|
||||
|
||||
Reference in New Issue
Block a user