Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I poked around a bit on their docs site [1] to get a feel for the language, and these two features stood out to me:

> - Interfaces and generics provide first-class alternative to hacky preprocessor-based or string-pasting shader specialization. Preprocessor hacks can be replaced with a well-understood language feature already used in Rust, Swift, C#, Java, and more.

> - Automatic differentiation greatly simplifies the implementation of learning-based techniques in shaders. Slang supports automatically generating both forward derivative and backward derivative propagation functions from forward computation code.

> - Slang supports a first class module system, which enables true separate compilation and semantic checking of shader code.

I am a total beginner at shaders, but when I've dabbled in them they are mostly surrounded by string concatenation and a variety of wild macros, so it's cool to see a "typescript for shaders" with such broad support, both of vendors, and of target shader languages.

[1]: https://shader-slang.com/slang/user-guide/introduction.html



Holy shit AD is a game changer.


Whats the tdlr for the uninformed about AD?


auto-differentiation is the magic behind most neural net-based ML (you do get some madmen who do the task manually). Backpropagation is basically just a special case of AD, and it lets you evaluate the derivative of an arbitrary (well-enough behaved) function with respect to any of its inputs. It's very useful for a lot of optimisation applications, but ML is the biggest in terms of GPU compute use.

(It's not particularly magical from a mathematic point of view, it's basically just an application of the chain rule, but it's something where you either need a fairly complex library or language support to implement, because you effectively need to take the function(s) you want the derivative of and transform them into a different set of calculations)


If you have auto-differentiation, it is tractable to do machine learning in a language. Because slang runs on any shader language & GPU, it could enable generalized acceleration of ML training on any graphics hardware which is cool.

YouTube videos on backpropagation might explain it better





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: