Repository navigation
vulkan: link ggml-cpu when GGML_VULKAN_CHECK_RESULTS / RUN_TESTS are enabled - #24444
Conversation
…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]>
|
Hi @Detensable, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
|
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! |
|
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 :) |
|
@ggml-org/maintainers Another approval needed. |
…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]>
…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]>
…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]>
…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]>
-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.