Alignment issues with msvc8 back

(L) [2007/09/18] [Michael77] [Alignment issues with msvc8] Wayback!

Hi,


I just started using the intel threading building blocks and just ran into troubles. I am trying to do a multithreaded scan to find the best splitting position and therefore need to hold my split candidates in an array of _m128 values. The results are later stored in a join function. So my task class looks something like this:
(L) [2007/09/18] [lycium] [Alignment issues with msvc8] Wayback!

probably you should use _MM_ALIGN16 on all data members that need aligning.
(L) [2007/09/18] [Michael77] [Alignment issues with msvc8] Wayback!

Sorry to mention:


float4 is actually a simple
(L) [2007/09/18] [lycium] [Alignment issues with msvc8] Wayback!

ah yes, quite right then.


i do know that msvc doesn't respect the compiler alignment settings, but afaik it does respect the __m128 alignment. hmm.
(L) [2007/09/18] [goodbyte] [Alignment issues with msvc8] Wayback!

Is ScanTriangles allocated on the stack or heap? If it's on the heap you would must manage the alignment by yourself (or use posix_memalign). I also assume you don't have any virtual functions in your class.
(L) [2007/09/19] [Michael77] [Alignment issues with msvc8] Wayback!

Mmhh, I guess it is on the heap. It is hidden somewhere deep in threading building blocks and I have no idea where (I am pretty new with threading building blocks). It is given to a parallel_reduce template that creates new task objects based on a template parameter, so this may be the problem. Virtual methods donĀ“t exist in the class. So I should probably find a way to align the data within that template class....
(L) [2007/09/19] [Michael77] [Alignment issues with msvc8] Wayback!

That sounds good, thanks, I will try that [SMILEY Smile] The alignment is definetly the problem, I just changed everything to using normal floats and doing unaligned stores/loads and that worked - although it is ugly and slower of course [SMILEY Sad]

back