Skip to content

metal: fix threadgroup half4x4 compilation error in lightning indexer - #26646

Merged
ggerganov merged 2 commits into
ggml-org:masterfrom
JamePeng:fix/metal-threadgroup-constructor
Aug 7, 2026
Merged

metal: fix threadgroup half4x4 compilation error in lightning indexer#26646
ggerganov merged 2 commits into
ggml-org:masterfrom
JamePeng:fix/metal-threadgroup-constructor

Conversation

@JamePeng

@JamePeng JamePeng commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
image
  • In MSL, declaring an array of matrix types like threadgroup half4x4 causes a 'no matching constructor' compilation error because MSL matrix types do not have zero-argument default constructors and threadgroup variables cannot have initializers.

  • Fix this by declaring a POD threadgroup half array instead and casting to threadgroup half4x4 * for matrix indexing.

Overview

In #25893, kernel_lightning_indexer declared an array of threadgroup half4x4.
MSL does not support implicit zero-argument constructors for matrix types,
causing a 'no matching constructor' build failure on Metal.

This fixes the issue by declaring a POD threadgroup half array and casting
it to threadgroup half4x4 *.

After this patch:

image

Additional information

image

Requirements

…lightning_indexer

- In MSL, declaring an array of matrix types like `threadgroup half4x4` causes
a 'no matching constructor' compilation error because MSL matrix types do not
have zero-argument default constructors and threadgroup variables cannot have
initializers.

- Fix this by declaring a POD `threadgroup half` array instead and casting
to `threadgroup half4x4 *` for matrix indexing.

Signed-off-by: JamePeng <jame_peng@sina.com>
@JamePeng
JamePeng requested a review from a team as a code owner August 5, 2026 17:55
@github-actions github-actions Bot added ggml changes relating to the ggml tensor library for machine learning Apple Metal https://en.wikipedia.org/wiki/Metal_(API) labels Aug 5, 2026
@ggml-gh-bot

ggml-gh-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

Hi @JamePeng, thanks for your contribution!

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

  • PR Template not respected: Please respect the template when creating a new pull request. Make sure to fill out all required sections.

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

@ggerganov ggerganov added the merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. label Aug 6, 2026
@ggerganov
ggerganov merged commit e40bf88 into ggml-org:master Aug 7, 2026
20 of 25 checks passed
@JamePeng
JamePeng deleted the fix/metal-threadgroup-constructor branch August 7, 2026 10:41
miltos22 pushed a commit to miltos22/llama.cpp-wackMall-merge-request that referenced this pull request Aug 10, 2026
…tning_indexer (ggml-org#26646)

- In MSL, declaring an array of matrix types like `threadgroup half4x4` causes
a 'no matching constructor' compilation error because MSL matrix types do not
have zero-argument default constructors and threadgroup variables cannot have
initializers.

- Fix this by declaring a POD `threadgroup half` array instead and casting
to `threadgroup half4x4 *` for matrix indexing.

Signed-off-by: JamePeng <jame_peng@sina.com>
satindergrewal pushed a commit to satindergrewal/llama.cpp that referenced this pull request Aug 11, 2026
…tning_indexer (ggml-org#26646)

- In MSL, declaring an array of matrix types like `threadgroup half4x4` causes
a 'no matching constructor' compilation error because MSL matrix types do not
have zero-argument default constructors and threadgroup variables cannot have
initializers.

- Fix this by declaring a POD `threadgroup half` array instead and casting
to `threadgroup half4x4 *` for matrix indexing.

Signed-off-by: JamePeng <jame_peng@sina.com>
satindergrewal pushed a commit to satindergrewal/llama.cpp that referenced this pull request Aug 12, 2026
…tning_indexer (ggml-org#26646)

- In MSL, declaring an array of matrix types like `threadgroup half4x4` causes
a 'no matching constructor' compilation error because MSL matrix types do not
have zero-argument default constructors and threadgroup variables cannot have
initializers.

- Fix this by declaring a POD `threadgroup half` array instead and casting
to `threadgroup half4x4 *` for matrix indexing.

Signed-off-by: JamePeng <jame_peng@sina.com>
huaxel pushed a commit to huaxel/CachyLLama that referenced this pull request Aug 12, 2026
…tning_indexer (ggml-org#26646)

- In MSL, declaring an array of matrix types like `threadgroup half4x4` causes
a 'no matching constructor' compilation error because MSL matrix types do not
have zero-argument default constructors and threadgroup variables cannot have
initializers.

- Fix this by declaring a POD `threadgroup half` array instead and casting
to `threadgroup half4x4 *` for matrix indexing.

Signed-off-by: JamePeng <jame_peng@sina.com>
brittlewis12 pushed a commit to brittlewis12/llama.cpp that referenced this pull request Aug 17, 2026
…tning_indexer (ggml-org#26646)

- In MSL, declaring an array of matrix types like `threadgroup half4x4` causes
a 'no matching constructor' compilation error because MSL matrix types do not
have zero-argument default constructors and threadgroup variables cannot have
initializers.

- Fix this by declaring a POD `threadgroup half` array instead and casting
to `threadgroup half4x4 *` for matrix indexing.

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

Labels

Apple Metal https://en.wikipedia.org/wiki/Metal_(API) ggml changes relating to the ggml tensor library for machine learning merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants