You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The attached code calls an assembly function that doesn't escape anything.
When marked with //go:noescape, it causes crash.
I originally bumped into this when switching to 1.2rc3 from 1.1.2 (am64). The original
(and lengthy) code strangely runs okay with 1.1.2 whereas the test case causes panic
with 1.1.2 as well.
This made me believe that the problem exists in both version, so I will try to find the
"missing element" that lets this one slip with go 1.1.2.
By the way, is I move u and v to the global scope, the problem disappears as well.
There is no guarantee of a 128-bit alignment of u in this code. Heap allocations are
better aligned than stack variables, which explains the issue.
Replacing MOVAPS by MOVUPS should work in all cases.
Yes. And when the address happens to be 128-bit aligned, I think using MOVUPS has no
performance hit at all.
Another way would be to allocate a slice (on stack/heap) larger than what you need, and
reslice it to get the needed alignment (you will need to use a C or even asm function to
do this, or you can use unsafe.Pointer).
Thank you all very much for explaining this. I was living under the delusion that all
allocations are aligned.
About performance penalty, it appears that there is none with a recent Intel CPU.
All works just fine.
I'm so sorry about filing this invalid bug.
by rayneolivetti:
Attachments:
The text was updated successfully, but these errors were encountered: