3 ms·
This being the internet, let me preface this with this being honest questions, rather than attacks. I did try to read through the docs before asking but I don't
by jerf 9y ago
This being the internet, let me preface this with this being honest questions, rather than attacks. I did try to read through the docs before asking but I don't see the answers directly.
Especially on the FPGA side, how does this interact with all the features of Go that seem ill-suited to an FPGA implementation? Can I write functions that generate and consume closures? Where is my garbage going on the FPGA side and how is it collected? Or is the FPGA code being written only in a subset of Go?
I understand the idea of wrapping the primitives offered by the FPGA hardware itself into channels, but I'm unclear on how one can sensibly implement a Go runtime on top of that in the FPGA without making it too difficult to understand the cost model of your Go code.
- marmaduke 9y agomight be like OpenCL: a subset of C99 with some extensions works for parallel hardware including FPGAs already so why not a subset of Go targeting FPGAs?
- jerf 9y ago"A subset of Go" is certainly one sensible option, but I don't see it documented. The obvious subset that one could get with the least effort is a rather brutally cut down subset of Go, to the point that I'd consider claiming it to be "Go running on an FPGA" to be nearly a lie. On the other extreme, you've got a full FPGA on hand, so nothing stops them from bringing up a simple ARM CPU die and putting a bit of general-purpose RAM there, so it's theoretically possible that you could write general-purpose FPGA code and have that FPGA-CPU gloss over any runtime issues, but that's where I get my question about how a programmer would be expected to model the costs incurred by given constructs sensibly. (Presumably, if performance is not a big deal to the programmer, they're not using FPGAs at all, so I'm going in assuming performance is at least in the top 3 concerns of anyone who might use this, if not #1.) (Also I'm not 100% sure about the intersection of what ARM cores might be available vs. what Go runs on; IIRC Go does ARM but only very high-end ones. So, take the principle of my point rather than the literal text. With enough work they can do "anything" with the FPGA code.)
- zhemao 9y agoUnder "Familiar Tooling", the webpage indicates that you will be able to use a "streamlined subset" of Go on their platform.
- bogomipz 9y ago>"Can I write functions that generate and consume closures?" Could you elaborate on why closures are ill-suited to FPGAs? Thanks.
- pubby 9y agoThey require garbage collection.
- jdblair 9y agoIf by closures you mean "anonymous functions that capture the state of in-scope values," then c++11 shows that a gc is not a requirement.
- bogomipz 9y agoThat was kind of my understanding of closure in Go: https://gobyexample.com/closures https://gobyexample.com/closures
- wahern 9y agoC++ only supports capturing a variable with a lifetime at least as long as the closure. In other words, you can't _return_ a closure from a function that captures an automatic variable (i.e. "stack-allocated" variable), or pass the closure to another thread of control that such that it outlives the original function invocation. AFAIK Go will automatically heap allocate any variable that is captured. (Theoretically, it could attempt to prove it won't out-live the enclosing function(s).) Automatic heap allocation requires automated GC. C++ has lots of syntactic sugar, but at the end of the day, like C and Rust it's a fundamentally pass-by-value language. Here's a good paper which describes some of the complexities and design decisions for a full and complete closure implementation that doesn't require decoration and compiler hinting: http://www.cs.tufts.edu/~nr/cs257/archive/roberto-ierusalimschy/closures-draft.pdf
- wahern 9y agoMore general issue: https://en.wikipedia.org/wiki/Funarg_problem https://en.wikipedia.org/wiki/Funarg_problem