Skip to content

Commit c820ec0

Browse files
committed
Rename some space -> spaces for clarity.
1 parent d7989dd commit c820ec0

File tree

4 files changed

+57
-53
lines changed

4 files changed

+57
-53
lines changed

nvbench/axes_metadata.cuh

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace nvbench
4242
struct axes_metadata
4343
{
4444
using axes_type = std::vector<std::unique_ptr<nvbench::axis_base>>;
45-
using iteration_space_type = std::vector<std::unique_ptr<nvbench::iteration_space_base>>;
45+
using iteration_spaces_type = std::vector<std::unique_ptr<nvbench::iteration_space_base>>;
4646

4747
template <typename... TypeAxes>
4848
explicit axes_metadata(nvbench::type_list<TypeAxes...>);
@@ -71,7 +71,6 @@ struct axes_metadata
7171
{
7272
const std::size_t start = this->m_axes.size();
7373
const std::size_t count = sizeof...(Args);
74-
// (this->add_axis(std::forward<Args>(args)), ...);
7574
(m_axes.push_back(args.clone()), ...);
7675
this->add_zip_space(start, count);
7776
}
@@ -86,13 +85,13 @@ struct axes_metadata
8685
this->add_user_iteration_space(std::move(make), start, count);
8786
}
8887

89-
[[nodiscard]] const iteration_space_type &get_type_iteration_space() const
88+
[[nodiscard]] const iteration_spaces_type &get_type_iteration_spaces() const
9089
{
91-
return m_type_space;
90+
return m_type_iteration_spaces;
9291
}
93-
[[nodiscard]] const iteration_space_type &get_value_iteration_space() const
92+
[[nodiscard]] const iteration_spaces_type &get_value_iteration_spaces() const
9493
{
95-
return m_value_space;
94+
return m_value_iteration_spaces;
9695
}
9796

9897
[[nodiscard]] const nvbench::int64_axis &get_int64_axis(std::string_view name) const;
@@ -126,8 +125,8 @@ struct axes_metadata
126125
private:
127126
axes_type m_axes;
128127
std::size_t m_type_axe_count = 0;
129-
iteration_space_type m_type_space;
130-
iteration_space_type m_value_space;
128+
iteration_spaces_type m_type_iteration_spaces;
129+
iteration_spaces_type m_value_iteration_spaces;
131130

132131
void add_zip_space(std::size_t first_index, std::size_t count);
133132
void add_user_iteration_space(std::function<nvbench::make_user_space_signature> make,
@@ -144,22 +143,23 @@ axes_metadata::axes_metadata(nvbench::type_list<TypeAxes...>)
144143
auto names = axes_metadata::generate_default_type_axis_names(num_type_axes);
145144

146145
auto names_iter = names.begin(); // contents will be moved from
147-
nvbench::tl::foreach<type_axes_list>(
148-
[&axes = m_axes, &spaces = m_type_space, &names_iter]([[maybe_unused]] auto wrapped_type) {
149-
// This is always called before other axes are added, so the length of the
150-
// axes vector will be the type axis index:
151-
const std::size_t type_axis_index = axes.size();
152-
153-
spaces.push_back(std::make_unique<linear_axis_space>(type_axis_index));
154-
155-
// Note:
156-
// The word "type" appears 6 times in the next line.
157-
// Every. Single. Token.
158-
typedef typename decltype(wrapped_type)::type type_list;
159-
auto axis = std::make_unique<nvbench::type_axis>(std::move(*names_iter++), type_axis_index);
160-
axis->template set_inputs<type_list>();
161-
axes.push_back(std::move(axis));
162-
});
146+
nvbench::tl::foreach<type_axes_list>([&axes = m_axes,
147+
&spaces = m_type_iteration_spaces,
148+
&names_iter]([[maybe_unused]] auto wrapped_type) {
149+
// This is always called before other axes are added, so the length of the
150+
// axes vector will be the type axis index:
151+
const std::size_t type_axis_index = axes.size();
152+
153+
spaces.push_back(std::make_unique<linear_axis_space>(type_axis_index));
154+
155+
// Note:
156+
// The word "type" appears 6 times in the next line.
157+
// Every. Single. Token.
158+
typedef typename decltype(wrapped_type)::type type_list;
159+
auto axis = std::make_unique<nvbench::type_axis>(std::move(*names_iter++), type_axis_index);
160+
axis->template set_inputs<type_list>();
161+
axes.push_back(std::move(axis));
162+
});
163163
m_type_axe_count = m_axes.size();
164164
}
165165

nvbench/axes_metadata.cxx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ axes_metadata::axes_metadata(const axes_metadata &other)
4141
}
4242

4343
m_type_axe_count = other.m_type_axe_count;
44-
m_type_space.reserve(other.m_type_space.size());
45-
for (const auto &iter : other.m_type_space)
44+
m_type_iteration_spaces.reserve(other.m_type_iteration_spaces.size());
45+
for (const auto &iter : other.m_type_iteration_spaces)
4646
{
47-
m_type_space.push_back(iter->clone());
47+
m_type_iteration_spaces.push_back(iter->clone());
4848
}
4949

50-
m_value_space.reserve(other.m_value_space.size());
51-
for (const auto &iter : other.m_value_space)
50+
m_value_iteration_spaces.reserve(other.m_value_iteration_spaces.size());
51+
for (const auto &iter : other.m_value_iteration_spaces)
5252
{
53-
m_value_space.push_back(iter->clone());
53+
m_value_iteration_spaces.push_back(iter->clone());
5454
}
5555
}
5656

