Forums > Dev

Max5 Signal Vector Mem Alignment

February 9, 2009 | 11:03 am

Dear c74,

I do a lot of stuff with SIMD (SSE) instructions for speed. In Max 4.6 I seemed to be able to assume that signal vectors were 16 byte aligned under Mac OS X (intel or otherwise) and I never ran into trouble.

In Max5 some experimentation suggests that the vectors are probably 8-byte aligned but 16-byte alignment will occur in 50% or so of cases (due to the 8 byte alignment). This means that my code gives me a bad instruction crash when I call it on an unaligned address.

Obviously, I could do unaligned load/storing but in some cases this would probably mean it wasn’t worth using SIMD at all. Is there any chance at all of the older vector alignment being available either by default, or as an option in the future?

I notice that in z_dsp, there is now a tantalising set of macros referring to SIMD things that was not there before. This seems to all be off at the moment, but leads me to think we might expect something SIMD related in the near future. One of the things here seems to be for setting minimum vector size for SIMD, which I imagine might have an effect on memory alignment when/if it’s implemented.

The best case for me would be for signal vectors to be 16-byte aligned in all cases, as was the case before. I realise this is basically a fairly esoteric request regarding the inner workings of the dsp code, and that I was relying before on something that was never guaranteed by the docs. However, it’s probably the only thing preventing me from using Max5 full time at the moment, and I’d love not to have to go back to 4 for certain speed requirements.

Thanks,

Alex


January 27, 2010 | 6:04 pm

Sorry, but… *bump* :D

I’d really like to know about how Max aligns its data. I feel Alex’s pain. Dear devs, is there any chance of making signal vectors 16-byte aligned? I know it’s a big ask, but it’s not just for us home coders… I’m sure you must have thought about it for your in-house development?


January 27, 2010 | 7:29 pm

Yes, I join the request.
I too, have done tons of Altivec and SSE stuff which was working great in Max4 but had to be put on hold indefinetely in Max5. I have also learnt at the last C74 expo that future developments of MSP will see signal objects communicate with 64 bits double precision instead of the current 32 bits single precision data types. However I can’t help thinking how this will affect the SIMD world since with double precision you can only process 2 values in parallel (assuming 128 bit vectors), which might make vectorization not even worth it.

If C74 could shed some light on this subject I promise I will send a box of good Italian wine to the San Francisco office ;)

Cheers.

- Luigi


January 27, 2010 | 10:26 pm

In Max 5.1.3, all signal vectors will be aligned on 16-byte boundaries.

Cheers,
Tim


Viewing 4 posts - 1 through 4 (of 4 total)