-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[WIP] torch.compile applied to ray sampling #2133
base: main
Are you sure you want to change the base?
Conversation
On a simple scene without camera distortions, I am getting 166 train rays/s with torch compile vs 160 rays/s without -> roughly 4% speedup overall. |
nerfstudio/utils/profiler.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are any of the changes here necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, but tracing at the latter steps is a good idea. Should I undo the changes?
@@ -526,15 +517,28 @@ def setup_eval(self): | |||
num_workers=self.world_size * 4, | |||
) | |||
|
|||
@torch.compile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use from nerfstudio.utils.misc import torch_compile
?
batch = self.train_pixel_sampler.sample(image_batch) | ||
return self._next_train_compiled(image_batch) | ||
|
||
@torch.compile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
torch_compile
Note: this is currently not ready for merging for the following reason: |
This PR applies torch.compile to pixel sampling and ray generation.
We could theoretically see some speedup.
NOTE: I haven't tested all configurations.