Commit ebf6fec7 by FritzFlorian

Move inputs and outputs to correct namespace.

parent 6333222f
......@@ -4,14 +4,14 @@
#include <tuple>
#include <array>
#include <pls/pls.h>
#include <pls/dataflow/internal/inputs.h>
#include <pls/dataflow/internal/outputs.h>
#include <pls/dataflow/internal/function_node.h>
#include <pls/dataflow/internal/graph.h>
#include <pls/dataflow/internal/switch_node.h>
#include <pls/dataflow/internal/split_node.h>
#include <pls/dataflow/internal/merge_node.h>
#include "pls/pls.h"
#include "pls/dataflow/internal/inputs.h"
#include "pls/dataflow/internal/outputs.h"
#include "pls/dataflow/internal/function_node.h"
#include "pls/dataflow/internal/graph.h"
#include "pls/dataflow/internal/switch_node.h"
#include "pls/dataflow/internal/split_node.h"
#include "pls/dataflow/internal/merge_node.h"
int main() {
using namespace pls::dataflow;
......
......@@ -56,7 +56,7 @@ add_library(pls STATIC
include/pls/internal/scheduling/task.h src/internal/scheduling/task.cpp
include/pls/internal/scheduling/scheduler_memory.h src/internal/scheduling/scheduler_memory.cpp
include/pls/internal/scheduling/lambda_task.h
include/pls/dataflow/internal/split_node.h)
include/pls/dataflow/internal/split_node.h include/pls/internal/helpers/member_function.h)
# Add everything in `./include` to be in the include path of this project
target_include_directories(pls
PUBLIC
......
......@@ -26,10 +26,10 @@ template<typename INS, typename OUTS, typename F>
class function_node {};
template<typename I0, typename ...I, typename O0, typename ...O, typename F>
class function_node<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>, F> : public node {
class function_node<inputs<I0, I...>, outputs<O0, O...>, F> : public node {
private:
// Our own type
using self_type = function_node<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>, F>;
using self_type = function_node<inputs<I0, I...>, outputs<O0, O...>, F>;
// Input-Output port types
using multi_in_port_type = multi_in_port<self_type, 0, I0, I...>;
......
......@@ -8,7 +8,7 @@ namespace internal {
template<typename I0, typename ...I, typename O0, typename ...O, typename F>
template<int POS, typename T>
void function_node<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>, F>::
void function_node<inputs<I0, I...>, outputs<O0, O...>, F>::
token_pushed(token<T> token) {
auto current_memory = get_invocation<invocation_memory>(token.invocation());
......@@ -24,7 +24,7 @@ token_pushed(token<T> token) {
// Helpers for actually calling the work lambda
//////////////////////////////////////////////////////////////////
template<typename I0, typename ...I, typename O0, typename ...O, typename F>
void function_node<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>, F>::
void function_node<inputs<I0, I...>, outputs<O0, O...>, F>::
execute_function(invocation_memory *invocation_memory, invocation_info invocation_info) {
auto lambda = [&]() {
input_tuple &inputs = invocation_memory->input_buffer_;
......@@ -39,14 +39,14 @@ execute_function(invocation_memory *invocation_memory, invocation_info invocatio
template<typename I0, typename ...I, typename O0, typename ...O, typename F>
template<int N, typename ...OT>
struct function_node<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>, F>::
struct function_node<inputs<I0, I...>, outputs<O0, O...>, F>::
propagate_output {
propagate_output(multi_out_port_type &, output_tuple &) {}
void propagate() {}
};
template<typename I0, typename ...I, typename O0, typename ...O, typename F>
template<int N, typename OT1, typename ...OT>
struct function_node<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>, F>::
struct function_node<inputs<I0, I...>, outputs<O0, O...>, F>::
propagate_output<N, OT1, OT...> {
multi_out_port_type &out_port_;
output_tuple &output_tuple_;
......@@ -62,14 +62,14 @@ propagate_output<N, OT1, OT...> {
template<typename I0, typename ...I, typename O0, typename ...O, typename F>
template<typename T>
void function_node<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>, F>::
void function_node<inputs<I0, I...>, outputs<O0, O...>, F>::
set_invocation_info(token<T> &token, invocation_info invocation_info) {
token.set_invocation(invocation_info);
}
template<typename I0, typename ...I, typename O0, typename ...O, typename F>
template<int ...IS, int ...OS>
void function_node<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>, F>::
void function_node<inputs<I0, I...>, outputs<O0, O...>, F>::
execute_function_internal(input_tuple &inputs, sequence<IS...>,
output_tuple &outputs, sequence<OS...>,
invocation_info invocation_info) {
......
......@@ -24,10 +24,10 @@ template<typename INS, typename OUTS>
class graph {};
template<typename I0, typename ...I, typename O0, typename ...O>
class graph<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>> : public node {
class graph<inputs<I0, I...>, outputs<O0, O...>> : public node {
private:
// Our own type
using self_type = graph<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>>;
using self_type = graph<inputs<I0, I...>, outputs<O0, O...>>;
// Input-Output port types (internal)
using inputs_type = multi_out_port<I0, I...>;
......@@ -71,6 +71,7 @@ class graph<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>> :
void build();
void run(value_input_tuple input, value_output_tuple &output) {
PLS_ASSERT(build_state_ == build_state::built, "Must build graph before running it!")
pls::scheduler::spawn_child<run_graph_task>(this, input, &output);
}
......
......@@ -8,14 +8,14 @@ namespace internal {
template<typename I0, typename ...I, typename O0, typename ...O>
template<int POS, typename T>
void graph<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>>::
void graph<inputs<I0, I...>, outputs<O0, O...>>::
token_pushed(token<T> token) {
auto invocation = get_invocation<invocation_memory>(token.invocation());
std::get<POS>(*invocation->output_buffer_) = token.value();
}
template<typename I0, typename ...I, typename O0, typename ...O>
void graph<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>>::
void graph<inputs<I0, I...>, outputs<O0, O...>>::
build() {
PLS_ASSERT(build_state_ == build_state::fresh, "Must only build a dataflow graph once!")
PLS_ASSERT(is_fully_connected(), "Must fully connect all inputs/outputs inside a dataflow graph!")
......@@ -31,7 +31,7 @@ build() {
}
template<typename I0, typename ...I, typename O0, typename ...O>
void graph<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>>::
void graph<inputs<I0, I...>, outputs<O0, O...>>::
build_recursive(node *node) {
if (node->build_state_ != build_state::fresh) {
return; // Already visited
......@@ -48,7 +48,7 @@ build_recursive(node *node) {
}
template<typename I0, typename ...I, typename O0, typename ...O>
void graph<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>>::
void graph<inputs<I0, I...>, outputs<O0, O...>>::
add_node(node *new_node) {
new_node->memory_index_ = num_nodes_++;
......@@ -63,7 +63,7 @@ add_node(node *new_node) {
template<typename I0, typename ...I, typename O0, typename ...O>
template<int N, typename ...IT>
struct graph<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>>::
struct graph<inputs<I0, I...>, outputs<O0, O...>>::
feed_inputs {
feed_inputs(inputs_type &, value_input_tuple &, invocation_info &) {}
void run() {}
......@@ -71,7 +71,7 @@ feed_inputs {
template<typename I0, typename ...I, typename O0, typename ...O>
template<int N, typename IT1, typename ...IT>
struct graph<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>>::
struct graph<inputs<I0, I...>, outputs<O0, O...>>::
feed_inputs<N, IT1, IT...> {
inputs_type &inputs_;
value_input_tuple &input_values_;
......@@ -90,7 +90,7 @@ feed_inputs<N, IT1, IT...> {
};
template<typename I0, typename ...I, typename O0, typename ...O>
class graph<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, O...>>::run_graph_task : public pls::task {
class graph<inputs<I0, I...>, outputs<O0, O...>>::run_graph_task : public pls::task {
graph *self_;
value_input_tuple input_;
value_output_tuple *output_;
......
......@@ -4,6 +4,7 @@
namespace pls {
namespace dataflow {
namespace internal {
template<typename I1, typename ...I>
struct inputs {
......@@ -11,5 +12,6 @@ struct inputs {
}
}
}
#endif //PLS_DATAFLOW_INTERNAL_INPUTS_H_
......@@ -3,6 +3,7 @@
#define PLS_DATAFLOW_INTERNAL_NODE_H_
#include "build_state.h"
#include "token.h"
namespace pls {
namespace dataflow {
......
......@@ -4,6 +4,7 @@
namespace pls {
namespace dataflow {
namespace internal {
template<typename O0, typename ...O>
struct outputs {
......@@ -11,5 +12,6 @@ struct outputs {
}
}
}
#endif //PLS_DATAFLOW_INTERNAL_OUTPUTS_H_
......@@ -7,6 +7,7 @@
#include "pls/internal/scheduling/task.h"
#include "pls/internal/scheduling/scheduler.h"
#include "pls/internal/helpers/unique_id.h"
#include "pls/internal/helpers/member_function.h"
namespace pls {
......@@ -16,6 +17,8 @@ using internal::scheduling::malloc_scheduler_memory;
using internal::scheduling::scheduler;
using unique_id = internal::helpers::unique_id;
template<class C, typename R, typename ...ARGS>
using member_function = internal::helpers::member_function<C, R, ARGS...>;
using internal::scheduling::task;
using internal::scheduling::lambda_task_by_reference;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment