-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug mode direct ExternalSource #3605
Debug mode direct ExternalSource #3605
Conversation
Add debug mode version of ExternalSource operator removing creation of seperate pipeline for it. Add TensorList constructor from list of Tensors. Add seperation of preperation of data for feed_input from actual feed_input. Add tests of ExternalSource in debug mode. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
!build |
CI MESSAGE: [3690021]: BUILD STARTED |
CI MESSAGE: [3690021]: BUILD FAILED |
Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
!build |
CI MESSAGE: [3693373]: BUILD STARTED |
Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
CI MESSAGE: [3693373]: BUILD PASSED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments only to TensorList constructor, I didn't read the rest yet.
dali/python/backend_impl.cc
Outdated
auto &t = list_of_tensors[i].cast<Tensor<Backend>&>(); | ||
tv[i] = std::move(t); | ||
} | ||
tl->Copy(tv, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we probably should have a sync. We might do a Copy on some other stream (we have this stream pool that creates stream per-device), and sync on that stream, as syncing stream 0 might be a bit over the top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -142,3 +142,18 @@ def check_squeeze(shape, dim, in_layout, expected_out_layout): | |||
(0, (1, 5, 1), "ABC", "BC"), | |||
(None, (3, 5, 1), "ABC", "AB")]: | |||
yield check_squeeze, shape, dim, in_layout, expected_out_layout | |||
|
|||
|
|||
def test_tensorlist_constructor_from_list_of_tensors(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be nice to test non-uniformly shaped TensorList as well (where each tensor has different dimensions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Add test for TL with different tensors of different shapes Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
…derski/DALI into debug_mode_direct_external_source Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
!build |
CI MESSAGE: [3735215]: BUILD STARTED |
CI MESSAGE: [3735215]: BUILD PASSED |
dali/python/nvidia/dali/pipeline.py
Outdated
@@ -55,6 +57,55 @@ def _get_default_stream_for_array(array): | |||
else: | |||
return None | |||
|
|||
|
|||
def _prep_data_for_feed_input(data, batch_size, layout): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nitpick, we can probably move it to external_source.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
dali/python/backend_impl.cc
Outdated
TensorVector<Backend> tv(list_of_tensors.size()); | ||
for (size_t i = 0; i < list_of_tensors.size(); ++i) { | ||
auto &t = list_of_tensors[i].cast<Tensor<Backend>&>(); | ||
tv[i] = std::move(t); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this move the data out of the list? Won't this be destructive function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to ShareData
if self._num_outputs is not None: | ||
for idx in range(self._num_outputs): | ||
if self._batch: | ||
raw_data = callback_out[idx] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct? We just save last output as raw_data
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a mistake, fixed it.
if self._batch: | ||
raw_data = callback_out[idx] | ||
else: | ||
raw_data = [callback_out[i][idx] for i in range(self._batch_size)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Use ShareData in TL constructor from list of tensors instead of move Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
!build |
CI MESSAGE: [3750054]: BUILD STARTED |
CI MESSAGE: [3750054]: BUILD FAILED |
CI MESSAGE: [3750054]: BUILD PASSED |
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Add direct external_source in debug mode Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for the debug mode) is in Python. Adds TensorList constructor from list of Tensors. Signed-off-by: ksztenderski <ksztenderski@nvidia.com>
Description
What happened in this PR
Adds debug version of ExternalSource operator removing additional callback to the backend. Before that, in the debug mode for external source we created a separate pipeline like for any other operator, which seems like an overkill considering that all of the ExternalSource implementation (relevant for debug mode) is in Python.
Adds TensorList constructor from list of Tensors.
Additional information
Checklist
Tests
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: N/A