Mastodon Politics, Power, and Science

Monday, November 30, 2026

Beyond the DAG: Orchestrating Iterative AI Workflows in a 21 KB C Dataflow Engine

J. Rogers, SE Ohio

If you spend enough time building generative AI pipelines in ComfyUI, you eventually hit the fundamental limitation of its architecture: ComfyUI is a strict Directed Acyclic Graph (DAG).
A DAG is fantastic for linear, batch-style rendering—prompt goes in, latent gets sampled, VAE decodes, image saves to disk. But the moment you want to treat AI generation as an iterative, conversational process, you have to start fighting the graph.
Consider a real-world workflow on constrained hardware—for example, running local diffusion over Vulkan on a thin-and-light Linux laptop using an instruction-editable model like FLUX.2 [klein]:
  1. Stage 1 (Fast Draft & Edit): Generate a 512×384 composition in ~2 minutes. Look at it. If you like the layout, feed that image back in with a new natural-language instruction ("add a brass lantern on the table" or "shift the lighting to dusk") and run another 2-minute pass. Repeat until the scene is locked in.
  2. Stage 2 (Heavy Finish): Once a draft is approved, route it to a 640×480 refinement pass followed by a 4x AI upscale to 2560×1920—an 8-minute heavy compute job.
To build this decision tree inside ComfyUI alone, you have to wire up third-party pause gates, sender/receiver feedback hacks, and manual bypass toggles just to simulate a while loop without accidentally triggering an 8-minute upscale on a throwaway draft.
Or, you can flip the architecture upside down: let ComfyUI be a stateless compute peripheral, and move the decision tree into a true cyclic dataflow engine.

Enter GrokThink / DataObj: Treating the Pipeline as Live Data
In DataObj (GrokThink), the core runtime is a hollow 21 KB C executable where the application is data, not code. Every capability—UI widgets, network sockets, scripting hosts, and API bridges for ComfyUI, Ollama, and MCP—lives in isolated ~30 KB .object modules discovered at startup.
More importantly, DataObj breaks three rules that hold traditional node editors back:
  1. Everything is a node in one uniform tree (registry, configuration, wiring, and live UI panels).
  2. Everything is a message passed asynchronously by pointer through node subscriptions—zero call-stack nesting, zero impedance layers.
  3. There are no ports. In, Out, Enable, and Clock are just property names. Any node can subscribe to any other node's properties.
When you delete the concept of ports and strict DAG ordering, building an interactive AI decision tree stops being a hack and becomes natural wiring.

Building the Decision Tree in DataObj
Instead of cramming state management into ComfyUI, DataObj sits on your browser canvas as an interactive instrument panel and orchestrator, talking to ComfyUI over its native API module.
1. Native Loops Without Workarounds
Because nodes communicate via subscriptions over an asynchronous scheduler, looping a FLUX.2 [klein] image back into an edit pass doesn't require special bridge nodes. You simply subscribe the Stage 1 input properties to the output of your decision switch.
When your 512×384 draft finishes in 2 minutes, it lands right on your browser panel next to an instruction text box and three live controls:
  • Discard: Drop the image and tweak your seed.
  • Iterate (Loop Back): Type your next edit instruction and trigger Stage 1 again. The image flows straight back into FLUX.2 [klein]'s reference input for another 2-minute pass.
  • Approve (Commit): Route the finished composition down the heavy path.
