Mastodon Politics, Power, and Science

Friday, November 27, 2026

ZeroPool: A Genuine Shared-Memory Orchestrator Across Compute Cores

J. Rogers, SE Ohio

https://github.com/BuckRogers1965/ZeroPool

Modern systems-on-chip are sold on a simple promise: CPU, GPU, and NPU working together, sharing data, no copies. The hardware mostly delivers. The software does not. What you actually get is three separate stacks, each with its own allocator and its own memory model, and the "shared memory" story left as an exercise for the developer.

ZeroPool exists to close that gap. Its goal is a genuine shared-memory orchestrator: one allocation, handed to every compute engine, with each engine executing against the identical memory array.

The Problem: Three Libraries, Three Allocations

The pitch is heterogeneous compute. The reality is that the Adreno GPU stack, the Hexagon NPU stack, and the CPU each want to own their memory. Vulkan wants VkDeviceMemory it allocated. FastRPC wants buffers it mapped. The CPU wants its own mmap. Left alone, each library allocates separately, and every handoff between engines becomes a copy.

The kernel support for real sharing is there — dma_heap, external memory import, SMMU fd import. The libraries just don't default to it, and the documentation doesn't lead you there.

ZeroPool's first principle is therefore: the application owns the allocation, and every library takes a handle instead of allocating.

  • Allocate once from /dev/dma_heap/system.
  • CPU: mmap the fd.
  • Adreno: import the fd as external VkDeviceMemory instead of vkAllocateMemory.
  • Hexagon: import the fd into the cDSP SMMU instead of letting FastRPC allocate.

No library allocates. They all receive the same handle and operate on the same physical array.

What Had to Be Proven

"Takes a handle" and "operates on that memory" are different claims. The proof of concept had to show the stronger one: that all three engines, given the same handle, actually execute against the identical physical memory, in sequence, with correct data handoff.

The CPU is trivial. The GPU is relatively easy — import the fd, run a shader, it operates on the memory. The NPU is where it gets hard. FastRPC and the cDSP don't just take an arbitrary buffer; they want signed skels and a specific mapping discipline. Getting any NPU execution to operate on the shared buffer was the crux of the proof.

The early proof of concept demonstrates it end-to-end:

[STAGE 1 - CPU] Oryon CPU allocated 4 MB shared arena from /dev/dma_heap/system (fd=6)
[STAGE 1 - CPU] Oryon CPU wrote Slice A (fd=6, offset 0x0000): [100, 200, 300, 400, 500, 600...]
[STAGE 2 - GPU] Adreno X1-85 mapped shared dma_heap fd=6 into Vulkan VkDeviceMemory
[STAGE 2 - GPU] Adreno X1-85 operated on Slice A and wrote Slice B in shared memory
[STAGE 3 - NPU] Hexagon V73 mapped shared dma_heap fd=6 into cDSP SMMU
[STAGE 3 - NPU] Hexagon V73 operated on Slice B and wrote HVX FFT1024 to Slice C
[ZEROPOOL VERIFIED] Oryon CPU -> Adreno X1-85 GPU -> Hexagon V73 NPU -> Oryon CPU all operated zero-copy on fd=6!

One allocation. One fd. Three architecturally different cores executing against the same memory array, zero-copy at every hop.

The Orchestrator

Proving the mechanism is the foundation. The next step is a runtime that uses it: a dataflow orchestrator over the shared arena.

  • Shared arena — one allocation, sized for the peak working set, with offsets handed out to every stage.
  • Stage table — a DAG of steps, each {engine, op, input_offset, output_offset, params_offset, in_place_flag}. Steps reference offsets, never allocations.
  • Dispatcher — walks the DAG and hands each step to the right engine. Output can be in-place or a different offset in the same block when shapes change.
  • Hardware completion signals — each engine signals done with a hardware fence or sync object. The CPU orchestrates without touching the data, and can itself take a step when the GPU and NPU are both busy.
  • Fallback chain — every op has a primary engine and a fallback: NPU, then GPU, then CPU. Because every engine operates on the same arena, falling back costs throughput, not correctness. No copy, no format conversion. The worst case is slower, never broken.

This is the shape of a real edge runtime: bounded memory, a stack of small models as layers, each layer dispatched to whichever engine is best and free, with in-place transforms where shapes allow and preallocated offsets where they don't.

The Open Question: The NPU Vocabulary

Today, the NPU leg runs against a handful of functions in precompiled signed libraries — whatever those libraries happen to expose. The orchestrator makes those functions go as far as possible by routing every matching step to the NPU and falling back to GPU or CPU for the rest. The workflow runs end-to-end regardless.

But the vocabulary is fixed by what has been signed, and that is the real constraint. The hardware can execute against shared memory. The memory model works. The orchestrator can dispatch to it. The missing piece is an open library of parameterized edge-AI primitives — matmul, elementwise, reductions, FFT, convolution — that developers can compose into their own models and run on the NPU they own.

For edge AI, that primitive set is small and sufficient. Composing a fixed set of signed primitives into arbitrary programs is how you get effective programmability without opening the NPU to arbitrary code. It is the same model as shaders on the GPU: a fixed instruction set, composed freely. The GPU has no signing gate. The NPU does.

The Ask

ZeroPool's goal is a genuine shared-memory orchestrator across compute cores — and the hardware already supports it. What is missing is for the compute engines to meet developers at the shared arena, and for the NPU's op vocabulary to be open enough to build real workloads on top.

Sign an open library of edge-AI primitives. Let developers compose their own models on the NPU they own. The mechanism works. The memory is already shared. The only thing left is the gate.


ZeroPool is a proof of concept demonstrating zero-copy execution across CPU, GPU, and NPU against a single dma_heap allocation on Snapdragon X Elite. The work is early; the foundation is proven; the orchestrator is next.

Thursday, November 26, 2026

Debugging the Hexagon V73 NPU on Snapdragon X Elite (X1E80100) Linux

J. Rogers, SE Ohio

Getting the Qualcomm Hexagon V73 NPU running on mainline Linux on a commercial Snapdragon X Elite laptop (Dell Latitude 7455, running Arch/Omarchy) is an exercise in separating kernel plumbing, FastRPC process domains, and firmware signature boundaries.
Tonight, instead of guessing at high-level AI frameworks, we stripped the stack down to its lowest layers and traced every syscall and RPC return code from the kernel up. Here is what actually happens under the hood—and what works today.

1. The Hardware & Kernel Plumbing Works Out of the Box
At the lowest level, mainline Linux on x1e80100 already brings up the Compute DSP (CDSP) cleanly:
  • The remoteproc subsystem boots the CDSP (32300000.remoteproc) using the OEM qccdsp8380.mbn firmware.
  • Character devices /dev/fastrpc-cdsp, /dev/fastrpc-cdsp-secure, and /dev/dma_heap/system are present and active.
  • The userspace FastRPC listener daemon (cdsprpcd) attaches to domain 3 (attachguestos and adsp_default_listener) without errors.

2. Signed Process Domains (-U 0) Are Live on the NPU
Running Qualcomm’s low-level FastRPC diagnostic suite (fastrpc_test) in Signed Process Domain mode (-U 0) proves that the Hexagon V73 NPU is actively executing code and sharing dma_heap / ION buffers with the ARM64 Oryon CPU:
text
Allocate 4000 bytes from ION heap
Creating sequence of numbers from 0 to 999
Compute sum on domain 3

Call calculator_sum on the DSP
Sum = 499500

Call calculator_max on the DSP
Max value = 999
[PASS] libcalculator.so
[PASS] libmultithreading.so
Use code with caution.
  • libcalculator.so and libmultithreading.so both pass. The CPU allocates a buffer in dma_heap, passes it over FastRPC to the Hexagon V73 NPU, and reads back the computed sum (499500) and max (999).
  • libhap_example.so fails with 0x4e (ENOSYS): The older Android HAP_mem_map_dmahandle ioctl is unsupported on mainline Linux dma_heap, which is expected.

