Skip to content

vulkan: link ggml-cpu when GGML_VULKAN_CHECK_RESULTS / RUN_TESTS are enabled - #24444

Merged
0cc4m merged 1 commit into
ggml-org:masterfrom
Detensable:fix-vulkan-check-results-link
Jun 23, 2026
Merged

0cc4m merged 1 commit into
ggml-org:masterfrom
Detensable:fix-vulkan-check-results-link

Conversation

@Detensable

@Detensable Detensable commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

-DGGML_VULKAN_CHECK_RESULTS=ON and -DGGML_VULKAN_RUN_TESTS=ON failed to link for some reason, and I noticed the debug code in ggml-vulkan.cpp calls ggml_graph_compute_with_ctx from ggml-cpu, but ggml-vulkan only links ggml-base and Vulkan. CI misses it because neither flag is built there i think..?

Fix: link ggml-cpu under those two options

Tested on Windows/MSVC: fails to link before, builds fine after.

Used Claude to help with the initial writeup, my apologies, and in the future, I will make note to not do that. I appreciate the time anyone spends looking at this. (The fix and testing are mine, not ai slop lol). Again, I SINCERELY apologize for using ai to write it up, and in the future, it will be in my own words.

…enabled

The result-checking and test debug paths in ggml-vulkan.cpp call ggml_graph_compute_with_ctx() to compute a CPU reference graph, but that symbol is defined in ggml-cpu, which ggml-vulkan does not link. Enabling -DGGML_VULKAN_CHECK_RESULTS=ON (or -DGGML_VULKAN_RUN_TESTS=ON) therefore fails to link with an unresolved external (e.g. LNK2019 on MSVC, undefined reference on GCC/Clang). This regressed after ggml-cpu was split into its own library. Link ggml-cpu under those two options so the debug builds link again.

Signed-off-by: Wyatt Caldwell <[email protected]>
@Detensable
Detensable requested a review from a team as a code owner June 11, 2026 00:54
@github-actions github-actions Bot added Vulkan Issues specific to the Vulkan backend ggml changes relating to the ggml tensor library for machine learning labels Jun 11, 2026
@ggml-gh-bot

ggml-gh-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

Hi @Detensable, 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.

@jeffbolznv

Copy link
Copy Markdown
Contributor

I haven't tested this change. I'm generally in favor of doing this to make it easier to enable these modes. FWIW, I think historically the way to use these modes is to disable BUILD_SHARED_LIBS so everything is statically linked together.

@Detensable

Detensable commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor Author

I haven't tested this change. I'm generally in favor of doing this to make it easier to enable these modes. FWIW, I think historically the way to use these modes is to disable BUILD_SHARED_LIBS so everything is statically linked together.

Hey Jeff, (@jeffbolznv)

I can't believe one of the Vulkan contributors, and even more an NVIDIA EMPLOYEE, read my PR, I'm ecstatic right now. I'm a huge fan of Vulkan, and NVIDIA. I wanted to agree, and also make note that it makes the debug modes work no matter on shared/static, and it makes sure that no one has to swap to a static build to turn on the result checks, imo, makes it nicer for anyone debugging Vulkan. I'm only presenting this change because it lets you "flip" on CHECK_RESULTS in a normal shared-lib dev build w/o rebuilding everything static, which (if my read is right) is the convenience you say you're in favor of? Further, it should only link ggml-cpu inside those two debug blocks so that regular and release builds don't change.

In the future, do you have any recommendations for me to progress with doing PR's? As you can see I'm pretty new, and inexperienced, and could use any suggestions you give. Thanks!

@0cc4m

0cc4m commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

I remember trying to do this in the past, but running into compile issues on some platform (something on Windows, maybe mingw?) because linking backends into each other isn't intended. But that was a long time ago.

@Detensable

Copy link
Copy Markdown
Contributor Author

I remember trying to do this in the past, but running into compile issues on some platform (something on Windows, maybe mingw?) because linking backends into each other isn't intended. But that was a long time ago.

im pretty sure that works now... compiled fine on windows :)

@0cc4m

0cc4m commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@ggml-org/maintainers Another approval needed.

@0cc4m
0cc4m merged commit c926ad0 into ggml-org:master Jun 23, 2026
27 checks passed
Geminihaha pushed a commit to Geminihaha/llama.cpp that referenced this pull request Jun 25, 2026
…enabled (ggml-org#24444)

The result-checking and test debug paths in ggml-vulkan.cpp call ggml_graph_compute_with_ctx() to compute a CPU reference graph, but that symbol is defined in ggml-cpu, which ggml-vulkan does not link. Enabling -DGGML_VULKAN_CHECK_RESULTS=ON (or -DGGML_VULKAN_RUN_TESTS=ON) therefore fails to link with an unresolved external (e.g. LNK2019 on MSVC, undefined reference on GCC/Clang). This regressed after ggml-cpu was split into its own library. Link ggml-cpu under those two options so the debug builds link again.

Signed-off-by: Wyatt Caldwell <[email protected]>
adrianhoehne pushed a commit to adrianhoehne/llama.cpp that referenced this pull request Jul 5, 2026
…enabled (ggml-org#24444)

The result-checking and test debug paths in ggml-vulkan.cpp call ggml_graph_compute_with_ctx() to compute a CPU reference graph, but that symbol is defined in ggml-cpu, which ggml-vulkan does not link. Enabling -DGGML_VULKAN_CHECK_RESULTS=ON (or -DGGML_VULKAN_RUN_TESTS=ON) therefore fails to link with an unresolved external (e.g. LNK2019 on MSVC, undefined reference on GCC/Clang). This regressed after ggml-cpu was split into its own library. Link ggml-cpu under those two options so the debug builds link again.

Signed-off-by: Wyatt Caldwell <[email protected]>
zommiommy pushed a commit to zommiommy/llama.cpp that referenced this pull request Aug 18, 2026
…enabled (ggml-org#24444)

The result-checking and test debug paths in ggml-vulkan.cpp call ggml_graph_compute_with_ctx() to compute a CPU reference graph, but that symbol is defined in ggml-cpu, which ggml-vulkan does not link. Enabling -DGGML_VULKAN_CHECK_RESULTS=ON (or -DGGML_VULKAN_RUN_TESTS=ON) therefore fails to link with an unresolved external (e.g. LNK2019 on MSVC, undefined reference on GCC/Clang). This regressed after ggml-cpu was split into its own library. Link ggml-cpu under those two options so the debug builds link again.

Signed-off-by: Wyatt Caldwell <[email protected]>
zbrad pushed a commit to zbrad/llama.cpp that referenced this pull request Sep 10, 2026
…enabled (ggml-org#24444)

The result-checking and test debug paths in ggml-vulkan.cpp call ggml_graph_compute_with_ctx() to compute a CPU reference graph, but that symbol is defined in ggml-cpu, which ggml-vulkan does not link. Enabling -DGGML_VULKAN_CHECK_RESULTS=ON (or -DGGML_VULKAN_RUN_TESTS=ON) therefore fails to link with an unresolved external (e.g. LNK2019 on MSVC, undefined reference on GCC/Clang). This regressed after ggml-cpu was split into its own library. Link ggml-cpu under those two options so the debug builds link again.

Signed-off-by: Wyatt Caldwell <[email protected]>
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 Vulkan Issues specific to the Vulkan backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants