[Scripts] Add op_coverage diagnostic for recent LLMs#245
Open
YWHyuk wants to merge 1 commit into
Open
Conversation
Add scripts/op_coverage.py, a two-phase aten-op coverage probe for the
torch.compile + npu:0 path. Phase 1 enumerates aten ops via a custom
dynamo backend over eager forward; Phase 2 actually runs torch.compile
on npu:0 and parses the failure traceback to surface the first-failing
aten op per model.
Includes 15 model builders aligned with transformers 4.51.3:
qwen2, gemma, gemma2, phi3, qwen3, qwen3_moe, gemma3, deepseek_v3,
llama4, glm4, olmo2, granite, phimoe, mamba2, mllama.
The mamba2 builder uses the SSM invariant num_heads * head_dim ==
expand * hidden_size (modeling_mamba2.py:171). The mllama builder
passes rope_scaling={"rope_type": "default"} so MllamaRotaryEmbedding
can init without a full Llama-3.2 scaling config.
Usage:
python scripts/op_coverage.py # all 15 models
python scripts/op_coverage.py --models qwen3 # subset
python scripts/op_coverage.py --enumerate-only
Results written to $TORCHSIM_LOG_PATH/op_coverage/<timestamp>/.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/op_coverage.py, a two-phase aten-op coverage probe for thetorch.compile + npu:0path.torch.compileonnpu:0and parses the failure traceback to surface the first-failing aten op per model.Models covered (transformers 4.51.3)
qwen2, gemma, gemma2, phi3, qwen3, qwen3_moe, gemma3, deepseek_v3, llama4, glm4, olmo2, granite, phimoe, mamba2, mllama.
Each builder uses
num_hidden_layers=2, small but realistic hidden/head dims, batch=1, seq_len=32, fp32. Configs were tuned to match each model's invariants (e.g. mamba2 SSM invariantnum_heads * head_dim == expand * hidden_size, mllamarope_scaling["rope_type"]).Usage
Results land in
$TORCHSIM_LOG_PATH/op_coverage/<timestamp>/as one<model>.logper model plus asummary.txt(status + per-model unique ops).Why
Surface coverage gaps for newer LLMs (Qwen3, DeepSeek-V3, Llama4, Phi-MoE, Mamba2, ...) in one shot so we can decide which aten ops, MLIR templates, or decompositions to prioritise. The current
tests/allowlist gates correctness on existing supported ops; this script complements it by enumerating what is not yet supported.Findings on develop @ 5045837 (already filed / known)
aten.convolutiondecomposition is hard-coded to 4D inputs (depthwise conv1d in the SSM mixer is not yet supported). Will file separately if useful.Test plan