2. Distributed Dispatch: Keep Your Laptop Free
Once you hit Approve, DataObj doesn't have to choke your laptop's GPU for the next 8 minutes. Using DataObj's TCP/HTTP and queue objects, the approved payload is dispatched across your LAN to a secondary worker machine running ComfyUI.
While that worker quietly grinds through a 10-to-100-image batch of 640×480 refinements and 4x AI upscales over the next couple of hours, your laptop stays cool, responsive, and completely free to sculpt new 2-minute drafts. Meanwhile, live TextOut and LED widgets on your DataObj canvas subscribe directly to the remote queue's depth property so you can watch the batch drain in real time.
3. Dead-Letter Logging and One-Click Retries
When pushing 100 heavy upscale jobs across heterogeneous hardware, things occasionally break—a worker runs out of VRAM, a Vulkan shader times out, or a network socket drops.
In a monolithic workflow, a mid-batch crash forces you to manually figure out which images finished and which didn't. In DataObj, fault tolerance is just wiring:
  • If a remote ComfyUI job returns an error or times out, the dispatcher routes that self-contained JSON payload into a Failed queue/log node and increments an error counter—while the remaining 99 jobs keep running.
  • A red LED on your canvas alerts you that a job stalled.
  • Once you fix the issue on the worker node, clicking a single Retry button on your panel flushes the Failed node's contents straight back into the active work queue. Only the broken jobs re-run.
4. Time-Travel Replay for Any Historical Job
Because every job in DataObj is pure, self-contained data—capturing the seed, the full chain of FLUX.2 [klein] edit instructions, reference image paths, and stage parameters—replaying history is completely free.
Spot an image you generated three days ago and wonder how it would look with a new element added, a different 4x upscaler model, or a newly released checkpoint? You don't dig through PNG metadata or rebuild a graph. You simply select that archived job record and route its message payload back into the Start node of your live graph, tweak one property on the canvas, and let it flow through the pipeline again.

Why Architecture Matters
ComfyUI is an unmatched execution engine for diffusion graphs, and pairing it with instruction-capable models like FLUX.2 [klein] unlocks genuinely creative, conversational image building.
By pairing ComfyUI with a lightweight, cyclic dataflow fabric like DataObj, you get the best of both worlds: ComfyUI does the heavy GPU math, while a 21 KB C message engine gives you true loops, live instrument panels, distributed batch queues, dead-letter retries, and full job replay.

Turning ComfyUI Into an Interactive Decision Tree: Human-in-the-Loop Workflows for Iterative AI Editing

J. Rogers, SE Ohio

Most ComfyUI workflows are built like assembly lines: you hit Queue Prompt, cross your fingers, and wait until the final SaveImage node finishes. That works fine when you are running a 10-second generation on a desktop workstation. It falls apart when you are running multi-stage pipelines on constrained hardware—like running Vulkan compute on a thin-and-light laptop—or when you are using instruction-editable models like FLUX.2 [klein] where the magic happens through iterative back-and-forth edits.
When a fast draft takes 2 minutes and your final hires-fix plus 4x AI upscale takes another 8 minutes, burning 10 minutes on a composition you end up discarding is painful. What you really want is a decision tree: a workflow that pauses mid-execution, shows you the draft, asks what you want to do next, and lets you either loop back for another edit pass or commit to the heavy upscale.
Because ComfyUI evaluates graphs as a Directed Acyclic Graph (DAG) from output backward, you cannot draw a literal wire from the end of a workflow back to its start. However, by combining interactive gate nodes with sender/receiver feedback loops, you can build a true state-machine-style decision tree right inside the canvas.

The Architecture: A Two-Stage State Machine
Instead of one monolithic pipeline, split your graph into three logical zones:
  1. Stage 1 (Fast Draft & Edit Loop): Runs at a fast resolution (e.g., 512×384) using an instruction-capable model like FLUX.2 [klein]. It accepts either a fresh prompt or a recycled image from the previous pass.
  2. The Decision Gate (Human-in-the-Loop): Halts execution after Stage 1, displays the preview, and waits for your input before evaluating anything downstream.
  3. Stage 2 (Heavy Finish): Your 640×480 refinement pass and 4x AI upscaler (2560×1920). Because ComfyUI uses lazy evaluation, none of Stage 2 runs unless the Decision Gate explicitly routes data into it.

Step 1: Install the Control Nodes
To pull this off cleanly (especially on non-CUDA setups like Linux ARM64 + Vulkan, where avoiding heavy Python binary dependencies matters), stick to lightweight custom nodes:
  • For Pausing & Branching: Install cg-image-filter (which provides the Image Filter pause-and-pick node) or an interactive switch node (InteractiveSwitch).
  • For Looping Back: Install ComfyUI Impact Pack (for ImageSender and ImageReceiver) or mm-comfyui-loopback (a dependency-light pure graph loop node).