3. Why Unsigned PDs (-U 1) and QNN HTP (libQnnHtpV73Skel.so) Fail
When moving from Qualcomm’s pre-signed test libraries to custom DSP code or QAIRT’s QnnHtp backend, two distinct errors appear depending on which Process Domain mode you request:
A. Unsigned Process Domain (-U 1) Fails With 0x8000054f
Even after generating a device-specific testsig-0xd2b85295.so for the SoC serial number (3535520405 / 0xd2b85295), strace on fastrpc_test -d 3 -U 1 revealed the exact point of failure:
text
openat(AT_FDCWD, "/dev/fastrpc-cdsp-secure", O_RDONLY|O_NONBLOCK) = 7
openat(AT_FDCWD, "/usr/lib/rfsa/adsp/cdsp/fastrpc_shell_unsigned_3", O_RDONLY) = 8
ioctl(7, FASTRPC_IOCTL_INIT_CREATE, 0xffffeeb64c00) = 18446744071562069327
Use code with caution.
That return value (0xffffffff8000054f -> 0x8000054f) is AEE_EQURTBADASID (an ASID allocation failure inside adsp_process_group_create_mpd_attrs on the CDSP). Crucially, FASTRPC_IOCTL_INIT_CREATE fails inside the CDSP firmware before userspace ever searches for or loads testsig-*.so.
As tracked in qualcomm/fastrpc Issue #400, 0x8000054f occurs when the CDSP boot firmware (qccdsp8380.mbn) and the DSP userland shells (fastrpc_shell_unsigned_3) come from mismatched firmware builds—or when the OEM CDSP image restricts unsigned shell creation.
B. Signed Process Domain (-U 0) Fails With 0x80000406 on HTP Skels
Forcing QAIRT’s QnnHtp device creation into Signed PD mode (QNN_HTP_DEVICE_CONFIG_OPTION_SIGNEDPD) gets past FASTRPC_IOCTL_INIT_CREATE—the session opens—but immediately fails when loading the HTP skeleton library:
text
<E> DspTransport.openSession qnn_open failed, 0x80000406, prio 100
<E> IDspTransport: Unable to load lib 0x80000406
Use code with caution.
0x80000406 is AEE_EUNABLETOLOAD:
  • QAIRT’s Linux libQnnHtpV73Skel.so ships in hexagon-v73/unsigned/ without a production CDSP ELF signature, so Signed PD rejects it.
  • Windows ARM64 OEM Driver Packs (.cab) include libQnnHtpV73SkelDrv.so signed via a Windows Authenticode .cat catalog (qcnspmcdm8380.cat). The Linux CDSP loader does not parse Windows .cat catalogs—it verifies embedded Qualcomm MBN/ELF hash segments—so it rejects the Windows .so as well.

4. Where Things Stand for X1E80100 Linux Developers
  1. The Silicon Works: On x1e80100 Linux, /dev/fastrpc-cdsp + cdsprpcd + dma_heap is functional today for properly signed Linux CDSP binaries.
  2. Matched Firmware Is Critical for User PDs: Recent community testing in qualcomm/fastrpc Issue #377 demonstrated that pairing a matched CDSP.HT.2.9.c1-00075 firmware and DSP shell set with QAIRT 2.48 resolves 0x8000054f and runs Llama-3.2-1B on X1E80100 Linux at ~195 tok/s.
  3. Zero-Copy CPU + GPU Is Unblocked: While CDSP firmware/signature parity catches up across OEM laptops, the Oryon CPU (NEON/i8mm) and Adreno X1-85 GPU (Mesa Turnip Vulkan) already share dma_heap buffers cleanly with zero firmware gates.

Data Sits in Place, Messages Flow: Rewriting the Rules of Edge AI on Unified Silicon

J. Rogers, SE Ohio

