Repository navigation
feature: collect memory inside a long-running application - #48
Open
benjaminshawki wants to merge 3 commits into
Open
benjaminshawki wants to merge 3 commits into
benjaminshawki wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #45 (
core/module-writer, which has #47's change in it): the kernel lets go of memory inside an application that goes on, not only when one ends. With it, Ray writes the kernel's module in one run:kernel.rayreadskernel.ts,wasm.raywrites it, no parts.Before, what an application made was let go of when it returned. The one run build is one application that never returns until the end, so it grew about 20 MB a minute and ran out of memory at about 72 minutes.
What changes (
kernel.ts,language.ts):SAFE_MIN) and more than it kept last time, what it made is moved together (evacuate), the rest let go of. What it made before that point is held where it is and read as roots.T_RUN), not the end of its chunk: a chunk taken right after the last one is the same run (what was left of the last one is written as a filler), so moving still walks one run in order.T_BODIES, the host's file texts and names) comes from memory set apart for it (global 512, 64 MB more each time it is used up), so a thread's chunks stay one after another.STARTmoves to 528.T_LEXV,T_REFF,T_WRITTEN_INare kept only where what they name is kept, and a frame does not keep what called it alive.T_APPLIED).x = vin a rule: the frame it closes over is a copy with that value alone in it.Checks:
-tover the bootstrap): the same results as feature: wasm.ray, Ray writes the kernel's JMP as a wasm module #45, line for line (480 errors, 1076 passed on both; addresses in "made, at" differ, as memory set apart moves them).env RAY_BUDGET=100000000 RAY_NOTESTS=1 RAY_NOCACHE=1 RAY_STATEMENT_MB=1900 node --import tsx src/language.ts --threads 1 --write=kernel.wasm '--value=wasm.module(32768)' ../ray/bootstrap/.entrypoint.ray3 <file including src/wasm.ray, src/kernel.ray and kernel.ts in Kernel_js>finishes (about 100 minutes, 1.2 GB at most), andnode --import tsx scripts/kernel-wasm.mts --check kernel.wasm --pages 32768answersthe same: 379351 bytes.