Skip to content

CUDA: support strided ABS for F16 and F32 - #28477

Closed
mornhussakuyo-hub wants to merge 2 commits into
ggml-org:masterfrom
mornhussakuyo-hub:cuda-abs-strided
Closed

mornhussakuyo-hub wants to merge 2 commits into
ggml-org:masterfrom
mornhussakuyo-hub:cuda-abs-strided

Conversation

@mornhussakuyo-hub

@mornhussakuyo-hub mornhussakuyo-hub commented Sep 6, 2026 •

Copy link
Copy Markdown

Assisted-by: Codex

Overview

CUDA ABS previously only supported fully contiguous tensors.

This PR adds support for tensors with contiguous rows and arbitrary outer strides, while preserving the existing fast path for fully contiguous tensors. Source and destination strides are handled independently, allowing ABS to work correctly with offset views, permuted outer dimensions, and in-place operations.

This contributes to the CUDA operator support work tracked in #14909 by filling the missing strided-tensor support for ABS.

Supported types:

  • F32
  • F16

Tests were added for padded and offset views, permuted outer dimensions, and both regular and in-place execution.

Additional information

The implementation was validated locally on an NVIDIA RTX 5060 Ti. The expanded ABS tests pass for all covered F16/F32 cases, including strided and in-place layouts.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES - OpenAI Codex was used to assist with investigation, implementation, testing, and local validation. The changes were reviewed by the contributor.

@mornhussakuyo-hub
mornhussakuyo-hub requested review from a team and ggerganov as code owners September 6, 2026 07:02
@github-actions github-actions Bot added documentation Improvements or additions to documentation testing Everything test related ggml changes relating to the ggml tensor library for machine learning CUDA Related to the CUDA backend labels Sep 6, 2026
@mornhussakuyo-hub

Copy link
Copy Markdown
Author

Hi @ggerganov , just a friendly ping on this PR. 🙂

I noticed that the CI workflows are currently showing action_required. If they require maintainer approval to run, could you please approve them when convenient?

The change has also been tested locally on CUDA, and I'd really appreciate a review when you have time. Thanks!

@JohannesGaessler

Copy link
Copy Markdown
Contributor

Thank you for your efforts. Regrettably this PR is implementing the wrong thing. Instead of a special case for GGML_OP_ABS instead the generic template should be extended with support for noncontiguous tensors. So I am closing this PR because it is adding technical debt and does not list a concrete use case. I'm sorry for doing this after weeks of silence, I took a break from llama.cpp and am currently working through my backlog. If you make a new PR that implements the support generically I'll give it priority for review.

@JohannesGaessler

Copy link
Copy Markdown
Contributor

Looking further, there seems to already be a PR: #28821 .

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 testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants