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

Move only per-chunk data to the GPU to support rendering large images #2481

Merged
merged 8 commits into from
Oct 21, 2023

Conversation

decrispell
Copy link
Contributor

@decrispell decrispell commented Sep 29, 2023

Despite chunking of the rays for evaluation, there is a lot of full-image per-pixel data (inputs and outputs) still being stored on the GPU, which can be problematic when rendering very large images.

This change allows passing a CPU camera_ray_bundle to get_outputs_for_camera_ray_bundle(). The per-chunk rays are moved to the GPU, and the per-chunk outputs are moved back to the device of the original camera_ray_bundle.

Behavior of existing code shouldn't change since inputs and outputs will still be stored completely on the GPU - it's just no longer a requirement.

@decrispell decrispell changed the title Move only per-chunk data to the GPU to support large images Move only per-chunk data to the GPU to support rendering large images Sep 29, 2023
@drewgilliam
Copy link
Contributor

@brentyi & @tancik - hoping you could help out again, this PR is a blocker for our team. Is there more information or more changes needed to get this PR merged? Thanks!

Copy link
Collaborator

@brentyi brentyi left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, this seems fine to me! Just left one minor comment.

nerfstudio/models/base_model.py Outdated Show resolved Hide resolved
@decrispell
Copy link
Contributor Author

decrispell commented Oct 21, 2023 via email

torch.is_tensor() doesn't have a TypeGuard annotation
@brentyi
Copy link
Collaborator

brentyi commented Oct 21, 2023

Ok! I pushed a fix: the error seemed correct, since output has a list[Tensor] | Tensor type and is_tensor(output) isn't annotated by the PyTorch team as a TypeGuard. Switching to isinstance() makes .to() pass the checks.

@brentyi brentyi merged commit f362eae into nerfstudio-project:main Oct 21, 2023
4 checks passed
@decrispell
Copy link
Contributor Author

That seems like a much better solution, Thanks @brentyi !

@decrispell decrispell deleted the gpuchunks branch October 21, 2023 11:16
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.

None yet

3 participants