Repository navigation
Conversation
2dd9035 to
8b6b50c
Compare
|
I re-enabled the RustRealloc hook that was removed in #1088 and then tried the examples from #702 with this PR. I got: |
|
blocked on #1243 |
There was a problem hiding this comment.
Nit: This could be written in a nicer way with if let Some(largest) = ... { ... } else { /* empty case */ }, thus avoiding unwrap().
|
Looks good to me. Two things:
|
|
One more thing: shouldn't we zero-initialize |
celinval
left a comment
There was a problem hiding this comment.
Can you at least add a few sanity tests? Have you tried measuring the performance gain at all? I am a bit worried about this PR since it is doing something way out of the rust spec.
|
Looks good to me, except I think this should have a test. Running Kani with the flag and checking that the value of an uninitialized variable is zero (or something to that effect). Or is there a reason not to test this? |
celinval
left a comment
There was a problem hiding this comment.
Thanks for adding a test, but it does show how this feature is unsound. I don't think we should add this code to Kani.
I would prefer if you publish a separate PR for the code that isn't directly related to this feature and keep the zero_initializer stuff in a branch for now.
If it is too painful to keep the zero_initializer logic on a branch, then I would suggest that we remove the kani option and just use a constant to enable / disable this code.
There was a problem hiding this comment.
How are the changes in this file related to the zero initialization?
|
What about an --enable-unsound flag |
Description of changes:
Right now, we can only
zero_initscalar types. This adds a recursive form to allow us tozero_initcomplex types as well.Resolved issues:
Resolves #ISSUE-NUMBER
Call-outs:
Using this may improve performance, at a potential soundness cost. Since the tradeoff is not clear, putting it behind a flag to allow experimentation, but keeping the current default for now.
Testing:
How is this change tested?
Is this a refactor change? No
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.