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

Change iterator over multiple Queue wrappers to request all protocols simulteniously #769

Closed

Conversation

VitalyFedyunin
Copy link
Contributor

@VitalyFedyunin VitalyFedyunin commented Sep 9, 2022

This is part of MPRS optimizations, changes are covered by the existing test_dataloader2.py test.

Stack from ghstack (oldest at bottom):

Differential Revision: D39816752

VitalyFedyunin added a commit that referenced this pull request Sep 9, 2022
… simulteniously

ghstack-source-id: 09787247b78b4054d16f606070fc00880a0763c9
Pull Request resolved: #769
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 9, 2022
…l protocols simulteniously"

This is part of MPRS optimizations, changes are covered by the existing test_dataloader2.py test.




[ghstack-poisoned]
VitalyFedyunin added a commit that referenced this pull request Sep 9, 2022
… simulteniously

ghstack-source-id: ed8aae4f86aaaa4157d8803e127ee2151c658b30
Pull Request resolved: #769
torchdata/dataloader2/reading_service.py Outdated Show resolved Hide resolved
torchdata/dataloader2/reading_service.py Outdated Show resolved Hide resolved
torchdata/dataloader2/reading_service.py Outdated Show resolved Hide resolved
Comment on lines +39 to +40

pass
Copy link
Contributor

Choose a reason for hiding this comment

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

BTW, It might be better to add an Error message in __init__.
super().__init__(msg).

Comment on lines +114 to +115
for idx in range(total_pipes):
self.datapipes[idx].protocol.request_next()
Copy link
Contributor

@ejguan ejguan Sep 9, 2022

Choose a reason for hiding this comment

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

This is the main review comment, the rests are some nits.

Might be a noob question. We now request and receive data from protocol object. Then, do we still need QueueWrapper? We can directly let _IterateQueueDataPipes store a list of protocol clients.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

QueueWrapper handles terminations (and snapshotting in the future). Direct access to protocol here is only required to reorder traversals.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

However, I'm still considering the possibility of merging _IterateQueueDataPipes and QueueWrapper to make it one class that supports 1:M queues.

…l protocols simulteniously"

This is part of MPRS optimizations, changes are covered by the existing test_dataloader2.py test.




[ghstack-poisoned]
…l protocols simulteniously"

This is part of MPRS optimizations, changes are covered by the existing test_dataloader2.py test.




[ghstack-poisoned]
Copy link
Contributor

@ejguan ejguan left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +126 to +129
if isinstance(response, communication.messages.InvalidStateResponse):
raise communication.iter.InvalidStateResetRequired
if isinstance(response, communication.messages.TerminateResponse):
raise communication.iter.TerminateRequired
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: shouldn't these be caught by QueueWrapper's method nonblocking_next?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, because I'm not using next of QueueWrapper, but instead accessing protocols next directly.

@VitalyFedyunin
Copy link
Contributor Author

@VitalyFedyunin has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

…l protocols simulteniously"

This is part of MPRS optimizations, changes are covered by the existing test_dataloader2.py test.


Differential Revision: [D39816752](https://our.internmc.facebook.com/intern/diff/D39816752)

[ghstack-poisoned]
@VitalyFedyunin
Copy link
Contributor Author

@VitalyFedyunin has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

…l protocols simulteniously"

This is part of MPRS optimizations, changes are covered by the existing test_dataloader2.py test.


Differential Revision: [D39816752](https://our.internmc.facebook.com/intern/diff/D39816752)

[ghstack-poisoned]
@VitalyFedyunin
Copy link
Contributor Author

@VitalyFedyunin has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot deleted the gh/VitalyFedyunin/20/head branch October 7, 2022 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants