Update state_generator::create to handle type axes.

This commit is contained in:
Allison Vacanti
2020-12-31 16:22:09 -05:00
parent a01254fd7a
commit a1bd7b03b3
10 changed files with 527 additions and 119 deletions

View File

@@ -36,25 +36,25 @@ void axes_metadata::add_string_axis(std::string name,
const int64_axis &axes_metadata::get_int64_axis(std::string_view name) const
{
const auto &axis = this->get_axis(name, nvbench::axis_type::int64);
return static_cast<const nvbench::int64_axis&>(axis);
return static_cast<const nvbench::int64_axis &>(axis);
}
const float64_axis &axes_metadata::get_float64_axis(std::string_view name) const
{
const auto &axis = this->get_axis(name, nvbench::axis_type::float64);
return static_cast<const nvbench::float64_axis&>(axis);
return static_cast<const nvbench::float64_axis &>(axis);
}
const string_axis &axes_metadata::get_string_axis(std::string_view name) const
{
const auto &axis = this->get_axis(name, nvbench::axis_type::string);
return static_cast<const nvbench::string_axis&>(axis);
return static_cast<const nvbench::string_axis &>(axis);
}
const type_axis &axes_metadata::get_type_axis(std::string_view name) const
{
const auto &axis = this->get_axis(name, nvbench::axis_type::type);
return static_cast<const nvbench::type_axis&>(axis);
return static_cast<const nvbench::type_axis &>(axis);
}
const axis_base &axes_metadata::get_axis(std::string_view name) const
@@ -90,4 +90,23 @@ const axis_base &axes_metadata::get_axis(std::string_view name,
return axis;
}
const nvbench::type_axis &axes_metadata::get_type_axis(std::size_t index) const
{
for (const auto &axis : m_axes)
{
if (axis->get_type() == nvbench::axis_type::type)
{
const type_axis &t_axis = static_cast<const type_axis &>(*axis);
if (t_axis.get_axis_index() == index)
{
return t_axis;
}
}
}
throw std::runtime_error(fmt::format("{}:{}: Invalid type axis index: {}.",
__FILE__,
__LINE__,
index));
}
} // namespace nvbench

View File

