Skip to content

make ggml_is_view as API#19539

Merged
ggerganov merged 3 commits intoggml-org:masterfrom
foldl:api_is_view
Feb 16, 2026
Merged

make ggml_is_view as API#19539
ggerganov merged 3 commits intoggml-org:masterfrom
foldl:api_is_view

Conversation

@foldl
Copy link
Contributor

@foldl foldl commented Feb 12, 2026

Make sure to read the contributing guidelines before submitting a PR

This PR makes ggml_is_view into an API.

Motivation

Some backends complain (example) when an input is a view with offsets. It helps to have an is_view API to make these backends happy.

@foldl foldl requested a review from ggerganov as a code owner February 12, 2026 07:08
@github-actions github-actions bot added the ggml changes relating to the ggml tensor library for machine learning label Feb 12, 2026
@ggerganov
Copy link
Member

ggerganov commented Feb 14, 2026

So there is a concern that some of these helper functions should remain in the implementation so that they can be inlined efficiently in the internal ggml code - some of them can be called extensively in hot loops. ggml_is_view() specifically does not seem to fall in this category, but I think it would be a good time to introduce a pattern to fix this more generally.

I think we can do the following:

  • Add ggml_aux_is_view() to public API (ggml.h) with implementation in ggml.c
  • Move ggml_is_view() implementation to ggml-impl.h
  • Make ggml_aux_is_view() implementation simply call ggml_is_view() (i.e. it will be inlined)

This way, internal ggml code will continue to use the inlined ggml_is_view() which is now located in ggml-impl.h. User code can call ggml_aux_is_view() which has the overhead of a function call.

With this new pattern established, we can continue to migrate the rest of the auxilary calls, such as ggml_is_transposed(), ggml_is_contiguous() etc. WDYT?

@foldl
Copy link
Contributor Author

foldl commented Feb 14, 2026

Yes, this is the best solution, inline for performance and an auxiliary for API.

The only shortcoming is that API names become longer with _aux_.... So I suggest to interchange the use of ggml_is_view() and ggml_aux_is_view(). This also paves the way for ggml_is_transposed(), etc: API can be kept unchanged and ggml_aux_is_transposed() can be used internally for performance.

@ggerganov
Copy link
Member

The only shortcoming is that API names become longer with aux.... So I suggest to interchange the use of ggml_is_view() and ggml_aux_is_view(). This also paves the way for ggml_is_transposed(), etc: API can be kept unchanged and ggml_aux_is_transposed() can be used internally for performance.

Yes, it won't be a breaking change this way. Though it would require a massive change in the internal ggml implementation to switch to the aux calls. But at the same time, it can be done incrementally. So your suggestion might be the better option indeed - let me give this a bit of more thought.

@ggerganov ggerganov merged commit d23a559 into ggml-org:master Feb 16, 2026
76 of 78 checks passed
michaelneale added a commit to michaelneale/llama.cpp that referenced this pull request Feb 17, 2026
* upstream/master: (88 commits)
  ci : bump komac version (ggml-org#19682)
  build : link ws2_32 as PUBLIC on Windows (ggml-org#19666)
  build : cleanup library linking logic (ggml-org#19665)
  convert : add JoyAI-LLM-Flash (ggml-org#19651)
  perplexity: add proper batching (ggml-org#19661)
  common : inline functions (ggml-org#18639)
  ggml : make `ggml_is_view` as API (ggml-org#19539)
  model: Add support for Tiny Aya Models (ggml-org#19611)
  build : rework llama_option_depr to handle LLAMA_CURL (ggml-org#19658)
  Adjust workaround for ROCWMMA_FATTN/GFX9 to only newer ROCm veresions (ggml-org#19591)
  models : deduplicate delta-net graphs for Qwen family (ggml-org#19597)
  graph : fix KQ mask, lora, cvec reuse checks (ggml-org#19644)
  ggml: aarch64: Implement SVE in Gemm q4_k 8x8 q8_k Kernel  (ggml-org#19132)
  sync : ggml
  ggml : bump version to 0.9.7 (ggml/1425)
  ggml : bump version to 0.9.6 (ggml/1423)
  cuda: optimize iq2xxs/iq2xs/iq3xxs dequantization (ggml-org#19624)
  docs: update s390x build docs (ggml-org#19643)
  build : remove LLAMA_HTTPLIB option (ggml-org#19623)
  cmake : check if KleidiAI API has been fetched (ggml-org#19640)
  ...
liparetejas pushed a commit to liparetejas/llama.cpp that referenced this pull request Feb 23, 2026
* make `ggml_is_view` as API

* introduce `ggml_aux_is_view` as inline version for internal use.

* change `ggml_aux_is_view` to  `ggml_impl_is_view`
bartowski1182 pushed a commit to bartowski1182/llama.cpp that referenced this pull request Mar 2, 2026
* make `ggml_is_view` as API

* introduce `ggml_aux_is_view` as inline version for internal use.

* change `ggml_aux_is_view` to  `ggml_impl_is_view`
ArberSephirotheca pushed a commit to ArberSephirotheca/llama.cpp that referenced this pull request Mar 3, 2026
* make `ggml_is_view` as API

* introduce `ggml_aux_is_view` as inline version for internal use.

* change `ggml_aux_is_view` to  `ggml_impl_is_view`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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