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
[1/N Dynamic Shapes]: Defer workspace size queries until execute for access to runtime input shapes (#393)
For the static case, workspace size was a constant and independent of
the runtime input sizes so it was OK to query and cache it during VM
context creation. However for the dynamic case it is dependent on the
runtime input shapes.
This PR moves workspace-size querying out of VM context creation and
into the explicit `getWorkspaceSize()` call. This keeps compile/load
from querying transient size and makes `execute()` require callers to
query workspace size before allocating and passing a workspace buffer.
For this PR, `getWorkspaceSize()` remains independent of runtime inputs:
it queries the currently supported constant transient size, stores the
maximum queried size on the graph, and returns `std::nullopt` when no
runtime artifact is loaded. Variant-pack/handle-dependent dynamic
workspace sizing is intentionally deferred until the dynamic size
function path is added.
Updates samples, benchmarks, and tests to call `getWorkspaceSize()`
before `allocateWorkspace(...)` and then pass the resulting workspace to
`execute()`. Also covers the AOT compile/load path.
---------
Signed-off-by: Sambhav Jain <sambhav@alumni.stanford.edu>
Co-authored-by: GPT 5.5 <codex@openai.com>
0 commit comments