1
\$\begingroup\$

I have been learning game development, using C++ and OpenGL, for about 4-5 months. Before that I used to program in C# and the .NET platform(about a year). So, I consider myself new to game engineering and software development as whole.

Recently I read about SIMD math. I found it interesting and started wondering if it was good to use it in my math library. But, considering that I have so much to learn and I haven't even laid the foundations of my knowledge of game development, should I explore it in depth and start using it? Or should I wait until I really start to need it?

\$\endgroup\$

2 Answers 2

5
\$\begingroup\$

This is really a matter of opinion, but I think SIMD can safely be postponed. It'll probably be a long time before you're doing so much math on the CPU that you'll need it. Besides, there are probably vector/matrix math libraries out there that have SIMD built-in already, and if you use one of those, it should "just work" and you'll have very little need to dig into the details.

\$\endgroup\$
3
  • \$\begingroup\$ Isn't it better if one first tries to make things by himself in order to undersand them? Anyway thanks for the answer! \$\endgroup\$
    – Tsvetan
    Jan 9, 2012 at 9:17
  • 1
    \$\begingroup\$ @Tsvetan depends on what you want to do. If your goal is to understand the details of SIMD at the machine code level, then sure, building your own SIMD math library is a good way to do that. But there's nothing wrong with using someone else's library to save time while you work on something more interesting. Most game programmers don't need to know the nuts and bolts of SIMD. And you can always use a library to begin with, then learn it yourself later. \$\endgroup\$ Jan 9, 2012 at 9:29
  • 1
    \$\begingroup\$ I agree with your "opinion". Besides, "premature optimization is the root of all evil", and SIMD is nothing but an optimization that you really might not need. Better focus efforts on playable elements on the game, rather than improvements you won't see due to frame limiter anyway. \$\endgroup\$
    – bobobobo
    Jan 9, 2012 at 13:12
1
\$\begingroup\$

SIMD in and of itself is straightforward to use, provided you are even mildly experienced with C++. The problem here is that not every problem lends itself to SIMD calculations. You need to appreciate that using SIMD to save time naturally assumes that you have a set of operations all of which are the same in nature (eg. div, sqrt) and all of which may be executed in parallel. Given the nature of real-time simulations (games), I would furthermore assume that there would be some degree of repetition of these set-operations several times per second for it to be worth considering using SIMD ops at all, as well. Two examples are:

  • Ray packets in RTRT (real-time raytracing)
  • Pixel operations (as found on the GPU which is massively parallel -- originally more SIMD but things have moved toward MIMD)

SIMD is never useful where you need the results of one operation to calculate the results of the next; performing physics stepping for an entity is an example of where SIMD would not be useful.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .