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

Fix performance regression in Greedy #32

Merged
merged 2 commits into from
Sep 28, 2023
Merged

Conversation

mofeing
Copy link
Member

@mofeing mofeing commented Sep 28, 2023

Greedy optimizer is wrongly considering outer product between all combinations of tensors as candidates. This in turn translates into an exponential time (and exponential space due to the implementation) execution.

This patch fixes the problem by avoiding outer products by default.

Before

# run 1
52.448305 seconds (130.85 M allocations: 62.620 GiB, 15.20% gc time, 1.61% compilation time)
# run 2
42.701409 seconds (129.02 M allocations: 62.499 GiB, 22.22% gc time)

pre

After

# run 1
2.786559 seconds (9.91 M allocations: 3.123 GiB, 14.70% gc time, 33.00% compilation time)
# run 2
1.843659 seconds (8.20 M allocations: 3.010 GiB, 19.13% gc time)

post

@mofeing mofeing requested a review from jofrevalles September 28, 2023 12:57
@mofeing mofeing added the bug Something isn't working label Sep 28, 2023
@mofeing mofeing marked this pull request as ready for review September 28, 2023 12:57
@mofeing mofeing merged commit 6b7a9fd into master Sep 28, 2023
@mofeing mofeing deleted the fix/optimizer/no-outer-greedy branch September 28, 2023 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants