Skip to content

Optimize list_to_packed to avoid for loop #1737

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

Closed

Conversation

Ruishenl
Copy link
Contributor

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.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 22, 2024
@bottler
Copy link
Contributor

bottler commented Feb 23, 2024

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
Copy link
Contributor Author

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
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@bottler merged this pull request in ccf2291.

@bottler
Copy link
Contributor

bottler commented Apr 2, 2024

@Ruishenl Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants