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

Feat/fixed chunk alloc by class #1960

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

mepatrick73
Copy link
Contributor

Pull Request Template

Checklist

  • Confirmed that run-checks all script has been executed.
  • Made sure the book is up to date with changes in this PR.

Related Issues/PRs

Provide links to relevant issues and dependent PRs.
#1752

Changes

Added sizes classes in memory management. If an allocation is asked for that is under the class threshold, that class threshold will be allocated. This is so that when we alloc bigger and bigger slices, we are stilll able to reuse. I.E if I ask 128mb, 150mb then 170mb, I'm still able to reuse allocations without having to realloc. Also recoded extend max memory to work. It's not currently being used due to computation being slow after being used. However it was tested for correctness.
Summarize the problem being addressed and your solution.

Testing

Tested against simple mm on Text-classification ag-news-training on release mode and saw 60% speedup improvement

@mepatrick73 mepatrick73 added the performance Anything related to performance label Jul 2, 2024
@mepatrick73 mepatrick73 self-assigned this Jul 2, 2024
Copy link

codecov bot commented Jul 2, 2024

Codecov Report

Attention: Patch coverage is 0% with 120 lines in your changes missing coverage. Please review.

Project coverage is 85.14%. Comparing base (755c070) to head (04ff03d).
Report is 2 commits behind head on main.

Files Patch % Lines
...-compute/src/memory_management/memory_pool/base.rs 0.00% 100 Missing ⚠️
...ates/burn-compute/src/memory_management/dynamic.rs 0.00% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1960      +/-   ##
==========================================
+ Coverage   84.87%   85.14%   +0.27%     
==========================================
  Files         797      810      +13     
  Lines       95082    99853    +4771     
==========================================
+ Hits        80697    85022    +4325     
- Misses      14385    14831     +446     

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

Comment on lines 221 to 225
//if self.recently_allocated_size > (0.8 * self.max_chunk_size as f64) as usize {
// self.extend_max_memory(storage);
// self.recently_added_chunks = Vec::new();
// self.recently_allocated_size = 0;
//}
Copy link
Member

Choose a reason for hiding this comment

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

Dead code

@@ -371,6 +397,7 @@ impl MemoryPool {
) -> ChunkHandle {
let padding = calculate_padding(size);
let effective_size = size + padding;
//let effective_size = self.max_chunk_size;
Copy link
Member

Choose a reason for hiding this comment

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

dead code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Anything related to performance
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

2 participants