-
-
Couldn't load subscription status.
- Fork 13
folk2 (parallel Folk evaluator) #217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
README.md
Outdated
|
|
||
| ## todo | ||
|
|
||
| - event statements? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Event statements would be amazing to ensure delivery (I've been thinking that asserts are for describing the universe as it currently is, so old state is no longer useful, but a message must be processed even if it is old). It's not necessary to get the current system working though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope! it might be a good idea to bring back, though -- it was just more broken / causing more problems than I thought and performance is still pretty good without it. it's sort of fulfilling the same role as your branch
where we would reload keymap every time, wasting a lot of time. Wasn't scoping keymap Hold properly.
so we can call into C module A, have it use a datatype validator from a different C module B, have it fail, and have it use the correct jmp_buf that was set by A.
Fix issue with non-terminated tcl objects
Fixes camera slice leak/crash/exhaustion, I think?
Match with instructions in calibrate-page.folk/esc-pos.folk
because now there's no statement duty cycle of active texture where we might catch it in an off period while rendering, leading to blinking out -- every time the GPU renders to screen here, it always has access to all the latest rendered writable textures.
Also fix editor.
Fixes bug where we'd leak statements (it was if the same key was used in multiple Whens)
Fixes leak bugs with camera slice, I think?
Should fix weird conflicts!
This fixes bug where system suspend causes the camera entire-frame detector to get killed which leaves the mutex locked forever.
Fixes camera entire-frame breaking on system resume (because its match was forever incomplete, breaking the -serially).
This is not ready to merge yet -- it isn't 100% on par with folk1 in functionality, it has some random instability and leaks (and blinking), and I might want to make a few more breaking changes.
But it works well enough that it's probably time for it to get more outside testing (calibration works, tabletop editor works, printing works).
I'll be editing this description over time to document the changes; this is a first draft.
Major changes:
keep 10ms,keep 8ms, etc times have been added to various places in the system. I want to think about ways to get rid of most/all of these (can we have receivers say they want to use either the current statement or the previous matching one? can we retain previous versions of statements by default?), or at least to have some more principled discipline of where they should go and why they should have that lengthStatements::findMatches(which was sort of a hacky escape valve) is being promoted toQuery!andForEach!, which are more first-classHold,Assert,Retract) now have!suffixAsserts in it to beAssert!s (ideally, make one an alias/wrapper/shim for the other)Holdis being replaced withHold!-- you can give it either a code block or a Claim/Wish to hold, and it takes-onand-keyoptionsfn, a new C module system, and a new Tcl module system (to be documented) make it reasonably easy to share code.[C]instead of[c create], and$cc compilereturns a library object that you then call methods on instead of dumping the compiled functions into global namespace. (then this library object can be safely shared over statements and invoked from any thread)collected matcheshave been renamed tocollected results(because Match is a specific datatype internally that I don't want to confuse)Notify:andSubscribe:have been added for point events (keypresses, print requests)Known issues:
camera slice works but is quite buggy. I think it's pushing the texture loading/unloading and the destructor implementation pretty hard. You'll get bugs where it causes other pages to blink in and out, where the camera slices get really laggy when projected,where it leaks MBs of memory and causes RAM exhaustion, and where the system crashes because the GPU-side texture storage is exhausted (presumably because we leaked camera slice textures?)Freeze/lock-in bug where page outlines sometimes lock in as ghosts when you leave the system on for a while (you'll see the stale detection/quad statements stuck in the database with a relatively lower statement id, also)points-at/other geometric operations, halo/title/other text operations, audio, terminal,web editor can't outline out of the boxThe design of folk2 is overall probably more complicated than folk1, but not enormously so: the core is now fixed C modules that are compiled ahead-of-time, since we barely touched them anyway, so boot times are faster and the whole thing is a single
./folkbinary like a 'normal' PL runtime, instead of leaning ontclsh8.6.It runs in one process that you can kill instead of a mess of forked processes.
There is one multithreaded Folk system instead of multiple federated ones on the machine, so you don't need to worry about
Start processand statement sharing.folk2 uses the Jim Tcl interpreter instead of Tcl 8.6, and it vendors Jim Tcl, so we can take more control over it and drop the external dependency.
Nice new things:
exec curlorsleep) in the middle of programs, or hit Folk web endpoints like / or /camera-frame from another computer, or write an infinite loop, without blocking the rest of the system. It should be harder for 'naive' programming to take down Folk, just like in any other preemptive OS.Start process,On process) has been removed; you can do bareWhen { ... }instead ofStart process { ... }if you want to not block the current execution context$(...)shorthand for expressions,x(y)shorthand for dicts, better stack traces, some OO stuff, some lexical scope stuff.(serially)modifier for When that makes only one of that When run at a time (for stuff like camera frames where you don't want to blow up the CPU with too much work and it's OK to miss one)(keep)modifier for Claim/Hold that keeps it around for a few milliseconds past its expiration to reduce blinking and keep downstream statements alive while you wait for the successor statement to come in (in case the downstream statement would be some really expensive operation that you don't want to wastefully/unnecessarily redo)settleparameter for Collect (which is used to stabilize graphics -- don't draw until the display list has been stable for a few milliseconds)tracy, which lets you low-overhead record zones, allocations, stack traces, events. Incredibly useful for performance monitoring, evaluator monitoring, blink debuggingNotify:andSubscribe:Next steps:
sound),fix web editor so it makes quads, port live-usb, update documentationcollected matches -> collected results, maybe nicer Hold syntax,maybe keep messing with the GPU/canvas/quad interfaces to make them cleaner, maybe rename On unmatch