SENTINEL — AI surveillance on Orin Nano Super: YOLOv8 + LFM2-VL + llama.cpp unified memory fix

SENTINEL — multi-model AI surveillance on Orin Nano Super: the cudaMalloc OOM fix + full pipeline benchmarks

Posting this mainly for the unified-memory fix (section 2) since I couldn’t find a
clear thread on it, plus benchmarks for running YOLOv8 + a VLM + face recognition
concurrently on the 8GB Orin Nano Super, in case anyone is sizing a similar pipeline.

1. Setup

  • Board: Jetson Orin Nano Super 8GB
  • JetPack 6.x, CUDA 12.6, Ubuntu 22.04 (L4T)
  • Power mode: [MAXN], jetson_clocks [on/off]
  • Pipeline:
    • YOLOv8n → TensorRT FP16 + ByteTrack (person detection/tracking)
    • DeepFace / Facenet512 + YuNet, async, with session Re-ID
    • LFM2-VL 1.6B (Q4_0) via llama.cpp for scene analysis
    • Flask dashboard (MJPEG + chat endpoint), Telegram alerts

All three models share the iGPU. YOLO runs every frame on the main loop;
face-rec and the VLM run async off a queue so they don’t stall the capture thread.

2. The cudaMalloc OOM fix (the actual reason for this post)

Stock llama.cpp CUDA builds fail to load the GGUF even with free RAM:

NvMapMemAllocInternalTagged: error 12
cudaMalloc failed: out of memory

Root cause: cudaMalloc requests dedicated VRAM, which doesn’t exist on this SoC —
CPU and GPU share the same physical memory. The allocation path needs to use
managed/unified memory instead.

Build fix:

cmake -B build \
  -DGGML_CUDA=ON \
  -DCMAKE_CUDA_ARCHITECTURES=87 \
  -DGGML_CUDA_ENABLE_UNIFIED_MEMORY=ON
cmake --build build --config Release -j$(nproc)

Runtime alternative (no rebuild):

GGML_CUDA_ENABLE_UNIFIED_MEMORY=1 ./llama-server ...

sm_87 is correct for Orin. After this, the model loads and offloads to GPU
cleanly. Open question for anyone who’s measured it: what’s the throughput cost
of UM vs a dedicated alloc on this SoC? I haven’t isolated it.

3. Benchmarks [RE-RUN AND CONFIRM ALL VALUES BEFORE POSTING]

Per-stage, full pipeline running concurrently:

Stage Latency Notes
YOLOv8n (TRT FP16) ~35–45 ms per frame, main loop
Face rec (Facenet512) ~200–400 ms async, off main loop
LFM2-VL scene analysis ~1.8–2.5 s async; this is the bottleneck
End-to-end frame path ~50–150 ms excludes async VLM
Main loop throughput ~28 FPS

Memory (tegrastats, paste real output):

Condition RAM used
Idle (models loaded) [CONFIRM]
Full pipeline active ~3.5–4.0 GB

Power / thermal :

Metric Value
Power draw 25 W
SoC temp 56 °C

4. Lessons learned

  • The OOM is not a quota problem — free RAM doesn’t help because the allocator
    path itself is wrong for a shared-memory SoC. UM is the fix, not more RAM.
  • The VLM dominates latency. Running it async off a queue was the only way to
    keep the capture loop near real-time.

5. Bottlenecks & future work

  • VLM latency (~2s) is the limiter. Considering: smaller quant, batching,
    or triggering the VLM only on YOLO/track events rather than continuously.
  • Haven’t characterized UM overhead — would welcome input.

Full code + build steps:

Writeup of the UM fix: https://hemkesh.hashnode.dev/

Hemkesh & V S Yogeshvar, Dayananda Sagar University

Update: wrote up the unified-memory fix in more detail here, in case it helps anyone else hitting this:

https://hemkesh.hashnode.dev/why-cudamalloc-fails-on-nvidia-jetson-orin-nano-super-and-the-one-flag-that-fixes-it

— 🤖 This is an automated AI response. I’m here to help, but please verify important details! —

To address the question regarding the deployment strategy for achieving a 2 QPS target for the vision-language workload on Orin Nano Super, we need to consider several factors based on the provided context.

  1. Inference Engines: The context mentions two open-source inference engines that work well on the Orin Nano: llama.cpp and TensorRT-Edge-LLM. For the Qwen3-VL-2B model, it’s essential to use an engine that supports this model. Given that Qwen3-VL is a relatively new model, using the latest version of vLLM or TensorRT-Edge-LLM that has added support for it is recommended.

  2. Model Optimization: The context discusses the use of quantization to reduce memory usage and improve performance. Quantization formats like Q4_K GGUF can be effective in fitting larger models like LLMs and VLMs within the Orin Nano’s 8GB memory. However, the specific quantization method and its impact on accuracy need to be considered.

  3. Memory Management: The Orin Nano’s shared memory environment requires efficient memory management. Techniques like using unified memory and ensuring that the allocation path uses managed/unified memory instead of dedicated VRAM can help mitigate out-of-memory (OOM) issues, as seen in the llama.cpp build fix.

  4. Async Processing and Batching: For concurrent execution of multiple models like YOLOv8, face recognition, and VLMs, asynchronous processing and batching can help in managing latency and throughput. Running face recognition and VLMs asynchronously off a queue, as mentioned, can prevent stalling the main capture thread.

  5. Power and Thermal Management: Monitoring and managing power draw and SoC temperature are crucial for sustained performance, especially in edge AI applications. Ensuring that the system operates within a safe thermal envelope and power budget is essential for reliability and longevity.

Given these considerations, a feasible deployment strategy for achieving the 2 QPS target on Orin Nano Super for the specified vision-language workload could involve:

  • Using Optimized Inference Engines: Utilize the latest version of vLLM or TensorRT-Edge-LLM that supports Qwen3-VL-2B.
  • Applying Quantization: Employ quantization techniques that balance model size and accuracy, such as Q4_K GGUF, to fit the model within the available memory.
  • Efficient Memory Management: Ensure the use of unified memory and optimize memory allocation paths to prevent OOM issues.
  • Async Processing and Batching: Implement asynchronous processing for face recognition and VLMs, and consider batching for improved throughput.
  • Monitoring and Optimization: Continuously monitor system performance, power consumption, and thermal metrics to identify bottlenecks and areas for optimization.

By carefully addressing these aspects, it’s possible to develop an efficient deployment strategy for the specified workload on the Orin Nano Super, aiming to achieve the desired performance target of 2 QPS.

— We support team will also look into your issue to have further suggestions soon. please stay tuned. —

Thanks for the replies. A few clarifications on the actual setup, since some of the suggestions don’t quite map to it:

Model/engine: this runs LFM2-VL 1.6B (Q4_0) via llama.cpp, not Qwen3-VL. llama.cpp is Liquid AI’s documented path for LFM2-VL (GGUF + mmproj vision projector), and for a single-stream edge workload it’s the right fit — vLLM’s continuous-batching advantage doesn’t apply when there’s one camera and one request in flight, and I haven’t seen confirmed LFM2-VL vision support in vLLM regardless.

Vision path: the VLM receives the actual frame — each analysis JPEG-encodes the frame and sends it as an image to llama-server’s /v1/chat/completions endpoint, so the model’s vision encoder runs on real pixels (not a text caption of detections). This requires launching with --mmproj; without it the server loads text-only and the image request silently fails.

Not chasing a fixed QPS: the VLM runs async off a single-slot queue, gated to ~one analysis every 4s and only when persons are tracked. Per-frame path (YOLO + tracking + face) stays ~50–150 ms; VLM scene analysis lands ~1.8–2.5s out of band, so it never stalls capture. DeepFace is pinned to CPU (CUDA_VISIBLE_DEVICES="") while YOLO and the VLM use the GPU — a deliberate choice to manage pressure on the shared 8GB pool.

Correction to my original post on the UM flag: GGML_CUDA_ENABLE_UNIFIED_MEMORY is a runtime environment variable, not a cmake build option — set it when launching the server, e.g. GGML_CUDA_ENABLE_UNIFIED_MEMORY=1 ./llama-server .... In the CUDA backend it switches allocations from cudaMalloc to cudaMallocManaged, backing tensors with the shared CPU/GPU pool instead of dedicated VRAM that doesn’t exist on this SoC. That’s the change that takes LFM2-VL from failing to load to fully GPU-offloaded.

The open question I’d still value input on: has anyone characterized the throughput cost of managed vs dedicated allocation specifically on Orin? On discrete GPUs there are reports of much worse prompt-processing under UM, but on an integrated-memory device there’s no dedicated-VRAM baseline to compare against — curious whether anyone’s profiled the managed path on Tegra.

Full code + build steps in the repo linked above.

Hi,

Thanks for sharing this information.
All Jetson devices use a shared memory architecture and we don’t observe a noticeable perf drop due to the memory.

Thanks.

Hi,

We try to reproduce this issue locally.
However, we can run nvidia/NVIDIA-Nemotron-3-Nano-4B-GGUF without using GGML_CUDA_ENABLE_UNIFIED_MEMORY locally.

Is this a model-dependent issue?
Could you share what kind of llama-server command to reproduce the UM issue?

Thanks.