-
-
Notifications
You must be signed in to change notification settings - Fork 651
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
[core/simd]: Write package documentation #4545
base: master
Are you sure you want to change the base?
Conversation
Check if SIMD is emulated on a target platform. | ||
|
||
This value is `true`, if the compile-time target has the hardware support for | ||
at 128-bit (or wider) SIMD. If the compile-time target lacks the hardware support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at 128-bit (or wider) SIMD. If the compile-time target lacks the hardware support | |
at least 128-bit (or wider) SIMD. If the compile-time target lacks the hardware support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"at least" implies "or wider" so at least one of these has to go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You now have has the hardware support for at 128-bit (or wider)
where for at
doesn't make any sense, so I tried to fix it with that suggestion.
core/simd/simd.odin
Outdated
between all of the lanes in a vector. | ||
|
||
Inputs: | ||
- `a`: Vector to reduce |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `a`: Vector to reduce | |
- `a`: The vector to reduce. |
core/simd/simd.odin
Outdated
reduce_and :: intrinsics.simd_reduce_and | ||
|
||
/* | ||
Reduce SIMD vector to a scalar by performing bitwise OR of all of the lanes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reduce SIMD vector to a scalar by performing bitwise OR of all of the lanes. | |
Reduce a vector to a scalar by performing bitwise OR of all of the lanes. |
core/simd/simd.odin
Outdated
/* | ||
Reduce SIMD vector to a scalar by performing bitwise OR of all of the lanes. | ||
|
||
This procedure returns a scalar, that is the result of the bitwise OR operation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This procedure returns a scalar, that is the result of the bitwise OR operation | |
This procedure returns a scalar that is the result of the bitwise OR operation |
core/simd/simd.odin
Outdated
between all of the lanes in a vector. | ||
|
||
Inputs: | ||
- `a`: Vector to reduce |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `a`: Vector to reduce | |
- `a`: The vector to reduce. |
core/simd/simd.odin
Outdated
- `a`: Vector to reduce | ||
|
||
Result: | ||
- Bitwise AND of all lanes, as a scalar. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Bitwise AND of all lanes, as a scalar. | |
- Bitwise OR of all lanes, as a scalar. |
Co-authored-by: Laytan <[email protected]>
Check if SIMD is emulated on a target platform. | ||
|
||
This value is `true`, if the compile-time target has the hardware support for | ||
at 128-bit (or wider) SIMD. If the compile-time target lacks the hardware support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"at least" implies "or wider" so at least one of these has to go
} | ||
return res | ||
|
||
Example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! I should fix this then. I haven't read your comments below, but it should be okay to surround the code block with text that describes what the example achieves, right? Otherwise I feel like the purpose of example is defeated, unless it's explained at least a little bit.
+-------+-------+-------+-------+ | ||
res: | ||
+-------+-------+-------+--------+ | ||
| 0x44 | 0xaa | 0x06 | 0xfe | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay this one I have to refuse, I was assuming 1-byte lanes, which I should probably make explicit in the comments.
/* | ||
Saturated addition of SIMD vectors. | ||
|
||
The *saturated sum* is a sum, that upon overflow or underflow, instead of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I should rewrite this.
core/simd/simd.odin
Outdated
res := simd.gather(ptrs, defaults, mask) | ||
fmt.println(res) | ||
|
||
The code would print `<2, 127, 10, 127>`. First and the third positions came |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are indented with a tab. Thanks for Output:
tip!
Co-authored-by: Laytan <[email protected]>
+------+------+------+------+ | ||
| 0 | 1 | 0.33 | 0.2 | | ||
+------+------+------+------+ | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1/0
may not result in 0
. That's a poor example.
No description provided.