Skip to content
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

Add metadata-only inputs. #5635

Merged
merged 5 commits into from
Sep 18, 2024
Merged

Add metadata-only inputs. #5635

merged 5 commits into from
Sep 18, 2024

Conversation

mzient
Copy link
Contributor

@mzient mzient commented Sep 17, 2024

Category:

Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)

Description:

The bug:
The Copy operator from device to host executed in host order, but the synchronization was skipped.
The solution:
Use a stream for CPU operators with GPU inputs.
Add a special class of metadata-only inputs which do need to wait for the data, so the executor can skip synchronization.

The necessary synchronization happens in the consumers of the copy results (the D2H copy result is a pinned buffer and the copy is asynchronous).

Additional information:

Affected modules and functionalities:

New executor:

  • stream assignment
  • workspace setup
  • most operators taking Any input now take a Metadata input

Key points relevant for the review:

Tests:

Stream assignment tests have been updated.
The pipeline_test.test_gpu2cpu_conditionals serves as a bug-fix test.

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: N/A

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [18471715]: BUILD STARTED

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [18471967]: BUILD STARTED

@JanuszL JanuszL self-assigned this Sep 17, 2024
Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [18473499]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [18471967]: BUILD PASSED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [18473499]: BUILD PASSED

@stiepan stiepan self-assigned this Sep 18, 2024
Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
Comment on lines -281 to -285
// If the output order of the operator is `host` then we don't wait for GPU
// inputs - they can't be accessed directly on host and the operator will
// have to issue some sort of synchronization if and when necessary.
// This optimization is essential to avoid oversynchronization
// when the operator needs to access the metadata only (e.g. getting the shape).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we get rid of the dangerous special treatment of GPU inputs to host-ordered operators. The new metadata flag takes care of the optimization now.

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [18504351]: BUILD STARTED

@mzient mzient merged commit 94f02ad into NVIDIA:main Sep 18, 2024
5 of 6 checks passed
stiepan pushed a commit that referenced this pull request Sep 18, 2024
* Assign a stream to CPU inputs with GPU (non-metadata) inputs
* Add Metadata input device - this declares that the input is used for metadata (shape, dtype, etc) access only
* Don't synchronize metadata inputs in executor.
* Don't prolong the lifetime of metadata-only inputs.
* Add InputDevice specifier to random number generators shape_like input.

---------

Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [18504351]: BUILD PASSED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants