feat(Core): Switch to deterministic memory tracker#10789
Draft
schneiderstefan wants to merge 3 commits into
Draft
feat(Core): Switch to deterministic memory tracker#10789schneiderstefan wants to merge 3 commits into
schneiderstefan wants to merge 3 commits into
Conversation
This PR unifies page instruction charging. The deterministic memory tracker (DMT) now charges for all combinations of {heap, stable} x {read, write} page access types. The cost is uniform and increased to 5000 instructions per OS page (4KiB).
Unchanged is the additional cost of copying dirty pages after the message execution (3000 instructions per page).
So overall, the costs change like this:
previously dmt
heap read: 0 5000
heap write: *1000 *5000
stable read: 0 5000
stable write: *1000 *5000
* additionally charged for copy overhead after the message (+3000)
The dirty stable pages tracking via the injected system API replacements is changed: The instruction counter is no longer decreased, because the DMT does it automatically. But the bitmap tracking of stable pages is kept, because it's still needed to limit overall stable memory access.
As a consequence of this change, heap accesses are charged deterministically and immediately (during the message/slice, rather than afterwards), which means that messages with lots of heap accesses are DTS'd properly. While this incurs additional cycle costs, it will allow us to increase the Wasm heap size to much more than the current 6GiB limit.
schneiderstefan
force-pushed
the
stschnei/dmt_for_stable
branch
from
July 16, 2026 09:48
1728edd to
e0e6336
Compare
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.
This PR unifies page instruction charging. The deterministic memory tracker (DMT) now charges for all combinations of {heap, stable} x {read, write} page access types. The cost is uniform and increased to 5000 instructions per OS page (4KiB).
Unchanged is the additional cost of copying dirty pages after the message execution (3000 instructions per page).
So overall, the costs change like this:
The dirty stable pages tracking via the injected system API replacements is changed: The instruction counter is no longer decreased, because the DMT does it automatically. But the bitmap tracking of stable pages is kept, because it's still needed to limit overall stable memory access.
As a consequence of this change, heap accesses are charged deterministically and immediately (during the message/slice, rather than afterwards), which means that messages with lots of heap accesses are DTS'd properly. While this incurs additional cycle costs, it will allow us to increase the Wasm heap size to much more than the current 6GiB limit.