Comments (5)
We don't currently handle thread locals in JIT closures anyways, so just compiling on another thread is always fine for now.
from lineiform.
Stretch goals: run the slow code and then switch midair to a fast single-pass inlining output and then if the Fn
's still live switch again to the output of a more aggressive linker variant with half the LLVM passes pulled in⦠:^)
from lineiform.
I think you could do something neat with having Lineiform return a Pin closure, so that the async jit compilation actually just patches the function pointer in the closure vtable directly so it has 0 overhead to swap it out (potentially multiple times). There would be weirdness, though, since a closure we're compiling could call another closure we're compiling, and we want to make sure if we inline the second further optimizations also affect everything upstream. I guess if you require Pin you can just have a dependency graph of closures in the main Lineiform struct, and trigger recompilation of everything that refers to a closure once you have optimized one?
from lineiform.
Is this a Pin
, or just like, a Cell
?
from lineiform.
I think you'd need Pin, since you'd want to hand out a pointer to the closure's vtable that it should atomically patch when it's done compiling; this means that the closure can't move while that pointer is alive, which is the canonical use for Pin. Cell doesn't prevent moves of the value.
You could also just forget about Pin entirely and poll for a compilation result at every FastFn::call invocation, which is simpler to implement (but a bit worse).
from lineiform.
Related Issues (18)
- Recursive example incomplete? HOT 1
- Do JIT compilation based on perf counters
- Abort compilation properly
- Lineiform metadata interface
- Implement inlining heuristics HOT 1
- Ahead-of-time compilation mode
- Persistent cache HOT 1
- Better tracing HOT 2
- Use a different IR than Cranelift HOT 3
- Use argument and output info for correct Cranelift function prototype declaration
- Use DWARF info to get the calling convention of external functions
- Compile-time closure freeze checking HOT 1
- Deallocate JIT code on FastFn drop HOT 2
- Handle pointer arguments in lifting
- Merge flow control back together after a branch HOT 2
- Implement looping HOT 2
- Handle dynamically linked functions HOT 1
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 lineiform.