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

Migrate reduce dim + More JIT instructions + Major wgpu reduce dim refactor #1396

Merged
merged 19 commits into from Mar 4, 2024

Conversation

louisfd
Copy link
Member

@louisfd louisfd commented Mar 1, 2024

  • NaiveReduceDim migrated to gpu representation

  • SharedReduceDim migrated to gpu representation

  • Instruction set needed for SharedReduceDim was added:
    -workgroup size
    -local invocation id
    -num workgroups
    -workgroup barrier
    -loop (not while because we found out it's error-prone, better loop with a break)
    -shared memory

  • Major refactor of reduce dim so kernels are generic over the algorithm type (sum, mean, argmin, argmax). Makes it much cleaner and scalable for autotune

Fix #1175

Copy link

codecov bot commented Mar 1, 2024

Codecov Report

Attention: Patch coverage is 92.30177% with 100 lines in your changes are missing coverage. Please review.

Project coverage is 85.72%. Comparing base (3d93e6d) to head (cae9f04).
Report is 8 commits behind head on main.

Files Patch % Lines
...burn-wgpu/src/codegen/dialect/gpu/vectorization.rs 0.00% 25 Missing ⚠️
crates/burn-wgpu/src/codegen/dialect/wgsl/base.rs 25.80% 23 Missing ⚠️
...ates/burn-wgpu/src/codegen/dialect/gpu/variable.rs 4.54% 21 Missing ⚠️
crates/burn-wgpu/src/kernel/reduce/base.rs 57.57% 14 Missing ⚠️
...tes/burn-wgpu/src/codegen/dialect/wgsl/compiler.rs 84.44% 7 Missing ⚠️
crates/burn-wgpu/src/codegen/dialect/gpu/shader.rs 0.00% 3 Missing ⚠️
crates/burn-wgpu/src/fusion/tracing/builder.rs 0.00% 3 Missing ⚠️
crates/burn-wgpu/src/codegen/dialect/gpu/branch.rs 88.88% 1 Missing ⚠️
...rn-wgpu/src/codegen/dialect/gpu/synchronization.rs 0.00% 1 Missing ⚠️
crates/burn-wgpu/src/compute/tune_key.rs 0.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1396      +/-   ##
==========================================
+ Coverage   85.52%   85.72%   +0.20%     
==========================================
  Files         594      608      +14     
  Lines       68226    69745    +1519     
==========================================
+ Hits        58348    59792    +1444     
- Misses       9878     9953      +75     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

LGTM

@@ -96,3 +103,15 @@ impl RangeLoop {
}));
}
}

impl Loop {
/// Registers a while loop to the given scope.
Copy link
Member

Choose a reason for hiding this comment

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

Is it a while loop or just a loop?

Copy link
Member Author

Choose a reason for hiding this comment

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

just a loop, forgot to change the comment

@nathanielsimard nathanielsimard merged commit 046d975 into main Mar 4, 2024
15 checks passed
@nathanielsimard nathanielsimard deleted the feat/jit/shared_reduce_dim branch March 4, 2024 15:48
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.

Refactor Reduce Autotune
2 participants