-
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
Fix bugs in C API and refactor tests #3350
Conversation
The tests do not do cleanup after creating CAPI pipeline, leaving live pipeline to be cleaned up by process shutdown. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown (as it was using async execution) and the whole test process could crash during shutdown. The read outputs are also not released properly after the last output is accessed. This is a bit awkward part of C API. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
!build |
CI MESSAGE: [3004657]: BUILD STARTED |
dali/c_api/c_api_test.cc
Outdated
for (int i = 0; i < prefetch_queue_depth; i++) { | ||
data.push_back(AllocBuffer<TypeParam>(num_elems * sizeof(uint8_t), false)); | ||
} | ||
std::vector<TensorList<TypeParam>> input_wrapper(3); |
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.
Maybe it is better to use TensorVector unless TensorList is the data structure we are reworking towards?
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.
Hmm, it should be
std::vector<TensorList<TypeParam>> input_wrapper(3); | |
std::vector<TensorList<TypeParam>> input_wrapper(prefetch_queue_depth); |
but other then that I just kept the TensorList. What we will use is up to be decided, but I've heard voices to keep the TensorList to match what we have in Python. But we will see.
CI MESSAGE: [3004657]: BUILD PASSED |
dali/c_api/c_api.cc
Outdated
pipe_handle->ws = ws.release(); | ||
pipe_handle->copy_stream = stream.release(); | ||
pipe_handle->pipe = pipeline.release(); | ||
pipe_handle->batch_sizes_map = bs_map.release(); |
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.
pipe_handle->batch_sizes_map = bs_map.release(); | |
pipe_handle->batch_size_map = bs_map.release(); |
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/c_api/c_api.cc
Outdated
pipe_handle->ws = ws.release(); | ||
pipe_handle->copy_stream = stream.release(); | ||
pipe_handle->pipe = pipeline.release(); | ||
|
||
auto bs_map = std::make_unique<batch_size_map_t>(); | ||
pipe_handle->batch_sizes_map = bs_map.release(); |
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.
pipe_handle->batch_sizes_map = bs_map.release(); | |
pipe_handle->batch_size_map = bs_map.release(); |
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
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
!build |
CI MESSAGE: [3017866]: BUILD STARTED |
CI MESSAGE: [3017866]: BUILD PASSED |
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Fix `daliDeserializeDefault` - the batch size map was not allocated and when the pipeline handle was correctly cleaned, it tried to deallocate memory under invalid pointer. Add missing `daliDeletePipeline` in all C API tests so the tests no longer leak the created pipeline. Some tests (daliOutputCopySamples) used to fill the prefetch queue and schedule additional runs, whilst accessing only one output iteration. The not-freed pipeline could be actively using the memory when the memory resources were cleared on shutdown and the whole test process could crash during shutdown. Remove the additional unused iteration in such case. Rework tests to not use access to underlying contiguous buffer of TensorList. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Description
What happened in this PR
Fix
daliDeserializeDefault
- the batch sizemap was not allocated and when the pipeline
handle was correctly cleaned, it tried to
deallocate memory under invalid pointer.
Add missing
daliDeletePipeline
in all C API testsso the tests no longer leak the created pipeline.
Some tests (daliOutputCopySamples) used to fill the
prefetch queue and schedule additional runs,
whilst accessing only one output iteration.
The not-freed pipeline could be actively using the memory
when the memory resources were cleared on shutdown
and the whole test process could crash during shutdown.
Remove the additional unused iteration in such case.
Rework tests to not use access to underlying
contiguous buffer of TensorList.
Additional information
Affected modules and functionalities:
C API
Key points relevant for the review:
Checklist
Tests
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: N/A