(Note: When using interactive pause nodes, make sure Auto Queue is disabled in the ComfyUI menu so runs do not pile up while waiting for your input.)

Step 2: Wire the Feedback Loop (Stage 1)
Instruction-based models like FLUX.2 [klein] shine when you treat generation like a conversation: generate a base scene, then pass that image back in with a new instruction ("add a brass lantern on the table" or "shift the lighting to dusk").
  1. Set up your Reference Input: Place an ImageReceiver node at the start of your Stage 1 block and connect its output to your model's ReferenceLatent (or img2img VAE Encode) path.
  2. Handle Pass #1 vs. Pass #2+: Use an image switch at the input of Stage 1. On your initial generation, leave the reference input bypassed (or routed from a blank latent) so FLUX.2 [klein] generates from text alone. Once a draft exists in the receiver, flip the input switch to feed the recycled image back in.
  3. Add Your Instruction Prompt: Keep your positive prompt node exposed right next to your Decision Gate so you can type your next edit instruction while reviewing the current preview.

Step 3: Build the Interactive Decision Gate
Immediately after Stage 1 decodes your 512×384 draft image, insert your gate.
  1. Connect the Stage 1 VAEDecode output into an Image Filter node (from cg-image-filter) or an InteractiveSwitch.
  2. Configure two distinct output paths from your gate:
    • Branch A — Iterate (Loop Back): Connects directly to an ImageSender node paired with Stage 1's ImageReceiver.
    • Branch B — Approve (Heavy Upscale): Connects into Stage 2's 640×480 hires-fix sampler and 4x upscaler.
When you click Queue Prompt, ComfyUI runs Stage 1, pops up the 512×384 preview at the gate, and freezes execution. Your GPU drops back to idle while you inspect the image.

Step 4: Running the Decision Tree in Practice
Once execution pauses at the gate, you have three clean choices:
Path 1: Discard & Start Over
If the composition is completely off, click Cancel on the gate. Stage 2 never touches your GPU. Tweak your seed or base prompt and queue again—total time spent: 2 minutes.
Path 2: Add an Element / Refine (The 2-Minute Loop)
If the base composition works and you want to add details or fix an area:
  1. Update your prompt box with the new instruction (e.g., "keep everything the same, add rain puddles reflecting neon signs").
  2. Ensure Stage 1's input switch is set to read from ImageReceiver.
  3. Select Branch A (Iterate) on your Decision Gate.
The image routes through ImageSender back to ImageReceiver and triggers a fresh 2-minute Stage 1 pass—preserving your subject and layout while applying the edit. You can repeat this loop three or four times until every detail is locked in.
Path 3: Commit to Final Render (The 8-Minute Finish)
Once your 512×384 draft is exactly what you want:
  1. Select Branch B (Approve) on your Decision Gate.
  2. ComfyUI immediately wakes up Stage 2, runs your 640×480 detail pass, executes the 4x AI upscale to 2560×1920, and saves the final image to disk.

Why This Changes How You Use Local AI
Adding a decision gate transforms ComfyUI from a batch renderer into an interactive creative workstation:
  • Zero wasted compute: Heavy upscalers and multi-pass refiners only execute on seeds you have already approved.
  • Tight creative feedback loops: You stay in flow with 2-minute prompt/edit cycles instead of waiting 10 minutes per experiment.
  • Hardware-friendly: Whether you are running on a desktop GPU or pushing Vulkan compute on a thin-and-light laptop, human-in-the-loop branching lets you get workstation-grade final outputs out of modest hardware.

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.

Beyond the DAG: Orchestrating Iterative AI Workflows in a 21 KB C Dataflow Engine

J. Rogers, SE Ohio If you spend enough time building generative AI pipelines in ComfyUI , you eventually hit the fundamental limitation of i...