@@ -50,6 +50,8 @@ struct axes_metadata
[[nodiscard]] const nvbench::axis_base &
get_axis(std::string_view name, nvbench::axis_type type) const;
[[nodiscard]] const nvbench::type_axis &get_type_axis(std::size_t index) const;
private:
axes_type m_axes;
};
@@ -63,15 +65,16 @@ void axes_metadata::set_type_axes_names(std::vector<std::string> names)
throw std::runtime_error("set_type_axes_names(): len(names) != "
"len(type_axes)");
}
auto names_iter = names.begin(); // contents will be moved from
nvbench::tl::foreach<type_axes>([&axes = m_axes, &names_iter](
std::size_t axis_index = 0;
auto names_iter = names.begin(); // contents will be moved from
nvbench::tl::foreach<type_axes>([&axes = m_axes, &names_iter, &axis_index](
[[maybe_unused]] auto wrapped_type) {
// Note:
// The word "type" appears 6 times in the next line.
// Every. Single. Token.
// Take a moment to just appreciate this beautiful language:
typedef typename decltype(wrapped_type)::type type_list;
auto axis = std::make_unique<nvbench::type_axis>(std::move(*names_iter++));
auto axis = std::make_unique<nvbench::type_axis>(std::move(*names_iter++),
axis_index++);
axis->set_inputs<type_list>();
axes.push_back(std::move(axis));
});

View File

@@ -1,10 +1,15 @@
#include <nvbench/detail/state_generator.cuh>
#include <nvbench/named_values.cuh>
#include <nvbench/type_axis.cuh>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cassert>
#include <functional>
#include <numeric>
namespace nvbench
{
@@ -12,58 +17,124 @@ namespace nvbench
namespace detail
{
std::vector<nvbench::state> state_generator::create(const axes_metadata &axes)
std::vector<std::vector<nvbench::state>>
state_generator::create(const axes_metadata &axes)
{
state_generator sg;
// Assemble states into a std::vector<std::vector<nvbench::state>>, where the
// outer vector has one inner vector per type_config, and all configs in an
// inner vector use the same type config. This should probably be wrapped up
// into a nicer data structure, but organizing states in this way makes
// matching up states to kernel_generator instantiations much easier during
// dispatch.
// vector of all axes:
const std::vector<std::unique_ptr<axis_base>> &axes_vec = axes.get_axes();
// Construct two state_generators:
// - Only type_axis objects,
// - Only non-type axes.
state_generator type_sg;
state_generator non_type_sg;
{
const auto &axes_vec = axes.get_axes();
std::for_each(axes_vec.cbegin(), axes_vec.cend(), [&sg](const auto &axis) {
if (axis->get_type() != nvbench::axis_type::type)
{
sg.add_axis(*axis);
}
});
// stage the type axes in a vector to allow sorting:
std::vector<std::reference_wrapper<const type_axis>> type_axes;
type_axes.reserve(axes_vec.size());
// Filter all axes by into type and non-type:
std::for_each(axes_vec.cbegin(),
axes_vec.cend(),
[&non_type_sg, &type_axes](const auto &axis) {
if (axis->get_type() == nvbench::axis_type::type)
{
type_axes.push_back(
std::cref(static_cast<const type_axis &>(*axis)));
}
else
{
non_type_sg.add_axis(*axis);
}
});
// Sort type axes by index:
std::sort(type_axes.begin(),
type_axes.end(),
[](const auto &axis_1, const auto &axis_2) {
return axis_1.get().get_axis_index() <
axis_2.get().get_axis_index();
});
std::for_each(type_axes.cbegin(),
type_axes.cend(),
[&type_sg](const auto &axis) { type_sg.add_axis(axis); });
}
std::vector<nvbench::state> states;
std::vector<std::vector<nvbench::state>> result;
{
states.reserve(sg.get_number_of_states());
for (sg.init(); sg.iter_valid(); sg.next())
const std::size_t num_type_configs = type_sg.get_number_of_states();
const std::size_t num_non_type_configs = non_type_sg.get_number_of_states();
result.reserve(num_type_configs);
// name / input_string pairs for type axes.
// Stored in named_values to simplify initializing the state objects.
nvbench::named_values type_config;
// Iterate through type axis combinations:
for (type_sg.init(); type_sg.iter_valid(); type_sg.next())
{
nvbench::state state;
for (const axis_index &axis_info : sg.get_current_indices())
// Construct map of current type axis parameters:
type_config.clear();
for (const auto &axis_info : type_sg.get_current_indices())
{
switch (axis_info.type)
{
default:
case axis_type::type:
assert("unreachable." && false);
break;
case axis_type::int64:
state.m_axis_values.set_int64(
axis_info.axis,
axes.get_int64_axis(axis_info.axis).get_value(axis_info.index));
break;
case axis_type::float64:
state.m_axis_values.set_float64(
axis_info.axis,
axes.get_float64_axis(axis_info.axis).get_value(axis_info.index));
break;
case axis_type::string:
state.m_axis_values.set_string(
axis_info.axis,
axes.get_string_axis(axis_info.axis).get_value(axis_info.index));
break;
}
type_config.set_string(
axis_info.axis,
axes.get_type_axis(axis_info.axis).get_input_string(axis_info.index));
}
states.push_back(std::move(state));
}
}
return states;
// Create the inner vector of states for the current type_config:
auto &states = result.emplace_back();
states.reserve(num_non_type_configs);
for (non_type_sg.init(); non_type_sg.iter_valid(); non_type_sg.next())
{
// Initialize each state with the current type_config:
nvbench::state state{type_config};
// Add non-type parameters to state:
for (const axis_index &axis_info : non_type_sg.get_current_indices())
{
switch (axis_info.type)
{
default:
case axis_type::type:
assert("unreachable." && false);
break;
case axis_type::int64:
state.m_axis_values.set_int64(
axis_info.axis,
axes.get_int64_axis(axis_info.axis).get_value(axis_info.index));
break;
case axis_type::float64:
state.m_axis_values.set_float64(
axis_info.axis,
axes.get_float64_axis(axis_info.axis)
.get_value(axis_info.index));
break;
case axis_type::string:
state.m_axis_values.set_string(
axis_info.axis,
axes.get_string_axis(axis_info.axis).get_value(axis_info.index));
break;
} // switch (type)
} // for (axis_info : current_indices)
states.push_back(std::move(state));
} // for non_type_sg configs
} // for type_sg configs
} // scope break
// phew.
return result;
}
std::size_t state_generator::get_number_of_states() const

View File

@@ -16,7 +16,8 @@ namespace detail
struct state_generator
{
static std::vector<nvbench::state> create(const axes_metadata &axes);
static std::vector<std::vector<nvbench::state>>
create(const axes_metadata &axes);
protected:
struct axis_index
@@ -32,9 +33,7 @@ protected:
this->add_axis(axis.get_name(), axis.get_type(), axis.get_size());
}
void add_axis(std::string axis,
nvbench::axis_type type,
std::size_t size)
void add_axis(std::string axis, nvbench::axis_type type, std::size_t size)
{
m_indices.push_back({std::move(axis), type, std::size_t{0}, size});
}

View File

@@ -34,6 +34,10 @@ protected:
state() = default;
state(nvbench::named_values values)
: m_axis_values{std::move(values)}
{}
nvbench::named_values m_axis_values;
};

View File

@@ -11,7 +11,7 @@ namespace nvbench
type_axis::~type_axis() = default;
std::size_t type_axis::get_index(const std::string &input_string) const
std::size_t type_axis::get_type_index(const std::string &input_string) const
{
auto it =
std::find(m_input_strings.cbegin(), m_input_strings.cend(), input_string);

View File

@@ -13,10 +13,11 @@ namespace nvbench
struct type_axis final : public axis_base
{
explicit type_axis(std::string name)
type_axis(std::string name, std::size_t axis_index)
: axis_base{std::move(name), axis_type::type}
, m_input_strings{}
, m_descriptions{}
, m_axis_index{axis_index}
{}
~type_axis() final;
@@ -24,7 +25,16 @@ struct type_axis final : public axis_base
template <typename TypeList>
void set_inputs();
std::size_t get_index(const std::string& input_string) const;
/**
* The index of this axis in the `benchmark`'s `type_axes` type list.
*/
[[nodiscard]] std::size_t get_axis_index() const { return m_axis_index; }
/**
* The index in this axis of the type with the specified `input_string`.
*/
[[nodiscard]] std::size_t
get_type_index(const std::string &input_string) const;
private:
std::size_t do_get_size() const final { return m_input_strings.size(); }
@@ -39,6 +49,7 @@ private:
std::vector<std::string> m_input_strings;
std::vector<std::string> m_descriptions;
std::size_t m_axis_index;
};
template <typename TypeList>

View File

@@ -29,6 +29,14 @@ void test_type_axes()
nvbench::axes_metadata axes;
axes.set_type_axes_names<three_type_axes>({"Integer", "Float", "Other"});
ASSERT(axes.get_type_axis("Integer").get_name() == "Integer");
ASSERT(axes.get_type_axis("Float").get_name() == "Float");
ASSERT(axes.get_type_axis("Other").get_name() == "Other");
ASSERT(axes.get_type_axis(0).get_name() == "Integer");
ASSERT(axes.get_type_axis(1).get_name() == "Float");
ASSERT(axes.get_type_axis(2).get_name() == "Other");
fmt::memory_buffer buffer;
for (const auto &axis : axes.get_axes())
{

View File

@@ -124,7 +124,14 @@ void test_basic()
void test_create()
{
using floats = nvbench::type_list<nvbench::float32_t, nvbench::float64_t>;
using ints = nvbench::type_list<nvbench::int32_t, nvbench::int64_t>;
using misc = nvbench::type_list<void, bool>;
using type_axes = nvbench::type_list<floats, ints, misc>;
nvbench::axes_metadata axes;
axes.set_type_axes_names<type_axes>({"Floats", "Ints", "Misc"});
axes.add_float64_axis("Radians", {3.14, 6.28});
axes.add_int64_axis("VecSize", {2, 3, 4}, nvbench::int64_axis_flags::none);
axes.add_int64_axis("NumInputs",
@@ -132,64 +139,349 @@ void test_create()
nvbench::int64_axis_flags::power_of_two);
axes.add_string_axis("Strategy", {"Recursive", "Iterative"});
const auto states = nvbench::detail::state_generator::create(axes);
const std::vector<std::vector<nvbench::state>> states =
nvbench::detail::state_generator::create(axes);
ASSERT_MSG(states.size() == (2 * 3 * 3 * 2),
"Actual: {} Expected: {}",
states.size(),
2 * 3 * 3 * 2);
// Outer vector has one entry per type_config
// 2 (Floats) * 2 (Ints) * 2 (Misc) = 8 total type_configs
ASSERT(states.size() == 8);
// Inner vectors have one entry per non-type config:
// 2 (Radians) * 3 (VecSize) * 3 (NumInputs) * 2 (Strategy) = 36
for (const auto &inner_states : states)
{
ASSERT(inner_states.size() == 36);
}
fmt::memory_buffer buffer;
for (const nvbench::state &state : states)
std::string table_format =
"| {:^5} | {:^10} | {:^6} | {:^4} | {:^4} | {:^7} | {:^7} | {:^9} | {:^9} |\n";
fmt::format_to(buffer, "\n");
fmt::format_to(buffer,
table_format,
"State",
"TypeConfig",
"Floats",
"Ints",
"Misc",
"Radians",
"VecSize",
"NumInputs",
"Strategy");
std::size_t type_config = 0;
std::size_t config = 0;
for (const auto &inner_states : states)
{
fmt::format_to(buffer,
"Radians: {:.2f} | "
"VecSize: {:1d} | "
"NumInputs: {:7d} | "
"Strategy: {}\n",
state.get_float64("Radians"),
state.get_int64("VecSize"),
state.get_int64("NumInputs"),
state.get_string("Strategy"));
for (const nvbench::state &state : inner_states)
{
fmt::format_to(buffer,
table_format,
config++,
type_config,
state.get_string("Floats"),
state.get_string("Ints"),
state.get_string("Misc"),
state.get_float64("Radians"),
state.get_int64("VecSize"),
state.get_int64("NumInputs"),
state.get_string("Strategy"));
}
type_config++;
}
const std::string ref =
R"expected(Radians: 3.14 | VecSize: 2 | NumInputs: 1024 | Strategy: Recursive
Radians: 6.28 | VecSize: 2 | NumInputs: 1024 | Strategy: Recursive
Radians: 3.14 | VecSize: 3 | NumInputs: 1024 | Strategy: Recursive
Radians: 6.28 | VecSize: 3 | NumInputs: 1024 | Strategy: Recursive
Radians: 3.14 | VecSize: 4 | NumInputs: 1024 | Strategy: Recursive
Radians: 6.28 | VecSize: 4 | NumInputs: 1024 | Strategy: Recursive
Radians: 3.14 | VecSize: 2 | NumInputs: 32768 | Strategy: Recursive
Radians: 6.28 | VecSize: 2 | NumInputs: 32768 | Strategy: Recursive
Radians: 3.14 | VecSize: 3 | NumInputs: 32768 | Strategy: Recursive
Radians: 6.28 | VecSize: 3 | NumInputs: 32768 | Strategy: Recursive
Radians: 3.14 | VecSize: 4 | NumInputs: 32768 | Strategy: Recursive
Radians: 6.28 | VecSize: 4 | NumInputs: 32768 | Strategy: Recursive
Radians: 3.14 | VecSize: 2 | NumInputs: 1048576 | Strategy: Recursive
Radians: 6.28 | VecSize: 2 | NumInputs: 1048576 | Strategy: Recursive
Radians: 3.14 | VecSize: 3 | NumInputs: 1048576 | Strategy: Recursive
Radians: 6.28 | VecSize: 3 | NumInputs: 1048576 | Strategy: Recursive
Radians: 3.14 | VecSize: 4 | NumInputs: 1048576 | Strategy: Recursive
Radians: 6.28 | VecSize: 4 | NumInputs: 1048576 | Strategy: Recursive
Radians: 3.14 | VecSize: 2 | NumInputs: 1024 | Strategy: Iterative
Radians: 6.28 | VecSize: 2 | NumInputs: 1024 | Strategy: Iterative
Radians: 3.14 | VecSize: 3 | NumInputs: 1024 | Strategy: Iterative
Radians: 6.28 | VecSize: 3 | NumInputs: 1024 | Strategy: Iterative
Radians: 3.14 | VecSize: 4 | NumInputs: 1024 | Strategy: Iterative
Radians: 6.28 | VecSize: 4 | NumInputs: 1024 | Strategy: Iterative
Radians: 3.14 | VecSize: 2 | NumInputs: 32768 | Strategy: Iterative
Radians: 6.28 | VecSize: 2 | NumInputs: 32768 | Strategy: Iterative
Radians: 3.14 | VecSize: 3 | NumInputs: 32768 | Strategy: Iterative
Radians: 6.28 | VecSize: 3 | NumInputs: 32768 | Strategy: Iterative
Radians: 3.14 | VecSize: 4 | NumInputs: 32768 | Strategy: Iterative
Radians: 6.28 | VecSize: 4 | NumInputs: 32768 | Strategy: Iterative
Radians: 3.14 | VecSize: 2 | NumInputs: 1048576 | Strategy: Iterative
Radians: 6.28 | VecSize: 2 | NumInputs: 1048576 | Strategy: Iterative
Radians: 3.14 | VecSize: 3 | NumInputs: 1048576 | Strategy: Iterative
Radians: 6.28 | VecSize: 3 | NumInputs: 1048576 | Strategy: Iterative
Radians: 3.14 | VecSize: 4 | NumInputs: 1048576 | Strategy: Iterative
Radians: 6.28 | VecSize: 4 | NumInputs: 1048576 | Strategy: Iterative
R"expected(
| State | TypeConfig | Floats | Ints | Misc | Radians | VecSize | NumInputs | Strategy |
| 0 | 0 | F32 | I32 | void | 3.14 | 2 | 1024 | Recursive |
| 1 | 0 | F32 | I32 | void | 6.28 | 2 | 1024 | Recursive |
| 2 | 0 | F32 | I32 | void | 3.14 | 3 | 1024 | Recursive |
| 3 | 0 | F32 | I32 | void | 6.28 | 3 | 1024 | Recursive |
| 4 | 0 | F32 | I32 | void | 3.14 | 4 | 1024 | Recursive |
| 5 | 0 | F32 | I32 | void | 6.28 | 4 | 1024 | Recursive |
| 6 | 0 | F32 | I32 | void | 3.14 | 2 | 32768 | Recursive |
| 7 | 0 | F32 | I32 | void | 6.28 | 2 | 32768 | Recursive |
| 8 | 0 | F32 | I32 | void | 3.14 | 3 | 32768 | Recursive |
| 9 | 0 | F32 | I32 | void | 6.28 | 3 | 32768 | Recursive |
| 10 | 0 | F32 | I32 | void | 3.14 | 4 | 32768 | Recursive |
| 11 | 0 | F32 | I32 | void | 6.28 | 4 | 32768 | Recursive |
| 12 | 0 | F32 | I32 | void | 3.14 | 2 | 1048576 | Recursive |
| 13 | 0 | F32 | I32 | void | 6.28 | 2 | 1048576 | Recursive |
| 14 | 0 | F32 | I32 | void | 3.14 | 3 | 1048576 | Recursive |
| 15 | 0 | F32 | I32 | void | 6.28 | 3 | 1048576 | Recursive |
| 16 | 0 | F32 | I32 | void | 3.14 | 4 | 1048576 | Recursive |
| 17 | 0 | F32 | I32 | void | 6.28 | 4 | 1048576 | Recursive |
| 18 | 0 | F32 | I32 | void | 3.14 | 2 | 1024 | Iterative |
| 19 | 0 | F32 | I32 | void | 6.28 | 2 | 1024 | Iterative |
| 20 | 0 | F32 | I32 | void | 3.14 | 3 | 1024 | Iterative |
| 21 | 0 | F32 | I32 | void | 6.28 | 3 | 1024 | Iterative |
| 22 | 0 | F32 | I32 | void | 3.14 | 4 | 1024 | Iterative |
| 23 | 0 | F32 | I32 | void | 6.28 | 4 | 1024 | Iterative |
| 24 | 0 | F32 | I32 | void | 3.14 | 2 | 32768 | Iterative |
| 25 | 0 | F32 | I32 | void | 6.28 | 2 | 32768 | Iterative |
| 26 | 0 | F32 | I32 | void | 3.14 | 3 | 32768 | Iterative |
| 27 | 0 | F32 | I32 | void | 6.28 | 3 | 32768 | Iterative |
| 28 | 0 | F32 | I32 | void | 3.14 | 4 | 32768 | Iterative |
| 29 | 0 | F32 | I32 | void | 6.28 | 4 | 32768 | Iterative |
| 30 | 0 | F32 | I32 | void | 3.14 | 2 | 1048576 | Iterative |
| 31 | 0 | F32 | I32 | void | 6.28 | 2 | 1048576 | Iterative |
| 32 | 0 | F32 | I32 | void | 3.14 | 3 | 1048576 | Iterative |
| 33 | 0 | F32 | I32 | void | 6.28 | 3 | 1048576 | Iterative |
| 34 | 0 | F32 | I32 | void | 3.14 | 4 | 1048576 | Iterative |
| 35 | 0 | F32 | I32 | void | 6.28 | 4 | 1048576 | Iterative |
| 36 | 1 | F64 | I32 | void | 3.14 | 2 | 1024 | Recursive |
| 37 | 1 | F64 | I32 | void | 6.28 | 2 | 1024 | Recursive |
| 38 | 1 | F64 | I32 | void | 3.14 | 3 | 1024 | Recursive |
| 39 | 1 | F64 | I32 | void | 6.28 | 3 | 1024 | Recursive |
| 40 | 1 | F64 | I32 | void | 3.14 | 4 | 1024 | Recursive |
| 41 | 1 | F64 | I32 | void | 6.28 | 4 | 1024 | Recursive |
| 42 | 1 | F64 | I32 | void | 3.14 | 2 | 32768 | Recursive |
| 43 | 1 | F64 | I32 | void | 6.28 | 2 | 32768 | Recursive |
| 44 | 1 | F64 | I32 | void | 3.14 | 3 | 32768 | Recursive |
| 45 | 1 | F64 | I32 | void | 6.28 | 3 | 32768 | Recursive |
| 46 | 1 | F64 | I32 | void | 3.14 | 4 | 32768 | Recursive |
| 47 | 1 | F64 | I32 | void | 6.28 | 4 | 32768 | Recursive |
| 48 | 1 | F64 | I32 | void | 3.14 | 2 | 1048576 | Recursive |
| 49 | 1 | F64 | I32 | void | 6.28 | 2 | 1048576 | Recursive |
| 50 | 1 | F64 | I32 | void | 3.14 | 3 | 1048576 | Recursive |
| 51 | 1 | F64 | I32 | void | 6.28 | 3 | 1048576 | Recursive |
| 52 | 1 | F64 | I32 | void | 3.14 | 4 | 1048576 | Recursive |
| 53 | 1 | F64 | I32 | void | 6.28 | 4 | 1048576 | Recursive |
| 54 | 1 | F64 | I32 | void | 3.14 | 2 | 1024 | Iterative |
| 55 | 1 | F64 | I32 | void | 6.28 | 2 | 1024 | Iterative |
| 56 | 1 | F64 | I32 | void | 3.14 | 3 | 1024 | Iterative |
| 57 | 1 | F64 | I32 | void | 6.28 | 3 | 1024 | Iterative |
| 58 | 1 | F64 | I32 | void | 3.14 | 4 | 1024 | Iterative |
| 59 | 1 | F64 | I32 | void | 6.28 | 4 | 1024 | Iterative |
| 60 | 1 | F64 | I32 | void | 3.14 | 2 | 32768 | Iterative |
| 61 | 1 | F64 | I32 | void | 6.28 | 2 | 32768 | Iterative |
| 62 | 1 | F64 | I32 | void | 3.14 | 3 | 32768 | Iterative |
| 63 | 1 | F64 | I32 | void | 6.28 | 3 | 32768 | Iterative |
| 64 | 1 | F64 | I32 | void | 3.14 | 4 | 32768 | Iterative |
| 65 | 1 | F64 | I32 | void | 6.28 | 4 | 32768 | Iterative |
| 66 | 1 | F64 | I32 | void | 3.14 | 2 | 1048576 | Iterative |
| 67 | 1 | F64 | I32 | void | 6.28 | 2 | 1048576 | Iterative |
| 68 | 1 | F64 | I32 | void | 3.14 | 3 | 1048576 | Iterative |
| 69 | 1 | F64 | I32 | void | 6.28 | 3 | 1048576 | Iterative |
| 70 | 1 | F64 | I32 | void | 3.14 | 4 | 1048576 | Iterative |
| 71 | 1 | F64 | I32 | void | 6.28 | 4 | 1048576 | Iterative |
| 72 | 2 | F32 | I64 | void | 3.14 | 2 | 1024 | Recursive |
| 73 | 2 | F32 | I64 | void | 6.28 | 2 | 1024 | Recursive |
| 74 | 2 | F32 | I64 | void | 3.14 | 3 | 1024 | Recursive |
| 75 | 2 | F32 | I64 | void | 6.28 | 3 | 1024 | Recursive |
| 76 | 2 | F32 | I64 | void | 3.14 | 4 | 1024 | Recursive |
| 77 | 2 | F32 | I64 | void | 6.28 | 4 | 1024 | Recursive |
| 78 | 2 | F32 | I64 | void | 3.14 | 2 | 32768 | Recursive |
| 79 | 2 | F32 | I64 | void | 6.28 | 2 | 32768 | Recursive |
| 80 | 2 | F32 | I64 | void | 3.14 | 3 | 32768 | Recursive |
| 81 | 2 | F32 | I64 | void | 6.28 | 3 | 32768 | Recursive |
| 82 | 2 | F32 | I64 | void | 3.14 | 4 | 32768 | Recursive |
| 83 | 2 | F32 | I64 | void | 6.28 | 4 | 32768 | Recursive |
| 84 | 2 | F32 | I64 | void | 3.14 | 2 | 1048576 | Recursive |
| 85 | 2 | F32 | I64 | void | 6.28 | 2 | 1048576 | Recursive |
| 86 | 2 | F32 | I64 | void | 3.14 | 3 | 1048576 | Recursive |
| 87 | 2 | F32 | I64 | void | 6.28 | 3 | 1048576 | Recursive |
| 88 | 2 | F32 | I64 | void | 3.14 | 4 | 1048576 | Recursive |
| 89 | 2 | F32 | I64 | void | 6.28 | 4 | 1048576 | Recursive |
| 90 | 2 | F32 | I64 | void | 3.14 | 2 | 1024 | Iterative |
| 91 | 2 | F32 | I64 | void | 6.28 | 2 | 1024 | Iterative |
| 92 | 2 | F32 | I64 | void | 3.14 | 3 | 1024 | Iterative |
| 93 | 2 | F32 | I64 | void | 6.28 | 3 | 1024 | Iterative |
| 94 | 2 | F32 | I64 | void | 3.14 | 4 | 1024 | Iterative |
| 95 | 2 | F32 | I64 | void | 6.28 | 4 | 1024 | Iterative |
| 96 | 2 | F32 | I64 | void | 3.14 | 2 | 32768 | Iterative |
| 97 | 2 | F32 | I64 | void | 6.28 | 2 | 32768 | Iterative |
| 98 | 2 | F32 | I64 | void | 3.14 | 3 | 32768 | Iterative |
| 99 | 2 | F32 | I64 | void | 6.28 | 3 | 32768 | Iterative |
| 100 | 2 | F32 | I64 | void | 3.14 | 4 | 32768 | Iterative |
| 101 | 2 | F32 | I64 | void | 6.28 | 4 | 32768 | Iterative |
| 102 | 2 | F32 | I64 | void | 3.14 | 2 | 1048576 | Iterative |
| 103 | 2 | F32 | I64 | void | 6.28 | 2 | 1048576 | Iterative |
| 104 | 2 | F32 | I64 | void | 3.14 | 3 | 1048576 | Iterative |
| 105 | 2 | F32 | I64 | void | 6.28 | 3 | 1048576 | Iterative |
| 106 | 2 | F32 | I64 | void | 3.14 | 4 | 1048576 | Iterative |
| 107 | 2 | F32 | I64 | void | 6.28 | 4 | 1048576 | Iterative |
| 108 | 3 | F64 | I64 | void | 3.14 | 2 | 1024 | Recursive |
| 109 | 3 | F64 | I64 | void | 6.28 | 2 | 1024 | Recursive |
| 110 | 3 | F64 | I64 | void | 3.14 | 3 | 1024 | Recursive |
| 111 | 3 | F64 | I64 | void | 6.28 | 3 | 1024 | Recursive |
| 112 | 3 | F64 | I64 | void | 3.14 | 4 | 1024 | Recursive |
| 113 | 3 | F64 | I64 | void | 6.28 | 4 | 1024 | Recursive |
| 114 | 3 | F64 | I64 | void | 3.14 | 2 | 32768 | Recursive |
| 115 | 3 | F64 | I64 | void | 6.28 | 2 | 32768 | Recursive |
| 116 | 3 | F64 | I64 | void | 3.14 | 3 | 32768 | Recursive |
| 117 | 3 | F64 | I64 | void | 6.28 | 3 | 32768 | Recursive |
| 118 | 3 | F64 | I64 | void | 3.14 | 4 | 32768 | Recursive |
| 119 | 3 | F64 | I64 | void | 6.28 | 4 | 32768 | Recursive |
| 120 | 3 | F64 | I64 | void | 3.14 | 2 | 1048576 | Recursive |
| 121 | 3 | F64 | I64 | void | 6.28 | 2 | 1048576 | Recursive |
| 122 | 3 | F64 | I64 | void | 3.14 | 3 | 1048576 | Recursive |
| 123 | 3 | F64 | I64 | void | 6.28 | 3 | 1048576 | Recursive |
| 124 | 3 | F64 | I64 | void | 3.14 | 4 | 1048576 | Recursive |
| 125 | 3 | F64 | I64 | void | 6.28 | 4 | 1048576 | Recursive |
| 126 | 3 | F64 | I64 | void | 3.14 | 2 | 1024 | Iterative |
| 127 | 3 | F64 | I64 | void | 6.28 | 2 | 1024 | Iterative |
| 128 | 3 | F64 | I64 | void | 3.14 | 3 | 1024 | Iterative |
| 129 | 3 | F64 | I64 | void | 6.28 | 3 | 1024 | Iterative |
| 130 | 3 | F64 | I64 | void | 3.14 | 4 | 1024 | Iterative |
| 131 | 3 | F64 | I64 | void | 6.28 | 4 | 1024 | Iterative |
| 132 | 3 | F64 | I64 | void | 3.14 | 2 | 32768 | Iterative |
| 133 | 3 | F64 | I64 | void | 6.28 | 2 | 32768 | Iterative |
| 134 | 3 | F64 | I64 | void | 3.14 | 3 | 32768 | Iterative |
| 135 | 3 | F64 | I64 | void | 6.28 | 3 | 32768 | Iterative |
| 136 | 3 | F64 | I64 | void | 3.14 | 4 | 32768 | Iterative |
| 137 | 3 | F64 | I64 | void | 6.28 | 4 | 32768 | Iterative |
| 138 | 3 | F64 | I64 | void | 3.14 | 2 | 1048576 | Iterative |
| 139 | 3 | F64 | I64 | void | 6.28 | 2 | 1048576 | Iterative |
| 140 | 3 | F64 | I64 | void | 3.14 | 3 | 1048576 | Iterative |
| 141 | 3 | F64 | I64 | void | 6.28 | 3 | 1048576 | Iterative |
| 142 | 3 | F64 | I64 | void | 3.14 | 4 | 1048576 | Iterative |
| 143 | 3 | F64 | I64 | void | 6.28 | 4 | 1048576 | Iterative |
| 144 | 4 | F32 | I32 | bool | 3.14 | 2 | 1024 | Recursive |
| 145 | 4 | F32 | I32 | bool | 6.28 | 2 | 1024 | Recursive |
| 146 | 4 | F32 | I32 | bool | 3.14 | 3 | 1024 | Recursive |
| 147 | 4 | F32 | I32 | bool | 6.28 | 3 | 1024 | Recursive |
| 148 | 4 | F32 | I32 | bool | 3.14 | 4 | 1024 | Recursive |
| 149 | 4 | F32 | I32 | bool | 6.28 | 4 | 1024 | Recursive |
| 150 | 4 | F32 | I32 | bool | 3.14 | 2 | 32768 | Recursive |
| 151 | 4 | F32 | I32 | bool | 6.28 | 2 | 32768 | Recursive |
| 152 | 4 | F32 | I32 | bool | 3.14 | 3 | 32768 | Recursive |
| 153 | 4 | F32 | I32 | bool | 6.28 | 3 | 32768 | Recursive |
| 154 | 4 | F32 | I32 | bool | 3.14 | 4 | 32768 | Recursive |
| 155 | 4 | F32 | I32 | bool | 6.28 | 4 | 32768 | Recursive |
| 156 | 4 | F32 | I32 | bool | 3.14 | 2 | 1048576 | Recursive |
| 157 | 4 | F32 | I32 | bool | 6.28 | 2 | 1048576 | Recursive |
| 158 | 4 | F32 | I32 | bool | 3.14 | 3 | 1048576 | Recursive |
| 159 | 4 | F32 | I32 | bool | 6.28 | 3 | 1048576 | Recursive |
| 160 | 4 | F32 | I32 | bool | 3.14 | 4 | 1048576 | Recursive |
| 161 | 4 | F32 | I32 | bool | 6.28 | 4 | 1048576 | Recursive |
| 162 | 4 | F32 | I32 | bool | 3.14 | 2 | 1024 | Iterative |
| 163 | 4 | F32 | I32 | bool | 6.28 | 2 | 1024 | Iterative |
| 164 | 4 | F32 | I32 | bool | 3.14 | 3 | 1024 | Iterative |
| 165 | 4 | F32 | I32 | bool | 6.28 | 3 | 1024 | Iterative |
| 166 | 4 | F32 | I32 | bool | 3.14 | 4 | 1024 | Iterative |
| 167 | 4 | F32 | I32 | bool | 6.28 | 4 | 1024 | Iterative |
| 168 | 4 | F32 | I32 | bool | 3.14 | 2 | 32768 | Iterative |
| 169 | 4 | F32 | I32 | bool | 6.28 | 2 | 32768 | Iterative |
| 170 | 4 | F32 | I32 | bool | 3.14 | 3 | 32768 | Iterative |
| 171 | 4 | F32 | I32 | bool | 6.28 | 3 | 32768 | Iterative |
| 172 | 4 | F32 | I32 | bool | 3.14 | 4 | 32768 | Iterative |
| 173 | 4 | F32 | I32 | bool | 6.28 | 4 | 32768 | Iterative |
| 174 | 4 | F32 | I32 | bool | 3.14 | 2 | 1048576 | Iterative |
| 175 | 4 | F32 | I32 | bool | 6.28 | 2 | 1048576 | Iterative |
| 176 | 4 | F32 | I32 | bool | 3.14 | 3 | 1048576 | Iterative |
| 177 | 4 | F32 | I32 | bool | 6.28 | 3 | 1048576 | Iterative |
| 178 | 4 | F32 | I32 | bool | 3.14 | 4 | 1048576 | Iterative |
| 179 | 4 | F32 | I32 | bool | 6.28 | 4 | 1048576 | Iterative |
| 180 | 5 | F64 | I32 | bool | 3.14 | 2 | 1024 | Recursive |
| 181 | 5 | F64 | I32 | bool | 6.28 | 2 | 1024 | Recursive |
| 182 | 5 | F64 | I32 | bool | 3.14 | 3 | 1024 | Recursive |
| 183 | 5 | F64 | I32 | bool | 6.28 | 3 | 1024 | Recursive |
| 184 | 5 | F64 | I32 | bool | 3.14 | 4 | 1024 | Recursive |
| 185 | 5 | F64 | I32 | bool | 6.28 | 4 | 1024 | Recursive |
| 186 | 5 | F64 | I32 | bool | 3.14 | 2 | 32768 | Recursive |
| 187 | 5 | F64 | I32 | bool | 6.28 | 2 | 32768 | Recursive |
| 188 | 5 | F64 | I32 | bool | 3.14 | 3 | 32768 | Recursive |
| 189 | 5 | F64 | I32 | bool | 6.28 | 3 | 32768 | Recursive |
| 190 | 5 | F64 | I32 | bool | 3.14 | 4 | 32768 | Recursive |
| 191 | 5 | F64 | I32 | bool | 6.28 | 4 | 32768 | Recursive |
| 192 | 5 | F64 | I32 | bool | 3.14 | 2 | 1048576 | Recursive |
| 193 | 5 | F64 | I32 | bool | 6.28 | 2 | 1048576 | Recursive |
| 194 | 5 | F64 | I32 | bool | 3.14 | 3 | 1048576 | Recursive |
| 195 | 5 | F64 | I32 | bool | 6.28 | 3 | 1048576 | Recursive |
| 196 | 5 | F64 | I32 | bool | 3.14 | 4 | 1048576 | Recursive |
| 197 | 5 | F64 | I32 | bool | 6.28 | 4 | 1048576 | Recursive |
| 198 | 5 | F64 | I32 | bool | 3.14 | 2 | 1024 | Iterative |
| 199 | 5 | F64 | I32 | bool | 6.28 | 2 | 1024 | Iterative |
| 200 | 5 | F64 | I32 | bool | 3.14 | 3 | 1024 | Iterative |
| 201 | 5 | F64 | I32 | bool | 6.28 | 3 | 1024 | Iterative |
| 202 | 5 | F64 | I32 | bool | 3.14 | 4 | 1024 | Iterative |
| 203 | 5 | F64 | I32 | bool | 6.28 | 4 | 1024 | Iterative |
| 204 | 5 | F64 | I32 | bool | 3.14 | 2 | 32768 | Iterative |
| 205 | 5 | F64 | I32 | bool | 6.28 | 2 | 32768 | Iterative |
| 206 | 5 | F64 | I32 | bool | 3.14 | 3 | 32768 | Iterative |
| 207 | 5 | F64 | I32 | bool | 6.28 | 3 | 32768 | Iterative |
| 208 | 5 | F64 | I32 | bool | 3.14 | 4 | 32768 | Iterative |
| 209 | 5 | F64 | I32 | bool | 6.28 | 4 | 32768 | Iterative |
| 210 | 5 | F64 | I32 | bool | 3.14 | 2 | 1048576 | Iterative |
| 211 | 5 | F64 | I32 | bool | 6.28 | 2 | 1048576 | Iterative |
| 212 | 5 | F64 | I32 | bool | 3.14 | 3 | 1048576 | Iterative |
| 213 | 5 | F64 | I32 | bool | 6.28 | 3 | 1048576 | Iterative |
| 214 | 5 | F64 | I32 | bool | 3.14 | 4 | 1048576 | Iterative |
| 215 | 5 | F64 | I32 | bool | 6.28 | 4 | 1048576 | Iterative |
| 216 | 6 | F32 | I64 | bool | 3.14 | 2 | 1024 | Recursive |
| 217 | 6 | F32 | I64 | bool | 6.28 | 2 | 1024 | Recursive |
| 218 | 6 | F32 | I64 | bool | 3.14 | 3 | 1024 | Recursive |
| 219 | 6 | F32 | I64 | bool | 6.28 | 3 | 1024 | Recursive |
| 220 | 6 | F32 | I64 | bool | 3.14 | 4 | 1024 | Recursive |
| 221 | 6 | F32 | I64 | bool | 6.28 | 4 | 1024 | Recursive |
| 222 | 6 | F32 | I64 | bool | 3.14 | 2 | 32768 | Recursive |
| 223 | 6 | F32 | I64 | bool | 6.28 | 2 | 32768 | Recursive |
| 224 | 6 | F32 | I64 | bool | 3.14 | 3 | 32768 | Recursive |
| 225 | 6 | F32 | I64 | bool | 6.28 | 3 | 32768 | Recursive |
| 226 | 6 | F32 | I64 | bool | 3.14 | 4 | 32768 | Recursive |
| 227 | 6 | F32 | I64 | bool | 6.28 | 4 | 32768 | Recursive |
| 228 | 6 | F32 | I64 | bool | 3.14 | 2 | 1048576 | Recursive |
| 229 | 6 | F32 | I64 | bool | 6.28 | 2 | 1048576 | Recursive |
| 230 | 6 | F32 | I64 | bool | 3.14 | 3 | 1048576 | Recursive |
| 231 | 6 | F32 | I64 | bool | 6.28 | 3 | 1048576 | Recursive |
| 232 | 6 | F32 | I64 | bool | 3.14 | 4 | 1048576 | Recursive |
| 233 | 6 | F32 | I64 | bool | 6.28 | 4 | 1048576 | Recursive |
| 234 | 6 | F32 | I64 | bool | 3.14 | 2 | 1024 | Iterative |
| 235 | 6 | F32 | I64 | bool | 6.28 | 2 | 1024 | Iterative |
| 236 | 6 | F32 | I64 | bool | 3.14 | 3 | 1024 | Iterative |
| 237 | 6 | F32 | I64 | bool | 6.28 | 3 | 1024 | Iterative |
| 238 | 6 | F32 | I64 | bool | 3.14 | 4 | 1024 | Iterative |
| 239 | 6 | F32 | I64 | bool | 6.28 | 4 | 1024 | Iterative |
| 240 | 6 | F32 | I64 | bool | 3.14 | 2 | 32768 | Iterative |
| 241 | 6 | F32 | I64 | bool | 6.28 | 2 | 32768 | Iterative |
| 242 | 6 | F32 | I64 | bool | 3.14 | 3 | 32768 | Iterative |
| 243 | 6 | F32 | I64 | bool | 6.28 | 3 | 32768 | Iterative |
| 244 | 6 | F32 | I64 | bool | 3.14 | 4 | 32768 | Iterative |
| 245 | 6 | F32 | I64 | bool | 6.28 | 4 | 32768 | Iterative |
| 246 | 6 | F32 | I64 | bool | 3.14 | 2 | 1048576 | Iterative |
| 247 | 6 | F32 | I64 | bool | 6.28 | 2 | 1048576 | Iterative |
| 248 | 6 | F32 | I64 | bool | 3.14 | 3 | 1048576 | Iterative |
| 249 | 6 | F32 | I64 | bool | 6.28 | 3 | 1048576 | Iterative |
| 250 | 6 | F32 | I64 | bool | 3.14 | 4 | 1048576 | Iterative |
| 251 | 6 | F32 | I64 | bool | 6.28 | 4 | 1048576 | Iterative |
| 252 | 7 | F64 | I64 | bool | 3.14 | 2 | 1024 | Recursive |
| 253 | 7 | F64 | I64 | bool | 6.28 | 2 | 1024 | Recursive |
| 254 | 7 | F64 | I64 | bool | 3.14 | 3 | 1024 | Recursive |
| 255 | 7 | F64 | I64 | bool | 6.28 | 3 | 1024 | Recursive |
| 256 | 7 | F64 | I64 | bool | 3.14 | 4 | 1024 | Recursive |
| 257 | 7 | F64 | I64 | bool | 6.28 | 4 | 1024 | Recursive |
| 258 | 7 | F64 | I64 | bool | 3.14 | 2 | 32768 | Recursive |
| 259 | 7 | F64 | I64 | bool | 6.28 | 2 | 32768 | Recursive |
| 260 | 7 | F64 | I64 | bool | 3.14 | 3 | 32768 | Recursive |
| 261 | 7 | F64 | I64 | bool | 6.28 | 3 | 32768 | Recursive |
| 262 | 7 | F64 | I64 | bool | 3.14 | 4 | 32768 | Recursive |
| 263 | 7 | F64 | I64 | bool | 6.28 | 4 | 32768 | Recursive |
| 264 | 7 | F64 | I64 | bool | 3.14 | 2 | 1048576 | Recursive |
| 265 | 7 | F64 | I64 | bool | 6.28 | 2 | 1048576 | Recursive |
| 266 | 7 | F64 | I64 | bool | 3.14 | 3 | 1048576 | Recursive |
| 267 | 7 | F64 | I64 | bool | 6.28 | 3 | 1048576 | Recursive |
| 268 | 7 | F64 | I64 | bool | 3.14 | 4 | 1048576 | Recursive |
| 269 | 7 | F64 | I64 | bool | 6.28 | 4 | 1048576 | Recursive |
| 270 | 7 | F64 | I64 | bool | 3.14 | 2 | 1024 | Iterative |
| 271 | 7 | F64 | I64 | bool | 6.28 | 2 | 1024 | Iterative |
| 272 | 7 | F64 | I64 | bool | 3.14 | 3 | 1024 | Iterative |
| 273 | 7 | F64 | I64 | bool | 6.28 | 3 | 1024 | Iterative |
| 274 | 7 | F64 | I64 | bool | 3.14 | 4 | 1024 | Iterative |
| 275 | 7 | F64 | I64 | bool | 6.28 | 4 | 1024 | Iterative |
| 276 | 7 | F64 | I64 | bool | 3.14 | 2 | 32768 | Iterative |
| 277 | 7 | F64 | I64 | bool | 6.28 | 2 | 32768 | Iterative |
| 278 | 7 | F64 | I64 | bool | 3.14 | 3 | 32768 | Iterative |
| 279 | 7 | F64 | I64 | bool | 6.28 | 3 | 32768 | Iterative |
| 280 | 7 | F64 | I64 | bool | 3.14 | 4 | 32768 | Iterative |
| 281 | 7 | F64 | I64 | bool | 6.28 | 4 | 32768 | Iterative |
| 282 | 7 | F64 | I64 | bool | 3.14 | 2 | 1048576 | Iterative |
| 283 | 7 | F64 | I64 | bool | 6.28 | 2 | 1048576 | Iterative |
| 284 | 7 | F64 | I64 | bool | 3.14 | 3 | 1048576 | Iterative |
| 285 | 7 | F64 | I64 | bool | 6.28 | 3 | 1048576 | Iterative |
| 286 | 7 | F64 | I64 | bool | 3.14 | 4 | 1048576 | Iterative |
| 287 | 7 | F64 | I64 | bool | 6.28 | 4 | 1048576 | Iterative |
)expected";
const std::string test = fmt::to_string(buffer);

View File

@@ -8,8 +8,9 @@
void test_empty()
{
nvbench::type_axis axis("Basic");
nvbench::type_axis axis("Basic", 0);
ASSERT(axis.get_name() == "Basic");
ASSERT(axis.get_axis_index() == 0);
ASSERT(axis.get_type() == nvbench::axis_type::type);
ASSERT(axis.get_size() == 0);
@@ -20,7 +21,7 @@ void test_empty()
void test_single()
{
nvbench::type_axis axis("Single");
nvbench::type_axis axis("Single", 0);
ASSERT(axis.get_name() == "Single");
axis.set_inputs<nvbench::type_list<nvbench::int32_t>>();
@@ -32,7 +33,7 @@ void test_single()
void test_several()
{
nvbench::type_axis axis("Several");
nvbench::type_axis axis("Several", 0);
ASSERT(axis.get_name() == "Several");
axis.set_inputs<
@@ -47,17 +48,17 @@ void test_several()
ASSERT(axis.get_description(2) == "");
}
void test_get_index()
void test_get_type_index()
{
nvbench::type_axis axis("GetIndexTest");
nvbench::type_axis axis("GetIndexTest", 0);
axis.set_inputs<
nvbench::
type_list<nvbench::int8_t, nvbench::uint16_t, nvbench::float32_t, bool>>();
ASSERT(axis.get_index("I8") == 0);
ASSERT(axis.get_index("U16") == 1);
ASSERT(axis.get_index("F32") == 2);
ASSERT(axis.get_index("bool") == 3);
ASSERT(axis.get_type_index("I8") == 0);
ASSERT(axis.get_type_index("U16") == 1);
ASSERT(axis.get_type_index("F32") == 2);
ASSERT(axis.get_type_index("bool") == 3);
}
int main()
@@ -65,5 +66,5 @@ int main()
test_empty();
test_single();
test_several();
test_get_index();
test_get_type_index();
}