Skip to content

feat: Named graph specializations in specializations.json (Prefill/Decode/Vision/Encoder/Embedding)#894

Open
vbaddi wants to merge 5 commits intoquic:mainfrom
vbaddi:feat/enabling_nested_new_spec_format
Open

feat: Named graph specializations in specializations.json (Prefill/Decode/Vision/Encoder/Embedding)#894
vbaddi wants to merge 5 commits intoquic:mainfrom
vbaddi:feat/enabling_nested_new_spec_format

Conversation

@vbaddi
Copy link
Copy Markdown
Contributor

@vbaddi vbaddi commented Mar 27, 2026

Summary

The backend compiler team requested a new specializations.json format where each entry carries a meaningful graph name (e.g. "Prefill", "Decode")

Changes

  • QEfficient/utils/_utils.py — new _infer_specialization_name() and to_named_specializations() helpers
  • QEfficient/base/modeling_qeff.py_compile() uses new format
  • QEfficient/compile/qnn_compiler.py — QNN path uses new format
  • QEfficient/compile/compile_helper.py — legacy create_and_dump_specializations() uses new format

Name inference rules

Keys present Assigned name
vision_size / img_size / grid_*, no seq_len Vision
encoder_ctx_len, no seq_len Encoder
sequence_length, no seq_len Embedding
seq_len != 1 Prefill
seq_len == 1 Decode
anything else Graph_N

Testing

21-unit tests added to tests/unit_test/models/test_model_quickcheck.py covering causal LM, continuous batching, VLM vision/language, Whisper, encoder/decoder, text embedding, and end-to-end JSON roundtrip.

cc: @anujgupt-github

Add to_named_specializations() helper that converts flat specialization dicts to the {name, symbols} format requested by the backend compiler team.
Names are inferred from dict keys: Prefill/Decode (seq_len), Vision (vision_size/img_size/grid_*), Encoder (encoder_ctx_len), Embedding (sequence_length), with Graph_N as fallback.
Updated all three serialization sites: modeling_qeff.py (_compile), qnn_compiler.py, and compile_helper.py (create_and_dump_specializations).

Signed-off-by: vbaddi <vbaddi@qti.qualcomm.com>
@vbaddi vbaddi self-assigned this Mar 27, 2026
@vbaddi vbaddi added the enhancement New feature or request label Mar 27, 2026
vbaddi added 4 commits March 27, 2026 16:44
…ore reading fields

Signed-off-by: vbaddi <vbaddi@qti.qualcomm.com>
Signed-off-by: vbaddi <vbaddi@qti.qualcomm.com>
Signed-off-by: vbaddi <vbaddi@qti.qualcomm.com>
…JSON write block, fixing this

Signed-off-by: vbaddi <vbaddi@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant