Run this model with HF Jobs
Run tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8") model = AutoModelForMultimodalLM.from_pretrained("tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8
- SGLang
How to use tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8 with Docker Model Runner:
docker model run hf.co/tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8
DockerHub tag is not public
Im not seeing the :DevQwenNextFlash tag on your Dockerhub repo. The performance looks really good from your benchmarks, cant wait to try it out!
I was debugging an AMD Quark issue, now resolved ๐ Hope it works well for you.
I tried running flash-next just now (setup: 4xR9700, TP4, 128gb (8x16gb 3200mt/s), vLLM 0.28.0 / Clav 28.01.2 from DevQwenNextFlash, VLLM_PLE_CPU_OFFLOAD=1, R4D_QSA=1, fp8 kv cache, 512k ctx via the yarn hf-overrides, chunked prefill @ 4096).
Short prompts are fast, but I hit two things on this image:
Hard crash on long sequences with MTP spec decode on
Any request with ~30k+ computed context or a longer generation kills the engine:
TimeoutError: RPC call to sample_tokens timed out.
Scheduler dump on the crash shows the MTP spec tokens as invalid:
scheduled_spec_decode_tokens = {reqid: [-1, -1, -1, -1]}
Reproduced 3x. After the crash the container stays as a zombie on the GPUs (docker rm -f can't kill it, needs --init / stop --timeout 0).
Workaround: dropped --speculative-config entirely (no MTP spec decode) โ long generations survive and I get about ~55 t/s), no crash. But I lose the spec-decode speedup.
Reasoning never terminates without enable_thinking: false
With the qwen3 reasoning parser, even a "write a 300 word story" prompt burns the entire token budget on reasoning (4000/4000 tokens = 100% reasoning, 70s, content = empty, finish=length). The model never switches to generating the actual answer. Setting chat_template_kwargs={"enable_thinking": false} fixes it: direct answer, 299 content tokens in 5.5s (~54 t/s), finish=stop. Is this expected for this checkpoint, or is the thinking budget supposed to auto-stop on this model?
Other than that: great work getting the MXFP4 + PLE-offload path running โ the N-gram offload loads in ~47s and short requests are snappy. Just wondering if #1 (MTP on long seq) and #2 (reasoning loop) are known, or if you want a dump / anything I can help test.
I have been able to do a little testing with this model/image and so far I have had no issues. So far I have been able to push a single treads context up to near 300k tokens and I am still getting between 50-80 tk/s decode. I will keep testing this model out and report back if I have any issues. I want to try and reproduce the errors that @washroom8132 is seeing if I can.
Thanks for the reports. Flash Next seems to respect thinking effort like 3.8 27B, but I haven't heavily tested that yet.
The long sequence crash is new to me. My suggestion to possibly work around is set:
R4D_AR=0
CLAV_AR=0
This will fall back to rccl card to card comms but will be a bit slower. If it persists after that there are other flags available that may help isolate it.
@tcclaviger update after more testing (4xR9700 on pcie4.0x16, TP4, DevQwenNextFlash, PLE_CPU_OFFLOAD=1, R4D_QSA=1, fp8 kv cache, 512k yarn, chunked prefill @ 4096)
MTP nspec 2 crashes the same way as nspec 4
Reduced num_speculative_tokens from 4 to 2: same result on long generations: TimeoutError: RPC call to sample_tokens timed out + scheduled_spec_decode_tokens = {reqid: [-1,-1,-1,-1]} in the scheduler dump. So it's not spec length.Persisting the Triton cache helped
The spec-decode kernels (_triton_mrope_forward, _store_qsa_rows_kernel, _expand_qsa_indices_kernel, _compress_qsa_groups_kernel) were being JIT-compiled during the first long inference request; the cache lives in /root/.triton/cache and gets wiped on every docker rm. After mounting a persistent dir there, long single-stream MTP requests survived across restarts (5/5, incl. 900-token generations). On this box (TR Pro 3945WX / Zen2, 128gb DDR4-3200) the compile takes a while, so I suspect the slow JIT + RPC deadline is part of the trigger.R4D_AR=0 + CLAV_AR=0 (your suggestion): helped for single requests Long MTP requests survive with these set (in combination with the persisted cache, so I can't fully isolate which one did it). But:
High concurrency still crashes the engine with MTP on 7 simultaneous requests โ EngineDeadError, same sample_tokens signature, even with R4D_AR=0. The RCCL fallback being slower seems to make it worse under load, not better.
So for now I'm running without MTP: stable, 245 t/s aggregate at 7 streams. MTP single-stream wasn't faster than no-MTP anyway in my runs (27-31 vs 50 t/s), it only made aggregate scale worse under load.
Happy to share the full scheduler dump from the crash if it helps. I'd guess it's machine-speed or PCIe-layout dependent.
Thanks for the data points, when I get back to working on this it'll help. I suspect there's a preexisting bug in the base vllm that is intermittent.
Okay, I was just able to replicate the crash that @washroom8132 got. I am running on a WRX90 platform with 128GB DDR5 6800MT/s, with all the GPUs running at PCIe 5 x16. I have not yet tested disabling MTP, but ill try that now and see if it helps.
Weird thing is, that I was using all day at work today to do some code reviews and comparing the output to Opus 5 and GPT 5.6-Sol and running the context window up to ~350k tokens without an issue. Just at the very end of the day I was testing out subagents in pi and it crashed. So context length might not be directly tied to the crashing, but rather concurrency?
Outside of the crash, this thing is running surprisingly well to be on an experimental fork of vLLM. Keep up the good work @tcclaviger
Thanks. I've had it up continuously running. I'm fairly certain the issue is tied to rOCM version + driver (DKMS vs provided) + MES version and the interaction between them. It seems these issues are creeping up across all AMD platforms right now.
MES 084 + DKMS, 6.16 kernel, Ubuntu 24.04 is what it's validated on, my host has same rocm version as the container (7.23 as I recall)
Sorry for the instability, I am pretty sure it's not my code, vllm upstream, fairly certain it's actually the image itself unfortunately, I'll be rebuilding against 7.14.
PS: I saw numbers running it in llama as a 4 bit on an H100, they're much lower heh.
If I remember right, I had some issues with the 6.x kernel on the R9700s. As soon as Ubuntu 26.04 dropped with kernel 7.x things just felt much more stable. I dont have any definitive proof of this, but it felt that way. I almost wonder if it would be worth trying to ride the bleeding edge with Ubuntu 26.04 and ROCm 10.
Man, your work and updates allowed me to fully use these gpu's. Awesome stuff !
Saw this discussion and wanted to join in to say that i've had crashes - even workstation restarts on this model...for some reason. I've asked qwen 3.8-27B to summarize what happened - figured more info is helpful. I can also share some more detailed container logs and system dumps if you think these are helpful
System
OS : Ubuntu 24.04.4 LTS
Kernel : 6.17.0-40-generic (x86_64)
Board : Lenovo ThinkStation P620 (1046), BIOS S07KT1FA
CPU : AMD Ryzen Threadripper PRO 3975WX (32C/64T, 4.37 GHz boost, 1 NUMA node)
RAM : 96 GB
GPU : 4x AMD Radeon AI PRO R9700 (1002:7551 rev c0, gfx1201 / RDNA4)
32 GiB VRAM each, 128 GiB total
43:00.0 SKU 1E4990U VBIOS 113-1E4990U-S83 x16 @ 32 GT/s
46:00.0 SKU R9700AT VBIOS 113-R9700AT-F40 x16 @ 32 GT/s
63:00.0 SKU G287BP00 VBIOS 115-G287BP00-100 x16 @ 32 GT/s
66:00.0 SKU G287BP00 VBIOS 115-G287BP00-100 x16 @ 32 GT/s
amdgpu : 6.16.13 (out-of-tree DKMS, pkg 1:6.16.13.30300400-2341068.24.04)
ROCm : 7.2.4 (rocm-core 7.2.4.70204-93~24.04)
vLLM : 0.27.0 (image tcclaviger/vllm:DevQwenNextFlash)
Setup: 4x R9700, TP4, 94 GB host RAM, tcclaviger/vllm:DevQwenNextFlash, Qwen3.8-Flash-Next-MXFP4-FP8, fp8 KV, chunked prefill @ 4096, --speculative-config {"method": "mtp", "num_speculative_tokens": 4}, 131072 ctx (native, no YaRN), --reasoning-parser qwen3.
Identical signature. Our scheduler dump at the crash:
scheduled_spec_decode_tokens={
chatcmpl-88000ae46bf0a94a-9d299daa: [-1, -1, -1, -1],
chatcmpl-bce5c143c48603e8-9fc3017f: [-1, -1, -1, -1],
chatcmpl-950734c5e5f70d24-a971fc2a: [-1, -1, -1, -1]
}
followed by TimeoutError: RPC call to sample_tokens timed out. โ EngineDeadError. Every in-flight request had all four MTP draft tokens as -1.
Our threshold is lower than ~30k. At the crash: num_computed_tokens=[9296, 9243, 9โฆ], num_running_reqs=3, kv_cache_usage=0.22. All three requests were in decode (scheduled_new_reqs=[], all cached), so this was decode-phase, not prefill. It's also not a saturation effect โ three concurrent requests at 22% KV is idle interactive use, not a load test.
Scoping it: two variables differ, not one. Being precise here since it affects where to look. We serve Qwen3.8-27B-MXFP416-MTP production on the same box with the same MTP settings (method: mtp, num_speculative_tokens: 4, TP4, fp8 KV), and it is completely stable โ currently 1 day 19 hours uptime with zero incidents, and 13 clean days before that under multi-user load including repeated concurrency-12 sweeps. But that production container runs tcclaviger/vllm:latest, not DevQwenNextFlash. Both report vLLM 0.27.0, so the version is matched, but the builds are not โ DevQwenNextFlash carries the custom attention/MoE path (R4dMxfp4MoEExperts, CLAV_ATTN).
So our evidence narrows it to checkpoint + DevQwenNextFlash build, and cannot separate those two.
The severity difference. For us this did not stay contained to the engine. On 2026-08-29 it took the whole machine down with a hard power-off โ no kernel panic, no MCE, no shutdown sequence, journal simply ends mid-line. Reconstructing from the kernel log, the GPU went first and vLLM noticed second:
| time | event |
|---|---|
| 15:10:45 | workers stop consuming the shm broadcast block |
| 15:10:52 | amdgpu 0000:63:00.0: SMU: I'm not done with your previous command โ repeats 111x |
| 15:15:43 | RPC call to sample_tokens timed out โ EngineDeadError |
| 15:17:23 | rocm-smi can only enumerate 2 of 4 GPUs |
| 15:19:30 | amdgpu: Failed to get fan speed(PWM)! |
| 15:19:35 | journal ends. Hard power-off |
Two things there that may matter for anyone else hitting this:
- The SMU wedges minutes before anything else notices.
/healthstayed 200 until 15:15:43, five minutes after the card had actually stopped responding. If you're running this unattended,dmesg | grep "I'm not done with your previous command"is a much earlier signal than the vLLM traceback. We had an 8m43s window on this occasion and ~2m on a previous one. - Fan control dies with the SMU, so the card runs thermally unmanaged for that entire window before the box goes down.
We've had this four times, and it picked a different GPU each time (0000:46:00.0 on 08-28, 0000:63:00.0 on 08-29), so it isn't one bad card. We initially suspected a PCIe riser and reseated it โ the reset survived the repair, on a verified-healthy x16 bus.
Thnaks for the summary. I had a shutdown event finally, and it also took the whole box down.
Your confirmation discovered in the logs matches what I have been suspecting is the root.
I will start working Wednesday to get it fixed. So hopefully a fixed version of the image by next weekend
Got it running on my machine as well!
4ร R9700 @ 240 W caps, EPYC 7443, NixOS, kernel 7.1.x in-tree amdgpu, ROCm 7.2 host:
- TG: 92-96 tok/s single request, ~98 tok/s at 31K context (MTP acceptance 2.6 โ 3.3 deep)
- PP: 5,269 t/s @ 24K / 5,016 t/s @ 86K (wall-clock, uncached, max_tokens=1)
- 4โ5 concurrent requests: 233โ298 tok/s aggregate
- 740,417-token KV pool; junction 92-97 ยฐC sustained; no crashes โ for the driver-matrix hunt: no Ubuntu, no DKMS, kernel 7.1.x
If I can test anything with that setup I'm more than happy to ^^ Will also test with this model more and get back here if I encounter anything.
Also, is the kernel source available anywhere? The fork's Python is readable in the image, the kernel .sos are the only closed piece, and this stack is impressive! If not, would you be willing to publish them?
A version will be submitted to the LibR4D repo on codeberg, owners is Stilldeadcode, who I give massive credit forth his kernel work and setting up an easy to work in library.
Right now some of the work is simple ported nvidia kernels and some is kernels that started there, and I reworked and tuned for 9700.
I plan to release a heavily revised and latency/concurrency improved fused kennel in about 10 days.
Hey mate once again cheers for the hard work. I can see from your recent comment you're re-writing the kernel - I've been wrestling with a startup crash for about 24hrs and it seems to be a roadblock specific to my physical topology (or at least exacerbated by it) and the way the R4D P2P-BAR all-reduce kernel is forced to route on startup which stops the fallback to RCCL. FYI I run your step3.7flash variant perfectly on an earlier image.
My hardware:
- Mobo - Gigayte TRX40 Aorus Pro WiFi
- CPU - AMD Threadripper 3960X
- 4 R9700s
- 3x physically plugged into pcie slots, 1x on a lian li riser (due to physical space limitations)
Did as much as I could making sure i reviewed all your info on this page, the docker image page, and probing this as far as I could from my side so i could provide you as much info as possible. Basically, I can get all the way through the boot (load weights, torch compile, GDN warmup) but then (thanks qwen3.8 27b):
In a nutshell:
- The HSA access-grant path, the HIP P2P capability check, and the coarse P2P copy path all work for all 4 GPUs. The cross-process IPC handle path (
hipIpcOpenMemHandlewithhipIpcMemLazyEnablePeerAccess) produces a broken fine-grained mapping for the riser pair (GPU0 = 05:00.0, behind a PCIe switch). The R4D kernel's P2P all-reduce depends on this path, so it faults. - The fault occurs during determine_available_memory() (KV-cache profiling), which runs a real forward pass that hits the MoE all-reduce, specifically an IPC handle mapping problem.
- The R4D P2P-BAR all-reduce kernel (r4d_ar_twoshot_wide_exact_kernel) faults with Page not present or supervisor privilege (HSA 0x1016) during cross-GPU P2P memory access over PCIe. "The fault occurs during determine_available_memory() (KV-cache profiling) when a real forward pass hits the MoE all-reduce."
- Saw you mentioned setting R4D_AR=0 above, that didn't work for me because "_force_qwen4_exp_env() (config.py:259) unconditionally overwrites R4D_AR to 1". The R4D P2P kernel faults, specifically, from the vllm logs: "(APIServer pid=1) WARNING ... [models/qwen4_exp/config.py:221]
Qwen4Exp requires R4D_AR=1 for crash safety; overriding the launch environment's R4D_AR=0." - The riser GPU (05:00.0) sits behind a PCIe riser (which is apparently) a known P2P weak point. The R4D kernel's P2P-BAR mapping does not appear to survive that topology.
Side note - in my investigation I tried to get to https://blog.robai.net/KernelWork/ and it's giving me a 503 and not resolving.
Fully LLM writeup (sorry about that, this is above my pay grade right now unfortunately) with the technical details, error codes, etc, below. Let me know if you need better logs or any other info.
Status: Reproduced. The R4D_AR=0 workaround is overridden by the model config
(see "The R4D_AR=0 workaround is overridden").
Severity: High โ crashes the worker during startup KV-cache profiling; model cannot serve.
Open question for tcclaviger: Does Qwen4Exp support heterogeneous PCIe topologies
(a GPU behind a PCIe switch), or is the R4D P2P all-reduce a hard requirement that makes
this model unservable on such hardware? Additionally: the forum thread for this model
advises R4D_AR=0 CLAV_AR=0 as a crash-isolation fallback, but the code overridesR4D_AR=0 to 1 โ which is correct?
Summary
The R4D P2P-BAR all-reduce kernel (r4d_ar_twoshot_wide_exact_kernel) faults withPage not present or supervisor privilege (HSA 0x1016) during cross-GPU P2P memory
access over PCIe. The fault occurs during determine_available_memory() (KV-cache
profiling), which runs a real forward pass that hits the MoE all-reduce. The faulting
GPU node differs between runs (node-1, then node-3), indicating a topology/
address-mapping issue rather than a specific bad GPU.
The riser GPU (05:00.0) sits behind a PCIe switch chain โ a known P2P weak point. The
R4D kernel's P2P-BAR mapping does not appear to survive that topology.
Environment
| Item | Value |
|---|---|
| GPUs | 4ร Radeon RX 7900 XT (R9700 AI Pro, gfx1201 / RDNA4) |
| CPU | AMD Threadripper 3960X (24C/48T) |
| Mobo | Gigabyte TRX40 Aorus Pro WiFi |
| OS | Ubuntu 24.04 |
| ROCm | 7.2.1 (host); container ROCm 7.2.3.0-90, HIP 7.2.53211, RCCL 2.27.7-HEAD:96a25b5 |
| Image | tcclaviger/vllm:DevQwenNextFlash (vllm 0.27.0, 2026-08-28) |
| Model | Qwen3.8-Flash-Next-MXFP4-FP8 (120B MoE, 512 experts, Qwen4ExpForConditionalGeneration) |
| TP | 4 |
| PCIe topology | GPUs at 23:00.0 and 4d:00.0 on x16 bridges; GPU C (4a:00.0) on x8 slot; riser GPU (05:00.0) behind PCIe switch chain |
| PCIe speed | All slots forced to Gen3 in BIOS (riser compatibility) |
Key env vars (from the compose file)
HSA_OVERRIDE_GFX_VERSION=12.0.1
HSA_ENABLE_SDMA=0
HSA_FORCE_FINE_GRAIN_PCIE=1
GPU_MAX_HW_QUEUES=1
NCCL_P2P_DISABLE=1
NCCL_SOCKET_IFNAME=lo
NCCL_PROTO=Simple
R4D_AR=0 โ set to disable the faulting backend (overridden by model config, see below)
CLAV_AR=0
VLLM_ROCM_USE_AITER=0
Reproduction
- Launch the 120B model with TP=4 using the
DevQwenNextFlashimage. - During startup, vLLM calls
determine_available_memory()which runs a forward pass. - The forward pass hits the MoE layers โ R4D all-reduce is invoked.
- The R4D P2P kernel faults.
- Attempted workaround:
R4D_AR=0in the compose file. Result: Overridden by the
model config (see log excerpt below). The fault persists.
The fault is reproducible but the faulting GPU node varies between runs:
- Run 1:
GPU node-1(Device 0), address0xf63734229000 - Run 2:
GPU node-3
Fault Details
Memory access fault by GPU node-1 (agent handle: 0x...) on address 0xf63734229000.
Reason: Page not present or supervisor privilege.
HSA_STATUS_ERROR_EXCEPTION: code: 0x1016
Faulting kernel (demangled):
r4d_ar_twoshot_wide_exact_kernel<__hip_bfloat16, 8, 4>
This is the R4D two-shot wide all-reduce kernel โ a P2P-BAR (peer-to-peer over PCIe
BAR) cross-GPU communication kernel.
Fault type: Page not present on a peer-GPU memory address. The kernel is touching
a virtual address that maps to peer-GPU VRAM, but that page is not present in the local
GPU's page table. This is a P2P visibility/mapping issue.
Why it's not a bad GPU: The faulting node changes between runs (node-1 โ node-3).
All 4 GPUs pass rocm-smi health checks. The 27B model (using RCCL, not R4D) runs
fine on the same 4 GPUs with TP=4.
The R4D_AR=0 workaround is overridden by the model config
Setting R4D_AR=0 in the launch environment is overridden for Qwen4Exp. The model
config unconditionally sets R4D_AR=1 at construction time, in the API process, before
the workers spawn. The startup log confirms this:
(APIServer pid=1) WARNING ... [models/qwen4_exp/config.py:221]
Qwen4Exp requires R4D_AR=1 for crash safety; overriding the launch environment's R4D_AR=0.
The relevant code (vllm/models/qwen4_exp/config.py:207-225):
_QWEN4_EXP_REQUIRED_ENV = {
"R4D_QSA": "1", # fp8 main KV cache is only servable by the r4d sparse leg
"R4D_AR": "1",
"CLAV_GDN": "0",
"CLAV_TUNABLEOP_SWEEP": "1",
}
def _force_qwen4_exp_env() -> None:
for key, value in _QWEN4_EXP_REQUIRED_ENV.items():
prior = os.environ.get(key)
if prior is not None and prior != value:
logger.warning(
"Qwen4Exp requires %s=%s for crash safety; overriding the "
"launch environment's %s=%s.", key, value, key, prior)
os.environ[key] = value # unconditional overwrite
This is called from Qwen4ExpConfig.__init__ (line 259), which runs in the API process
before workers spawn. Workers inherit os.environ, so they see R4D_AR=1 regardless
of what the compose file set.
The source comment states these are "crash-safety constraints, not tuning defaults (the
wrong combination does not merely serve slower, it goes down)." The R4D P2P all-reduce
is therefore a load-bearing requirement of Qwen4Exp โ there is no supported RCCL-only
path for this model.
Consequence
The only ways to run Qwen4Exp on this topology are:
- (a) Make the R4D P2P kernel work on this topology, or
- (b) Patch the image to drop
R4D_ARfrom_QWEN4_EXP_REQUIRED_ENVand accept the
RCCL fallback โ which also risks theR4D_QSA=1sparse-attention leg.
Diagnosis
The R4D all-reduce uses fine-grained (uncached) P2P via hipIpcOpenMemHandle
(r4d_ar_ipc_open in r4d.so). On this topology, the riser GPU (05:00.0) is behind a
PCIe switch chain. The fine-grained P2P mapping for the riser pair returns success but
produces a broken mapping: hipIpcOpenMemHandle returns a valid pointer, but the
underlying hsa_amd_agents_allow_access did not create a working fine-grained mapping.
The first kernel touch of that mapping faults with Page not present (0x1016).
This is fine-grained-specific, not a general P2P failure. Verified on this hardware:
- A direct P2P copy test (alloc on GPU j, copy to GPU i) succeeds for all 12 pairs,
including the riser (GPU0 = 05:00.0). The coarse/cached P2P path works. - The R4D kernel (fine-grained/uncached path) faults.
- step3.7flash (~100B MoE, TP=4, ~100 TG/s) works fine on the same 4 GPUs because it
uses RCCL (coarse P2P), not the R4D fine-grained kernel.
Narrowed diagnosis (probes):
HSA access-grant path works. A ctypes probe calling
hsa_amd_agents_allow_accessdirectly returns SUCCESS for all 12 GPU pairs at
both 256B and 24MB (R4D scratch size). This rules out the HSA access-grant path as
the failure point.HIP reports P2P available for all pairs.
hipDeviceCanAccessPeerreturns 1
(yes) for all 12 pairs.hipDeviceEnablePeerAccesssucceeds (subsequent calls
return "already enabled").Coarse P2P copy works for all pairs. A direct
hipMemcpyD2D test (alloc on
GPU j, copy to GPU i) succeeds for all 12 pairs including the riser.The failure is in the cross-process IPC handle path. The R4D kernel uses
hipIpcGetMemHandle/hipIpcOpenMemHandle(withhipIpcMemLazyEnablePeerAccess) to map peer scratch across worker processes.
This is a cross-process mechanism โ each vLLM TP worker is a separate process,
and the IPC handles are exchanged between them. A single-process probe cannot test
this path (it fails withhipErrorInvalidContextfor all pairs, which is expected
behavior for same-process IPC handle use, not a P2P failure).The fault signature confirms the IPC handle mapping is broken. The
Page not present(0x1016) fault inr4d_ar_twoshot_wide_exact_kerneloccurs when
the kernel touches a peer scratch pointer that was mapped viahipIpcOpenMemHandle. The mapping was established (the pointer is non-null) but the
underlying page-table entry is absent โ the lazy peer-access enable did not actually
create a working fine-grained mapping for the switch-hopped peer.
In summary: The HSA access-grant path, the HIP P2P capability check, and the coarse
P2P copy path all work for all 4 GPUs. The cross-process IPC handle path
(hipIpcOpenMemHandle with hipIpcMemLazyEnablePeerAccess) produces a
broken fine-grained mapping for the riser pair (GPU0 = 05:00.0, behind a PCIe switch).
The R4D kernel's P2P all-reduce depends on this path, so it faults.
The faulting address (0xf63734229000) is not in any GPU's physical BAR range
(BAR0s are at 0x4000000000, 0x5000000000, 0x7000000000, 0xa000000000, each 32G).
It is a GPU virtual address in the faulting GPU's page table that was supposed to be
mapped to a peer's VRAM via the IPC handle path, but the mapping is absent.
Why the existing fineโcoarse fallback does not catch this
r4d_all_reduce.py:_alloc (line 218) falls back fineโcoarse only ifar_ipc_alloc throws. If ar_ipc_alloc/ar_ipc_open succeeds but produces a broken
fine-grained mapping (the case here), the fallback never triggers, the comm is installed
(self.disabled = False), and the first all-reduce faults at runtime.
Why you cannot simply force fine=False
The kernel's memory ordering is tuned for fine-grained: self.acq = 0 ("no explicit
acquire fence โ uncached reads already fresh", line 111) and self.drain = 3
(s_wait_storecnt drain for fine-grained/uncached scratch, line 110). Coarse (cached)
P2P requires an acquire fence; flipping fine=False without correcting acq/drain
would produce silent data corruption (stale cached reads), not a clean fix. Thefine flag affects only the allocation, not the kernel launch โ the launch uses the
same code path with the same acq/drain regardless.
Dispatch chain (from r4d_all_reduce.py in the image)
R4D_AR โ CLAV_AR โ RCCL
R4D_ARgate:os.environ.get("R4D_AR", "1") != "1"โ returnsNone(skip)CLAV_ARgate:os.environ.get("CLAV_AR", "1") != "1"โ returnsNone(skip)- For Qwen4Exp,
R4D_ARis forced to1andCLAV_AR=0โ R4D is the active backend - R4D faults โ worker crashes before any fallback can occur
Observation: CLAV_AR has a probe mechanism that R4D_AR lacks
The sibling backend CLAV_AR (clav_ar.py) has a startup probe that issues real
all-reduces during startup, reconciles results across ranks, and falls back to a
known-good path if the probe fails. It also has a CLAV_P2P=0 kill-switch.
The R4D_AR backend (r4d_all_reduce.py) does not have this probe. Its __init__
opens the IPC handles and sets self.disabled = False with no verification that the
mapping works. The first kernel touch faults with 0x1016.
This is not a fix proposal โ it's an observation that a mechanism already exists in
the codebase that could potentially be adapted for R4D_AR. Whether this is the right
approach, or whether the kernel itself needs to handle the switch topology differently,
is for tcclaviger to decide.
Why the existing CLAV_AR probe doesn't help: The dispatch chain runs R4D_AR first.
If R4D_AR is installed (which it is, because it has no probe to detect the broken
mapping), it faults before CLAV_AR is ever reached.
User-side workarounds (all imperfect):
DISABLE_ALL_CLAV=1โ disables all HIP kernels (attention, GDN, GEMM, MoE, AR).
Works but massive performance hit.CLAV_P2P=0โ disables CLAV_AR and CLAV_AG but not R4D_AR. Does not help.R4D_AR=0โ overridden by the Qwen4Exp config (see above).
Additional Context
- The GDN (Gated Delta Net) linear-attention warmup completes successfully (layers 0-16)
before the fault. The fault is specifically in the MoE all-reduce, not the attention. - The
Poller timed outspam in the logs is a separate, harmless issue (hardcodedSHM_READER_RECHECK_INTERVAL_MS = 5000inshm_broadcast.py). VLLM_ROCM_USE_AITER=0is set; the aiter MoE path is not used (the 120B model's
MoE uses the R4D MXFP4 path,r4d_mxfp4_moe.py, which calls the GEMM kernelr4d_gemm_moe_mxfp4a8_nt_b16โ not the all-reduce).- The GPU coredump handler is missing in the container (
execvp failed: No such file or directory), so no coredump is produced on fault.
Log Excerpt
(APIServer pid=1) WARNING ... [models/qwen4_exp/config.py:221]
Qwen4Exp requires R4D_AR=1 for crash safety; overriding the launch environment's R4D_AR=0.
(Worker pid=161) INFO ... [r4d_all_reduce.py:179]
r4d all-reduce INSTALLED (rank=1/4 slot=24320KB finegrained=True 1shot<=30720 elems, 2shot<=20971520, ti8 2shot<=41943040)
...
[Worker_TP1][pid=150] Memory access fault by GPU node-1 (agent handle: 0x...)
[Worker_TP1][pid=150] on address 0xf63734229000.
[Worker_TP1][pid=150] Reason: Page not present or supervisor privilege.
[Worker_TP1][pid=150] HSA_STATUS_ERROR_EXCEPTION: code: 0x1016
[Worker_TP1][pid=150] kernel: r4d_ar_twoshot_wide_exact_kernel<__hip_bfloat16, 8, 4>
@hsolutions48 - are you sure the riser is causing you trouble ? I have 3 of my 4 gpu's on gen4 x16 risers (because i can't fit more than 2 gpu's maybe in my Lenovo Thinkstation P620) and haven't had any issues. I had one riser not properly seated and that made one of my gpu's run at x4 for a month before i realised this weekend and seated it properly.
Ok, spoke too soon on no crashes, hit one today. Caught one on the 4รR9700 / NixOS / kernel-7.1 box, same signature as the others ([-1,-1,-1,-1] spec-decode -> RPC call to sample_tokens timed out, engine dies but container stays "up"). Had two concurrent sessions running when it happened.
Didn't power off though at first, I tried to force-kill the container, and that teardown deadlocked and killed the box. Mine's SMU fw 104.76.0 / smu_v14_0_0 if that helps correlate.
There are a mix if issues at play, to fallback to RCCL, both R4D_AR and CLAV_AR need to be 0. CLAV_AR has a numeric incompatiblity with this model, so R4D was used, it's the superior successor to CLAV_AR anyways.
That is the crash during the graph capture with R4D AR is disabled, happens on my system to.
Regarding the other failures, I cannot say, cannot troubleshoot, and cannot verify a fix. I will be shifting to the correct production rocm version etc. I expect that will resolve many issues, almost certainly the load based SMU crashes occuring. Hopefully that catches your fault as well.
With the hundreds(thousands?) of P2P capable platform combinations it is simply not possible for me to chase every one, AMD basically stopped enforcing standards on AIB partners outside of a fine subset of CPU related UEFI and very narrow PCIE layout standards years ago.
Not sure if you meant my crash but I do actually have both CLAV_AR and R4D_AR set to 0. Totally understand that you can't cater to every single hardware config out there, fingers crossed for the update your working on.
@radu-mereuta
Not super sure! Like i said i can run step3.7flash tp4 no worries but in this specific image, model, and trying to utilise the ~clav fast paths, it seems to catch in this specific way... But it's good to know there are others out there with risers (and by the looks of it, roughly the same generation of board + cpu) that aren't having the same issues! Though this specific TRX40 board seems to have a particularly poorly laid out root complex for the pcie slots..
Do you run any extra stability env vars or anything? e.g. I have to run things like NCCL_PROTO=Simple, NCCL_P2P_DISABLE=1, RCCL_WARP_SPEED_ENABLE=0, HSA_ENABLE_SDMA=0, etc. [edit] - it's on my list to do a parameterised env var sweep to check which of these is the actual fix and which ones are just bloating my yaml's but you know... it's on the list..!
Not anyone in general just a reminder I cannot possibly cover all cases for everyone ๐ I also run a PCIE expander, the LR Link 5.0 x16 to 32 channel card, for 4x8 on my GPUs, but it's AM5 9950x/9950x3d depending which CPU I need else where at any given moment.
I am well along the ROCM 10 rebase line and update, I deployed 26.04 and rocm 10 on my system last night and have been dogfooding Flash-Next all day without issue, including some very torturous artificial concurrency stability testing, everything seems resolved.
In the log search, the findings pointed at some underlying interaction between 7.x and the 9700 microcode leading to a (not always the same card) GPU losing connectivity, which triggers a driver reboot, which results in a wedged card and brings the system down. Hopefully rocm 10 in image and host resolves it. As soon as I have the updated image tested I'll update the docker hub image with the new version.
Additionally, I'm starting the refined mxfp4 quantization for the experts this weekend, so the quant accuracy will significantly improve towards preserving original BF16 model behaviors. Adding in AWQ and GPTQ calibration steps instead of the straight quant it has currently.
Will you publish the source code you use to perform that quantization?
It's part of the image, the image carries an array of tools for all manner of tasks, KL divergence capture and evaluation, PPL testing, expert mapping, quantization in a host of paradigms, fp8 scale calibration etc. Most of it is based on quark, and adapted for nicer memory management.
Rocm 10 build is proving stable, will give it a bit more uptime before publishing.
New Image is pushed, now promoted to tcclaviger/vllm:dev. I'll update the readme.
Validated against
26.04 host
rocm 10 host
no dkms
inside the image it matches 26.04 and rocm 10.
Having gone back to 27B as a regression test, I definitely prefer flash next!
I have been testing the new image for the past few hours and its feeling good so far. Ill keep hammering on it for the rest of today at work, and on some personal projects through the weekend. I had gone back to Qwen3.8-27B while you were fixing this image, and I forgot just how much more I like flash.
I really do appreciate all the work you have put into this @tcclaviger .
Alright. So far i've gotten no workstation reboots anymore.
I did have an engine fault this morning and noticed some weird degradation in speed from around 92 tok/s (single user) to about 18 tok/s. Turns out the ngram table was being swapped out. And that eventually crashed the engine because it would hang from how slow stuff was to retrieve from the swap space.
So @tcclaviger - i'd consider this a good idea to point out that if users notice speed degradation with no apparent reason, they should make it so that docker never goes into swap. I added the following arguments to the docker run command -> "--memory=80g --memory-swap=80g" which makes the swap allowance = 0 and basically tells the system that stuff put in ram by this docker container never goes into the swap file :)
Again. Apreciate the work you've been doing to get this working - and keeping it alive and up to date with these crazy model releases !
LE: After making sure the ngram table never gets swapped, my speeds also increased a bit to about 100-145 tok/s lol. I'll still test it out this weekend some more (also with multiple agents), but the fact that it's so big is killing my kv cache allocation size.
Any idea if the other quants are going to be a bit smaller - so the kv cache is adequate for at least 6-7 concurrent @132k.
Good catch and detective work, linux moving it to swap was something I hadn't even thought about, but makes sense as a performance impacting possibility now that we've a giant chunk of the model in system ram! Things you don't hit in the dev env but in prod, fun :)
The :dev image is updated and should give better concurrency, and have a few small updates to the model itself, better prefill, roughly the same decode and give back a tiny bit of VRAM.
At 0.95 I get 549,753 tokens. There are some buffers that will shrink as I work on decode performance, and claw back a bit of kv space.
PLE Swap mitigated with:
--ulimit memlock=-1:-1 \
and pinned in the ple code via mlock, so everything else can swap as normal, but PLE remains static in system RAM. Can be disabled if needed with:
VLLM_PLE_MLOCK=0
The latest update stopped working on my 4ร R9700 setup with TP=4 and MTP enabled. With the new weights and previous image, startup failed with:
ValueError: Weight output_partition_size = 160 is not divisible by weight quantization block_n = 128.
Updating to the newer :dev image (f3185766โฆ) hit a different error during weight loading:
AttributeError: 'MergedColumnParallelLinear' object has no attribute 'data'
Iโm back up after rolling back to:
- Image:
sha256:3ddca3c9d5f9b96867bf39d0d2e6f6a9617e386b782bbb5333d9e89699f3339b - Model revision:
88b0bba1e34e1a7a3f6847ac3a7db76584ba2ad8
@tcclaviger is the recipe on the model card still accurate after the updates?
You grabbed it at an interim build, the weight loading has been fixed, you may need to grab the updated HF repo files there are some small changes that were updated in the model.
Looking into the merged column parallel linear that is... a new failure I've not observed before.
Edit: Seems there was an interaction, verified now the new image loads both version of the checkpoint here, the BF16 MTP Attention and the FP8 MTP Attention versions.
For the most current version, which sues FP8 MTP Attention, a small speed boost just three files need to be updated in your local fileset of the checkpoint:
model-00060-of-00131.safetensors
model.safetensors.index.json
config.json
The old image, will not load the FP8 MTP attention, but the new image should load both versions correctly now. I am going to start using pinned versions in the docker hub so it's easier to grab a specific version in the future, currently all 3, latest, dev, 28.01.4 are in step but wont be for long. This image should be fine to load and run whichever version of the model you might be using.
A small bug in the kv scale use for FP8 kv also fixed, 28.01.5 now has that fixed and properly loads the provided kv scales here in the checkpoint.
Following up on the MergedColumnParallelLinear error โ figured it out, and it's why you couldn't reproduce it.
It's not the checkpoint or the image. It's how the model is passed on the command line. Your recipe uses a bind-mounted directory (/app/models). I was passing the HF repo id (tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8) with HF_HOME pointed at my cache and letting vLLM resolve it.
_checkpoint_block_fp8_scale_name() in compressed_tensors.py decides whether to register block-FP8 scales as weight_scale or weight_scale_inv by reading model.safetensors.index.json from the model path โ but it bails to weight_scale if the path isn't a local directory:
if not model_path or not os.path.isdir(model_path):
return "weight_scale"
A repo id isn't a directory, so the layers get weight_scale params, the checkpoint delivers linear_attn.in_proj_qkv.weight_scale_inv, LinearBase.load_weights can't find it on the layer, falls through to the module itself, and dies on .data. Log shows it right before the crash:
compressed-tensors block-fp8 bypass: scale parameter name 'weight_scale' (from checkpoint at tcclaviger/Qwen3.8-Flash-Next-MXFP4-FP8)
Fix on my side: point the model arg at the cached snapshot dir instead of the repo id.
/data/models/hub/models--tcclaviger--Qwen3.8-Flash-Next-MXFP4-FP8/snapshots/<hash from refs/main>
Log then says 'weight_scale_inv' and the current checkpoint (0144a5e6, FP8 MTP attention) loads fine on 28.01.10. Up and running at 524k, ~566k KV tokens at 0.95 with the model-card compilation config.
@tcclaviger could you try to resolve through the HF cache (huggingface_hub.try_to_load_from_cache or snapshot_download(local_files_only=True)) before the isdir check? Low priority since the documented recipe already avoids it.
