{
  "$schema": "https://ambiqai.github.io/helia-ui/schema/reference-model-1.json",
  "generatedFrom": {
    "sourceCommit": "70611e608778a432566e30965e8b4bc7ea75aa36",
    "tool": "doxyref",
    "version": "1.17.0"
  },
  "language": "cpp",
  "modules": [
    {
      "description": "Plan buffers using lifetimes and sizes.",
      "name": "GreedyMemoryPlanner",
      "path": "greedymemoryplanner",
      "submodules": [],
      "summary": "Plan buffers using lifetimes and sizes.",
      "symbols": [
        {
          "description": "A memory planner that uses a greedy algorithm to arrange buffers in memory to minimize the overall arena size needed.\n\nThe algorithm works like this:\n\n- The client enters the buffer information through `AddBuffer()`.\n- When a function like `GetOffsetForBuffer()` is called, the CalculateOffsetsIfNeeded() method is invoked.\n- If an up to date plan is not already present, one will be calculated.\n- The buffers are sorted in descending order of size.\n- The largest buffer is placed at offset zero.\n- The rest of the buffers are looped through in descending size order.\n- The other buffers that need to be in memory at the same time are found.\n- The first gap between simultaneously active buffers that the current buffer fits into will be used.\n- If no large-enough gap is found, the current buffer is placed after the last buffer that's simultaneously active.\n- This continues until all buffers are placed, and the offsets stored.\n\nThis is not guaranteed to produce the best placement, since that's an NP-Complete problem, but in practice it should produce one that's decent.",
          "examples": [],
          "id": "tflite::GreedyMemoryPlanner",
          "kind": "class",
          "language": "cpp",
          "members": [
            {
              "description": "",
              "examples": [],
              "id": "tflite::GreedyMemoryPlanner::GreedyMemoryPlanner",
              "kind": "method",
              "language": "cpp",
              "members": [],
              "name": "GreedyMemoryPlanner",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "tflite::GreedyMemoryPlanner::GreedyMemoryPlanner()",
              "source": {
                "line": 48,
                "path": "tensorflow/lite/micro/memory_planner/greedy_memory_planner.h",
                "url": "https://github.com/AmbiqAI/helia-rt/blob/70611e608778a432566e30965e8b4bc7ea75aa36/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h#L48"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "tflite::GreedyMemoryPlanner::~GreedyMemoryPlanner",
              "kind": "method",
              "language": "cpp",
              "members": [],
              "name": "~GreedyMemoryPlanner",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "tflite::GreedyMemoryPlanner::~GreedyMemoryPlanner()",
              "source": {
                "line": 49,
                "path": "tensorflow/lite/micro/memory_planner/greedy_memory_planner.h",
                "url": "https://github.com/AmbiqAI/helia-rt/blob/70611e608778a432566e30965e8b4bc7ea75aa36/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h#L49"
              },
              "summary": ""
            },
            {
              "description": "You need to pass in an area of memory to be used for planning. The client should ensure the validity of the memory when it needs to use this object. This memory isn't owned by this object, so management should be handled by the client. This is so it can be stack or globally allocated if necessary on devices without dynamic memory allocation. How many buffers can be planned for will depend on the size of this scratch memory, so you should enlarge it if you see an error when calling `AddBuffer()`. The memory can be reused once you're done with the planner, as long as you copy the calculated offsets to another location. Each buffer requires about 36 bytes of scratch.",
              "examples": [],
              "id": "tflite::GreedyMemoryPlanner::Init",
              "kind": "method",
              "language": "cpp",
              "members": [],
              "name": "Init",
              "params": [
                {
                  "description": "",
                  "name": "scratch_buffer",
                  "type": "unsigned char *"
                },
                {
                  "description": "",
                  "name": "scratch_buffer_size",
                  "type": "int"
                }
              ],
              "raises": [],
              "returns": [],
              "signature": "TfLiteStatus tflite::GreedyMemoryPlanner::Init(unsigned char *scratch_buffer, int scratch_buffer_size)",
              "source": {
                "line": 61,
                "path": "tensorflow/lite/micro/memory_planner/greedy_memory_planner.h",
                "url": "https://github.com/AmbiqAI/helia-rt/blob/70611e608778a432566e30965e8b4bc7ea75aa36/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h#L61"
              },
              "summary": "You need to pass in an area of memory to be used for planning."
            },
            {
              "description": "Record details of a buffer we want to place.",
              "examples": [],
              "id": "tflite::GreedyMemoryPlanner::AddBuffer--classtflite_1_1GreedyMemoryPlanner_1ace53d9f7cabd0185dbae7e8efeca9c3f",
              "kind": "method",
              "language": "cpp",
              "members": [],
              "name": "AddBuffer",
              "params": [
                {
                  "description": "",
                  "name": "size",
                  "type": "int"
                },
                {
                  "description": "",
                  "name": "first_time_used",
                  "type": "int"
                },
                {
                  "description": "",
                  "name": "last_time_used",
                  "type": "int"
                }
              ],
              "raises": [],
              "returns": [],
              "signature": "TfLiteStatus tflite::GreedyMemoryPlanner::AddBuffer(int size, int first_time_used, int last_time_used)",
              "source": {
                "line": 65,
                "path": "tensorflow/lite/micro/memory_planner/greedy_memory_planner.h",
                "url": "https://github.com/AmbiqAI/helia-rt/blob/70611e608778a432566e30965e8b4bc7ea75aa36/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h#L65"
              },
              "summary": "Record details of a buffer we want to place."
            },
            {
              "description": "Record details of an offline planned buffer offset we want to place. offline_offset is the buffer offset from the start of the arena.",
              "examples": [],
              "id": "tflite::GreedyMemoryPlanner::AddBuffer--classtflite_1_1GreedyMemoryPlanner_1aeec6ef086e45488218835ee61f4b76ce",
              "kind": "method",
              "language": "cpp",
              "members": [],
              "name": "AddBuffer",
              "params": [
                {
                  "description": "",
                  "name": "size",
                  "type": "int"
                },
                {
                  "description": "",
                  "name": "first_time_used",
                  "type": "int"
                },
                {
                  "description": "",
                  "name": "last_time_used",
                  "type": "int"
                },
                {
                  "description": "",
                  "name": "offline_offset",
                  "type": "int"
                }
              ],
              "raises": [],
              "returns": [],
              "signature": "TfLiteStatus tflite::GreedyMemoryPlanner::AddBuffer(\n    int size,\n    int first_time_used,\n    int last_time_used,\n    int offline_offset\n)",
              "source": {
                "line": 70,
                "path": "tensorflow/lite/micro/memory_planner/greedy_memory_planner.h",
                "url": "https://github.com/AmbiqAI/helia-rt/blob/70611e608778a432566e30965e8b4bc7ea75aa36/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h#L70"
              },
              "summary": "Record details of an offline planned buffer offset we want to place."
            },
            {
              "description": "Returns the high-water mark of used memory. This is the minimum size of a memory arena you'd need to allocate to hold these buffers.",
              "examples": [],
              "id": "tflite::GreedyMemoryPlanner::GetMaximumMemorySize",
              "kind": "method",
              "language": "cpp",
              "members": [],
              "name": "GetMaximumMemorySize",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "size_t tflite::GreedyMemoryPlanner::GetMaximumMemorySize()",
              "source": {
                "line": 75,
                "path": "tensorflow/lite/micro/memory_planner/greedy_memory_planner.h",
                "url": "https://github.com/AmbiqAI/helia-rt/blob/70611e608778a432566e30965e8b4bc7ea75aa36/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h#L75"
              },
              "summary": "Returns the high-water mark of used memory."
            },
            {
              "description": "How many buffers have been recorded.",
              "examples": [],
              "id": "tflite::GreedyMemoryPlanner::GetBufferCount",
              "kind": "method",
              "language": "cpp",
              "members": [],
              "name": "GetBufferCount",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "int tflite::GreedyMemoryPlanner::GetBufferCount()",
              "source": {
                "line": 78,
                "path": "tensorflow/lite/micro/memory_planner/greedy_memory_planner.h",
                "url": "https://github.com/AmbiqAI/helia-rt/blob/70611e608778a432566e30965e8b4bc7ea75aa36/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h#L78"
              },
              "summary": "How many buffers have been recorded."
            },
            {
              "description": "Where a given buffer should be placed in the memory arena. This information is stored in the memory arena itself, so once the arena is used for inference, it will be overwritten.",
              "examples": [],
              "id": "tflite::GreedyMemoryPlanner::GetOffsetForBuffer",
              "kind": "method",
              "language": "cpp",
              "members": [],
              "name": "GetOffsetForBuffer",
              "params": [
                {
                  "description": "",
                  "name": "buffer_index",
                  "type": "int"
                },
                {
                  "description": "",
                  "name": "offset",
                  "type": "int *"
                }
              ],
              "raises": [],
              "returns": [],
              "signature": "TfLiteStatus tflite::GreedyMemoryPlanner::GetOffsetForBuffer(int buffer_index, int *offset)",
              "source": {
                "line": 83,
                "path": "tensorflow/lite/micro/memory_planner/greedy_memory_planner.h",
                "url": "https://github.com/AmbiqAI/helia-rt/blob/70611e608778a432566e30965e8b4bc7ea75aa36/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h#L83"
              },
              "summary": "Where a given buffer should be placed in the memory arena."
            },
            {
              "description": "Prints an ascii-art diagram of the buffer layout plan.",
              "examples": [],
              "id": "tflite::GreedyMemoryPlanner::PrintMemoryPlan",
              "kind": "method",
              "language": "cpp",
              "members": [],
              "name": "PrintMemoryPlan",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "void tflite::GreedyMemoryPlanner::PrintMemoryPlan()",
              "source": {
                "line": 86,
                "path": "tensorflow/lite/micro/memory_planner/greedy_memory_planner.h",
                "url": "https://github.com/AmbiqAI/helia-rt/blob/70611e608778a432566e30965e8b4bc7ea75aa36/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h#L86"
              },
              "summary": "Prints an ascii-art diagram of the buffer layout plan."
            },
            {
              "description": "Debug method to check whether any buffer allocations are overlapping. This is an O(N^2) complexity operation, so only use for testing.",
              "examples": [],
              "id": "tflite::GreedyMemoryPlanner::DoAnyBuffersOverlap",
              "kind": "method",
              "language": "cpp",
              "members": [],
              "name": "DoAnyBuffersOverlap",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "bool tflite::GreedyMemoryPlanner::DoAnyBuffersOverlap()",
              "source": {
                "line": 90,
                "path": "tensorflow/lite/micro/memory_planner/greedy_memory_planner.h",
                "url": "https://github.com/AmbiqAI/helia-rt/blob/70611e608778a432566e30965e8b4bc7ea75aa36/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h#L90"
              },
              "summary": "Debug method to check whether any buffer allocations are overlapping."
            },
            {
              "description": "Number of bytes required in order to plan a buffer.",
              "examples": [],
              "id": "tflite::GreedyMemoryPlanner::per_buffer_size",
              "kind": "method",
              "language": "cpp",
              "members": [],
              "name": "per_buffer_size",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "static size_t tflite::GreedyMemoryPlanner::per_buffer_size()",
              "source": {
                "line": 100,
                "path": "tensorflow/lite/micro/memory_planner/greedy_memory_planner.h",
                "url": "https://github.com/AmbiqAI/helia-rt/blob/70611e608778a432566e30965e8b4bc7ea75aa36/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h#L100"
              },
              "summary": "Number of bytes required in order to plan a buffer."
            },
            {
              "description": "Returns False because the `GreedyMemoryPlanner` doesn't preserves all tensors after invocation. Do to the fact that tensors that tensor data for tensors that aren't being used during a phase of invocation are overwritten.",
              "examples": [],
              "id": "tflite::GreedyMemoryPlanner::preserves_all_tensors",
              "kind": "method",
              "language": "cpp",
              "members": [],
              "name": "preserves_all_tensors",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "bool tflite::GreedyMemoryPlanner::preserves_all_tensors() const",
              "source": {
                "line": 113,
                "path": "tensorflow/lite/micro/memory_planner/greedy_memory_planner.h",
                "url": "https://github.com/AmbiqAI/helia-rt/blob/70611e608778a432566e30965e8b4bc7ea75aa36/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h#L113"
              },
              "summary": "Returns False because the GreedyMemoryPlanner doesn't preserves all tensors after invocation."
            }
          ],
          "name": "GreedyMemoryPlanner",
          "params": [],
          "raises": [],
          "returns": [],
          "signature": "class GreedyMemoryPlanner : public tflite::MicroMemoryPlanner",
          "source": {
            "line": 46,
            "path": "tensorflow/lite/micro/memory_planner/greedy_memory_planner.h",
            "url": "https://github.com/AmbiqAI/helia-rt/blob/70611e608778a432566e30965e8b4bc7ea75aa36/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h#L46"
          },
          "summary": "A memory planner that uses a greedy algorithm to arrange buffers in memory to minimize the overall arena size needed."
        }
      ]
    }
  ],
  "name": "heliaRT"
}
