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 stream sync for scratch pad eviction #2843

Closed
wants to merge 2 commits into from

Conversation

sryap
Copy link
Contributor

@sryap sryap commented Jul 14, 2024

Summary:
Before this diff, SSD TBE unsafely evicts data from the scratch pad
(the buffer that stores conflict missed data). The eviction happened
on the SSD stream while the backward TBE happened on the default
stream. SSD TBE did not properly synchronize the streams to ensure
that the backward TBE completed before evicting data from the scratch
pad. This diff fixes the problem by adding the syncrhonization
between streams to ensure the correct execution order between the
backward TBE and the scratch pad eviction.

Differential Revision: D59716516

Copy link

netlify bot commented Jul 14, 2024

Deploy Preview for pytorch-fbgemm-docs ready!

Name Link
🔨 Latest commit 346ccbb
🔍 Latest deploy log https://app.netlify.com/sites/pytorch-fbgemm-docs/deploys/669838911a07810008278130
😎 Deploy Preview https://deploy-preview-2843--pytorch-fbgemm-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59716516

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59716516

sryap added a commit to sryap/FBGEMM that referenced this pull request Jul 14, 2024
Summary:
Pull Request resolved: pytorch#2843

Before this diff, SSD TBE unsafely evicts data from the scratch pad
(the buffer that stores conflict missed data).  The eviction happened
on the SSD stream while the backward TBE happened on the default
stream.  SSD TBE did not properly synchronize the streams to ensure
that the backward TBE completed before evicting data from the scratch
pad.  This diff fixes the problem by adding the syncrhonization
between streams to ensure the correct execution order between the
backward TBE and the scratch pad eviction.

Differential Revision: D59716516
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59716516

sryap added a commit to sryap/FBGEMM that referenced this pull request Jul 14, 2024
Summary:
Pull Request resolved: pytorch#2843

Before this diff, SSD TBE unsafely evicts data from the scratch pad
(the buffer that stores conflict missed data).  The eviction happened
on the SSD stream while the backward TBE happened on the default
stream.  SSD TBE did not properly synchronize the streams to ensure
that the backward TBE completed before evicting data from the scratch
pad.  This diff fixes the problem by adding the syncrhonization
between streams to ensure the correct execution order between the
backward TBE and the scratch pad eviction.

Differential Revision: D59716516
sarunya and others added 2 commits July 16, 2024 14:20
Differential Revision: D59795139
Summary:
Pull Request resolved: pytorch#2843

Before this diff, SSD TBE unsafely evicts data from the scratch pad
(the buffer that stores conflict missed data).  The eviction happened
on the SSD stream while the backward TBE happened on the default
stream.  SSD TBE did not properly synchronize the streams to ensure
that the backward TBE completed before evicting data from the scratch
pad.  This diff fixes the problem by adding the syncrhonization
between streams to ensure the correct execution order between the
backward TBE and the scratch pad eviction.

**Before and after this diff**

{F1761028617}

**Before:** the scratch pad eviction happens as soon as the cache eviction
is done, which is incorrect. In the figure, it overlaps with TBE
forward and backward.

**After:** the scartch pad eviction happens after the backward pass of TBE
is done

Reviewed By: q10

Differential Revision: D59716516
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59716516

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 13d5470.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants