-
Notifications
You must be signed in to change notification settings - Fork 255
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
Well-defined lazy initialization for get_intra_edges
#3277
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closed
barrbrain
force-pushed
the
intra-edges
branch
6 times, most recently
from
October 27, 2023 05:59
e9a9cdf
to
bf464ea
Compare
Codecov ReportAttention:
... and 1 file with indirect coverage changes 📢 Thoughts on this report? Let us know!. |
barrbrain
force-pushed
the
intra-edges
branch
from
October 27, 2023 08:46
db3b948
to
64fd4b1
Compare
barrbrain
changed the title
WIP: Well-defined lazy initialization for
Well-defined lazy initialization for Oct 27, 2023
get_intra_edges
get_intra_edges
barrbrain
force-pushed
the
intra-edges
branch
from
October 27, 2023 18:43
64fd4b1
to
0fd4a45
Compare
Equivalent to composing Aligned::new() with MaybeUninit::uninit_array(), which is currently only available in nightly rustc.
Always write to the top-left so the initialized area is contiguous. Introduce new types to make a safe rebinding pattern ergonomic: let mut edges: IntraEdgeBuffer<T> = Aligned::uninit_array(); let edges: IntraEdge<T> = get_intra_edges(&mut edges, ...); predict_intra(&edges, ...); IntraEdgeBuffer holds the aligned array for initialization. IntraEdge holds references to the initialized slices and ensures the layout required by the intra-prediction assembly. Support passing pre-initialized data for tests and benchmarks. Since MaybeUninit::write_slice() is only available in nightly rustc, use std::mem::transmute() with copy_from_slice() in get_intra_edges().
barrbrain
force-pushed
the
intra-edges
branch
from
October 27, 2023 19:15
0fd4a45
to
efa9f8c
Compare
lu-zero
approved these changes
Oct 27, 2023
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.
Probably fine, I'm debating if it is better to hide the buffer allocation in the function and return (buffer, ref).
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Inspired by #3276. Introduce new types to capture the requirements of intra edge buffers and avoid undefined behavior.
Analysis from @kornelski quoted below: