Determines correct fe_args and vaiml_config flags for mixed-precision ONNX models based on quantization pattern. Analyzes island topology and quantization types for single NPU partition compilation on VitisAI.
Ships in AMD Ross Agentic AI Assistant. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill must always be accessed through the worker, never in a different way.
Allowed workers: vai-mixed-precision-worker, or the vai-flag-configuration
skill, which is its own entry point.
Determines the correct fe_args frontend flags and vaiml_config settings for a
mixed-precision ONNX model. Analyzes the model's quantization topology to select
appropriate compiler flags for single-NPU-partition compilation.
fe_args and fe_experiment are aliases, as are group_args and
experiments; compiler logs may use either spelling.
Prefer fe_args and group_args in new configs.
This skill expects arguments in this form:
--model <onnx_model> [--analyze] [--device stx|ve2] [--output-config <vitisai_config.json>]
--model <path>: (MANDATORY) Path to the quantized ONNX model--analyze: (OPTIONAL) Print detailed analysis without generating config--device <stx|ve2>: (OPTIONAL, default: ve2) Target device--output-config <path>: (OPTIONAL) Path to write generated vitisai_config.jsonAnalyze the model and classify into one of these categories:
Pattern: Entire graph is wrapped in QuantizeLinear/DequantizeLinear (QDQ)
input(int8) → DQ → op → Q → DQ → op → Q → output(int8)
Required flags:
{
"enable_f32_to_bf16_conversion": false,
"fe_args": ""
}
No special flags needed. The compiler handles pure QDQ models natively.
Pattern: One floating-point region and one quantized region.
Sub-patterns:
input(fp) → [fp ops] → Q → DQ → [int8 ops] → outputinput(int8) → [int8 ops] → Q → DQ → [fp ops] → outputinput(fp) → [fp] → Q/DQ → [int8] → Q/DQ → [fp] → outputinput(int8) → [int8] → Q/DQ → [fp] → Q/DQ → [int8] → outputRequired flags:
{
"enable_f32_to_bf16_conversion": true,
"fe_args": "match-power-of-two-quant-kernel=1"
}
For ve2 (FP16 instead of BF16):
{
"enable_f32_to_f16_conversion": true,
"fe_args": "match-power-of-two-quant-kernel=1",
"device": "ve2"
}
Explanation: match-power-of-two-quant-kernel=1 enables the MLLIB
QuantizeLinear kernel matcher for BF16/FP16 → Int8 transitions at island
boundaries. Without this, the quantize operation between floating-point and
int8 regions won't be recognized as an NPU kernel.
Pattern: Multiple alternating quantized and floating-point regions.
[int8] → [fp] → [int8] → [fp] → [int8] → ...
Required flags:
{
"enable_f32_to_bf16_conversion": true,
"fe_args": "match-power-of-two-quant-kernel=1"
}
Explanation:
match-power-of-two-quant-kernel=1 — same as Category 2The shorthand group_args: "mixed_precision" is equivalent to both flags:
{
"enable_f32_to_bf16_conversion": true,
"group_args": "mixed_precision"
}
This expands internally to: match-power-of-two-quant-kernel=1
Pattern: Entire model is floating-point, to be force-converted to bf16/fp16.
Required flags:
{
"enable_f32_to_bf16_conversion": true,
"fe_args": ""
}
For FP16 (ve2 only):
{
"enable_f32_to_f16_conversion": true,
"device": "ve2"
}
def classify_model(model):
"""Classify model quantization topology."""
has_qdq = any(n.op_type in ("QuantizeLinear", "DequantizeLinear")
for n in model.graph.node)
# com.amd.quark quantization ops indicate a specialized method (e.g.
# block floating-point or extended per-layer precision) handled by an
# optional plugin skill, not by the core pipeline.
has_specialized = any(n.domain == "com.amd.quark" and "Quantize" in n.op_type
for n in model.graph.node)
has_naked_fp = has_floating_point_ops_without_qdq(model)
# Count islands (contiguous regions of same precision)
islands = count_precision_islands(model)
if has_specialized:
# Delegate flag determination to the matching plugin skill under
# skills/experimental-methods/. If none is installed, report that the
# model uses a specialized quantization the core pipeline cannot flag.
return "SPECIALIZED"
if has_qdq:
if not has_naked_fp:
return "PURE_VINT8"
if islands <= 3:
return "TWO_ISLAND"
return "MULTI_ISLAND"
return "PURE_FLOAT"
{
"passes": [
{
"name": "vaiml_partition",
"plugin": "vaip-pass_vaiml_partition",
"vaiml_config": {
"keep_outputs": true,
"optimize_level": 2,
"enable_f32_to_bf16_conversion": <DETERMINED>,
"logging_level": "info",
"fe_args": "<DETERMINED>",
"device": "<DEVICE>"
}
}
],
"target": "VAIML",
"targets": [
{ "name": "VAIML", "pass": ["vaiml_partition"] }
]
}
For Telluride architecture targeting a single NPU partition:
If CpuBecause messages appear in compilation logs, it indicates operations
that could not be mapped to NPU. Common causes:
| Model Type | f32_to_bf16 | f32_to_f16 | match-pow2-quant |
|---|---|---|---|
| Pure VINT8 | - | - | - |
| 2-island (bf16) | ✓ | - | ✓ |
| 2-island (fp16) | - | ✓ | ✓ |
| Multi-island (bf16) | ✓ | - | ✓ |
| Multi-island (fp16) | - | ✓ | ✓ |
| Pure BF16 | ✓ | - | - |
| Pure FP16 | - | ✓ | - |
Models quantized by a specialized method (block floating-point, extended per-layer precision, etc.) are flagged by the corresponding plugin skill under
skills/experimental-methods/, which supplies its own flag rows. The core skill does not determine flags for those formats.
Edge quantization allows the runtime (FLEXMLRT/VART) to handle data type conversions at model boundaries — inputs and outputs — rather than having the NPU kernel graph perform them. This is relevant for mixed-precision models where the model's input/output types differ from the NPU compute types.
When enabled, edge quantization preserves standalone Quantize (at input)
or Dequantize (at output) operations in the compiled graph metadata
(flexmlrt-hsi.json) rather than converting them into NPU kernels. The
runtime then handles these conversions as host-side data transformations.
Concretely:
QuantizeLinear at the model input
(arg → Q → NPU ops) is annotated for runtime processing. The runtime
performs the float→int8 conversion on the host before feeding data to NPU.DequantizeLinear at the model
output (NPU ops → DQ → return) is annotated for runtime processing. The
runtime performs the int8→float conversion on the host after NPU computation.| Flag | Description | Default |
|---|---|---|
edge-quantization-in-rt=1 | Enable both input quantization and output dequantization in RT | false |
input-quantization-in-rt=1 | Enable only input-side quantization in RT | false |
output-dequantization-in-rt=1 | Enable only output-side dequantization in RT | false |
Relationship: edge-quantization-in-rt=1 is the union of
input-quantization-in-rt=1 and output-dequantization-in-rt=1. Setting the
umbrella flag is equivalent to setting both individual flags.
The FPConversionPass QDQ detection algorithm uses these flags to decide whether standalone Q/DQ operations at function boundaries should be preserved or converted:
With input-quantization-in-rt=1 or edge-quantization-in-rt=1:
Standalone Quantize ops that consume a block argument (function input)
directly AND are not part of a fake QDQ pair are added to the
keepTypeSet. Their types are preserved so the runtime can handle the
conversion. The scale factor from the QuantizeLinear is propagated to the
rt_transformations annotation in the HSI JSON.
With output-dequantization-in-rt=1 or edge-quantization-in-rt=1:
Standalone Dequantize ops that feed a function return AND are not part of
a fake QDQ pair are added to the keepTypeSet. Their types are preserved
so the runtime can handle the output conversion. The scale factor from the
DequantizeLinear is propagated to the output rt_transformations.
Without these flags: Edge Q/DQ operations are treated like any other operation — they may be force-converted to the target type (bf16/fp16) and implemented as NPU DequantizeLinear/QuantizeLinear kernels.
The MoveCastDown pass attempts to move tosa.cast operations closer to
function boundaries (block arguments or return ops), past layout
transformation ops (reshape, transpose). This matters for edge quantization
because:
fp-conversion-keep-function-signature=1 is active, casts are inserted
at function edges to convert between the original signature type and the
internal NPU type.| Scenario | Recommendation | Rationale |
|---|---|---|
| Model inputs are float, NPU works in int8 | input-quantization-in-rt=1 | Runtime quantizes inputs on host — avoids an NPU Q kernel |
| Model outputs are float, NPU produces int8 | output-dequantization-in-rt=1 | Runtime dequantizes outputs on host — avoids an NPU DQ kernel |
| Both of the above | edge-quantization-in-rt=1 | Enables both directions |
| Pure int8-in/int8-out model | Not needed | No float↔int8 conversion at edges |
| Full BF16 model | Not needed | No quantization at all |
| Models with floating-point boundaries | Evaluate case-by-case | If the outermost boundary op feeds directly into return, edge quant may help |
| Aspect | Edge Quant Enabled | Edge Quant Disabled |
|---|---|---|
| NPU kernel count | Fewer (Q/DQ handled by RT) | More (Q/DQ are NPU kernels) |
| Host CPU work | More (float↔int8 on host) | Less (NPU handles everything) |
| Latency | May increase if host is bottleneck | May increase if NPU is kernel-count limited |
| Data movement | Int8 crosses PCIe/AXI (smaller) | Float crosses PCIe/AXI (larger) |
| Accuracy | Identical (same math, different executor) | Identical |
| Compilation | Scale factors in flexmlrt-hsi.json | Scale factors baked into NPU graph |
General guidance:
flexmlrt-hsi.json annotations that the runtime stack expects.To estimate whether edge quantization helps:
edge-quantization-in-rt=1) and compare{
"enable_f32_to_bf16_conversion": true,
"fe_args": "match-power-of-two-quant-kernel=1 edge-quantization-in-rt=1"
}
Or individually controlled:
{
"enable_f32_to_bf16_conversion": true,
"fe_args": "match-power-of-two-quant-kernel=1 input-quantization-in-rt=1 output-dequantization-in-rt=1"
}
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
vitisai, onnx, mixed-precision, quantization, compiler-flags, npu
/amd-ross-agentic-ai-assistant:vai-fe-argsfrom AMD Ross Agentic AI Assistant
npx claudepluginhub xilinx/ross-ai-assistant --plugin amd-ross-agentic-ai-assistant50 skills in this plugin
/hls-architectConvert input code to a multi-stage HLS dataflow, validate with the other hls skills, then hand off to optimize./hls-array-to-streamAnalyze whether a given C/C++ code snippet follows the recommended coding style for array-to-stream conversion in Vitis HLS. Keywords: array, stream, HLS, pragma, ap_fifo, axis, interface/hls-burst-inferenceAnalyze whether burst inference optimization can be applied to a given C/C++ code snippet in Vitis HLS. Keywords: burst, HLS, pragma, m_axi, AXI, memory, optimizationOther plugins' skills for the same job