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 flaky init #842

Merged
merged 2 commits into from
Oct 3, 2023
Merged

Fix flaky init #842

merged 2 commits into from
Oct 3, 2023

Conversation

nathanielsimard
Copy link
Member

Some of the tests were flaky, and I suspect the problem came from unreliable initialization in burn-wgpu. The problem comes from the fact that zeros was achieved by multiplying an empty tensor by zero. However, the empty tensor might have invalid numbers in it, or NaN, which would make the zeros or ones function return NaN as well. The fix is pretty simple: create a Full kernel and use it to initialize tensors. This reduces the number of kernels launched and avoids uninitialized memory from causing numerical problems. I wasn't able to reproduce the flaky test after the change.

@nathanielsimard
Copy link
Member Author

@dae I think this fixes the flaky test in burn-wgpu.

Copy link
Member

@louisfd louisfd left a comment

Choose a reason for hiding this comment

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

it works

@louisfd louisfd merged commit 809ad72 into main Oct 3, 2023
@nathanielsimard nathanielsimard deleted the fix/wgpu/flaky-init branch October 3, 2023 20:35
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.

2 participants