facebookresearch / pytorch3d

PyTorch3D is FAIR's library of reusable components for deep learning with 3D data
https://pytorch3d.org/
Other
8.7k stars 1.3k forks source link

Optimize list_to_packed to avoid for loop #1737

Closed Ruishenl closed 5 months ago

Ruishenl commented 7 months ago

For larger N and Mi value (e.g. N=154, Mi=238) I notice list_to_packed() has become a bottleneck for my application. By removing the for loop and running on GPU, i see a 10-20 x speedup.

bottler commented 7 months ago

The function needs to work with items of different lengths (Mi different for each i). I think you need to sum over the lengths, and then this should work.

Ruishenl commented 7 months ago

The function needs to work with items of different lengths (Mi different for each i). I think you need to sum over the lengths, and then this should work.

Updated.

facebook-github-bot commented 7 months ago

@bottler has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 6 months ago

@Ruishenl has updated the pull request. You must reimport the pull request before landing.

facebook-github-bot commented 6 months ago

@bottler has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 5 months ago

@bottler merged this pull request in facebookresearch/pytorch3d@ccf22911d4daa74af7fbf70b3373bc0fe46d6d7c.

bottler commented 5 months ago

@Ruishenl Thank you!