Skip to content

Added SILU_BACK operation support for Metal gpu. - #25982

Merged
ggerganov merged 2 commits into
ggml-org:masterfrom
Blackcyan30:metal-silu-back
Aug 2, 2026
Merged

ggerganov merged 2 commits into
ggml-org:masterfrom
Blackcyan30:metal-silu-back

Conversation

@Blackcyan30

Copy link
Copy Markdown
Contributor

Overview

Adds the Metal backend for SILU_BACK (CPU/CUDA/Vulkan already exist)

The kernel reads one element from each of the inputs (dy[gid], x[gid]) for a tensor position given by gid, computes the sigmoid and then the derivative and writes one output dx[gid], mirroring the CPU/CUDA math implementations. There is one thread per output element. Supports f32, fully contiguous tensors.

Additional information

test-backend-ops -o SILU_BACK passes on Apple M1 (SILU_BACK test 1/1, full metal suite 12845/12845 pass, checked against the CPU for reference).
#14909 issue reference

Requirements

  • I have read and agree with the contributing guidelines

  • AI usage disclosure: Yes
    I used AI to help me trace the cpu and the cuda implementations as well as the GPU dispatch architecture and early little code suggestion, so I can understand the architecture being followed as well as the math, it also reviewed the code I wrote for correctness.

@Blackcyan30
Blackcyan30 requested a review from a team as a code owner July 22, 2026 02:53
@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 Jul 22, 2026
@Blackcyan30
Blackcyan30 marked this pull request as draft July 22, 2026 02:54
@Blackcyan30
Blackcyan30 marked this pull request as ready for review July 22, 2026 02:54
@Blackcyan30

Blackcyan30 commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi maintainers of @/ggml-org/ggml-metal , a gentle ping to follow up on my pr, it has been open for a little over a week. It adds f32 contiguous tensor SILU_BACK support for Metal, the focused correctness test and full Metal backend op suite pass on my Apple M1 macbook. I would appreciate a review when time is good for you.

@forforever73 forforever73 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. Since this is a training-related op, I don't have any concerns from my side.

@forforever73 forforever73 added the merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. label Jul 31, 2026
Comment thread ggml/src/ggml-metal/ggml-metal-ops.cpp Outdated
@ggerganov
ggerganov merged commit 221f0f6 into ggml-org:master Aug 2, 2026
1 check passed
TheTom pushed a commit to TheTom/llama-cpp-turboquant that referenced this pull request Aug 3, 2026
* feat(silu_back): implemented silu_back op for f32

* fix(silu_back): removed redundant asserts in ggml-metal-ops.cpp function ggml_metal_op_silu_back.
satindergrewal pushed a commit to satindergrewal/llama.cpp that referenced this pull request Aug 12, 2026
* feat(silu_back): implemented silu_back op for f32

* fix(silu_back): removed redundant asserts in ggml-metal-ops.cpp function ggml_metal_op_silu_back.
thecodacus pushed a commit to thecodacus/llama.cpp that referenced this pull request Sep 7, 2026
* feat(silu_back): implemented silu_back op for f32

* fix(silu_back): removed redundant asserts in ggml-metal-ops.cpp function ggml_metal_op_silu_back.
zbrad pushed a commit to zbrad/llama.cpp that referenced this pull request Sep 10, 2026
* feat(silu_back): implemented silu_back op for f32

* fix(silu_back): removed redundant asserts in ggml-metal-ops.cpp function ggml_metal_op_silu_back.
pl752 pushed a commit to pl752/llama.cpp that referenced this pull request Sep 15, 2026
* feat(silu_back): implemented silu_back op for f32

* fix(silu_back): removed redundant asserts in ggml-metal-ops.cpp function ggml_metal_op_silu_back.
frostyautumnleaf pushed a commit to frostyautumnleaf/llama.cpp that referenced this pull request Oct 5, 2026
* feat(silu_back): implemented silu_back op for f32

* fix(silu_back): removed redundant asserts in ggml-metal-ops.cpp function ggml_metal_op_silu_back.
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.

3 participants