Repository navigation
Update loops in CpuMath to be more efficient - #1177
Conversation
|
Did you run any benchmarks to make sure it bring speed improvements? |
| Vector128<float> scalarVector128 = Sse.SetAllVector128(scalar); | ||
|
|
||
| if (pDstCurrent + 4 <= pDstEnd) | ||
| if (pDstCurrent <= pDstEnd - 4) |
There was a problem hiding this comment.
creating a temp for pDstEnd - 4 is probably better, as that would better ensure that each loop isn't doing pDstEnd - 4 before the comparison
I don't believe so, both PRs have the same problem, which is that each iteration of the loop may do a substraction/addition as part of the comparison. As commented on #1177 (comment), creating a temp |
| Vector128<float> scalarVector = Sse.SetAllVector128(scalar); | ||
|
|
||
| while (pDstCurrent + 4 <= pDstEnd) | ||
| while (pDstCurrent <= pDstEnd - 4) |
There was a problem hiding this comment.
Could you update the SSE case as well?
|
|
||
| private const int Vector256Alignment = 32; | ||
|
|
||
| private const int destinationEnd = pDstEnd - 4; |
There was a problem hiding this comment.
Where is pDstEnd defined, I wouldn't expect this could be a constant....
|
@tannergooding does this look OK now? Nice perf improvement @jwood803 thank you! |
| float* pDstEnd = pdst + dst.Length; | ||
| float* pDstCurrent = pdst; | ||
| int destinationEnd = pDstEnd - 4; | ||
|
|
There was a problem hiding this comment.
This should be updated to remove the extra new line.
|
This was a bad change/merge float* pDstEnd = pdst + dst.Length;
float* pDstCurrent = pdst;
int destinationEnd = pDstEnd - 4;
The @shauheen @danmosemsft - maybe now would be a good time to get a I've opened #1495 for the build break. |


Fixes issue #835