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

Decrease Stack Size #88

Merged
merged 2 commits into from
Oct 11, 2023
Merged

Decrease Stack Size #88

merged 2 commits into from
Oct 11, 2023

Conversation

SamuelRiedel
Copy link
Member

Make the L1 size a configurable parameter and decrease the default stack size to 512 bytes per core. This is plenty for the kernels I wrote and should easily be enough for most other kernels as well, but @mbertuletti, @yichao-zh, @sermazz, let me know what you think as well.

Changelog

Changed

  • Decrease stack size to 128 words

Checklist

  • Automated tests pass
  • Changelog updated
  • Code style guideline is observed

@mbertuletti
Copy link
Collaborator

I tested it on some of my kernels and it works safely. For me you would be free to merge.

Copy link
Collaborator

@sermazz sermazz left a comment

Choose a reason for hiding this comment

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

For me it also looks good. Just a note about the systolic configuration:
systolic.mk uses the default stack size (which now is going from 1024 to 512 bytes), but increases the size of the sequential memory per core (2048 bytes). This is because the first few words of each tile sequential region are allocated to Xqueue (https://github.com/pulp-platform/mempool/blob/main/software/runtime/crt0.S#L71-L74). Then the remaining sequential space not used by either Xqueue or the stack is allocated to the sequential heap (https://github.com/pulp-platform/mempool/blob/main/software/runtime/runtime.h#L79-L95).
The sequential heap is not heavily employed.. so to reduce memory waste in the systolic configuration too, I would reduce its sequential memory per core from 2048 to 1024 bytes.

@SamuelRiedel
Copy link
Member Author

For me it also looks good. Just a note about the systolic configuration: systolic.mk uses the default stack size (which now is going from 1024 to 512 bytes), but increases the size of the sequential memory per core (2048 bytes). This is because the first few words of each tile sequential region are allocated to Xqueue (https://github.com/pulp-platform/mempool/blob/main/software/runtime/crt0.S#L71-L74). Then the remaining sequential space not used by either Xqueue or the stack is allocated to the sequential heap (https://github.com/pulp-platform/mempool/blob/main/software/runtime/runtime.h#L79-L95). The sequential heap is not heavily employed.. so to reduce memory waste in the systolic configuration too, I would reduce its sequential memory per core from 2048 to 1024 bytes.

Absolutely, I added this to the PR.

@SamuelRiedel SamuelRiedel requested a review from sermazz October 11, 2023 11:09
Copy link
Collaborator

@sermazz sermazz left a comment

Choose a reason for hiding this comment

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

Good to merge for me :)

@SamuelRiedel SamuelRiedel merged commit d371350 into main Oct 11, 2023
62 checks passed
@SamuelRiedel SamuelRiedel deleted the stack-update branch October 11, 2023 13:46
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.

3 participants