Hot answers tagged

26

It's essentially because not all GPUs can support function calls—and even if they can, function calls may be quite slow or have limitations such as a very small stack depth. Shader code and GPU compute code may appear to have function calls all over the place, but under normal circumstances they're all 100% inlined by the compiler. The machine code ...


12

No it is not guaranteed, since the OpenGL specification allows that two Compute Shader run concurrently or even in different order. You need to call glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT) before the second glDispatchCompute to ensure visibility of the writes from program_one. From the OpenGL.org wiki article on the memory model: [...] ...


6

The best place to put a look up table for a GPU compute shader depends on the size of the lookup table, and the frequency/coherency of access. In your case (you mentioned 4kb), shared local memory would likely be best (assuming you do not need this memory for other purposes in the same kernel). This memory has different names in different APIs, but is the ...


5

Old Hardware Some older cards didn't used to jump instructions in warps, so this was indeed an issue. If you have a conditional with these cards, the inside logic of the conditional would still be evaluated even if the block wasn't entered by any of the pixels, vertices, etc. There's little you can do in this case because every instruction will be executed. ...


5

There seems to be some confusion of terminology here. In Direct3D, you have threads and thread groups. "work item" and "work group" are generally encountered in OpenCL terminology, where a "work item" would be what a thread is in Direct3D and a "work group" corresponds to a Direct3D thread group. groupshared memory is memory accessible to all threads that ...


4

If there is no divergence (i.e. all threads in a wave take the same branch) newer GPU's can skip all the work within the if-branch. If there's divergence, then code in both branches is executed, but thread execution mask basically defines which threads execute code in which branch (code in non-executed branches for threads are effectively NOPed out). This is ...


3

Based on the comment of "ratchet freak" I researched Transform Feedback Buffers and solved my problem that way. I now generate the simulated points on the CPU and put them into a VertexBufferObject. I generate a second VBO for the points (along with some others for velocity). The connectivity of the cloth is given as an vertex-attribute in ivec4. Using the ...


3

The Opengl deals this problem automatically? How could it? At no point do you inform OpenGL that you only want 900 invocations. You have exactly 2 mechanisms to control the number of invocations: the work group size in the shader, and the work group count in the dispatch call. That determines how many invocations there are. If you want a variable number ...


3

It's possible to emulate Vulkan on a sufficiently capable non-Vulkan API. This is the point of the Vulkan Portability Initiative. Indeed, there is already a Vulkan implementation on top of the Apple proprietary API Metal, and there is work being done to implement Vulkan on top of D3D12. It probably would be possible to implement a version of Vulkan that ...


3

Yes, it is possible. For one however, Möller-Trumbore is not the only algorithm out there for ray triangle intersection, there exist others. However all of these rely on linear algebra vector multiplications and matrix operations. These can be combined into 4x4 tensor core operations (and each tensor core can do 4x4x4, but there are 8 cuda cores to every ...


2

You need nvidia-docker. If your ssh server is in a Docker instance, you can assign each one to a different GPU. Then just set things up so only one team is sshing into each Docker instance. You don't need to do anything fancy with cudaSetDevice(), or risk students using the wrong device and messing things up for others, because each instance looks like it ...


2

Are there algorithms that cannot be implemented this way and have to be implemented in OpenCL, and if so, how do I know if my algorithm is one of them? Yes. Generally scatter-gather algorithms work poorly in OpenGL as the data locality is poor. When you have to grab bits from all over the input image for each output pixel, it's going to be slow or nearly ...


2

Compute queues in general don't necessarily mean you can now do 2x dispatches in parallel. A single queue that fully saturates the compute units will have better throughput. Multiple queues are useful if one queue consumes less resources (shared memory or registers), then secondary queues can then overlap on the same compute unit. For real-time rendering ...


Only top voted, non community-wiki answers of a minimum length are eligible