You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide a compilation parameter that sets the number of WebAssembly linear-memory pages a program allocates at startup. Today this is hardcoded.
Today codegen declares linear memory as a fixed single page and never grows it:
// core/wasm-codegen/src/compiler.rs
memory_section.memory(MemoryType{minimum:1,maximum:Some(1),// exactly one 64 KiB page, fixed — no memory.grow
...});
Proposal
Allow the page count to be specified per project/build, surfaced two ways:
Project manifest — an Inference.toml key (e.g. under a [build] / [memory] table, pages = N).
CLI parameter — a flag on infs build (and infc) that overrides the manifest value for a single build.
Codegen would then emit MemoryType { minimum: N, maximum: Some(N) } (fixed, no growth) so the memory footprint stays deterministic and reproducible. The resolved page count becomes the budget consumed by the footprint check in the companion issue.
Notes / open questions
Default stays at 1 page when unset, preserving current behaviour and byte-identical output.
Decide the precedence order (CLI overrides manifest overrides default) and the key name/location in Inference.toml.
Keep minimum == maximum (fixed, non-growable) to retain the "no memory.grow, deterministic footprint" property; a growable variant would be a separate decision.
Relationship
Feeds the budget for the memory-footprint static check (companion issue).
Context: spun out of the array-bounds work in Array Bounds Checking #164 during a design discussion on memory safety.
Summary
Provide a compilation parameter that sets the number of WebAssembly linear-memory pages a program allocates at startup. Today this is hardcoded.
Today codegen declares linear memory as a fixed single page and never grows it:
Proposal
Allow the page count to be specified per project/build, surfaced two ways:
Inference.tomlkey (e.g. under a[build]/[memory]table,pages = N).infs build(andinfc) that overrides the manifest value for a single build.Codegen would then emit
MemoryType { minimum: N, maximum: Some(N) }(fixed, no growth) so the memory footprint stays deterministic and reproducible. The resolved page count becomes the budget consumed by the footprint check in the companion issue.Notes / open questions
Inference.toml.minimum == maximum(fixed, non-growable) to retain the "nomemory.grow, deterministic footprint" property; a growable variant would be a separate decision.Relationship
Future work.