diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-08-01 16:05:06 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 11:49:36 -0800 |
commit | bddaac5e2678b190719228fc26877af5a2ef1910 (patch) | |
tree | c8e092f84e09ecd5e678c829294973068a7da292 /host/lib/include/uhdlib | |
parent | 35db8f741b4b6c0bccf04e68e81bc4ecb5018357 (diff) | |
download | uhd-bddaac5e2678b190719228fc26877af5a2ef1910.tar.gz uhd-bddaac5e2678b190719228fc26877af5a2ef1910.tar.bz2 uhd-bddaac5e2678b190719228fc26877af5a2ef1910.zip |
rfnoc: graph: Optimize property propagation algorithm
This introduces the concept of a resolution context, because the
property propagation algorithm needs to behave differently when called
during an initialization step (e.g. when the graph is committed), or
when the user changes a property on one of the nodes after it was
committed.
The algorithm is modified as follows:
- When called during an initialization step, then all nodes get resolved
at least once. If nodes added new properties, then all nodes get
touched again until the max number of iterations is reached.
- When called because a node modified one of its properties, then that
node is always resolved first. From there, all other nodes are
resolved in topological order. However, the algorithm immediately
terminates as soon as there are no more dirty nodes.
- When called because a node modified one of its properties, but the
graph is currently not in a committed state, then that node will do
a local property resolution.
Diffstat (limited to 'host/lib/include/uhdlib')
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/graph.hpp | 4 | ||||
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/resolve_context.hpp | 26 |
2 files changed, 29 insertions, 1 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/graph.hpp b/host/lib/include/uhdlib/rfnoc/graph.hpp index 5b735b624..286f2303f 100644 --- a/host/lib/include/uhdlib/rfnoc/graph.hpp +++ b/host/lib/include/uhdlib/rfnoc/graph.hpp @@ -10,6 +10,7 @@ #include <uhd/rfnoc/actions.hpp> #include <uhd/rfnoc/graph_edge.hpp> #include <uhd/rfnoc/node.hpp> +#include <uhdlib/rfnoc/resolve_context.hpp> #include <boost/graph/adjacency_list.hpp> #include <deque> #include <memory> @@ -146,7 +147,8 @@ private: *************************************************************************/ /*! Implementation of the property propagation algorithm */ - void resolve_all_properties(); + void resolve_all_properties(uhd::rfnoc::resolve_context context, + rfnoc_graph_t::vertex_descriptor initial_node); /************************************************************************** * Action API diff --git a/host/lib/include/uhdlib/rfnoc/resolve_context.hpp b/host/lib/include/uhdlib/rfnoc/resolve_context.hpp new file mode 100644 index 000000000..29a2e5f6f --- /dev/null +++ b/host/lib/include/uhdlib/rfnoc/resolve_context.hpp @@ -0,0 +1,26 @@ +// +// +// Copyright 2019 Ettus Research, a National Instruments Company +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#ifndef INCLUDED_UHD_RFNOC_RESOLVE_CONTEXT_HPP +#define INCLUDED_UHD_RFNOC_RESOLVE_CONTEXT_HPP + +namespace uhd { namespace rfnoc { + +/*! Describe situations out of which property propagation is called + */ +enum class resolve_context { + //! Property propagation was called during an initialization process (e.g., + // the graph was committed) + INIT, + //! Property propagation was called because a property on a node was + // updated + NODE_PROP +}; + +}} // namespace uhd::rfnoc + +#endif /* INCLUDED_UHD_RFNOC_RESOLVE_CONTEXT_HPP */ |