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

btl/sm: rewrite of fast box (per-peer receive buffers) #13037

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hjelmn
Copy link
Member

@hjelmn hjelmn commented Jan 14, 2025

I was investigating possibly lost btl/sm messages and realized that the code is difficult to follow and it is not always clear what I was attempting to do. It is not clear if there is a problem but the rewrite is worth committing.

This change does the following:

  • Seperate the fast box metadata out from the fast box receive data. These parts are logically separate so there was no need to keep adjusting the offset based on the metadata (start of buffer was offset 64, now 0).

  • Use modulo-math instead of toggling an extra bit to determine full vs empty. To keep this fast the modulo is done with bitwise-and with a mask and the fast box size has been limited to a power of two. This change simplifies the math and only has one special case to cover ( end overflow-- end less than start).

  • General cleanup of the code overall to improve readability.

I was investigating possibly lost btl/sm messages and realized that the code is
difficult to follow and it is not always clear what I was attempting to do. It
is not clear if there is a problem but the rewrite is worth committing.

This change does the following:

 - Seperate the fast box metadata out from the fast box receive data. These
   parts are logically separate so there was no need to keep adjusting the
   offset based on the metadata (start of buffer was offset 64, now 0).

 - Use modulo-math instead of toggling an extra bit to determine full vs
   empty. To keep this fast the modulo is done with bitwise-and with a
   mask and the fast box size has been limited to a power of two. This
   change simplifies the math and only has one special case to cover (
   end overflow-- end less than start).

 - General cleanup of the code overall to improve readability.

Signed-off-by: Nathan Hjelm <[email protected]>
@hjelmn hjelmn requested a review from bosilca January 14, 2025 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant