Skip to content

Commit 78213c7

Browse files
committed
Apply review comments
1 parent a5b5304 commit 78213c7

File tree

5 files changed

+56
-56
lines changed

5 files changed

+56
-56
lines changed

include/oneapi/tbb/detail/_flow_graph_indexer_impl.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -224,22 +224,22 @@
224224
}; //indexer_node_base
225225

226226
// type generators
227-
template<typename T0, typename... TN>
227+
template<typename... TN>
228228
struct indexer_types {
229-
using output_type = tagged_msg<std::size_t, T0, TN...>;
230-
using input_ports_type = std::tuple<indexer_input_port<T0>, indexer_input_port<TN>...>;
231-
using indexer_base_type = indexer_node_base<input_ports_type, output_type, std::tuple<T0, TN...>>;
229+
using output_type = tagged_msg<std::size_t, TN...>;
230+
using input_ports_type = std::tuple<indexer_input_port<TN>...>;
231+
using indexer_base_type = indexer_node_base<input_ports_type, output_type, std::tuple<TN...>>;
232232
};
233233

234-
template<typename... T>
235-
class unfolded_indexer_node : public indexer_types<T0, TN...>::indexer_base_type {
234+
template<typename... TN>
235+
class unfolded_indexer_node : public indexer_types<TN...>::indexer_base_type {
236236
public:
237-
using input_ports_type = typename indexer_types<T0, TN...>::input_ports_type;
238-
using output_type = typename indexer_types<T0, TN...>::output_type;
239-
using tuple_types = std::tuple<T0, TN...>;
237+
using input_ports_type = typename indexer_types<TN...>::input_ports_type;
238+
using output_type = typename indexer_types<TN...>::output_type;
239+
using tuple_types = std::tuple<TN...>;
240240

241241
private:
242-
using base_type = typename indexer_types<T0, TN...>::indexer_base_type;
242+
using base_type = typename indexer_types<TN...>::indexer_base_type;
243243
public:
244244
unfolded_indexer_node(graph& g) : base_type(g) {}
245245
unfolded_indexer_node(const unfolded_indexer_node &other) : base_type(other) {}

include/oneapi/tbb/flow_graph.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ class function_node
961961

962962
//! implements a function node that supports Input -> (set of outputs)
963963
// Output is a tuple of output types.
964-
template<typename Input, typename Output, typename Policy = queueing>
964+
template<typename Input, typename OutputTuple, typename Policy = queueing>
965965
__TBB_requires(std::default_initializable<Input> &&
966966
std::copy_constructible<Input>)
967967
class multifunction_node :
@@ -980,11 +980,11 @@ class multifunction_node :
980980
typedef cache_aligned_allocator<Input> internals_allocator;
981981

982982
protected:
983-
static const int N = std::tuple_size<Output>::value;
983+
static const int N = std::tuple_size<OutputTuple>::value;
984984
public:
985985
using input_type = Input;
986986
using output_type = null_type;
987-
typedef typename wrap_tuple_elements<multifunction_output, Output>::type output_ports_type;
987+
using output_ports_type = typename wrap_tuple_elements<multifunction_output, OutputTuple>::type;
988988
using input_impl_type =
989989
multifunction_input<input_type, output_ports_type, Policy, internals_allocator>;
990990
using input_queue_type = function_input_queue<input_type, internals_allocator>;

test/common/graph_utils.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
Copyright (c) 2005-2025 Intel Corporation
3+
Copyright (c) 2025 UXL Foundation Contributors
34
45
Licensed under the Apache License, Version 2.0 (the "License");
56
you may not use this file except in compliance with the License.
@@ -970,4 +971,45 @@ void test(unsigned N) {
970971

971972
} // namespace lightweight_testing
972973

974+
template <std::size_t N>
975+
struct edge_maker {
976+
template <typename Sender, typename NodeType>
977+
static void make(Sender& sender, NodeType& node) {
978+
oneapi::tbb::flow::make_edge(sender, oneapi::tbb::flow::input_port<N - 1>(node));
979+
edge_maker<N - 1>::make(sender, node);
980+
}
981+
982+
template <typename Sender, typename NodeType>
983+
static void make(std::vector<Sender>& senders, NodeType& node) {
984+
oneapi::tbb::flow::make_edge(senders[N - 1], oneapi::tbb::flow::input_port<N - 1>(node));
985+
edge_maker<N - 1>::make(senders, node);
986+
}
987+
};
988+
989+
template <>
990+
struct edge_maker<0> {
991+
template <typename Sender, typename NodeType>
992+
static void make(Sender&, NodeType&) {}
993+
};
994+
995+
template <std::size_t N>
996+
struct assert_all_items_equal_impl {
997+
template <typename TupleLike, typename Message>
998+
static void compare(const TupleLike& tuple_like, const Message& message) {
999+
CHECK_MESSAGE(std::get<N - 1>(tuple_like) == message, "Unexpected element");
1000+
assert_all_items_equal_impl<N - 1>::compare(tuple_like, message);
1001+
}
1002+
};
1003+
1004+
template <>
1005+
struct assert_all_items_equal_impl<0> {
1006+
template <typename TupleLike, typename Message>
1007+
static void compare(const TupleLike&, const Message&) {}
1008+
};
1009+
1010+
template <typename TupleLike, typename Message>
1011+
void assert_all_items_equal_to(const TupleLike& tuple_like, const Message& message) {
1012+
assert_all_items_equal_impl<std::tuple_size<TupleLike>::value>::compare(tuple_like, message);
1013+
}
1014+
9731015
#endif // __TBB_harness_graph_H

test/conformance/conformance_flowgraph.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/*
22
Copyright (c) 2020-2025 Intel Corporation
3-
Copyright (c) 2025 UXL Foundation Contributors
43
54
Licensed under the Apache License, Version 2.0 (the "License");
65
you may not use this file except in compliance with the License.
@@ -812,25 +811,4 @@ void test_with_reserving_join_node_class() {
812811
if at least one successor accepts the tuple must consume messages");
813812
}
814813
}
815-
816-
template <std::size_t N>
817-
struct edge_maker {
818-
template <typename Sender, typename NodeType>
819-
static void make(Sender& sender, NodeType& node) {
820-
oneapi::tbb::flow::make_edge(sender, oneapi::tbb::flow::input_port<N - 1>(node));
821-
edge_maker<N - 1>::make(sender, node);
822-
}
823-
824-
template <typename Sender, typename NodeType>
825-
static void make(std::vector<Sender>& senders, NodeType& node) {
826-
oneapi::tbb::flow::make_edge(senders[N - 1], oneapi::tbb::flow::input_port<N - 1>(node));
827-
edge_maker<N - 1>::make(senders, node);
828-
}
829-
};
830-
831-
template <>
832-
struct edge_maker<0> {
833-
template <typename Sender, typename NodeType>
834-
static void make(Sender&, NodeType&) {}
835-
};
836814
#endif // __TBB_test_conformance_conformance_flowgraph_H

test/conformance/conformance_join_node.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -351,26 +351,6 @@ join_node_type_generator_t<N, JoinPolicy> make_join_node(oneapi::tbb::flow::grap
351351
return make_join_node_helper<N, JoinPolicy, N, BodyToGenerate...>::make(g, body...);
352352
}
353353

354-
template <std::size_t N>
355-
struct tuple_assert_impl {
356-
template <typename Tuple, typename Message>
357-
static void make(const Tuple& tuple, const Message& message) {
358-
CHECK_MESSAGE(std::get<N - 1>(tuple) == message, "Unexpected tuple element");
359-
tuple_assert_impl<N - 1>::make(tuple, message);
360-
}
361-
};
362-
363-
template <>
364-
struct tuple_assert_impl<0> {
365-
template <typename Tuple, typename Message>
366-
static void make(const Tuple&, const Message&) {}
367-
};
368-
369-
template <std::size_t N, typename Tuple, typename Message>
370-
void tuple_assert(const Tuple& tuple, const Message& message) {
371-
tuple_assert_impl<N>::make(tuple, message);
372-
}
373-
374354
template <typename JoinPolicy, std::size_t N, typename... Body>
375355
void test_join_node_with_n_inputs_impl(Body... body) {
376356
static_assert(sizeof...(Body) <= 1, "Unexpected arguments");
@@ -391,7 +371,7 @@ void test_join_node_with_n_inputs_impl(Body... body) {
391371

392372
std::size_t body_counter = 0;
393373
function_node<output_tuple> function(g, serial, [&](const output_tuple& tuple) {
394-
tuple_assert<N>(tuple, message);
374+
assert_all_items_equal_to(tuple, message);
395375
++body_counter;
396376
});
397377

0 commit comments

Comments
 (0)