Re:Emu: Language for Programming GPUs in Rust
by fluffything on Monday June 03, 2019 @04:38AM
(#20081415)
AFAICT 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.
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.