class
SushiAI::Graph::MemoryPlan
The planner's output: one Placement per value, plus arena sizes.
- Declared in
include/SushiAI/graph/memory_plan.hpp
A value type. Copyable, and cheap enough to hand around by value; it holds two vectors and nothing that owns memory on a device.
Public member functions
MemoryPlan()=defaultThe empty plan: it covers no value and asks for no arena.
Adopting one is how a caller says "pack nothing" - every value then falls through to its own allocation, which is what the library did before this pass existed and what an A/B measurement of the pass needs as its control.
std::size_t value_count() const noexceptHow many values the plan covers.
const Placement & placement(ValueId id) constWhere id lives.
Parameters
idThe value to look up.
Returns
Its placement.
Exceptions
ErrorIf
idis not covered by this plan.
bool is_packed(ValueId id) const noexceptWhether id was packed into an arena.
ValueId buffer_of(ValueId id) const noexceptResolves which value owns the specified value's bytes.
Non-throwing lookup to resolve alias chains even in an empty plan.
Parameters
idThe value to resolve.
Returns
Owning value id, or id itself if unmapped.
SushiRuntime::span< const Arena > arenas() const noexceptEvery arena the plan asks for, in id order.
std::size_t arena_bytes() const noexceptTotal bytes across every arena.
std::size_t unpacked_bytes() const noexceptWhat the packed buffers would have cost one allocation each.
bool reuse_enabled() const noexceptWhether live ranges were actually overlapped.
False means every buffer got its own slot - a correct plan that saves nothing. reuse_note() says why.
std::string_view reuse_note() const noexceptWhy reuse was declined, or empty when it ran.
Static public member functions
static MemoryPlan build(const Graph &graph, const PlanOptions &options={})Generates an arena memory plan for the given graph.
Parameters
graphThe graph to plan.
optionsPacking and alignment options.
Returns
The computed memory plan.
Exceptions
ErrorIf alignment is zero or graph topological order is broken.