For the past decade, running AI has meant living under one dominant set of rules inherited from the discrete-GPU era: a host CPU manages memory, a proprietary driver (cudaMalloc) locks tensors inside separate VRAM, and every step of an inference pipeline hauls gigabytes of data across a bus (cudaMemcpy) while Python and C++ wrappers orchestrate the traffic.
That programming model made sense when an AI accelerator was a 300-watt card plugged into a PCIe slot. On modern unified-memory ARM laptops, it is completely backwards.
SharedMemProc is an open-source, bare-metal AI runtime built and tested on a Dell Latitude 7455 (Qualcomm Snapdragon X Elite) running Omarchy (Arch Linux + Hyprland). Instead of wrapping CUDA or bolting high-level ML frameworks onto ARM Linux, it talks directly to the Linux kernel to treat the entire System-on-Chip—Oryon CPU, Adreno X1-85 GPU, and Hexagon V73 NPU—as a single spatial memory fabric.

How SharedMemProc Works
The runtime is built on a simple inversion borrowed from dataflow systems architecture (DataObj / GrokThink): data sits stationary in physical memory, and weightless messages flow between subscribed compute nodes.
1. One Physical dma_heap Arena, Mapped Three Ways
At startup, the Hardware Abstraction Layer allocates a persistent physical memory slab directly from the Linux kernel via /dev/dma_heap/system (DMA_HEAP_IOCTL_ALLOC). That single file descriptor (dmabuf_fd) is mapped once into all three processor address spaces:
  • Oryon CPU: Mapped into userspace virtual memory via mmap(), with explicit cache-coherency tracking (DMA_BUF_IOCTL_SYNC).
  • Adreno X1-85 GPU: Imported zero-copy into a Vulkan VkBuffer via VK_EXT_external_memory_dma_buf on Mesa’s open-source Turnip driver—bound once at startup with VK_WHOLE_SIZE.
  • Hexagon V73 NPU: Attached via /dev/fastrpc-cdsp (FASTRPC_IOCTL_INIT_ATTACH) and pinned directly into the Compute DSP’s SMMU/IOMMU page table (FASTRPC_IOCTL_MEM_MAP).
2. Zero-Copy TensorView Handles & Offset Passing
Nothing is ever copied, serialized, or re-bound between steps. Whether slicing attention heads, chaining one model's output into another's input, or passing tensors across engines, nodes only pass a tiny 64-byte TensorView descriptor (arena_id, byte_offset, shape, strides, and Linux sync_file fences). On the Adreno GPU, tensor offsets are injected straight into shader registers via Vulkan push constants in nanoseconds.
3. RCU-Style Lease Pinning & Deferred Change Requests
When three asynchronous engines share physical RAM, memory safety is paramount. Every sub-allocated slice carries an atomic active_leases counter. While any CPU, GPU, or NPU task is in flight, its bound memory slices are strictly immutable. When the orchestrator needs to compact fragmented scratchpads or hot-swap model weights, it enqueues a non-blocking ChangeRequest callback on that region. In-flight tasks finish uninterrupted; the exact completion fence that drops active_leases to zero automatically triggers the deferred compaction or swap with exclusive ownership.

What the Proof of Concept Just Proved
In proof_of_concept/hello.c, we stripped away every ML library, Python interpreter, and vendor wrapper—leaving ~250 lines of C23 talking directly to Linux kernel ioctls—and executed a live 3-way zero-copy hardware handshake on the Latitude 7455:
  1. Allocated a physical dma_heap slab (fd=4, CPU virtual address 0xf7773de90000).
  2. Bound that exact dmabuf_fd once into the Adreno X1-85 GPU and mapped it zero-copy into the Hexagon CDSP IOMMU at dsp_vaddr=0xe6c00000.
  3. Stage 1 (Oryon CPU): Wrote a vector array [0, 1, 2, 3, ...] in-place using ARM NEON intrinsics (vst1q_s32) and flushed dirty CPU cache lines via DMA_BUF_IOCTL_SYNC.
  4. Stage 2 (Adreno GPU): Dispatched a SPIR-V compute shader using a push-constant byte_offset to multiply every element by 2 in-place—zero staging buffers, zero descriptor updates.
  5. Stage 3 (Hexagon NPU + Verification): Verified the Hexagon DSP mapped the live tensor at 0xe6c00000 with zero copies, and read back 0 2 4 6 8 10 on the CPU after cache invalidation.
