Peter Newman
2013-Jul-20 08:08 UTC
[LLVMdev] Another memory alignment issue with SSE operations
Unfortunately, I've ran into a second issue where addpd is being performed on memory that isn't 16 byte aligned. Again, this only happens if the createJIT OptLevel is set to Default (vs None). According to http://www.jaist.ac.jp/iscenter-new/mpc/altix/altixdata/opt/intel/vtune/doc/users_guide/mergedProjects/analyzer_ec/mergedProjects/reference_olh/mergedProjects/instructions/instruct32_hh/vc8a.htm that will cause a GPF. I've attached the LLVM IR and a copy of the Disassembly this results in. The crash occurs at 00370872 At the time of the crash, ESP is set to 0018EEF8 - this results in a value is not 16 byte aligned. I notice that the offset is aligned though. The crash occurs on the first instance of addpd applied to the stack (as I understand ESP is used for). There is also raises the question of would it be worth requiring alignment of the function stack to improve performance (assuming movapd is faster then movupd). I'm not expecting LLVM to recognize this (although it would be neat) but is this something worth setting ourselves, knowing we're going to be using mostly SSE instructions? And how would we do that? -- Peter N -------------- next part -------------- A non-text attachment was scrubbed... Name: addpd-unaligned.zip Type: application/octet-stream Size: 42810 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130720/387f45bf/attachment.obj>
Peter Newman
2013-Jul-20 08:58 UTC
[LLVMdev] Another memory alignment issue with SSE operations
I discovered the alignstack(16) attribute, and am now using this in our code. This avoids this crash, and as a bonus, causes the resulting code to use movapd instead of movupd - so is potentially faster code, too. -- Peter N On 20/07/2013 6:08 PM, Peter Newman wrote:> Unfortunately, I've ran into a second issue where addpd is being > performed on memory that isn't 16 byte aligned. Again, this only > happens if the createJIT OptLevel is set to Default (vs None). > > According to > http://www.jaist.ac.jp/iscenter-new/mpc/altix/altixdata/opt/intel/vtune/doc/users_guide/mergedProjects/analyzer_ec/mergedProjects/reference_olh/mergedProjects/instructions/instruct32_hh/vc8a.htm > > that will cause a GPF. > > I've attached the LLVM IR and a copy of the Disassembly this results > in. The crash occurs at 00370872 > > At the time of the crash, ESP is set to 0018EEF8 - this results in a > value is not 16 byte aligned. I notice that the offset is aligned though. > > The crash occurs on the first instance of addpd applied to the stack > (as I understand ESP is used for). > > There is also raises the question of would it be worth requiring > alignment of the function stack to improve performance (assuming > movapd is faster then movupd). I'm not expecting LLVM to recognize > this (although it would be neat) but is this something worth setting > ourselves, knowing we're going to be using mostly SSE instructions? > And how would we do that? > > -- > Peter N > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130720/1062ceec/attachment.html>
Apparently Analagous Threads
- [LLVMdev] llvm.x86.sse2.sqrt.pd not using sqrtpd, calling a function that modifies ECX
- [LLVMdev] SIMD instructions and memory alignment on X86
- Question about llvm vectors
- [LLVMdev] Proposal for a new LLVM concurrency memory model
- [LLVMdev] Proposal for a new LLVM concurrency memory model