Sign in to follow this  
masterbubu

SSE Question

Recommended Posts

masterbubu    181
Hi,

I created an sse vector class, and I want to use it as a member of other wrapper classes.

the problem is either the wrapper class or its members needs to be aligned, which consumes lots of memory.
I use the the vector class to speed up the skinning system.

is there a way to use sse without consuming lots of ram, and still befits the sse boost?

tnx

Share this post


Link to post
Share on other sites
ApochPiQ    23000
How many objects are you creating? What platforms? Generally speaking it's hard to find a point where the extra handful of bytes for alignment is actually a serious problem, unless you're operating on a really big scale.

Share this post


Link to post
Share on other sites
masterbubu    181
Platform :VS2010.


The skinning system is part of game engine, so I want to support many objects.

if I'll save an aligned buffer of floats (say 512 bytes ) and memcpy the vertex data to it, how much it will harm the performances?

I'm trying to find the best way to enjoy sse boost, and no wasting to much memory.

Share this post


Link to post
Share on other sites
ApochPiQ    23000
[quote name='masterbubu' timestamp='1341346112' post='4955435']
The skinning system is part of game engine, so I want to support many objects.[/quote]

"Many" could mean different things. Are you talking about dozens? Hundreds? Millions? Remember that a modern computer probably has at least 2GB of memory in it, so you'd need to have literally many tens of millions of bytes of memory used by alignment padding to even [i]notice[/i]. Considering alignment on a 16-byte boundary can use up, at most, 15 extra bytes of memory, you're looking at millions of objects in-game before you have to care.



[quote]if I'll save an aligned buffer of floats (say 512 bytes ) and memcpy the vertex data to it, how much it will harm the performances?[/quote]

I'm not sure what you're asking here. Copying to aligned memory addresses does not "harm" performance. On the contrary, using aligned addresses can actually improve performance in some circumstances, albeit not hugely. Also, you [b]must[/b] align your data on 16-byte boundaries to use SSE, so you're not really "wasting" anything - you don't have a choice.

[quote]I'm trying to find the best way to enjoy sse boost, and no wasting to much memory.
[/quote]

Past a point, bending over backwards to try and save a few bytes of memory is probably going to hurt you far more than it helps. Saving a tiny bit of memory is going to cost you heavily in terms of throughput if you're constantly moving stuff into and out of aligned SSE-ready buffers.



Perhaps you could explain why you are concerned about the memory usage?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this