Skip to content

ggml-backend-meta: do not scale view offsets internal to a split unit - #25689

Draft
Frozenlock wants to merge 1 commit into
ggml-org:masterfrom
Frozenlock:fix-view-offset-split
Draft

ggml-backend-meta: do not scale view offsets internal to a split unit#25689
Frozenlock wants to merge 1 commit into
ggml-org:masterfrom
Frozenlock:fix-view-offset-split

Conversation

@Frozenlock

Copy link
Copy Markdown

Overview

The heuristic classifying a view offset as internal vs. proportional misses offsets smaller than the stride of one split unit — e.g. a strided view at a fixed offset into rows that are split along that unit. Such offsets apply within every unit on every device and must be preserved as-is; scaling them makes devices holding distributed slices read from the wrong position.

Concrete case: an MLA attention graph's rope view (offset 768 into 1024-byte per-head rows, rows split by head). The proportional scaling turned the offset into 384, landing mid-row, corrupting output whenever heads were actually distributed across devices. With the fix, -sm tensor output on GLM-4.7-Flash is byte-identical to -sm layer on even and skewed splits.

Additional information

Prerequisite for MLA-architecture tensor parallelism (DeepSeek2/GLM-DSA), which I intend to propose as a follow-up; see the split scheme sketched by @gaugarg-nv in #19378.

Requirements

  • I have read and agree with the contributing guidelines[1]
  • AI usage disclosure: YES. the bug was found, the fix authored, and the validation runs executed by an AI coding agent operating my hardware under my direction.

[1] I am NOT a cpp programmer, so I'm not in a position to evaluate the quality as I would with my main programming languages. That's my way on contributing back to this project. Given the contributing guidelines, I'll understand if you don't accept the PR.

@github-actions github-actions Bot added the ggml changes relating to the ggml tensor library for machine learning label Jul 14, 2026
@ggml-gh-bot

ggml-gh-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

Hi @Frozenlock, thanks for your contribution!

Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:

  • Multiple open PRs from a new contributor: We limit new contributors (those without a previously merged PR) to 1 open PR at a time. You currently have 2 open PRs.

  • AI-generated content: This project does not accept PRs, descriptions or commit messages that are fully or predominantly AI-generated. If you have used AI to assist you in writing code, please make sure to disclose that explicitly.


Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below.

The heuristic classifying a view offset as internal vs. proportional
missed offsets that are smaller than the stride of one split unit, e.g.
a strided view at a fixed offset into rows that are split along that
unit (the MLA q_pe rope view). Such offsets apply within every unit on
every device and must be preserved as-is; scaling them makes devices
with distributed slices read from the wrong position.
@Frozenlock
Frozenlock force-pushed the fix-view-offset-split branch from f08302a to 6b6e44d Compare July 15, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant