When should I use the C++ AMP (or shouldn't use it)?
What is an overhead of AMP? How long it takes to copy data to GPU memory and back? What is a minimal data size when AMP starts to decrease performance?
When should I use the C++ AMP (or shouldn't use it)?
What is an overhead of AMP? How long it takes to copy data to GPU memory and back? What is a minimal data size when AMP starts to decrease performance?
Copyright © 2021 Jogjafile Inc.
Copying data isn't that big an overhead as long as you're not doing it too much. Copying a few large chunks of data is fine once in a while. Games usually copy over instance data for each object on each frame, for example, and this can kill performance if overdone, but is usually fine. Notably, they don't copy over stuff like 3D geometry, and that would destroy you.
The use case, generally, is for simple (think, at maximum, an FSM) computations on a large amount of data, where each datum is treated individually.
As for performance, well, a profile is the only way to be sure. GPUs are quite different beasts and the minimum data size really depends on the computation at hand, and the data spread. For example, GPUs don't really like it when multiple threads don't branch the same way.