Skip to content

Commit

Permalink
Tensor changes in master graph and ring buffer (#17)
Browse files Browse the repository at this point in the history
* Add changes in master graph.h and master_graph.cpp

Changed all instances from Image to Tensor
Remove the cycle idx loop in output routine
Removed video output routine
Removed copy out API
Remove API to get output width, height from info
Remove output tensor allocation

* Remove instances of output tensor in MasterGraph

* Add get_output_tensors API in MasterGraph

* Remove IBS and associated changes from MasterGraph

* Add changes in ring buffer

Remove master buffer and intrduce sub buffer for HOST

* Remove processing on HIP and OCL check from master graph

* Remove sub buffer count variable from ring buffer init

* Remove use of vx_tensor for the output tensors

* Code clean up

* Changed output ptr type to auto
  • Loading branch information
fiona-gladwin authored Mar 23, 2023
1 parent a321eeb commit 006eadc
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 1,073 deletions.
5 changes: 1 addition & 4 deletions rocAL/rocAL/include/pipeline/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ struct Context
{
LOG("Processing on " + STR(((affinity == RocalAffinity::CPU)?" CPU": " GPU")))
master_graph = std::make_shared<MasterGraph>(batch_size, affinity, gpu_id, prefetch_queue_depth, output_tensor_type);
_internal_batch_size = master_graph->internal_batch_size();
}
~Context()
{
Expand All @@ -52,10 +51,8 @@ struct Context
return master_graph->timing();
}
size_t user_batch_size() { return _user_batch_size; }
size_t internal_batch_size() { return _internal_batch_size; }
private:
void clear_errors() { error = "";}
std::string error;
size_t _user_batch_size;
size_t _internal_batch_size;
};
};
118 changes: 42 additions & 76 deletions rocAL/rocAL/include/pipeline/master_graph.h

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions rocAL/rocAL/include/pipeline/ring_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class RingBuffer
///\param dev
///\param sub_buffer_size
///\param sub_buffer_count
void init(RocalMemType mem_type, void *dev, unsigned sub_buffer_size, unsigned sub_buffer_count);
void init(RocalMemType mem_type, void *dev, std::vector<size_t> &sub_buffer_size);
void initBoxEncoderMetaData(RocalMemType mem_type, size_t encoded_bbox_size, size_t encoded_labels_size);
void release_gpu_res();
std::vector<void*> get_read_buffers() ;
std::vector<void*> get_read_buffers();
void* get_host_master_read_buffer();
std::vector<void*> get_write_buffers();
std::pair<void*, void*> get_box_encode_write_buffers();
Expand All @@ -72,13 +72,12 @@ class RingBuffer
void increment_write_ptr();
bool full();
const unsigned BUFF_DEPTH;
unsigned _sub_buffer_size;
std::vector<size_t> _sub_buffer_size;
unsigned _sub_buffer_count;
std::mutex _lock;
std::condition_variable _wait_for_load;
std::condition_variable _wait_for_unload;
std::vector<std::vector<void*>> _dev_sub_buffer;
std::vector<void*> _host_master_buffers;
std::vector<std::vector<void*>> _host_sub_buffers;
std::vector<void *> _dev_bbox_buffer;
std::vector<void *> _dev_labels_buffer;
Expand Down
2 changes: 0 additions & 2 deletions rocAL/rocAL/source/api/rocal_api_data_loaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ rocalSequenceReader(
// Set sequence batch size and batch ratio in master graph as it varies according to sequence length
context->master_graph->set_sequence_reader_output();
context->master_graph->set_sequence_batch_size(sequence_length);
context->master_graph->set_sequence_batch_ratio();
bool decoder_keep_original = true;

// This has been introduced to support variable width and height video frames in future.
Expand Down Expand Up @@ -384,7 +383,6 @@ rocalSequenceReaderSingleShard(
// Set sequence batch size and batch ratio in master graph as it varies according to sequence length
context->master_graph->set_sequence_reader_output();
context->master_graph->set_sequence_batch_size(sequence_length);
context->master_graph->set_sequence_batch_ratio();
bool decoder_keep_original = true;

// This has been introduced to support variable width and height video frames in future.
Expand Down
Loading

0 comments on commit 006eadc

Please sign in to comment.