diff options
author | Josh Blum | 2012-09-13 23:45:21 -0700 |
---|---|---|
committer | Josh Blum | 2012-09-13 23:45:21 -0700 |
commit | f48974cbfc5304003ad5296d8df610579768d362 (patch) | |
tree | 40eb308e253e3ec2b1376fabec9ca12f084f2620 /lib | |
parent | ac9daab85d3651f9a63eafc48beb901c0941da7f (diff) | |
download | sandhi-f48974cbfc5304003ad5296d8df610579768d362.tar.gz sandhi-f48974cbfc5304003ad5296d8df610579768d362.tar.bz2 sandhi-f48974cbfc5304003ad5296d8df610579768d362.zip |
added set buffer affinity hook for blocks
Diffstat (limited to 'lib')
-rw-r--r-- | lib/block.cpp | 5 | ||||
-rw-r--r-- | lib/block_allocator.cpp | 1 | ||||
-rw-r--r-- | lib/block_task.cpp | 9 | ||||
-rw-r--r-- | lib/element_impl.hpp | 1 |
4 files changed, 13 insertions, 3 deletions
diff --git a/lib/block.cpp b/lib/block.cpp index 406e16b..48b18f3 100644 --- a/lib/block.cpp +++ b/lib/block.cpp @@ -240,3 +240,8 @@ bool Block::check_topology(int, int) { return true; } + +void Block::set_buffer_affinity(const Affinity &affinity) +{ + (*this)->buffer_affinity = affinity; +} diff --git a/lib/block_allocator.cpp b/lib/block_allocator.cpp index 5e24a00..708b35b 100644 --- a/lib/block_allocator.cpp +++ b/lib/block_allocator.cpp @@ -93,6 +93,7 @@ void ElementImpl::handle_allocation(const tsbe::TaskInterface &task_iface) SBufferConfig config; config.memory = NULL; config.length = bytes; + config.affinity = this->buffer_affinity; config.token = this->output_buffer_tokens[i]; SBuffer buff(config); //buffer derefs here and the token messages it back to the block diff --git a/lib/block_task.cpp b/lib/block_task.cpp index a9b88bd..cddfb97 100644 --- a/lib/block_task.cpp +++ b/lib/block_task.cpp @@ -130,10 +130,13 @@ void ElementImpl::handle_task(const tsbe::TaskInterface &task_iface) this->consume_called[i] = false; //inline dealings, how and when input buffers can be inlined into output buffers - //TODO, check that the buff.get_affinity() matches this block or we dont inline //continue; - if (potential_inline and input_inline_enables[i] and output_inline_index < num_outputs) - { + if ( + potential_inline and + input_inline_enables[i] and + output_inline_index < num_outputs and + buff.get_affinity() == this->buffer_affinity + ){ //copy buffer reference but push with zero length, same offset SBuffer new_obuff = buff; new_obuff.length = 0; diff --git a/lib/element_impl.hpp b/lib/element_impl.hpp index 0ec4650..18edfce 100644 --- a/lib/element_impl.hpp +++ b/lib/element_impl.hpp @@ -150,6 +150,7 @@ struct ElementImpl } block_state; Token token; size_t hint; //some kind of allocation hint + Affinity buffer_affinity; std::vector<std::vector<BufferHintMessage> > output_allocation_hints; |