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

work around extreme slowdown in BatchNorm due to julia performance bug in broadcast fusion #586

Merged
merged 1 commit into from
Feb 8, 2019

Conversation

KristofferC
Copy link
Contributor

@KristofferC KristofferC commented Jan 30, 2019

Code:

using Flux
bn = BatchNorm(32);
testimg = randn(Float32, 416, 416, 32, 1);
@time bn(testimg)

Before

#   8.712519 seconds (224.78 M allocations: 4.133 GiB, 4.82% gc time)

After

#  0.059702 seconds (177 allocations: 105.631 MiB, 23.61% gc time)

@KristofferC KristofferC changed the title work around extreme slowdown due julia performance bug work around extreme slowdown in BatchNorm due julia performance bug in broadcast fusion Jan 30, 2019
@KristofferC KristofferC changed the title work around extreme slowdown in BatchNorm due julia performance bug in broadcast fusion work around extreme slowdown in BatchNorm due to julia performance bug in broadcast fusion Jan 30, 2019
@r3tex
Copy link
Contributor

r3tex commented Jan 30, 2019

Works for me!

@KristofferC
Copy link
Contributor Author

Seems similar in spirit to #555.

@MikeInnes
Copy link
Member

Seems good but as in that PR, would be great to have a test (even if it's GPU-only).

@KristofferC
Copy link
Contributor Author

Test for what? Number of allocations?

@MikeInnes
Copy link
Member

That'd be fine given how stark the difference is. This comment also indicated that this fixes GPU compilation, but I don't know if you were aiming for that as well.

@KristofferC
Copy link
Contributor Author

For some reason it didn't seem like my previous workaround worked anymore so I changed to the one in #555.

@MikeInnes
Copy link
Member

👍 Thanks!

@MikeInnes MikeInnes merged commit 601e2d8 into FluxML:master Feb 8, 2019
@KristofferC KristofferC deleted the kc/batchnorm branch February 8, 2019 11:13
@KristofferC KristofferC mentioned this pull request Feb 20, 2019
@ToucheSir ToucheSir mentioned this pull request Aug 12, 2021
8 tasks
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