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

ExternalSource refactoring and fixing #5690

Merged
merged 5 commits into from
Oct 29, 2024

Conversation

mzient
Copy link
Contributor

@mzient mzient commented Oct 24, 2024

Category:

Bug fix (non-breaking change which fixes an issue)
Refactoring (Redesign of existing code that doesn't affect functionality)

Description:

  • fix:
    • ExternalSource: use events from a proper device
    • AccessOrder - set current device when using special handles
  • refactor CachingList
    • use proper "item" wrapper type
    • remove "apprentice" and simplify lookahead logic
    • remove weird make_unique dependence
    • use r-value when recycling
  • refactor ExternalSource
    • store TensorList by value in list items
    • move all iteration data to one structure and queue
    • associate events directly with data items
    • use global event pool and obtain events for proper streams

Additional information:

Affected modules and functionalities:

Key points relevant for the review:

Tests:

  • 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

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [19728778]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [19728778]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [19730281]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [19730281]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [19730281]: BUILD PASSED

@jantonguirao jantonguirao assigned szalpal and unassigned banasraf Oct 28, 2024
int device_id = order.is_device() ? order.device_id() : tl_elm->data.device_id();
cudaEvent_t event = tl_elm->GetCompletionEvent(order.device_id());

if (order.device_id() != device_id_ &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

This condition is unreadable, can you make it a function with readable name? Like is is_ambiguous_order in access_order.cc?

Copy link
Contributor Author

@mzient mzient Oct 28, 2024

Choose a reason for hiding this comment

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

Since it's done once per iteration, I think we can afford to just always go with the DeviceGuard. I couldn't make such assumptions in access_order.cc, but here it's quite different.
Alternatively, I can add an "record(cudaEvent_t)" function to AccessOrder - I'd rather not perpetuate the incidental complexity of stream handling in AccessOrder API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I always add DeviceGuard. It takes 80ns on my machine and that's done once per iteration, so it's rather cheap.

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [19826818]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [19826818]: BUILD FAILED

- refactor CachingList
  - use proper "item" wrapper type
  - remove "apprentice" and simplify lookahead logic
  - remove weird make_unique dependence
  - use r-value when recycling
- refactor ExternalSource
  - store TensorList by value in list items
  - move all iteration data to one structure and queue
  - associate events directly with data items
  - use global event pool and obtain events for proper streams

----

Signed-off-by: Michal Zientkiewicz <[email protected]>
Signed-off-by: Michal Zientkiewicz <[email protected]>
Signed-off-by: Michal Zientkiewicz <[email protected]>
@mzient mzient force-pushed the external_source_refactoring_and_fixes branch from c77478b to afc953e Compare October 29, 2024 08:13
Signed-off-by: Michał Zientkiewicz <[email protected]>
@NVIDIA NVIDIA deleted a comment from dali-automaton Oct 29, 2024
@NVIDIA NVIDIA deleted a comment from dali-automaton Oct 29, 2024
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [19867432]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [19867432]: BUILD PASSED

@mzient mzient merged commit 268704e into NVIDIA:main Oct 29, 2024
6 checks 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.

8 participants