Conversation
…olume Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
|
I'll fix CI failures and address comments from users with write access that start with 'DevinAI' or '@devin'.
|
Drop the trainer_deployment_env() coupling; set TRITON_CACHE_DIR and TORCHINDUCTOR_CACHE_DIR next to TORCHINDUCTOR_COMPILE_THREADS in each definition's backend_env and forward them to Ray actors on other nodes. Add scripts/kernel_cache_bench.py for before/after startup timing. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
|
Superseded by #65, which takes the same approach (shared v2 Volume at /root/.cache/kernel-cache, TRITON_CACHE_DIR/TORCHINDUCTOR_CACHE_DIR via backend_env, forwarded to Ray workers via _WORKER_ENV_VARS). |
Author
|
#65 will handle this |
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.
Summary
Every lilo trainer is
single_use_containers=Truewithmin_containers=0, so each new trainer (autoscale, replacement, scoped run) cold-compiles every Triton/FLA kernel and Inductor graph — withTORCHINDUCTOR_COMPILE_THREADS=1this was observed at ~30 min of startup. Mirrors modal-projects/stitch#251: point both compiler caches at a shared Volume v2 so kernels compile once per (arch × torch/triton version × source) and are reused by every subsequent container.definitions/*.py:TRAINER_VOLUMES[KERNEL_CACHE_ROOT] = kernel_cache_volume, and every trainer decorator now passesenv=trainer_deployment_env()(6 of them previously passed noenv=), which now always includesKERNEL_CACHE_ENV. Function-level env (rather thanbackend_env) is deliberate: it's inherited by torchrun ranks, byray starton clustered worker nodes (which never runrun_engine_with_backend), and by Ray actors, so no changes to_WORKER_ENV_VARS.trainerinscoped.py: same mount + env (covers customengine.trainer_image).commit(); relies on Volume v2 background commits, as in stitch.Operational notes: cache keys hash triton/ptxas/torch versions + arch + source, so runtime bumps are misses (no stale reuse) but the volume grows monotonically (~0.3 MB/Triton kernel; the equivalent stitch miles volume is 1.5 GB / 40k files) — prune manually. If an entry is ever bad,
modal volume rm -r lilo-kernel-cacheand trainers fall back to a cold compile.Tests:
tests/providers/test_kernel_cache.pyasserts every definition and the scoped trainer mount the volume and set the env;test_modal_deployment.pyupdated fortrainer_deployment_env()now including the cache env.Benchmark
Pending — baseline (main) vs. cold (empty volume) vs. warm (separate container, populated volume) on
qwen3_5_4b_full_64kinkevinli-lilo; numbers to follow.Link to Devin session: https://modal.devinenterprise.com/sessions/467320372a264381b9c015c4dd9bf804
Open in Devin Desktop: https://modal.devinenterprise.com/desktop/session/467320372a264381b9c015c4dd9bf804?variant=devin
Requested by: @kevintli