It proved that all three heterogeneous processors on a commercial ARM Linux laptop can address, mutate, and synchronize over the exact same physical RAM pages simultaneously without CUDA or proprietary black boxes.

How This Rewrites the Rules of AI
Moving from discrete-GPU habits to a unified-memory dataflow runtime changes five fundamental rules of how we build AI systems:
Rule 1: Memory Bandwidth Replaces FLOPS as the Primary Currency
On an edge SoC, LPDDR5x bandwidth is shared across the entire system. Traditional frameworks waste up to 40% of their bandwidth budget copying tensors across driver boundaries. When data never moves and only offset handles flow, 100% of memory bandwidth feeds the math units—directly increasing tokens-per-second and battery life.
Rule 2: Models Are Persistent "Edge Firmware," Not Transient Cloud Jobs
On an edge device, you aren't serving random one-off cloud requests—you are running a known suite of capabilities continuously. Instead of the brutal load -> run -> tear down cycle, models become memory-mapped firmware handles (ModelHandle tables) pinned permanently in the arena with 0 ms cold-start latency.
Rule 3: Pinned Micro-Agent Dataflow Beats One Giant Monolith
Rather than cramming one sluggish generalist model into 32 GB of RAM, a zero-copy arena lets you pin 10 to 20 fine-tuned specialist micro-agents (0.5B–3B parameters each, sharing base weights where possible) simultaneously. The orchestrator wires an on-the-fly workflow across them—passing intermediate embeddings and hidden states directly via TensorView pointers with zero text serialization between agents.
Rule 4: Sub-Layer Heterogeneous Pipelining Replaces "Pick One Backend"
Instead of forcing an entire model onto CPU or GPU or NPU, a single workflow becomes an overlapping assembly line: the Hexagon NPU runs always-on routing and dense matrix prefill at ~2–3 watts, the Adreno GPU runs parallel attention and dynamic shaders, and the Oryon CPU (i8mm / dotprod) handles low-latency control flow and sampling—all executing concurrently on different offsets of the same arena.
Rule 5: Freedom from the CUDA Monoculture
By building on standard Linux kernel primitives (dma_heap, sync_file, fastrpc) and open Mesa Turnip Vulkan drivers, SharedMemProc bypasses proprietary vendor lock-in completely. And on fragmented hardware with discrete VRAM, ComputeArena affinity simply binds layers to their local memory domain and overlaps multi-task pipelines asynchronously across the bus.

Next Steps from the Proof of Concept
With Milestone 0 proven on bare metal, development moves into four concrete engineering phases:
  1. Phase 1 — Two-Zone Arena & RCU Checkpoint Compaction (hal_arena): Implement the static pinned zone (for resident ModelHandle weights) and dynamic compactable zone (for live KV-caches and scratchpads), complete with atomic active_leases, ChangeRequest drain callbacks, and strict reverse-order lease teardown.
  2. Phase 2 — Coherency Tracker & Fence DAG Scheduler: Automate DMA_BUF_IOCTL_SYNC calls via last-writer engine tracking and wire non-blocking sync_file / Vulkan timeline semaphores into the DataObj message scheduler.
  3. Phase 3 — Live NPU Compute & Bare-Metal INT8 MatMul Kernels: Execute active Hexagon CDSP payloads via FASTRPC_IOCTL_INVOKE alongside hand-tuned ARMv8.7-A i8mm (vmmlaq_s32) CPU micro-kernels and Adreno Vulkan subgroup matrix shaders.
  4. Phase 4 — Loadable .object Modules & Multi-Agent Routing: Package arenas, ModelHandle registries, and hardware dispatchers as hot-loadable DataObj modules—turning unified LPDDR5x into a self-instrumenting, zero-copy agentic runtime.

ZeroPool: A Genuine Shared-Memory Orchestrator Across Compute Cores

J. Rogers, SE Ohio https://github.com/BuckRogers1965/ZeroPool Modern systems-on-chip are sold on a simple promise: CPU, GPU, and NPU working...