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

Perf/wgpu/reduce dim #943

Merged
merged 10 commits into from
Nov 13, 2023
Merged

Perf/wgpu/reduce dim #943

merged 10 commits into from
Nov 13, 2023

Conversation

louisfd
Copy link
Member

@louisfd louisfd commented Nov 10, 2023

I wrote a new algorithm for reduction in wgpu.
Contrary to the former, it can use many threads in the computation of a single output element, leveraging shared memory.
Therefore, it is better on unbalanced tensors with shapes like [50, 10000, 50] (when reduce dim is the large one, here 1)
However it is slower on balanced tensors like [512, 512, 512], because the former was already very well parallelized in those cases.
It makes it a very good case for autotune, which I have implemented too.
For now, sum_dim and mean_dim are done with the new algorithm, with autotune. ArgsMax, ArgsMin and Sum haven't been done yet.

Copy link
Member

@nathanielsimard nathanielsimard left a comment

Choose a reason for hiding this comment

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

🏎🏎🏎

@louisfd louisfd merged commit 831335a into main Nov 13, 2023
7 checks passed
@nathanielsimard nathanielsimard deleted the perf/wgpu/reduce_dim branch November 17, 2023 00:40
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

2 participants