How to Read Shader Assembly
interplayoflight.wordpress.com
interplayoflight.wordpress.com
Comparing that experience with the complexity of the instruction set described in this article, it's easy to appreciate how far GPUs have come in 19 years.
But it still pays to peek into disassembly every now and then. For instance, one time I got to shorten a kernel runtime by switching an index type from size_t to uint32_t. Apparently, 64-bit integer division wasn't supported directly by the target architecture and instead of some kind of IDIV, there was a 100-lines function embedded and called on every division.
Just downcasting an index before pushing it to the kernel made the whole thing considerably faster. But I wouldn't know I should have done this if not for the disassembly.
> Even though no one writes shaders in assembly directly nowadays
I heard that back over 20 years ago in college. It wasn't true then and it is still not true. It's becoming less common, though.
Sometimes people don't even have an assembler and have to resort to writing machine code directly, in binary.
Incidentally, I can't express with words the admiration that I have for the experts in performance tuning that I've met over the years, especially at NVidia. These folks live and breathe GPU architecture to a degree that I will never achieve.