Skip to content

Precompute M-RoPE cos/sin on the host (workaround for #280) - #345

Closed
stikves wants to merge 1 commit into
apple:mainfrom
stikves:sukru/fix-issue-280
Closed

stikves wants to merge 1 commit into
apple:mainfrom
stikves:sukru/fix-issue-280

Conversation

@stikves

@stikves stikves commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #280.

The in-graph cos/sin gather composite survives only one lookup per graph (and only when position_ids is the graph's own position input), so multi-position (M-RoPE) models — Qwen2/3-VL, whose time/height/width rows each need a lookup — can't gather inside the graph. Add host-side gather_cos_sin_host / mrope_cos_sin that do the table lookup with plain indexing, so models precompute cos/sin and feed them as rope_cos / rope_sin graph inputs instead of position_ids. Runtime composite limitation (not a modeling bug); tracked via Feedback Assistant.

Draft for preview.

The in-graph cos/sin gather composite survives only one lookup per graph, so
multi-position (M-RoPE) models (Qwen2/3-VL) cannot gather inside the graph. Add
host-side gather_cos_sin_host / mrope_cos_sin so cos/sin are precomputed and fed
as rope_cos / rope_sin graph inputs instead of position_ids.

Workaround for apple#280 (runtime composite limitation).
@tjia1818 tjia1818 closed this Oct 12, 2026
@tjia1818 tjia1818 reopened this Oct 12, 2026
@tjia1818 tjia1818 closed this Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The RoPE cos/sin gather composite allows only one lookup per graph, fed straight from the position input

2 participants