Add zeroWhere! fused masked zeroing primitive with ComparisonOp#91
Merged
Add zeroWhere! fused masked zeroing primitive with ComparisonOp#91
zeroWhere! fused masked zeroing primitive with ComparisonOp#91Conversation
Closed
Agent-Logs-Url: https://github.com/Quafadas/vecxt/sessions/2050e7c1-327a-4bfb-83c2-b678afa73246 Co-authored-by: Quafadas <24899792+Quafadas@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add fused ZeroWhere operator for masked zeroing
Add Apr 13, 2026
zeroWhere! fused masked zeroing primitive with ComparisonOp
Copilot stopped work on behalf of
Quafadas due to an error
April 13, 2026 18:28
Owner
|
@copilot Don’t test the large array in CI , concentrate on correctness only… |
Agent-Logs-Url: https://github.com/Quafadas/vecxt/sessions/ab12a61a-1a73-407b-b445-42d377914d57 Co-authored-by: Quafadas <24899792+Quafadas@users.noreply.github.com>
Contributor
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.
The two-pass pattern
dz1 *:*= (z1 > 0)allocates a temporaryArray[Boolean]and makes two SIMD passes.zeroWhere!fuses compare + blend + store into a single pass with zero allocations.API
Changes
vecxt/src/ComparisonOp.scala— new cross-platformenum ComparisonOp(LT, LE, GT, GE, EQ, NE); exported fromall.scalasrc-jvm/floatarrays.scala,doublearrays.scala) — SIMD implementation usingFloatVector/DoubleVector.blend(zero, mask)for the main loop; scalar tail handles non-aligned lengthssrc-js/,src-native/) — while-loop implementations forArray[Float]andArray[Double]vecxt/test/src/zeroWhere.test.scala— cross-platform correctness suite: basic correctness, all 6 ops, non-aligned lengths, empty arrays, NaN/infinity edge cases, self-referential arrays; bothFloatandDoubleThe
opparameter isinline, so the match is eliminated at each call site and the comparison is inlined directly into the loop.