[Bug] flm serve crashes with Access Violation (0xc0000005) at start of token generation on Ryzen AI NPU (XDNA2)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 152
- Avg merge
- 4h 14m
- Merged PRs (30d)
- 11
Description
Hi, I encounter a systematic crash when trying to stream model answer through ip:port access, from a third party app, that I tried to diagnostic with the help of gemini. Here is the report :
Describe the bug
When running flm serve on a Windows system with a Ryzen AI (XDNA2) NPU, the server crashes with a segmentation fault/access violation (0xc0000005) immediately when it starts generating tokens. This happens for both streaming and non-streaming requests, and has been confirmed to affect multiple models (gemma4-it:e4b and llama3.2:1b), crashing at the exact same fault offset.
Environment
- OS: Windows 11
- FLM Version:
0.9.44 - NPU Architecture: XDNA2
- NPU Driver Version:
32.0.20102.3930 - Models tested:
gemma4-it:e4bllama3.2:1b
Steps to Reproduce
- Start the FLM server:
"C:\Program Files\flm\flm.exe" serve --host 0.0.0.0 --port 11434 --cors 0 - Send a POST request to
/api/chat:{ "model": "llama3.2:1b", "messages": [ { "role": "user", "content": "Write a one-sentence greeting." } ], "stream": true } - The server locks the NPU, loads the model, begins generation, and then crashes/terminates immediately.
Console Logs (Llama 3.2 1B)
[🟢 ] NPU Locked!
[FLM] Loading model: C:\Users\Adminlocal\.flm\models\Llama-3.2-1B-NPU2
[FLM] Start generating...
[FLM] Prefill chunk 1/1 with 42 tokens
<Crash / Exit code 1>
Windows Event Viewer Log (Same for both Gemma 4 and Llama 3.2)
Faulting application name: flm.exe, version: 0.0.0.0
Faulting module name: flm.exe, version: 0.0.0.0
Exception code: 0xc0000005 (Access Violation)
Fault offset: 0x00000000002c6823
Path: C:\Program Files\flm\flm.exe
Additional context
flm validate output:
[Windows] NPU: XDNA2
[Windows] NPU driver version: 32.0.20102.3930
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the flm serve entry point and reproduce the crash by sending the documented POST request to /api/chat on the specified Ryzen AI XDNA2 setup. Investigate the access violation reported at offset 0x2c6823; done means both streaming and non-streaming generation complete without the server terminating.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- ai-infra-agents, api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100