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

Removing unnecessary gradient tensor loads #20

Merged
merged 3 commits into from
Nov 11, 2024

Conversation

laserkelvin
Copy link
Contributor

@laserkelvin laserkelvin commented Nov 7, 2024

Proposed changes

Based on discussions with @Pennycook, this PR provides a small but noticable performance bump to the first version of EquiTriton kernels. Comparison with the e3nn + torch.compile autotuned kernels showed that the backward pass contained unnecessary memory loads that introduced an element-wise latency.

Originally, variables for accumulating gradients were initialized by performing tl.load. The optimization introduced here is to remove this load dependency, allowing g_x/y/z to be calculated as soon as the first order gradients are streamed in. The main impact I've seen from running these kernels is removing the significant dropoff in performance at higher node counts seen in #9 from 10^5 nodes and above, making relative performance more or less constant across node counts. Tested on a 1100 GPU Max on PyTorch 2.6.0a0+git487873f, and triton==3.1.0.

cc @mitkotak in case you're interested in tracking these changes

Types of changes

What types of changes does your code introduce to the project?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (if none of the other choices apply)
  • Performance optimization

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you are unsure about any of them, do not hesitate to ask. We are
here to help! This is simply a reminder of what we are going to look for before
merging your code.

  • I have read the CONTRIBUTING agreement
  • Current formatting and unit tests / base functionality passes locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

@laserkelvin laserkelvin added the enhancement New feature or request label Nov 7, 2024
@smiret-intel smiret-intel merged commit 6a78110 into IntelLabs:main Nov 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants