P7: AllocationResolver — one resolver decides domain and scope - #1153
Merged
michalharakal merged 1 commit intoAug 26, 2026
Merged
michalharakal merged 1 commit into
michalharakal merged 1 commit into
Conversation
Placement joins WeightForm as a resolved decision (#1133's answer): AllocationResolver is a pure function of what will be held (the resolved form), what the profile says (domainFor and its threshold) and what the platform can do (StorageCapabilities, injectable so a test can resolve for a platform it is not running on). PlanTensor.allocation stops hardcoding MMAP_FILE/MODEL — a spec that claimed every weight was mapped even on a platform that cannot map, and even for a dequantized copy that no longer matches the file. Mapping now requires all three: the form asks MAPPED, the platform can map, and the bytes really are the file's bytes; everything else falls to the profile's heap/off-heap threshold over the bytes actually held. AllocationResolver.explain() renders the decision with its reason, so a plan can say where every tensor landed and why. Closes #1143. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
michalharakal
merged commit Aug 26, 2026
a1b35a4
into
feature/1142-delete-dead-placement
2 checks passed
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.
Closes #1143 (parent #1133). Stacked on #1152 — merge that first; GitHub retargets this one to
developwhen the base branch goes.The P7 answer, implemented: placement joins
WeightFormas a resolved decision.AllocationResolver.resolve(weight, profile, platform)— a pure function of what will be held (the resolved form), what the profile says (domainForgets its first real consumer), and what the platform can do (StorageCapabilities, injectable so a test can resolve for a platform it is not running on).PlanTensor.allocationstops hardcodingMMAP_FILE/MODEL: mapping now requires the form to ask MAPPED, the platform to be able to map, and the bytes to really be the file's bytes — a dequantized or feed-ordered weight is a load-time copy and cannot be paged from a file it no longer matches. Everything else falls to the profile's heap/off-heap threshold overresidentBytes.AllocationResolver.explain()renders each decision with its reason ("form asks MAPPED but this platform cannot map files"), recomputed fromresolveso it can never drift from what was actually decided.AllocationResolverTestpins the rules;PlannerProfileTestpins thedomainForthreshold edges;MemoryPlanTestupdated for the resolved (no-longer-assumed) allocation.Full pr-gate green (all legs; JS/Wasm with
-Pkotlin.incremental.js.ir=falseper the cache glitch).🤖 Generated with Claude Code