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

Executor 2.0: Per-operator stream assignment policy #5620

Merged
merged 4 commits into from
Sep 8, 2024

Conversation

mzient
Copy link
Contributor

@mzient mzient commented Sep 4, 2024

Category:

New feature (non-breaking change which adds functionality)

Description:

The PR implements a per-operator stream assignment algorithm.
The algorithm minimizes the number of necessary streams and tries to minimize the number of stream switches.

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

mzient added a commit that referenced this pull request Sep 4, 2024
* Add ExecNode stream assignment algorithms and tests.
NOTE: Follow up #5620 implements per-operator assignment.
---------
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
@mzient mzient force-pushed the per_operator_stream_assignment branch from 610fd7d to 2a11ce6 Compare September 4, 2024 14:10
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [18125248]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [18125248]: BUILD PASSED

@szkarpinski szkarpinski self-assigned this Sep 5, 2024
@stiepan stiepan self-assigned this Sep 5, 2024
void Assign(ExecGraph &graph) {
int num_nodes = graph.Nodes().size();

// the nodes in the graph must be sorted topologically
Copy link
Collaborator

Choose a reason for hiding this comment

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

Such requirements that are only expressed in the comments make this bug-prone. How about adding a simple check that the graph is actually toposorted? It's just something like for each E in edges assert(e.from.index < e.to.index) - linear time, few lines of code

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 should rephrase: the graph is sorted. That's how it's built. You can manually construct one that's not, but it's not usable and its validation will fail.

mzient and others added 3 commits September 6, 2024 13:38
It works by traversing the graph in depth-first fashion, from outputs
to inputs. Each node has a set of "ready" streams which are merged
when the graph converges. When a stream is reused in a subsequent
node, the stream id is removed from the producer's ready set
and the removal happens recursively, but only once for each stream id.

Typical complexity is O(V+E), pessimistic complexity is O(V+E^2).

Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
@mzient mzient force-pushed the per_operator_stream_assignment branch from a80eb0b to 0870fed Compare September 6, 2024 11:38
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [18189246]: BUILD STARTED

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

CI MESSAGE: [18190005]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [18190005]: BUILD PASSED

@mzient mzient merged commit 2117f88 into NVIDIA:main Sep 8, 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.

4 participants