[HN Gopher] Shader Printf in HLSL and DX12
___________________________________________________________________
Shader Printf in HLSL and DX12
Author : davikr
Score : 33 points
Date : 2024-01-08 11:08 UTC (1 days ago)
(HTM) web link (therealmjp.github.io)
(TXT) w3m dump (therealmjp.github.io)
| WesSouza wrote:
| Neat.
|
| In the meantime web developers keep yelling "you don't need
| console.log", lol
| jfim wrote:
| Web developers typically have working debuggers available
| though.
| chuckadams wrote:
| I write SPAs in VueJS, but even with the vue devtools
| available, I still find myself using console.log so that I
| don't have to keep drilling down into a very deep component
| tree every time the page reloads. Plus, the console lets me
| scroll back and read the history of changes, something I'd
| only get in the devtools if I threw every bit of local state
| into pinia. The devtools come in handy from time to time, but
| the DX is just not there yet, and I doubt it ever will be.
| djmips wrote:
| GPU often has debuggers available. PIX is very good these
| days for example.
| sillysaurusx wrote:
| Setting the output color to red was our printf back in the day.
| dragontamer wrote:
| A strong GPU programmer can do this instinctively. But thinking
| about it deeper, I think this is exactly the kind of project that
| demonstrates what is so different about GPUs vs CPU programming.
|
| 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)
___________________________________________________________________
(page generated 2024-01-09 23:01 UTC)