Skip to content

benchmarks.SaturnOPU.analyze_opu_coverage

Source: benchmarks/SaturnOPU/analyze_opu_coverage.py

benchmarks.SaturnOPU.analyze_opu_coverage

Analyze OPU VOPACC coverage per model from compiled assembly files.

Parses IREE-compiled RISC-V assembly to determine: - Dispatch types (conv, matmul, elementwise, reduction, etc.) - OPU acceleration status per dispatch (VOPACC, fused QDQ, mmt4d, none) - Coverage percentages and compute weight estimates

Usage

python analyze_opu_coverage.py [--model-name NAME] python analyze_opu_coverage.py --all # analyze all pre-built models

analyze_assembly(asm_path, model_name='unknown')

Analyze an assembly file and return dispatch-level metrics.

classify_dispatch(name)

Classify a dispatch by its operator type based on the function name.

classify_opu_kernel(func_asm, opu_status)

Classify the specific OPU kernel path used by this dispatch.

Maps to the optimization journey categories: - "opu_encoding_resolver" — iree_uk_opu_matmul via +xopu encoding (best) - "opu_fused_qdq" — iree_uk_opu_matmul_qdq (fused dequant+bias+requant) - "opu_runtime_mmt4d" — iree_uk_mmt4d with runtime OPU detection (OPU_IM2COL) - "opu_vectorcontract" — inline VOPACC via VectorContractCustomKernels - "rvv_baseline" — no OPU, standard RVV - "non_compute" — elementwise/reduction/softmax (not a matmul)

classify_opu_status(func_asm)

Determine OPU acceleration status from assembly text.

extract_matmul_dims(dispatch_name)

Extract M, N, K dimensions from dispatch name like 'matmul_like_64x512x128'.

Returns (M, N, K) or None if not a matmul dispatch. Also handles batch matmuls like 'batch_matmul_8x64x64x128' → (64, 64, 128).

find_assembly(directory)

Find the linked assembly file in a dump directory.

print_summary(results, model_name)

Print a formatted summary of OPU coverage.

save_csv(all_results, output_path)

Save per-dispatch results to CSV.