Skip to content

Conversation

@fabiomestre
Copy link
Contributor

The current implementation of the topological sort algorithm relies on a recursive function. This causes stack overflow issues when the graphs are very large. There is also a performance issue in the current implementation related to the way std::find() is being used.

This commit reimplements the topological sort algorithm to fix these issues:

  • Uses an iterative approach instead of recursive.
  • Removes the use of std::find() and instead relies on keeping the state with a helper variable.
  • Reimplements the cycle checking algorithm to use the same topological sort function as the one used during scheduling.
  • Fixes a bug with make_edge() not removing the dest node from the list of root nodes.

@fabiomestre fabiomestre marked this pull request as ready for review March 17, 2025 19:04
@fabiomestre fabiomestre requested a review from a team as a code owner March 17, 2025 19:04
@fabiomestre fabiomestre requested a review from EwanC March 17, 2025 19:04
Fábio Mestre added 3 commits March 18, 2025 15:56
The current implementation of the topological sort
algorithm relies on a recursive function. This causes
stack overflow issues when the graphs are very large.
There is also a performance issue in the current implementation
related to the way std::find() is being used.

This commit reimplements the topological sort algorithm to fix
these issues:

- Uses an iterative approach instead of recursive.
- Removes the use of std::find() and instead relies on keeping the state
  with a helper variable.
- Reimplements the cycle checking algorithm to use the same topological
  sort function as the one used during scheduling.
- Fixes a bug with make_edge() not removing the dest node from the list of
  root nodes.
@fabiomestre
Copy link
Contributor Author

@intel/llvm-gatekeepers This should be ready to merge.

@kbenzie kbenzie merged commit d2578a3 into intel:sycl Mar 19, 2025
26 of 27 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.

3 participants