-
Notifications
You must be signed in to change notification settings - Fork 178
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
SHM: optimize metadata #1714
base: main
Are you sure you want to change the base?
SHM: optimize metadata #1714
Conversation
… into sigle "Metadata" structure
- change three_node_combination_multicast ports
…ead and less structure sizes for SHM
Put ProtocolID and ChunkDescriptor into SHM metadata: less wire overhead and less internal structure sizes for SHM Gains 2% more performance for SHM, but this is not the only thing: it opens a way to implement publish-before-allocated-and-written concept, that should dramatically increase SHM performance and improve latency! |
@@ -0,0 +1,58 @@ | |||
// | |||
// Copyright (c) 2023 ZettaScale Technology |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure it's 2025 for newly-created files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
#[stabby::stabby] | ||
pub struct Metadata<const S: usize> { | ||
headers: [ChunkHeaderType; S], | ||
watchdogs: [AtomicU64; S], // todo: replace with (S + 63) / 64 when Rust supports it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious to know more about the todo comment here. What's the intended behaviour and current limitations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Watchdogs are packed as bits of u64
. This means that for S
headers we need S/64
-sized u64
array. However, stable Rust doesn't support const arithmetic for const generic parameter like this:
watchdogs: [AtomicU64; (S + 63) / 64]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation
) | ||
} | ||
|
||
pub fn count(&self) -> usize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If count
is const, couldn't be an associated const
instead of a function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in a bit different way: pub const fn
The reason is that associated constant cannot be called through object instance, only as Type::constant
, so I need to carry full object type (and it is compilcated) everywhere
const fn
is intended to work in the way we need
LGTM. I'll just wait to merge it because of the |
Sure, that's intended as I didn't put "release" label :) |
@yellowhatter It's well understood that SHM is still marked as unstable, meaning that breaking changes may be introduced. |
@Mallets The idea is clear. I think we can add smth similar to |
I think it makes sense. This would allow us to better control the introduction of additional changes in the future. |
closes #1703
Combined SHM metadata in single storage that is now identified with single descriptor.
By-the-way fixed undiscovered edge case bug with buffer validity check in the receiver code.
Improves SHM performance by 35% (1.7M -> 2.3M) that moves SHM efficiency threshold to somewhat less than 512 bytes.
Breaks backward compatibility for SHM communication. Non-SHM is not affected.