perf(qwen_vl): profile the residual decode falloff on M5 Max at 64 and 2048 prompt tokens

Open
#3,546 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
rust, shell

Research direction

Build the project with cargo build --release --features metal,accelerate, then run scripts/capture_m5_metal_trace.sh or use Instruments on an M5 Max at 64- and 2048-token prompts. Record per-kernel timings under docs/benchmark_results/ and link the new profile from docs/benchmark_results/model_tests_m5max.md, attributing the residual per-token cost with numbers, especially whether it comes from KV-read growth.

Written by the indexing model from the issue text.

Description

area:models priority:low status:ready type:performance

Refs #1686

Background

This is the one #1686 acceptance criterion that cannot run on the CUDA host where the rest was finished: "A profile at 64 and at 2048 prompt tokens on qwen2.5-vl-3b-4bit attributes the extra per-token cost to these specific code paths rather than asserting it, and is recorded under docs/benchmark_results/."

The three #1686 changes have landed: repeat_kv removed from qwen2_vl, qwen3_vl, and qwen3_vl_moe; mask skipped at seq_len 1; MRoPE cos/sin built once per forward (qwen3 hoist in PR #3545). Commit 5946fa58 recorded the M5 Max curve, in its message only: 169.83 / 170.71 / 163.45 / 155.77 tok/s at 64 / 128 / 512 / 2048 (falloff 8.3%, was 40.3%). mlx-lm falls 9 to 11%.

Task

On an M5 Max, cargo build --release --features metal,accelerate, then profile decode at prompt 64 and 2048 with scripts/capture_m5_metal_trace.sh or Instruments. Attribute where per-token cost grows with context. If the residual is structural (KV read growth), say so with the numbers.

Acceptance Criteria

  • A profile record with per-kernel timings at both lengths exists under docs/benchmark_results/.
  • docs/benchmark_results/model_tests_m5max.md links to it.
Dominant language
Rust
Stars
505
Forks
81
Avg merge
14h 2m
Merged PRs (30d)
448

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lablup/mlxcel

All issues in lablup/mlxcel

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.