6 ms·
Emu: Language for Programming GPUs in Rust
- pitaj 7y agoI have several questions: 1. What exact syntactic differences does this have from rust, and why? Some differences I see are in function definitions: lack of `fn` keyword, `->` for function return type, and colons for parameter types. 2. How does this make use of the borrow-checker, if at all? 3. Who is the target audience? Is it meant for general mathematical acceleration or graphics? It seems to be meant for scientific purposes, seeing as it provides a system of units and constants.
- fluffything 7y agoAFAICT this does not really use Rust, or the Rust type system at all. This is just a procedural macro that parses "Rust-like" syntax into an AST, and then 1:1 fold that AST into OpenCL. This AST is not type checked, and if you were to, for example, replace the usage of an `u32` in there with a `type U32 = u32;` then parsing will probably fail, because the proc macro doesn't know what `U32` means. The OpenCL code that gets dumped into a byte string, is compiled at run-time by your graphics driver. The proc macro can probably, at best, try to verify that it is correct at compile-time, by passing the dump to some OpenCL verification tool, but it does not appear to be doing that right now.
- rjeli 7y agoIt seems the purpose of rust would be to use the borrow checker for safe compilation, but this is all in a macro? So the value add of rust here is the good macro system?
- lightgreen 7y agoI think it is designed to embed OpenCL easily into Rust, not as standalone tool or embed it into other languages.
- ajkjk 7y agoWell, there's the value add in not having to touch C++...
- fulafel 7y agoIndeed. Though there are also other contenders (eg Futhark) in the sane GPU languages competition.
- auggierose 7y agoInteresting: https://futhark-lang.org https://futhark-lang.org
- fulafel 7y agoIf you want to snack on some Futhark code along with the docs, the Advent of Code solutions (linked from https://futhark-lang.org/blog/2018-12-25-futhark-0.8.1-released.html https://futhark-lang.org/blog/2018-12-25-futhark-0.8.1-relea...) might be a good place to start. I liked them because they include problems that are not good fit for Futhark, so it documents how to think about the applicability as well.
- nestorD 7y agoRust GPU iterators based on a Futhark like approach are one of my dreams (a sort of GPU equivalent for Rayon). The Rust community is used to high level functions via the iterator abstraction and wants high performance : it seems like a perfect match.
- pjmlp 7y agoDepends, as NVidia nowadays designs their GPGPUs for C++ as source language. "CppCon 2017: Olivier Giroux Designing (New) C++ Hardware" https://www.youtube.com/watch?v=86seb-iZCnI https://www.youtube.com/watch?v=86seb-iZCnI
- gitgud 7y agoA bit off-topic, but it seems articles with "in Rust" or "in Go" tacked on the end are consistently upvoted to the front-page. I wonder how well this reflects actual usage of the languages Rust and Go...
- kbenson 7y agoThe front page isn't an indicator of usage, it's an indicator of interest, and specifically the interest of the type of people that read HN. I don't think it's a stretch to say that Rust seems to have garnered the interest of a lot of those types of people, whether or not they are currently using it.
- unnouinceput 7y agoIt doesn't. As a freelancer if I type "rust" on upwork right now I get only 26 jobs. If I type "golang" it yelds 104 jobs. But if I type "php" I get 7966 jobs; "java" = 2547 jobs; C# = 1174 jobs. Even "Assembler" gives 292 results, more then double of both rust + golang combined. For me Rust / Golang / Swift are those Instagram "influencers" that the press talk a lot about it but have little power in the harsh reality of the world.
- adamnemecek 7y agoThey've been around for a much shorter period of time. Also, maybe upwork skews toward a different type of jobs.
- unnouinceput 7y agoSwift is 5 years old and yields more results then rust who is 8 years old. You know you have a good one when it picks up and just goes. All of them 3, poor Rust is the most talked about in HN and yet is the least used in real world. As for upwork skewing, you really have no idea what upwork is. They have absolutely zero interest to hide results as their money comes from those jobs people get hired for. So why would they cut their own revenue?
- 7y ago