Shader Printf in HLSL and DX12
therealmjp.github.io
therealmjp.github.io
In CPU programming, just sequentially outputting printf one-at-a-time works. And you can optimize this to go faster-and-faster.
In GPU programming, its innately a parallel job. Any printf call will innately cause all 32-threads of your warp to call printf at the same time (at a minimum!!), which immediately requires all 32 threads to coordinate. Bonus points for expanding out to 1024-threads of a workgroup or cross-workgroup atomics with a wider CUDA-grid.
This "printf" is simple enough to a typical programmer, and yet hits so many advanced parallelization problems (so "reserving" bufferspace and other such tricks to help make the parallel-back-into-sequential for CPU land)
In the meantime web developers keep yelling “you don’t need console.log”, lol