Create safe slices from cdef_line_buf#981
Closed
rinon wants to merge 53 commits intosjc/init_lowest_pixel_memfrom
Closed
Create safe slices from cdef_line_buf#981rinon wants to merge 53 commits intosjc/init_lowest_pixel_memfrom
cdef_line_buf#981rinon wants to merge 53 commits intosjc/init_lowest_pixel_memfrom
Conversation
When backtraces are disabled (due to their large performance overhead), we can still capture the `Location::caller()`, which is quite cheap. This is very useful for rare panics in CI, which can be hard to reproduce.
… add `#[track_caller]`s when `debug_assertions`.
rinon
commented
Apr 18, 2024
Collaborator
Author
rinon
left a comment
There was a problem hiding this comment.
This fails due to out of bounds slice access in the third backup_lpf call (https://github.com/memorysafety/rav1d/pull/981/files#diff-e9e188b522fe10286c7075c8068b07949fff51301681598c10c42927aa884061R339). I think this length must be wrong. @fbossen, can you look at this? Looks like you added the slice originally and I don't really understand that PR (#728).
…ounds error messages (#980) When backtraces are disabled (due to their large performance overhead), we can still capture the `Location::caller()`, which is quite cheap. This is very useful for rare panics in CI, which can be hard to reproduce. This also makes the out-of-bounds error messages more informative (they say which thing exactly is out of bounds and what the bound was, like `std`).
…elds (#978) I found these by running the argon tests in debug mode (not just `debug_assertions`), as these `libstd` assertions are only run in actual debug mode.
…_dav1d`, as this is the only callsite and we'll need to store stuff on the stack.
… there are safer wrapper methods.
…ough the callstack.
… side of the `fn` ptr boundary).
…ntMutArcSlice<refmvs_temporal_block>>`s.
…vs_pool` now that `mvs`s have been `Arc`ified.
…l` now that `cdf`s have been `Arc`ified.
This fixes a bug from #971 where I was overslicing. It wasn't caught by the normal tests, only the argon tests that only ran on `main` once I merged.
`fn splat_mv` is already a method, and `fn rav1d_refmvs_save_tmvs` was already like a method, but as a free `fn`. So this just makes them all methods on `Rav1dRefmvsDspContext`, which helps things for `fn load_tmvs` as I make it and the `mvs` fields safe.
…ough the callstack (#983)
This was already `Arc`ified in a previous PR, so this removes the now unused pool.
…ust mostly nothing if asm is disabled.
…ng `&'static` refs in `Rav1dContext`.
…e `&'static`s (#986) * Fixes `dsp` field of #713. * Fixes all `fn *dsp_init`s of #862. * Improves DSP initialization code size of #809. This * Makes all `fn *dsp_init*`s safe. * Changes all `fn *dsp_init*`s into `fn *DSPContext::new`s that directly initialize the type without `unsafe`ly zero initializing it first. This is done by directly initializing in `fn default`, which is for the fallback `fn`s, and then updating the `fn` ptrs in the `fn init_{x86,arm}`s. These `fn`s are also all `const` now, as that was trivial. * Adds `wrap_fn_ptr!` and `enum_map!`s to the array fields of `Rav1dMCDSPContext`, since I needed a default value to initialize the arrays directly if I want it the indices to be named (rather than a normal array, whose order is easy to mix up). `wrap_fn_ptr!` provides that default value, which is then optimized out. * Replaces the `Rav1dContext::dsp` array, which is manually lazily initialized, with `fn Rav1dDSPContext::get`, which uses `OnceLock` for lazy initialization. * Makes the `Rav1dFrameData::dsp` raw ptr into a `&'static` now that we lazily initialize it with `OnceLock`. This also dramatically reduces the code size of DSP initialization (in KiB): | Target | Before | After | | ------------------------------- | ------ | ----- | | `x86_64-unknown-linux-gnu` | 192.5 | 95.6 | | `i686-unknown-linux-gnu` | 106.5 | 39.6 | | `aarch64-unknown-linux-gnu` | 88.2 | 15.3 | | `armv7-unknown-linux-gnueabihf` | 103.8 | 17.0 | This is measured before using `cargo bloat --filter 'dsp_init'` and after using `cargo bloat --filter 'DSPContext::new'`.
Collaborator
Author
Collaborator
Collaborator
Author
|
|
This file contains hidden or 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
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.
No description provided.