Interesting...posila wrote: Wed Dec 12, 2018 7:18 amMore accurate name for GPU architecture is SIMT (Single instruction, multiple threads). The article describes control flow handling following wayNightinggale wrote: Wed Dec 12, 2018 1:39 am Looks like it is running an if-else structure on shaders. Does that mean shaders can handle conditional branching? If so then the shaders might end up in different places in the code. Does that mean shaders are not SIMD? Has the GPU system left the SIMD system? That doesn't make sense because both CUDA and OpenCL claims to be SIMD.A downside of SIMT execution is the fact that thread-specific control-flow is performed using "masking", leading to poor utilization where a processor's threads follow different control-flow paths. For instance, to handle an IF-ELSE block where various threads of a processor execute different paths, all threads must actually process both paths (as all threads of a processor always execute in lock-step), but masking is used to disable and enable the various threads as appropriate. Masking is avoided when control flow is coherent for the threads of a processor, i.e. they all follow the same path of execution. The masking strategy is what distinguishes SIMT from ordinary SIMD, and has the benefit of inexpensive synchronization between the threads of a processor.
I realized it's possible to emulate logic operators with arithmetic operators doodling with "factorio combinators"
you can say 0 -> false, non 0 -> true
then the * operator behaves as the "and" operator.
Then I remembered i had done similar tricks to convert simple loops with if statements in them to vector operations (SIMD) with similar trick with the downside that all paths are evaluated but some of them evaluates to 0 and then don't contribute to the result.