DINOv2/CLIP on Ryzen AI MAX+ NPU — BF16 doesn't work, here's what does

Been running vision models on my EVO-X2 for a research project and hit the same wall everyone hits. Figured I’d write up what actually fixed it since the docs sent me in the wrong direction for a while.

Short version: use XINT8, not BF16

BF16 sounds like the right choice for a transformer model but it silently kills NPU performance. DINOv2 has 2 LayerNorms per block, 12 blocks. In BF16 every single one falls back to CPU. You end up with ~48 CPU/NPU transfers per forward pass and the model is basically running on CPU anyway.

XINT8 keeps LayerNorm on chip. That’s the whole fix.

Before/after on my machine (Ryzen AI MAX+ 395, 128GB, no GPU):

  • DINOv2-S: 53ms with BF16 → 0.86ms with XINT8

  • V-JEPA 2-L: 1849ms, no XINT8 path yet (the 5D video input breaks things)

  • Small custom CNN: 0.34ms NPU

Also the quantization tool changed

If you’re still using vai_q_onnx it’s deprecated. Quark replaced it:

python

from quark.onnx import quantize
from quark.onnx.quantization.config import Config, QuantizationConfig

quantize(
    model='dinov2s.onnx',
    output_model_path='dinov2s_xint8.onnx',
    config=Config(global_quant_config=QuantizationConfig(
        quant_format='QDQ',
        quant_mode='XINT8'
    ))
)

One more thing – check your vaip_config.json has target: XDNA2 not XDNA. Strix Halo is XDNA2 and it matters.

Put the export/quantize/benchmark scripts on GitHub if anyone wants them: github.com/taylorjohn/strix-halo-vision-npu

Background on why I care: I’m building a navigation world model that runs the full perception stack on this hardware simultaneously. The encoder I trained on it (26K params) beats V-JEPA 2 ViT-G (1B params) on robot navigation benchmarks. Running everything at 1.32ms total. Paper in progress

1 Like

Hello,

These results show how XINT8 is the best choice for running vision models on the latest Ryzen AI chips. By keeping LayerNorm on the NPU chip, AMD hardware avoids slow data transfers and stays very fast. Great mentioning the Quark tool for quantization and setting the target to XDNA2, which allows the NPU to reach its full speed for research. It is great to see these huge speed improvements. Thanks.