Are literals splatted in SIMD Operations? #1416
-
Is there any performance difference if I write this fn multiply_by_two[
dtype: DType, simd_width: Int
](x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]:
alias splatted_two = SIMD[dtype, simd_width](2.)
return splatted_two * x instead of this? fn multiply_by_two[
dtype: DType, simd_width: Int
](x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]:
return 2.0 * x In other words, is the literal |
Beta Was this translation helpful? Give feedback.
Answered by
abduld
Jan 1, 2024
Replies: 1 comment 1 reply
-
The two are equivalent. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
leandrolcampos
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The two are equivalent.