[stdlib] Fix inconsistency with UnsafePointer[SIMD[bool]]
#3800
+50
−0
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.
Fixes #2813 and #3229
This was originally fixed with
DTypePointer
, but regressed after it got removed.I'm still curious about whether original behavior is intended or not, and what we want to do about the inconsistency (if anything).
SIMD[bool]
does seem to be packed in memory, and I'm guessing that just carries over topop.store
/pop.load
:Because of that, this fix may have unwanted consequences.
The solution in this PR is the same as before: it forces simd bools to be represented as bytes when doing stores/loads.
Doing it this way keeps simd bools consistent with the other dtypes when doing stores/loads of varying widths.
Maybe there's a way we could pack bools in a width-independent way, but i cant see that working with pointer offset.
we might want to have a separate method, or a parameter which keeps the original behavior.
Another thing i noticed,
bitwidthof[SIMD[DType.bool, 4]]()
returns32
, so I'm really not sure what's intended here.