Comments (2)
@t0yv0 probably knows exactly what WebSharper does, but I believe it basically contains a compiler from a subset of F# to JS. Alea cuBase similarly compiles F# to Cuda. There are probably a few more examples where F# quotations are being compiled to some target other than CIL.
So, it is certainly possible.
Do you have some more specific application in mind?
Compiling CML style code to Native you could probably improve performance by up to about 10x for code that makes heavy use of message passing and lightweight threads. Other kinds of code might not improve much. (Hopefully, though, the JIT compiler, at some point, implements escape analysis and can eliminate intermediate object allocations. That could give a 5x-10x improvement in some cases with Hopac (it would eliminate a lot of GC pressure and GC write-barriers). This estimate is based on an experiment I did with MLton.) It would be quite a bit of work to make really good run-time environment for such a Native CML system even if you would use something like LLVM to generate the native code.
Depending on what you really want, it might not be the best approach to compile arbitrary Hopac/CML code to a limited execution environment like a GPU. Note that when crossing boundaries between execution environments there are typically fairly large overheads. Not knowing what you have in mind, but I would likely compile some more limited programs to such a special environment and then implement only special purpose message passing abstractions to integrate with Hopac. Something like a channel through which you could asynchronously send messages to a GPU kernel for processing and receive the results. The GPU kernel itself would not necessarily be programmed with anything like CML.
from hopac.
The lowest hanging fruit (may be quite a bit of work through) may be to just to optimise for .net platform itself where you remove some costly abstractions and object creation. Though tangential but the following might be of some interest: http://scala-lms.github.io/, http://stanford-ppl.github.io/Delite/, https://github.com/tiarkrompf/scala-virtualized/wiki. One thing that I do not like about the LMS approach is this cannot be done compile time.
Also with regard to GPU what you say is what I had in mind. You extract portion of the code which can benefit from running in a GPU environment through execution is slower, but make upto it by aggressively parallelisation. Similarly for FPGA in some cases.
With regard to FPGA you can perhaps target the whole or larger proportion to be realised in hardware. Some interesting links http://nuggle.me/ (not exactly what would be useful here), https://chisel.eecs.berkeley.edu/, http://www.bluespec.com/ (http://en.wikipedia.org/wiki/Bluespec), http://clash.ewi.utwente.nl/, http://www.myhdl.org/, http://raintown.org/lava/, http://en.wikipedia.org/wiki/Atom_(programming_language),
I don't like the idea for directly to LLVM compiling. This is too low level to work with and depends on portability of LLVM. May you you have to have an intermediate stage where you use a minimal language before this translates to the lower level. The lower level can be LLVM IR also. Languages that use this multi layer approach are Red/System Red, and DSL oriented languages like Racket / Redex, Shen, Qi, Scheme / Lisp variants, also see https://github.com/JeffBezanson/femtolisp (from the creator of Julia Language). In this case the IR will just be used to translate from F# AST to intermediate representation to AST representation conducive to translate to target language to target language. Low level languages can presume to have an AST representation also. So should be close to AST, TST representation and should be easily manipulatable.
Another aspect that may be incorporated is verification (see Why3, WhyML) and fluent testing (like in http://www.pyret.org/) to see if the system behaves as expected and code generated is also accurate.
from hopac.
Related Issues (20)
- Add Azure DevOps build HOT 2
- Problems with network stream HOT 9
- Handling exceptions HOT 9
- Stack Overflow in Alt.choose HOT 3
- Fibonacci benchmark fails with Stack Overflow on NET Core, but not on Framework HOT 4
- Production Ready? HOT 5
- IAsyncEnumerable<T> interop HOT 1
- How to convert to task? HOT 6
- ValueTask<T> interop HOT 1
- How to get the build working on Windows? HOT 2
- Stack overflow with recursive job HOT 5
- Is this project dead? HOT 1
- Why do these two code snippets result in different behavior HOT 1
- FSharp.Core 5.0 support HOT 15
- Why does the left side not uncommit after the right side has been chosen when using Alt.prepare? HOT 8
- How can uncaught exception errors be redirected?
- BadImageFormatException HOT 6
- How to conCollect but stop on first exception? HOT 8
- System.Diagnostics.Activity doesn't flow properly with Hopac, resulting in incorrect telemetry correlation
- Example of paranoid function?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hopac.