<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mark Baker on Medium]]></title>
        <description><![CDATA[Stories by Mark Baker on Medium]]></description>
        <link>https://medium.com/@Fail-Safe?source=rss-454578a952e1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*V6Wi2K30UfVCxi3QnkTFmg.jpeg</url>
            <title>Stories by Mark Baker on Medium</title>
            <link>https://medium.com/@Fail-Safe?source=rss-454578a952e1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 14:46:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Fail-Safe/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[I Rewrote My AI Memory Service in Rust. Here’s What Changed.]]></title>
            <link>https://medium.com/@Fail-Safe/i-rewrote-my-ai-memory-service-in-rust-heres-what-changed-92f47d9d2564?source=rss-454578a952e1------2</link>
            <guid isPermaLink="false">https://medium.com/p/92f47d9d2564</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Mark Baker]]></dc:creator>
            <pubDate>Sun, 30 Aug 2026 03:21:58 GMT</pubDate>
            <atom:updated>2026-08-30T03:50:41.708Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Go wasn’t failing. An isolated rewrite, 100,000-trace benchmarks, and crash tests showed where Rust genuinely helped — and where it didn’t.</em></p><figure><img alt="Editorial graphic showing Noema moving from a Go baseline to Rust production through parity, scale, and recovery gates, with measured 100,000-trace improvements." src="https://cdn-images-1.medium.com/max/1024/1*7ZgSdMjVNmV8xLn0ebBVuA.png" /><figcaption>Noema’s rewrite preserved behavior first, then measured the operational differences.</figcaption></figure><p>Recently, I replaced the production implementation of Noema — my local-first memory layer for AI agents — with Rust.</p><p>That sentence invites the obvious question: <em>Was Rust faster?</em></p><p>Sometimes. But that turned out to be one of the less interesting answers.</p><p>The more useful questions were harder: Could the rewrite preserve every storage and protocol contract? Would it reduce the cost of running a long-lived memory service? Could it make stronger recovery guarantees practical? And what would it reveal about assumptions buried in the Go implementation?</p><p>The Go version was working. That mattered. I wasn’t escaping a failed codebase; I was asking whether a different implementation could earn the right to replace it.</p><p>The production cutover shipped in Noema v0.20.0 on August 18, 2026. Here is what the rewrite actually changed — and what it did not.</p><h3>First, what kind of system is Noema?</h3><p>Noema gives AI agents and the humans working with them a persistent place to record facts, decisions, preferences, observations, and intentions.</p><p>Each memory is a plain Markdown file. SQLite provides the local index, full-text search, event history, federation state, and optional embeddings. Noema also runs a filesystem watcher, exposes a Model Context Protocol server over stdio and HTTP, synchronizes memories between peers, and performs optional memory consolidation.</p><p>In practical terms, the rewrite sat beneath nearly every product promise: local files remain the source of truth; editor changes become auditable events; MCP serves agents locally or over guarded HTTP; and federated peers synchronize without a central broker while preserving concurrent edits as explicit divergences.</p><figure><img alt="A diagram showing Markdown files and editor changes flowing into the Noema binary, which coordinates SQLite search, a filesystem watcher, MCP transports, event history, security, recovery, agents, and federated peers." src="https://cdn-images-1.medium.com/max/1024/1*LkNDLzhkAfQmNxs1efWK4A.png" /><figcaption>Noema’s production runtime sits between human-edited Markdown, local SQLite state, MCP clients, and peer-to-peer federation. The port had to preserve each boundary.</figcaption></figure><p>That workload is important context. Most of Noema’s time is spent in SQLite, filesystem reconciliation, networking, and model I/O. None of those costs disappears because the surrounding application changes languages.</p><p>So I did not begin with “Rust must be faster.” In fact, the original assessment found a full candidate scan and sort in semantic search that was more likely to matter than Go’s runtime. An algorithmic problem does not become a language problem just because a rewrite is appealing.</p><p>The rewrite needed a better justification.</p><h3>I treated Go as the oracle, not the old code to discard</h3><p>The safest way to run the experiment was to keep the Go implementation intact and build Rust alongside it.</p><p>The compatibility boundary was much larger than a list of CLI commands. The Rust version had to preserve:</p><p>- the Markdown and YAML frontmatter format;<br>- the SQLite schema and migrations;<br>- command output, JSON shapes, errors, and exit codes;<br>- MCP tools, schemas, and transports;<br>- event signatures and vector clocks;<br>- watcher behavior and external-edit reconciliation;<br>- federation and mixed-runtime interoperability;<br>- backup, restore, crash recovery, and plugin contracts; and<br>- the terminal UI down to lifecycle and rendering behavior.</p><p>This turned the rewrite into a differential test program. The question was not “Does the Rust version look complete?” It was “Can the same scenarios run against both implementations and produce equivalent behavior?”</p><p>That distinction saved the project more than once.</p><p>An early model-driven comparison strongly favored Go. The cause was not the language. The Rust port had abbreviated prompts, weaker output validation, and incomplete rules for ambiguous terms. Bringing the prompt contract to parity — and applying the same grounding improvements to both versions — closed the gap. The final blind reviews were effectively tied.</p><p>The rewrite did not prove that Rust makes models better. It exposed behavior that had never been specified precisely enough.</p><h3>The measured workload did get faster — and lighter</h3><p>Once behavior was aligned, I ran release-optimized scale campaigns at 10,000 and 100,000 traces. Each scenario used fresh server processes, alternating run order, identical verified corpora, exact post-write counts, and five runs.</p><p>The most representative scenario mixed selective reads with trace creation and updates — the shape of a real agent-memory service rather than a search-only benchmark.</p><p>At 10,000 traces, Rust processed 4,311 operations per second versus Go’s 3,412: a 26.3% lead. Peak sampled memory fell from 109.6 MiB to 85.8 MiB, a 21.7% reduction.</p><p>At 100,000 traces, the lead grew. Rust processed 4,204 operations per second versus 2,977 for Go, a 41.2% improvement. Peak sampled memory fell from 175.6 MiB to 104.0 MiB, a 40.8% reduction.</p><figure><img alt="Two grouped bar charts comparing Go and Rust throughput and peak memory at 10,000 and 100,000 traces. Rust is 26% and 41% faster while using 22% and 41% less memory." src="https://cdn-images-1.medium.com/max/1024/1*VPJi6zK_B4m1C_m_02MLZg.png" /><figcaption>On Noema’s mixed workload, Rust’s throughput and memory advantages increased between 10,000 and 100,000 traces. These are measured points, not a fitted scaling curve.</figcaption></figure><p>Those results matter for Noema because it is intended to stay running. Lower memory use in the steady mixed workload means more than winning a short microbenchmark.</p><p>The advantage also survived a bounded three-node federation test. Both implementations converged to the same 80 events per node after active replication and a restart, while the Rust processes used 37.4% less peak aggregate memory and 18.8% less mean sampled CPU.</p><p>But the workload shape mattered — a lot.</p><p>Rust was faster in all ten final throughput scenarios, yet it did not always use less memory. A serial full-corpus response at 100,000 traces retained 2.15 times Go’s peak memory. Broad output with four clients was roughly tied. Selective retrieval and mixed traffic favored Rust.</p><p><strong>“Rust uses less memory”</strong> would have been a cleaner story. It would also have been false.</p><figure><img alt="Diverging bars comparing ten Go and Rust scenarios. Rust is faster in all ten, uses less memory in seven, is approximately tied in one, and uses more in two broad serial scans." src="https://cdn-images-1.medium.com/max/1024/1*7_reJi54-XgMaGnoOKD2dw.png" /><figcaption>Rust led throughput in every final scenario, but full-corpus serial output used more memory. Workload shape matters.</figcaption></figure><h3>Rust made durability an explicit product choice</h3><p>The rewrite’s most meaningful architectural result was not a benchmark. It was a clearer durability boundary.</p><p>Noema now has two durability profiles:</p><p>- <strong>Standard</strong> is the default. It matches the Go implementation’s direct file write and single SQLite transaction.<br>- <strong>Strong</strong> adds recovery records, stable mutation locks, atomic temporary files, rename, file and directory flushes, and reconciliation after interruption.</p><p>Standard mode is the fair performance comparison because both implementations do equivalent mutation work. Strong mode deliberately does more work to buy a stronger recovery guarantee.</p><figure><img alt="Three charts compare Go, Rust standard, and Rust strong for seed time, mixed throughput, and write latency. Rust strong is much slower because it performs additional recovery work." src="https://cdn-images-1.medium.com/max/1024/1*gv8d9R66qoBJsyVVaFeTcg.png" /><figcaption>Standard is the like-for-like comparison. Strong performs additional journal and flush work to provide a stronger recovery posture.</figcaption></figure><p>The price is substantial. At 10,000 traces, mixed throughput fell from 4,311 operations per second in Rust’s standard mode to 253 in strong mode. Median write latency rose from 0.301 ms to 9.128 ms.</p><p>That is not a Rust regression. It is the cost of a different durability protocol.</p><p>The strong profile passed process-death tests and repeated APFS detach-and-remount recovery tests on disposable disk images. Those tests still do not prove survival when hardware loses an acknowledged write sitting in a volatile device cache. Durability claims deserve the same precision as performance claims.</p><p>Could I have built the same protocol in Go? Yes. Strong recovery is not an intrinsic Rust feature. Rust made the state machine practical to express and test during the rewrite, while the profile boundary let Noema offer it without silently changing the default cost for every user.</p><h3>The compiler changed the maintenance surface</h3><p>Noema combines SQLite access, concurrent MCP transports, background federation, filesystem watchers, consolidation jobs, and TLS. Rust’s compile-time memory and thread-safety checks are a good match for that kind of long-lived process.</p><p>I cannot attach a benchmark percentage to “the compiler rejects more invalid states.” It is a maintainability and defect-prevention argument, not a performance result. But it changes how confidently I can evolve concurrency and recovery code.</p><p>The production implementation also became smaller.</p><figure><img alt="Horizontal bars compare Noema’s production source. Go has 19,775 code-only and 26,966 physical lines; Rust has 17,664 code-only and 18,784 physical lines." src="https://cdn-images-1.medium.com/max/1024/1*EQTLqy2-TZ6zXP7IZVr2jA.png" /><figcaption>At the signed comparison baseline, Noema’s Rust runtime used 10.7% fewer code-only lines and 30.3% fewer physical lines than the Go runtime.</figcaption></figure><p>At the signed comparison baseline, the Go runtime contained 19,775 code-only lines across 97 files. The Rust runtime contained 17,664 lines across 25 files: 10.7% fewer code lines. Physical source lines fell by 30.3%, largely because the Go version carried much heavier commentary.</p><p>That does not prove Rust is inherently more concise, and line counts do not prove correctness. It does mean Noema’s production behavior now occupies a smaller maintenance surface, while the compatibility and resilience suites remain outside that count as the evidence that the behavior survived.</p><h3>The rewrite improved the benchmarks by breaking them first</h3><p>Some of the most valuable findings were not Go-versus-Rust results at all. They were implementation mistakes that invalidated early comparisons.</p><p>The first Rust MCP server reopened the memory store for every request. Rust also emitted pretty, full-row results where Go emitted compact rows. And new traces initially used an update-style FTS delete before insertion. Because the stored ID was not the FTS row ID, each delete scanned an increasingly large virtual table.</p><p>All three effects made the early data misleading.</p><p>Keeping a connection open, matching the wire representation, and using insert-only create helpers removed those biases. Only the corrected campaigns became headline results.</p><p>This is one of the strongest arguments for a measured rewrite: it forces hidden contracts into the open. But it is also a warning. A rewrite benchmark can easily measure mismatched behavior, accidental I/O, or an implementation bug and then mislabel the result as a language property.</p><h3>Rust did not win every dimension</h3><p>The final decision scorecard retained the disadvantages because they affect real operators:</p><p>- The optimized Rust binary was 18.1 MiB versus 14.2 MiB for Go — 27.8% larger.<br>- Bundled SQLite improved native capabilities but introduced C compilation and cross-compilation concerns that the pure-Go SQLite build avoided.<br>- Serial full-corpus output used substantially more memory in Rust at 100,000 traces.<br>- Model-driven consolidation quality reached parity, not a Rust advantage.<br>- Strong durability is dramatically slower by design.</p><p>The Rust release still ships as one binary across macOS, Linux, and Windows on x86–64 and ARM64, so the larger artifact has modest practical impact. But “modest” is not the same as nonexistent.</p><h3>So, was the rewrite worth it?</h3><p>For Noema, yes — but not because “Rust is better than Go.”</p><p>It was worth it because the experiment produced a behavior-compatible implementation that is faster and lighter under Noema’s representative mixed workload, uses fewer resources during bounded federation, gives me stronger compile-time boundaries around concurrent service code, reduces the production maintenance surface, and makes enhanced recovery an explicit opt-in product choice.</p><p>Just as importantly, the process improved the specification. Differential tests found missing prompt contracts, protocol-shape mismatches, recovery edges, terminal-rendering differences, and a corpus-size regression that casual testing would have missed.</p><p>I would not generalize this into “rewrite your Go service in Rust.” I would generalize the method:</p><p>1. Keep the existing system as an executable oracle.<br>2. Define compatibility before writing the replacement.<br>3. Benchmark representative workloads, not language-friendly microbenchmarks.<br>4. Separate policy differences — especially durability — from runtime performance.<br>5. Preserve caveats in the final story.<br>6. Do not cut over until the replacement earns it.</p><p>A rewrite is not valuable because it produces new code. It is valuable when it produces better evidence, sharper contracts, and an operational result that justifies the risk.</p><p>Rust earned the cutover for Noema. The test program — not the language’s reputation — made that decision defensible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HkTk7H-cTOc75XNJ3q1sHQ.png" /></figure><p><em>Noema is open source. You can </em><a href="https://noemacortex.com/"><em>learn more about the project</em></a><em>, read the </em><a href="https://github.com/Fail-Safe/Noema/blob/main/docs/why-rust.md"><em>public Rust rationale</em></a><em>, inspect the </em><a href="https://github.com/Fail-Safe/Noema/blob/main/docs/rust-rewrite-experiment-results.md"><em>detailed experiment results</em></a><em>, or use the </em><a href="https://github.com/Fail-Safe/Noema/blob/main/tests/rust-rewrite/report-data.json"><em>curated report data</em></a><em> to reproduce the measurements and caveats behind the decision.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92f47d9d2564" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running LLMs on the AMD Strix Halo NPU Under Linux — A Complete Guide for Fedora 43]]></title>
            <link>https://medium.com/@Fail-Safe/running-llms-on-the-amd-strix-halo-npu-under-linux-a-complete-guide-for-fedora-43-5544acfbfcec?source=rss-454578a952e1------2</link>
            <guid isPermaLink="false">https://medium.com/p/5544acfbfcec</guid>
            <category><![CDATA[halo-strix]]></category>
            <category><![CDATA[amd-ryzen]]></category>
            <category><![CDATA[npu]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Mark Baker]]></dc:creator>
            <pubDate>Thu, 26 Mar 2026 15:13:58 GMT</pubDate>
            <atom:updated>2026-03-31T20:46:53.361Z</atom:updated>
            <content:encoded><![CDATA[<p>If you own a Ryzen AI MAX+ 395 machine with 128GB unified memory and you’re running Linux, this guide is for you.</p><p><em>An honest note on process: I used Claude (Anthropic) as an AI assistant throughout this work — for debugging help, research, and drafting this writeup. Every command was run and validated by me on my own hardware.</em></p><p>There’s a dedicated AI accelerator sitting inside your AMD Ryzen AI MAX+ 395 that most Linux users haven’t been able to touch — until now. The XDNA 2 NPU has 50 TOPS of dedicated AI compute, and as of late March 2026, the full software stack to use it for LLM inference on Linux is finally in place. Getting there requires a pre-release kernel, building two components from source, and a handful of dependency fixes that aren’t documented anywhere in one place.</p><p>This guide walks through exactly what it took on a Nimo MME2S and Corsair AI Workstation 300 (both Sixunited AXB35 board — same silicon as the GMKtec EVO-X2 and Bosgame M5) running Fedora 43. Every command here was run and verified.</p><p><strong>What you’ll end up with:</strong> Linux kernel 7.0-rc6 (or later), XRT 2.23.0 built from source, FastFlowLM 0.9.37 built from source, and a validated NPU running LLM inference.</p><h3>Prerequisites</h3><ul><li>Fedora 43 installed and running (kernel 6.x is fine as a starting point)</li><li>You’re in the video and render groups: sudo usermod -aG video,render $(whoami)</li><li>Basic familiarity with building software from source</li><li>About 2–3 hours and a decent internet connection</li></ul><h3>Part 1: Installing Kernel 7.0</h3><p>The NPU firmware protocol changed between the 6.x and 7.0 kernel series. Specifically, firmware version 1.1.x requires protocol support that only landed in kernel 7.0. Without it, the driver loads but immediately fails with:</p><pre>aie2_check_protocol: Incompatible firmware protocol major 7 minor 2<br>aie2_hw_start: firmware is not alive</pre><p>Fedora’s build infrastructure (Koji) already has the latest rc build available. Install koji and check what’s current:</p><pre>sudo dnf install -y koji<br>koji latest-build rawhide kernel</pre><p>This will show you the current build name. At time of writing it’s kernel-7.0.0-0.rc6.49.fc45. The rc number advances — use whatever koji latest-build returns, the process is identical. Download it:</p><pre>koji download-build --arch=x86_64 kernel-7.0.0-0.rc6.49.fc45</pre><p>Install the essential packages (you only need core, modules, and modules-extra — skip the debug and devel packages unless you need them):</p><pre>sudo dnf install -y \<br>  kernel-core-7.0.0-0.rc6.*.x86_64.rpm \<br>  kernel-modules-core-7.0.0-0.rc6.*.x86_64.rpm \<br>  kernel-modules-7.0.0-0.rc6.*.x86_64.rpm \<br>  kernel-modules-extra-7.0.0-0.rc6.*.x86_64.rpm \<br>  kernel-7.0.0-0.rc6.*.x86_64.rpm</pre><p>Set it as the default boot entry. Use the exact version string from your download:</p><pre>sudo grub2-set-default &quot;7.0.0-0.rc6.49.fc45.x86_64&quot;<br>sudo grub2-mkconfig -o /boot/grub2/grub.cfg</pre><p>Add the required kernel parameters via /etc/default/grub. Open it and append to GRUB_CMDLINE_LINUX:</p><pre>ttm.pages_limit=32505856 ttm.page_pool_size=32505856 amdgpu.cwsr_enable=0</pre><blockquote><strong><em>Important:</em></strong><em> Do NOT add </em><em>amd_iommu=off. That parameter is sometimes recommended for Strix Halo GPU performance in llama.cpp, but it completely disables the NPU (</em><em>/dev/accel/accel0 will not appear). Leave IOMMU enabled.</em></blockquote><p>Rebuild grub and reboot:</p><pre>sudo grub2-mkconfig -o /boot/grub2/grub.cfg<br>sudo reboot</pre><p>After rebooting, confirm you’re on the new kernel and parameters are set:</p><pre>uname -r<br># 7.0.0-0.rc6.49.fc45.x86_64</pre><pre>cat /proc/cmdline<br># Should include the three ttm/amdgpu params</pre><h3>Update the NPU Firmware</h3><p>The default firmware on the system (npu.sbin.1.0.0.166) is incompatible with the new driver protocol. You need firmware 1.1.2.65, which is in the upstream linux-firmware git repository but not yet in the Fedora package:</p><pre>git clone --depth 1 \<br>  https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git \<br>  /tmp/linux-firmware-upstream</pre><pre># Install the newer firmware<br>sudo cp /tmp/linux-firmware-upstream/amdnpu/17f0_11/npu.sbin.1.1.2.65 \<br>  /lib/firmware/amdnpu/17f0_11/</pre><pre># Point the symlink at it<br>sudo ln -sf npu.sbin.1.1.2.65 /lib/firmware/amdnpu/17f0_11/npu.sbin</pre><pre># Rebuild initramfs and reload the driver<br>sudo dracut --force<br>sudo modprobe -r amdxdna<br>sudo modprobe amdxdna</pre><pre># Verify<br>cat /sys/bus/pci/drivers/amdxdna/*/fw_version<br># 1.1.2.65</pre><h3>Part 2: Building XRT 2.23.0 from Source</h3><p>XRT (Xilinx Runtime) is the userspace library stack that FLM uses to talk to the NPU hardware. There’s a Fedora COPR package available (xanderlent/amd-npu-driver) but it ships XRT 2.19.0, which is missing the xrt::runlist::add API that FLM&#39;s prebuilt NPU kernel libraries require. You&#39;ll hit a linker error if you try to use it.</p><p>The right approach is to build XRT from the xdna-driver repo using its own build system, which pins XRT at exactly the version the NPU driver was tested against (builds as 2.23.0).</p><h3>Clone and Prepare</h3><pre>git clone --recursive https://github.com/amd/xdna-driver.git ~/xdna-driver</pre><p>The --recursive flag is important — XRT is a submodule.</p><h3>Install Build Dependencies</h3><pre>sudo dnf install -y \<br>  gcc-c++ cmake ninja-build \<br>  ncurses-devel \<br>  python3-pybind11 pybind11-devel \<br>  systemtap-sdt-devel \<br>  libstdc++-static glibc-static \<br>  ocl-icd-devel opencl-headers \<br>  libdrm-devel \<br>  python3-devel \<br>  elfutils-libelf-devel \<br>  rapidjson-devel \<br>  boost-devel \<br>  libuuid-devel \<br>  rpm-build \<br>  openssl-devel</pre><h3>Build Using the Provided Build Script</h3><p>The repo has its own build system that handles XRT and the XDNA plugin together in one pass. Use it:</p><pre>cd ~/xdna-driver/build<br>./build.sh -release -nokmod</pre><p>-nokmod skips the kernel module (already in-tree on kernel 7.0). This will take several minutes — it builds XRT core, the XDNA shim, and downloads some prebuilt NPU kernel archives from GitHub.</p><p>When the build completes, generate the RPM package:</p><pre>cd ~/xdna-driver/build/Release<br>cpack</pre><p>You should see:</p><pre>CPack: - package: .../xrt_plugin.2.23.0_43-x86_64-amdxdna.rpm generated.</pre><h3>Install the RPM</h3><p>The RPM declares a dependency on xrt-base which doesn&#39;t exist as a separate package in this build path. Use --nodeps to bypass it — we&#39;ll install the required libraries manually in the next step:</p><pre>sudo rpm -ivh --nodeps ~/xdna-driver/build/Release/xrt_plugin.2.23.0_43-x86_64-amdxdna.rpm</pre><h3>Install XRT Core Libraries</h3><p>The RPM installs the XDNA plugin but not the XRT core libraries. Copy them from the build output:</p><pre>sudo mkdir -p /opt/xilinx/xrt/lib64</pre><pre>sudo cp ~/xdna-driver/build/Release/bins/lib64/libxrt_core.so.2.23.0 /opt/xilinx/xrt/lib64/<br>sudo cp ~/xdna-driver/build/Release/bins/lib64/libxrt_coreutil.so.2.23.0 /opt/xilinx/xrt/lib64/</pre><pre># Create versioned symlinks<br>sudo ln -sf libxrt_core.so.2.23.0     /opt/xilinx/xrt/lib64/libxrt_core.so.2<br>sudo ln -sf libxrt_core.so.2.23.0     /opt/xilinx/xrt/lib64/libxrt_core.so<br>sudo ln -sf libxrt_coreutil.so.2.23.0 /opt/xilinx/xrt/lib64/libxrt_coreutil.so.2<br>sudo ln -sf libxrt_coreutil.so.2.23.0 /opt/xilinx/xrt/lib64/libxrt_coreutil.so</pre><h3>Install XRT Headers</h3><p>FLM’s build system needs the XRT headers. Copy them from the submodule source:</p><pre>sudo mkdir -p /opt/xilinx/xrt/include<br>sudo cp -r ~/xdna-driver/xrt/src/runtime_src/core/include/xrt /opt/xilinx/xrt/include/<br>sudo cp -r ~/xdna-driver/xrt/src/runtime_src/core/include/experimental /opt/xilinx/xrt/include/</pre><h3>Fix the lib vs lib64 Path</h3><p>FLM links against -L/opt/xilinx/xrt/lib but the libraries are in lib64. Create a symlink:</p><pre>sudo ln -sf /opt/xilinx/xrt/lib64 /opt/xilinx/xrt/lib</pre><h3>Verify the Critical Symbol</h3><p>Before moving on, confirm the API that FLM needs is present in the built library:</p><pre>nm -D /opt/xilinx/xrt/lib64/libxrt_coreutil.so.2.23.0 | grep &quot;runlist.*add&quot;<br># Should show: T _ZN3xrt7runlist3addEONS_3runE</pre><p>If you see that symbol, you’re good.</p><h3>Make XRT Permanent</h3><p>These steps ensure FLM works correctly in all contexts — interactive shells, systemd services, and any process that doesn’t manually set up the environment:</p><pre># Make the libraries findable by the dynamic linker<br>echo &#39;/opt/xilinx/xrt/lib64&#39; | sudo tee /etc/ld.so.conf.d/xrt.conf<br>sudo ldconfig</pre><pre># flm serve looks for libxrt_core in /usr/local/lib64 specifically<br>sudo ln -sf /opt/xilinx/xrt/lib64/libxrt_core.so.2.23.0 /usr/local/lib64/libxrt_core.so.2<br>sudo ln -sf /opt/xilinx/xrt/lib64/libxrt_core.so.2.23.0 /usr/local/lib64/libxrt_core.so</pre><pre># Set XRT environment variables for all shells and systemd services<br>sudo tee /etc/profile.d/xrt.sh &lt;&lt;EOF<br>export XILINX_XRT=/opt/xilinx/xrt<br>export PATH=/opt/xilinx/xrt/bin:\$PATH<br>export LD_LIBRARY_PATH=/opt/xilinx/xrt/lib64:\$LD_LIBRARY_PATH<br>EOF</pre><h3>Part 3: Building FastFlowLM from Source</h3><p>FastFlowLM (FLM) is the inference engine that orchestrates NPU-accelerated LLM inference. The prebuilt NPU kernel libraries in the repo (src/lib/) are closed-source, but FLM itself builds from source against those.</p><h3>Clone FastFlowLM</h3><pre>git clone https://github.com/FastFlowLM/FastFlowLM.git ~/FastFlowLM<br>cd ~/FastFlowLM<br>git submodule update --init --recursive</pre><h3>Install Build Dependencies</h3><p>Several of these aren’t obvious from the error messages — here’s the complete list:</p><pre>sudo dnf install -y \<br>  cargo rust \<br>  libcurl-devel \<br>  libuuid-devel \<br>  libdrm-devel \<br>  fftw-devel \<br>  ffmpeg-free-devel \<br>  boost-program-options \<br>  boost-devel \<br>  ncurses-devel</pre><p>The ffmpeg headers in Fedora install to /usr/include/ffmpeg/ rather than the standard /usr/include/ path that the build system expects. Fix this with symlinks:</p><pre>sudo ln -sf /usr/include/ffmpeg/libavcodec    /usr/include/libavcodec<br>sudo ln -sf /usr/include/ffmpeg/libavformat   /usr/include/libavformat<br>sudo ln -sf /usr/include/ffmpeg/libavutil     /usr/include/libavutil<br>sudo ln -sf /usr/include/ffmpeg/libswresample /usr/include/libswresample<br>sudo ln -sf /usr/include/ffmpeg/libswscale    /usr/include/libswscale<br>sudo ln -sf /usr/include/ffmpeg/libavdevice   /usr/include/libavdevice<br>sudo ln -sf /usr/include/ffmpeg/libavfilter   /usr/include/libavfilter</pre><h3>Configure and Build</h3><pre>cd ~/FastFlowLM<br>cmake -S src --preset linux-default<br>ninja -C src/build -j$(nproc)</pre><p>The first build will take some time — the Rust tokenizer library (tokenizers-cpp) compiles all its dependencies from scratch. Subsequent builds are fast.</p><p>Install:</p><pre>sudo ninja -C src/build install</pre><p>FLM installs to /opt/fastflowlm/.</p><h3>Part 4: Validation and First Inference</h3><h3>Set the Memlock Limit</h3><p>The NPU requires unlimited locked memory. Add this to /etc/security/limits.conf:</p><pre>sudo tee -a /etc/security/limits.conf &lt;&lt;EOF<br>*    soft    memlock    unlimited<br>*    hard    memlock    unlimited<br>EOF</pre><p><strong>Reboot at this point.</strong> The memlock change requires a full reboot to take effect — a new shell or ulimit -l unlimited in an unprivileged session will fail with &quot;Operation not permitted&quot;.</p><h3>Validate</h3><pre>flm validate</pre><p>You should see:</p><pre>[Linux]  Kernel: 7.0.0-rc6...<br>[Linux]  NPU: /dev/accel/accel0 with 8 columns<br>[Linux]  NPU FW Version: 1.1.2.65<br>[Linux]  amdxdna version: 0.6<br>[Linux]  Memlock Limit: infinity</pre><p>amdxdna version: 0.6 is expected — it refers to the kernel driver interface version, not a problem.</p><p>Note that flm validate works without sudo — the /dev/accel/accel0 device is owned by the render group (crw-rw-rw-. 1 root render), which you added yourself to in the prerequisites.</p><h3>Pull a Model and Run It</h3><pre>flm pull qwen3:4b<br>flm run qwen3:4b --pmode turbo</pre><p>Inside the interactive session, use /verbose to see performance metrics:</p><pre>&gt;&gt;&gt; /verbose<br>&gt;&gt;&gt; Explain the difference between vLLM and llama.cpp in 3 sentences<br>...<br>Verbose:<br>  TTFT:           1.31 s<br>  Prefill speed:  22.12 tokens/s<br>  Decoding speed: 19.10 tokens/s</pre><p>For a broader look at available models:</p><pre>flm list</pre><p>You’ll find llama3.x, Qwen3, Gemma3, Phi4, Whisper, and multimodal (VL) variants — all with NPU-optimized kernels. The 4B models decode at around 19–20 t/s; the 1B model at ~62 t/s.</p><h3>Serve via OpenAI-Compatible API</h3><p>FLM includes a server mode that exposes an OpenAI-compatible REST API — useful for pointing other tools at your NPU without any API keys or cloud costs:</p><pre>flbm serve llama3.2:1b --host 0.0.0.0 --port 8081 --pmode turbo</pre><p>Open port 8081 in the firewall if you want to reach it from other machines on your LAN:</p><pre>sudo firewall-cmd --add-port=8081/tcp --permanent &amp;&amp; sudo firewall-cmd --reload</pre><p>Test it from any machine on your network:</p><pre>curl -s -X POST http://&lt;server-ip&gt;:8081/v1/chat/completions \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;model&quot;: &quot;llama3.2:1b&quot;,<br>    &quot;messages&quot;: [{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;Hello from the NPU!&quot;}]<br>  }&#39; | python3 -c &quot;import sys,json; r=json.load(sys.stdin); print(r[&#39;choices&#39;][0][&#39;message&#39;][&#39;content&#39;])&quot;</pre><p>At ~54 t/s over LAN with a 1B model, this is a responsive and low-power endpoint for agentic workloads that don’t need heavy reasoning.</p><h3>Understanding What You’ve Actually Built</h3><p>A few honest notes for context.</p><p>The NPU is a Copilot+ PC feature, not an HPC accelerator. It was designed for background tasks: real-time transcription, translation, camera effects. At 50 TOPS of dedicated INT8 compute it’s genuinely useful for small models running continuously, but it doesn’t compete with the GPU for raw throughput — your Radeon 8060S with 256 GB/s of memory bandwidth will outpace the NPU on anything larger than ~4B parameters.</p><p>Where the NPU shines is power efficiency and simultaneous use. Running a lightweight monitoring or routing model on the NPU while the GPU handles the heavy lifting is a compelling architecture for 24/7 agentic workflows — both can run at the same time without contention.</p><p>The GPU story on this hardware is also worth mentioning: with ROCm 7.x and the kyuz0 toolboxes (see strix-halo-toolboxes.com), a 35B MoE model runs at ~47 t/s decode and a 72B Q4 at ~4.8 t/s — serious numbers for a mini PC. The NPU complements that, it doesn’t replace it.</p><h3>Quick Reference: What You Built and Where It Lives</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yZrQ3d1GWsaClxZlXWpedg.png" /><figcaption>What you build and where it lives. Way to go!</figcaption></figure><h3>Key References</h3><ul><li><a href="https://github.com/FastFlowLM/FastFlowLM">FastFlowLM GitHub</a></li><li><a href="https://github.com/amd/xdna-driver">xdna-driver GitHub</a></li><li><a href="https://lemonade-server.ai/flm_npu_linux.html">Lemonade NPU Linux Guide</a></li><li><a href="https://strix-halo-wiki.com/">Strix Halo Wiki</a></li><li><a href="https://strix-halo-toolboxes.com/">kyuz0 Strix Halo Toolboxes</a> — for the GPU/ROCm side</li></ul><p><em>Tested on a Nimo MME2S and Corsair AI Workstation 300 (Sixunited AXB35 board, AMD Ryzen AI MAX+ 395, 128GB LPDDR5X) running Fedora 43 Server Edition. The same board ships under several OEM names including GMKtec EVO-X2 and Bosgame M5.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5544acfbfcec" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>