Re: [AD] malloc

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


As it stands at the moment, allegro can be severly performance hit, if
someone compiles it with SSE turned on, P4, and AMD CPUs both have SSE.

Have you tried enabling SSE to test the performance hit? And if so, do you know if it's not just from improper SSE code use, or due to improper memory alignment? Do you know if GCC/MSVC don't already optimize malloc calls to return aligned pointers when SSE is being used?

no i dont know if mallocs auto align during SSE use, however all the documenation i've read including msdn stuff specifically tell you to align memory using aligned_malloc() surely they would not have made such a big deal of it if msvcr.dll does this already.

Besides, I thought we already talked about this on IRC and such. Memory bitmaps and samples and such won't benefit from aligned allocation since even if the pointer is aligned, each value within will not be (eg. if bmp->line[0][0] is an aligned access, ((uint32_t*)bmp->line[0])[1] won't be,

i wouldn't be accessing [0][1] SSE is 128bits wide, pixels are 32, so i can process 4 pixels at once.
then the next load would be [0][4] (aligned again).


etc). Plus, you can't gaurantee the alignment of video bitmaps since the system allocates/maps them, not your program.

video cards dont have SSE.
why would you write SSE code for video bitmaps?


Personally, I don't see why GCC would generate SSE code to use on dereferenced pointers (which it'll almost never know at compile time if they're aligned or not). Instead, it probably would only use SSE code to use on the variables themselves, where it'll know for certain if it will be properly aligned or not.


using array notation assists in most optimzing compilers abilities to use SSE effectively.



Intel are now recommending that code favour SSE instead of MMX (cpu
manufacturers have already signalled the death of MMX)

MMX won't disappear from processors. There are programs that require an MMX-compatible CPU, and such programs would become unrunable if MMX went away. And it's only natural that Intel would favour SSE over MMX. SSE is newer, and probably better than MMX (and it gives users more of an incentive to buy a newer CPU if they still have old ones).



nor will i386 instructions, so should we not bother with MMX either, as i386 is good enough.





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/