Skip to content

metal : add f16 and bf16 support for concat operator - #24724

Merged
ggerganov merged 2 commits into
masterfrom
gg/concat-f16-bf16
Jun 17, 2026
Merged

ggerganov merged 2 commits into
masterfrom
gg/concat-f16-bf16

Conversation

@ggerganov

@ggerganov ggerganov commented Jun 17, 2026 •

Copy link
Copy Markdown
Member

Overview

Extend the Metal backend concat operator to support f16, bf16, i8, i16, and i64.

Requirements

Extend the Metal backend concat operator to support f16 and bf16 tensor
types in addition to the existing f32 and i32 support.

- Template kernel_concat on type T with specializations for float, half,
  bfloat, and int
- Add type-specific pipeline getter ggml_metal_library_get_pipeline_concat()
- Update device support check to allow f16 unconditionally and bf16 when
  device supports bfloat16
- Update dispatch to select the correct kernel specialization by type

Assisted-by: pi:llama.cpp/Qwen3.6-27B
@ggerganov
ggerganov marked this pull request as ready for review June 17, 2026 14:44
@ggerganov
ggerganov requested a review from a team as a code owner June 17, 2026 14:44
@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 Jun 17, 2026
@ggerganov
ggerganov merged commit 8d2e580 into master Jun 17, 2026
31 of 33 checks passed
@ggerganov
ggerganov deleted the gg/concat-f16-bf16 branch June 17, 2026 16:39
@JamePeng

JamePeng commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor
image It seems this update will cause an error message indicating that bfloat16 cannot be found: error: use of undeclared identifier 'bfloat'; did you mean 'float'?

Update1: I found M1 doesn't support BFloat16. and the github action use the macos runner is : Machine: arm64 Arch: ('64bit', ''), Apple M1 (Virtual)

@ggerganov

Copy link
Copy Markdown
Member Author

@JamePeng Thanks for the report - should be fixed with #24747

adrianhoehne pushed a commit to adrianhoehne/llama.cpp that referenced this pull request Jul 5, 2026
* metal : add f16 and bf16 support for concat operator

Extend the Metal backend concat operator to support f16 and bf16 tensor
types in addition to the existing f32 and i32 support.

- Template kernel_concat on type T with specializations for float, half,
  bfloat, and int
- Add type-specific pipeline getter ggml_metal_library_get_pipeline_concat()
- Update device support check to allow f16 unconditionally and bf16 when
  device supports bfloat16
- Update dispatch to select the correct kernel specialization by type

Assisted-by: pi:llama.cpp/Qwen3.6-27B

* metal : extend concat operator to support f16, bf16, i8, i16 and i64

Assisted-by: pi:llama.cpp/Qwen3.6-27B
zommiommy pushed a commit to zommiommy/llama.cpp that referenced this pull request Aug 18, 2026
* metal : add f16 and bf16 support for concat operator

Extend the Metal backend concat operator to support f16 and bf16 tensor
types in addition to the existing f32 and i32 support.

- Template kernel_concat on type T with specializations for float, half,
  bfloat, and int
- Add type-specific pipeline getter ggml_metal_library_get_pipeline_concat()
- Update device support check to allow f16 unconditionally and bf16 when
  device supports bfloat16
- Update dispatch to select the correct kernel specialization by type

Assisted-by: pi:llama.cpp/Qwen3.6-27B

* metal : extend concat operator to support f16, bf16, i8, i16 and i64

Assisted-by: pi:llama.cpp/Qwen3.6-27B
zbrad pushed a commit to zbrad/llama.cpp that referenced this pull request Sep 10, 2026
* metal : add f16 and bf16 support for concat operator

Extend the Metal backend concat operator to support f16 and bf16 tensor
types in addition to the existing f32 and i32 support.

- Template kernel_concat on type T with specializations for float, half,
  bfloat, and int
- Add type-specific pipeline getter ggml_metal_library_get_pipeline_concat()
- Update device support check to allow f16 unconditionally and bf16 when
  device supports bfloat16
- Update dispatch to select the correct kernel specialization by type

Assisted-by: pi:llama.cpp/Qwen3.6-27B

* metal : extend concat operator to support f16, bf16, i8, i16 and i64

Assisted-by: pi:llama.cpp/Qwen3.6-27B
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants