Some SSE questions

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

No idea, if the thing crashes on exit you need to use the debugger and find out where. If it is crashing in the heap check routine it means you've probably walked past the end of some buffer.

If you're getting access violation reading zero, which functions are you in when that read occurs?

You're not going to be able to figure out what is happening without running a capable debugger.

If you're mangling the buffers from the host you need to write your own host to test this.

That should be easy to identify, just check the call stack and see which function you're in.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.

Post

camsr wrote:
mystran wrote: If you get a crash because of stack misalignment then really you have a buggy compiler
I am using TDM-GCC (MingW64) because, well, it's as close to GCC as I want to get on Windows :lol:
As I've said before - TDM is 'non-standard' gcc...

In any way - there's an easy way to check if it's the stack that is getting smashed ( are you getting segfaults? ), add -mstackrealign to your compile options, if the problem persists, the problem is not on the stack.

On a slightly related note - most info on SSE talks about data like [y, y[-1], y[-2], y[-3]] , but there is very little info on processing data [w, x, y, z], was wondering how to get simple 4x LFO in the latter data context(?). Any links that describes this 'parallel data' processing in a practical manner would be appreciated.

@camsr - sorry for the slight hijack.

Regards
Andrew

Post

camsr wrote:
tony tony chopper wrote: You should never assume that your plugin will be asked to processed a 4-sample-aligned length.
Good point. I should also check sampleframes to verify if 4 samples even exists before entering the vector loop.
...Annnd :D That was it. I forgot that buffers may be very small.

Post

Ichad.c wrote: As I've said before - TDM is 'non-standard' gcc...
Which I think might be why my x64 plugins have problems in some hosts.
OR it could be I haven't enabled some important VST method that some hosts may rely on.

Post

The "access violation for address 0" is how at least MSVC debugger shows the alignment faults. With a half decent debugger, ask for the disassembly and you'll see what operation is causing it.

Regarding aligning stuff manually: yeah you can do that, but it doesn't really work in all cases (unless you actually write assembler directly), because compilers can spill temporaries as well (as part of register allocation; it's not too common if you can fit in registers, but it can happen) and this won't work unless the compiler knows how to align stuff on stack.

As for GCC on Windows .. it's kinda like trying to eat noodles with a fork .. sure you can do it, but using chopsticks (=one of the compilers where Windows isn't a second priority hack) would make the experience a lot smoother.

Post

mystran, lol

Newest strange behavior,
Everything works fine now when the plugin is loaded into a mixer track in FL.
But loading it into Patcher, or MuTools MUX, no audio is processed.
MUX gave a warning "User Thread Wait Timeout Error @ REP[12]

Post

And, -mstackrealign has saved the day.

Now I may eat my noodles with a fork. :D

Post

Well, actually -mstackrealign has helped a great deal, but every so often the plugin still crashes on exit, less frequently than before. Must I use the heap and aligned sections?

Post

You can try Boost.SIMD to let you write proper SSE code on any compiler (provided you check alignment), without having to learn intrinsics or modify your code if you want to upgrade to a different vectorization size.

Post

Miles1981 wrote:You can try Boost.SIMD to let you write proper SSE code on any compiler (provided you check alignment), without having to learn intrinsics or modify your code if you want to upgrade to a different vectorization size.
Yeah Boost is inticing for SIMD. I read they will be integrating it into the standard library! Wondering how that one will work out

Post

Hi,

You can also have a look on the Agner Fog C++ vector class library. There is a template class which let you implement readable SSE2, SSE3, SSSE3, AVX etc code. Should work on your compiler.
Even debug performance is not so good. Maybe there are some alignment hints also.

Post Reply

Return to “DSP and Plugin Development”