Skip to content

CUDA: add COL2IM_1D op#25151

Open
Ssamdeman wants to merge 1 commit into
ggml-org:masterfrom
Ssamdeman:cuda-col2im1d-op
Open

CUDA: add COL2IM_1D op#25151
Ssamdeman wants to merge 1 commit into
ggml-org:masterfrom
Ssamdeman:cuda-col2im1d-op

Conversation

@Ssamdeman

@Ssamdeman Ssamdeman commented Jun 29, 2026

Copy link
Copy Markdown

Overview

Implements GGML_OP_COL2IM_1D on the CUDA backend — the inverse of IM2COL and the missing counterpart to the CPU reference merged in #24206. Uses an output-centric gather kernel (no atomics), templated over f32/f16/bf16 with fp32 accumulation. The host wrapper reads op_params = [s0, OC, p0] and derives K = src->ne[0] / OC.

Testing:

  • test-backend-ops -o COL2IM_1D → 33/33 OK across all dtype × kernel/stride/padding cases
  • Full test-backend-ops regression clean (12868/12868)
  • Regenerated docs/ops.md via scripts/create_ops_docs.py

Additional information

The kernel math was verified line-by-line against the CPU _impl reference. col2im_1d.cu/.cuh are self-contained; the sibling im2col files are untouched.

Requirements

  • I have read and agree with the contributing guidelines

  • AI usage disclosure:

  • AI usage disclosure: YES. I authored the code in this PR myself — I wrote the CUDA kernel, host wrapper, and backend wiring based on my own understanding of the col2im_1d math and the ggml backend structure. I used AI assistively in two ways: (1) to explain ggml architecture and help me verify my indexing/memory-layout assumptions against the merged CPU reference, and (2) when my tests failed, I gave the AI my code and the errors, and it helped me understand why they were failing and what to correct. I reviewed and applied the fixes myself, I understand every line in the final code, and I take full responsibility for all submitted changes.

Implements GGML_OP_COL2IM_1D on the CUDA backend (inverse of IM2COL), the missing counterpart to the merged CPU reference. Output-centric gather kernel templated over f32/f16/bf16 with fp32 accumulation. Passes 33/33 test-backend-ops cases; full regression suite clean. Regenerated docs/ops.md.
@Ssamdeman Ssamdeman requested a review from a team as a code owner June 29, 2026 22:53
@github-actions github-actions Bot added documentation Improvements or additions to documentation ggml changes relating to the ggml tensor library for machine learning CUDA Related to the CUDA backend labels Jun 29, 2026
@ggml-gh-bot

ggml-gh-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

Hi @Ssamdeman, thanks for your contribution!

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

  • 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.

@Ssamdeman Ssamdeman closed this Jun 29, 2026
@Ssamdeman Ssamdeman reopened this Jun 29, 2026
@Ssamdeman

Copy link
Copy Markdown
Author

Thanks. I clarified it more!

@am17an

am17an commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

remove the ops.csv changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CUDA Related to the CUDA backend documentation Improvements or additions to documentation 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