Skip to content

Commit

Permalink
Disable 'module::Switcher' validation code for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
kouchy committed Mar 31, 2024
1 parent f2f67cf commit fccb9ab
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 33 deletions.
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,11 @@ if(AFF3CT_CORE_TESTS)
add_executable(aff3ct-core-test-nested-do-while-loops $<TARGET_OBJECTS:aff3ct-core-obj>
${CMAKE_CURRENT_SOURCE_DIR}/tests/bootstrap/nested_do_while_loops.cpp)
set_target_properties(aff3ct-core-test-nested-do-while-loops PROPERTIES
OUTPUT_NAME test-nested-do-while-loops
POSITION_INDEPENDENT_CODE ON) # set -fpie
OUTPUT_NAME test-nested-do-while-loops
POSITION_INDEPENDENT_CODE ON) # set -fpie
list(APPEND aff3ct_core_tests_list aff3ct-core-test-nested-do-while-loops)
list(APPEND aff3ct_core_targets_list aff3ct-core-test-nested-do-while-loops)


add_executable(aff3ct-core-test-simple-pipeline $<TARGET_OBJECTS:aff3ct-core-obj>
${CMAKE_CURRENT_SOURCE_DIR}/tests/bootstrap/simple_pipeline.cpp)
set_target_properties(aff3ct-core-test-simple-pipeline PROPERTIES
Expand Down
6 changes: 6 additions & 0 deletions docs/pipeline_ctrl_flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ void Check_ctrl_flow(Node n, List path_taken):
throw an error
```

!!! danger
<u>Edit 2024-03-31</u>: We found that the previous check algorithm is not
valid in the general case. For instance, in the case of nested do while
loops, it will raise an error when there is none. Thus, this check has
been disabled until a more robust solution can be found.

### Tests

Some specific tests have been added to the project to validate the robustness of
Expand Down
1 change: 0 additions & 1 deletion include/Runtime/Pipeline/Pipeline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ class Pipeline : public tools::Interface_get_set_n_frames
std::vector<std::vector<runtime::Task*>> get_tasks_per_threads() const;
std::vector<std::vector<runtime::Task*>> get_tasks_per_types () const;


inline const std::vector<std::vector<runtime::Task*>>& get_firsts_tasks() const;
inline const std::vector<std::vector<runtime::Task*>>& get_lasts_tasks() const;

Expand Down
6 changes: 5 additions & 1 deletion src/Runtime/Sequence/Sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,8 @@ ::init(const std::vector<TA*> &firsts, const std::vector<TA*> &lasts, const std:
}

this->n_tasks = taid;
this->check_ctrl_flow(root);
// this->check_ctrl_flow(root); // /!\ this check has been commented because it is known to do not work in the
// general case
this->_init<SS>(root);
this->update_firsts_and_lasts_tasks();
this->gen_processes();
Expand Down Expand Up @@ -2457,6 +2458,8 @@ ::set_n_frames(const size_t n_frames)
}
}

// /!\ this check has been commented because it is known to do not work in the general case
/*
template<class SS>
void Sequence
::check_ctrl_flow(tools::Digraph_node<SS>* root)
Expand Down Expand Up @@ -2548,3 +2551,4 @@ ::check_ctrl_flow(tools::Digraph_node<SS>* root)
std::vector<tools::Digraph_node<SS>*> already_parsed_nodes;
return check_control_flow_parity(root, already_parsed_nodes);
}
*/
56 changes: 28 additions & 28 deletions tests/bootstrap/nested_do_while_loops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,20 @@ int main(int argc, char** argv)
iterator2.set_custom_name("IteratorOut");

// sockets binding

switcher2 ["select::in_data1" ] = initializer ["initialize::out" ];
iterator2 ("iterate" ) = switcher2 ("select" );
switcher2 ["commute::in_ctrl" ] = iterator2 ["iterate::out" ];
switcher ["select::in_data1" ] = switcher2 ["select::out_data" ];
iterator ("iterate" ) = switcher ("select" );
switcher ["commute::in_ctrl" ] = iterator ["iterate::out" ];
(*incs[0]) ["increment::in" ] = switcher ["select::out_data" ];
switcher2 [ "select::in_data1"] = initializer ["initialize::out" ];
switcher [ "select::in_data1"] = switcher2 [ "select::out_data" ];
iterator ( "iterate" ) = switcher ( "select" );
switcher [ "commute::in_ctrl" ] = iterator [ "iterate::out" ];
(*incs[0]) ["increment::in" ] = switcher [ "select::out_data" ];
for (size_t s = 0; s < incs.size() -1; s++)
(*incs[s+1])["increment::in" ] = (*incs[s]) [ "increment::out" ];
switcher ["commute::in_data" ] = (*incs[incs.size()-1])[ "increment::out" ];
switcher ["select::in_data0" ] = switcher ["commute::out_data0"];
switcher2 ["commute::in_data" ] = switcher ["commute::out_data1"];
switcher2 ["select::in_data0" ] = switcher2 ["commute::out_data0"];
finalizer ["finalize::in" ] = switcher2 ["commute::out_data1"];
(*incs[s+1])["increment::in" ] = (*incs[s]) [ "increment::out" ];
switcher [ "commute::in_data" ] = (*incs[incs.size()-1])[ "increment::out" ];
switcher [ "select::in_data0"] = switcher [ "commute::out_data0"];
iterator2 ( "iterate" ) = switcher [ "commute::out_data1"];
switcher2 [ "commute::in_data" ] = switcher [ "commute::out_data1"];
switcher2 [ "commute::in_ctrl" ] = iterator2 [ "iterate::out" ];
switcher2 [ "select::in_data0"] = switcher2 [ "commute::out_data0"];
finalizer [ "finalize::in" ] = switcher2 [ "commute::out_data1"];

runtime::Sequence sequence_nested_loops(initializer("initialize"), n_threads);
sequence_nested_loops.set_n_frames(n_inter_frames);
Expand Down Expand Up @@ -249,7 +248,7 @@ int main(int argc, char** argv)
chain_sleep_time += inc->get_ns();

auto theoretical_time = ((chain_sleep_time * n_exec * n_inter_frames) / 1000.f / 1000.f / n_threads) *
(iterator.get_limit() * iterator2.get_limit());
((iterator.get_limit() +1) * (iterator2.get_limit() +1));
std::cout << "Sequence theoretical time: " << theoretical_time << " ms" << std::endl;

// verification of the sequence execution
Expand Down Expand Up @@ -290,20 +289,21 @@ int main(int argc, char** argv)
}

sequence_nested_loops.set_n_frames(1);
/*switcher2 [module::swi::tsk::select ][1] .unbind(initializer[module::ini::sck::initialize::out]);
iterator2 [module::ite::tsk::iterate] .unbind(switcher2 [module::swi::tsk::select][3]);
switcher2 [module::swi::tsk::commute][0] .unbind(switcher2 [module::swi::tsk::select][2]);
switcher2 [module::swi::tsk::commute][1] .unbind(iterator2 [module::ite::sck::iterate::out]);
switcher [module::swi::tsk::select ][1] .unbind(switcher2 [module::swi::tsk::commute][2]);
iterator [module::ite::tsk::iterate] .unbind(switcher [module::swi::tsk::select ][3]);
switcher [module::swi::tsk::commute][0] .unbind(switcher [module::swi::tsk::select ][2]);
switcher [module::swi::tsk::commute][1] .unbind(iterator [module::ite::sck::iterate::out]);
(*incs[0])[module::inc::sck::increment::in].unbind(switcher [module::swi::tsk::commute][2]);

switcher2 [module::swi::tsk::select ][ 1].unbind(initializer [module::ini::sck::initialize::out]);
switcher [module::swi::tsk::select ][ 1].unbind(switcher2 [module::swi::tsk::select ][ 2]);
iterator [module::ite::tsk::iterate ].unbind(switcher [module::swi::tsk::select ]);
switcher [module::swi::tsk::commute ][ 1].unbind(iterator [module::ite::sck::iterate ::out]);
(*incs[0]) [module::inc::sck::increment::in].unbind(switcher [module::swi::tsk::select ][ 2]);
for (size_t s = 0; s < incs.size() -1; s++)
(*incs[s+1])[module::inc::sck::increment::in].unbind((*incs[s])[module::inc::sck::increment::out]);
switcher [module::swi::tsk::select][0] .unbind((*incs[incs.size()-1])[module::inc::sck::increment::out]);
switcher2 [module::swi::tsk::select][0] .unbind(switcher [module::swi::tsk::commute][3]);
finalizer [module::fin::sck::finalize::in] .unbind(switcher2 [module::swi::tsk::commute][3]);*/
(*incs[s+1])[module::inc::sck::increment::in].unbind((*incs[s]) [module::inc::sck::increment ::out]);
switcher [module::swi::tsk::commute ][ 0].unbind((*incs[incs.size()-1])[module::inc::sck::increment ::out]);
switcher [module::swi::tsk::select ][ 0].unbind(switcher [module::swi::tsk::commute ][ 2]);
iterator2 [module::ite::tsk::iterate ].unbind(switcher [module::swi::tsk::commute ][ 3]);
switcher2 [module::swi::tsk::commute ][ 0].unbind(switcher [module::swi::tsk::commute ][ 3]);
switcher2 [module::swi::tsk::commute ][ 1].unbind(iterator2 [module::ite::sck::iterate ::out]);
switcher2 [module::swi::tsk::select ][ 0].unbind(switcher2 [module::swi::tsk::commute ][ 2]);
finalizer [module::fin::sck::finalize ::in].unbind(switcher2 [module::swi::tsk::commute ][ 3]);

return test_results;
}

0 comments on commit fccb9ab

Please sign in to comment.