@@ -65,18 +65,18 @@ axes_metadata &axes_metadata::operator=(const axes_metadata &other)
6565

6666
m_type_axe_count = other.m_type_axe_count;
6767

68-
m_type_space.clear();
69-
m_type_space.reserve(other.m_type_space.size());
70-
for (const auto &iter : other.m_type_space)
68+
m_type_iteration_spaces.clear();
69+
m_type_iteration_spaces.reserve(other.m_type_iteration_spaces.size());
70+
for (const auto &iter : other.m_type_iteration_spaces)
7171
{
72-
m_type_space.push_back(iter->clone());
72+
m_type_iteration_spaces.push_back(iter->clone());
7373
}
7474

75-
m_value_space.clear();
76-
m_value_space.reserve(other.m_value_space.size());
77-
for (const auto &iter : other.m_value_space)
75+
m_value_iteration_spaces.clear();
76+
m_value_iteration_spaces.reserve(other.m_value_iteration_spaces.size());
77+
for (const auto &iter : other.m_value_iteration_spaces)
7878
{
79-
m_value_space.push_back(iter->clone());
79+
m_value_iteration_spaces.push_back(iter->clone());
8080
}
8181

8282
return *this;
@@ -128,7 +128,7 @@ void axes_metadata::add_string_axis(std::string name, std::vector<std::string> d
128128

129129
void axes_metadata::add_axis(const axis_base &axis)
130130
{
131-
m_value_space.push_back(std::make_unique<linear_axis_space>(m_axes.size()));
131+
m_value_iteration_spaces.push_back(std::make_unique<linear_axis_space>(m_axes.size()));
132132
m_axes.push_back(axis.clone());
133133
}
134134

@@ -161,7 +161,7 @@ void axes_metadata::add_zip_space(std::size_t first_index, std::size_t count)
161161

162162
// add the new tied iteration space
163163
auto tied = std::make_unique<zip_axis_space>(std::move(input_indices));
164-
m_value_space.push_back(std::move(tied));
164+
m_value_iteration_spaces.push_back(std::move(tied));
165165
}
166166

167167
void axes_metadata::add_user_iteration_space(std::function<nvbench::make_user_space_signature> make,
@@ -182,7 +182,7 @@ void axes_metadata::add_user_iteration_space(std::function<nvbench::make_user_sp
182182
}
183183

184184
auto user_func = make(std::move(input_indices));
185-
m_value_space.push_back(std::move(user_func));
185+
m_value_iteration_spaces.push_back(std::move(user_func));
186186
}
187187

188188
const int64_axis &axes_metadata::get_int64_axis(std::string_view name) const

nvbench/benchmark_base.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ std::size_t benchmark_base::get_config_count() const
7777
{
7878
const auto &axes = m_axes.get_axes();
7979
const std::size_t value_count =
80-
nvbench::detail::transform_reduce(m_axes.get_value_iteration_space().cbegin(),
81-
m_axes.get_value_iteration_space().cend(),
80+
nvbench::detail::transform_reduce(m_axes.get_value_iteration_spaces().cbegin(),
81+
m_axes.get_value_iteration_spaces().cend(),
8282
std::size_t{1},
8383
std::multiplies<>{},
8484
[&axes](const auto &space) { return space->get_size(axes); });
8585

8686
const std::size_t type_count = nvbench::detail::transform_reduce(
87-
m_axes.get_type_iteration_space().cbegin(),
88-
m_axes.get_type_iteration_space().cend(),
87+
m_axes.get_type_iteration_spaces().cbegin(),
88+
m_axes.get_type_iteration_spaces().cend(),
8989
std::size_t{1},
9090
std::multiplies<>{},
9191
[&axes](const auto &space) { return space->get_active_count(axes); });

nvbench/detail/state_generator.cxx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ state_generator::state_generator(const benchmark_base &bench)
9292
void state_generator::build_axis_configs()
9393
{
9494
const axes_metadata &axes = m_benchmark.get_axes();
95-
const auto &type_space = axes.get_type_iteration_space();
96-
const auto &value_space = axes.get_value_iteration_space();
95+
const auto &type_spaces = axes.get_type_iteration_spaces();
96+
const auto &value_spaces = axes.get_value_iteration_spaces();
9797

9898
state_iterator ti;
9999
state_iterator vi;
@@ -105,12 +105,16 @@ void state_generator::build_axis_configs()
105105
// instantiations.
106106
{
107107
const auto &axes_vec = axes.get_axes();
108-
std::for_each(type_space.crbegin(), type_space.crend(), [&ti, &axes_vec](const auto &space) {
109-
ti.add_iteration_space(space->get_iterator(axes_vec));
110-
});
111-
std::for_each(value_space.begin(), value_space.end(), [&vi, &axes_vec](const auto &space) {
112-
vi.add_iteration_space(space->get_iterator(axes_vec));
113-
});
108+
std::for_each(type_spaces.crbegin(), //
109+
type_spaces.crend(),
110+
[&ti, &axes_vec](const auto &space) {
111+
ti.add_iteration_space(space->get_iterator(axes_vec));
112+
});
113+
std::for_each(value_spaces.begin(), //
114+
value_spaces.end(),
115+
[&vi, &axes_vec](const auto &space) {
116+
vi.add_iteration_space(space->get_iterator(axes_vec));
117+
});
114118
}
115119

116120
m_type_axis_configs.clear();

0 commit comments

Comments
 (0)