TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Shader Printf in HLSL and DX12

48 pointsby davikrover 1 year ago

3 comments

dragontamerover 1 year ago
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.<p>In CPU programming, just sequentially outputting printf one-at-a-time works. And you can optimize this to go faster-and-faster.<p>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.<p>This &quot;printf&quot; is simple enough to a typical programmer, and yet hits so many advanced parallelization problems (so &quot;reserving&quot; bufferspace and other such tricks to help make the parallel-back-into-sequential for CPU land)
sillysaurusxover 1 year ago
Setting the output color to red was our printf back in the day.
WesSouzaover 1 year ago
Neat.<p>In the meantime web developers keep yelling “you don’t need console.log”, lol
评论 #38928339 未加载