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

corrected rand! for mutable static arrays and moved them to an extension #28

Merged
merged 3 commits into from
Oct 4, 2023

Conversation

schrimpf
Copy link
Contributor

@schrimpf schrimpf commented Oct 3, 2023

Fixes #27

A couple things of note:

  • I removed methods for immutable SArrays, since I think it's just not possible to modify them in place
  • I removed the dependency on StrideArraysCore. It was only used to create Ptr(x) and I don't think it's needed.

@chriselrod
Copy link
Member

The point of the PtrArray is to potentially avoid allocations.
Julia does not have proper escape analysis, so it conservatively heap allocates unnecessarily. PtrArray with GC.@preserve is a workaround.

MArray <: StaticArray and SArray <: StaticArray.
MArray is mutable, but SArray is not. Other hypothetical StaticArrays are mutable.

I don't really use this with StaticArrays, though, and we can blame current limitations of Julia's compiler for the allocations, so I'm okay merging this.

@codecov
Copy link

codecov bot commented Oct 4, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (c34cf44) 74.10% compared to head (bfe3c8f) 73.82%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
- Coverage   74.10%   73.82%   -0.28%     
==========================================
  Files           5        6       +1     
  Lines         695      680      -15     
==========================================
- Hits          515      502      -13     
+ Misses        180      178       -2     
Files Coverage Δ
ext/VectorizedRNGStaticArraysExt.jl 100.00% <100.00%> (ø)
src/api.jl 71.31% <100.00%> (+6.86%) ⬆️
src/VectorizedRNG.jl 82.14% <0.00%> (-3.05%) ⬇️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@schrimpf
Copy link
Contributor Author

schrimpf commented Oct 4, 2023

This last change is about the best I can do. I do not understand the failed Aqua tests on version 1.6, and cannot fix them. They do not seem to matter anyway.

@chriselrod
Copy link
Member

This last change is about the best I can do. I do not understand the failed Aqua tests on version 1.6, and cannot fix them. They do not seem to matter anyway.

I wouldn't worry about them either.

@chriselrod chriselrod merged commit 33880b1 into JuliaSIMD:master Oct 4, 2023
9 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

missing arguments in rand! methods for StaticArrays
2 participants