-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Description
Feature or enhancement
Proposal:
This provides an alternative design to #133171. I have a branch where all tests (including FT) pass.
Phase 1:
For the first and simplest phase, we could add a watcher/callback to thread creation. When multiple threads are created, we simply invalidate the executor as _CHECK_VALIDITY fails.
This means single threaded code gets all the benefits of JIT in the future, while multi-threaded code will lose all the benefits. However, both can coexist at the same time in the same build. We will finally get JIT + FT in a limited form.
Phase 2:
If we detect multiple threads are running, we turn off the non-thread safe optimizations, and redo the trace with those optimizations off. If we detect only a single thread, we follow phase 1 and run till we get invalidated. This allows single threaded code to run faster, while multi-threaded code will run a little slower. Note that all optimizations I've proposed for the JIT in the past 6 months and in the future are FT safe (in theory. whether they are implemented in practice is different).
Follow-up after this:
- Lock/unlock removal in FT code.
Has this already been discussed elsewhere?
No response given