FE-1237: Add optional per-place token capacity - #9177
Draft
kube wants to merge 1 commit into
Draft
Conversation
A place can declare a maximum token count, which participates in transition enablement the standard way: a transition cannot fire if it would take an output place above capacity. Output tokens apply at the end of a frame, so the check folds in what earlier transitions this frame already committed. Deadlock detection uses the same check, so a net blocked only by full output places is reported as deadlocked rather than stepping to maxTime doing nothing. Nets without capacities keep empty constraint tables and skip the check.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
This was referenced Aug 8, 2026
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.
🌟 What is the purpose of this PR?
A place can now declare a maximum number of tokens it will hold. Raised for supply-chain style modelling, where finite storage and buffers are the point rather than an edge case.
It is also the keystone for what comes after: capacity is what converts frames from growable to fixed-size, which is the precondition for a fixed-layout GPU or WASM path.
🔗 Related links
🚫 Blocked by
🔍 What does this change?
Capacity participates in transition enablement, following the standard Petri-net capacity constraint: a transition cannot fire if firing would take any output place above its capacity.
Two details that matter:
maxTimewith nothing happening instead of being reported as deadlocked.Nets that declare no capacities are unaffected — the constraint tables are empty and the hot path skips them.
Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
Capacity is not retro-applied: a net whose initial marking already exceeds a capacity it later declares is not rejected, because enablement blocks transitions rather than repairing state.
🐾 Next steps
The fixed-size frame layout this unlocks (SoA, WASM linear memory) is not built here — the runtime still uses growable frames. The WebGPU backend stacked above this one is the first consumer that requires capacities.
🛡 What tests cover this?
engine/capacity.test.tscovers the constraint tables and headroom check;monte-carlo/capacity.test.tscovers end-of-frame accumulation across several transitions feeding one place, and deadlock reporting.❓ How to test this?