Skip to content

vulkan : fix undeclared test identifiers when GGML_VULKAN_RUN_TESTS=ON - #29946

Closed
sanjeevafk wants to merge 1 commit into
ggml-org:masterfrom
sanjeevafk:fix-vulkan-run-tests-decl
Closed

sanjeevafk wants to merge 1 commit into
ggml-org:masterfrom
sanjeevafk:fix-vulkan-run-tests-decl

Conversation

@sanjeevafk

Copy link
Copy Markdown

Overview

Fixes #29909.

When compiling with -DGGML_VULKAN=ON -DGGML_VULKAN_RUN_TESTS=ON, the build fails due to undeclared identifiers and internal linkage:

error: 'ggml_vk_test_dequant_matmul' was not declared in this scope
error: 'ggml_vk_test_matmul' was not declared in this scope

Following PR #28732 which split ggml-vulkan.cpp, the test functions (ggml_vk_test_dequant, ggml_vk_test_dequant_matmul, ggml_vk_test_matmul) were moved into ggml-vulkan-debug.cpp with static storage duration, while their call sites remained in ggml-vulkan.cpp.

This PR:

  1. Adds declarations for the test functions in ggml-vulkan-common.h guarded under #if defined(GGML_VULKAN_RUN_TESTS).
  2. Removes static from ggml_vk_test_dequant, ggml_vk_test_dequant_matmul, and ggml_vk_test_matmul in ggml-vulkan-debug.cpp.
  3. Adds an explicit template instantiation for ggml_vk_test_matmul<ggml_fp16_t, float> in ggml-vulkan-debug.cpp for the callers in ggml-vulkan.cpp.
  4. Relocates the default parameter (bool mmq = false) to the header declaration in ggml-vulkan-common.h.
  5. Fixes a signedness comparison warning (shader_size >= dq_configs.size()) in ggml-vulkan-debug.cpp.

Additional information

Verified locally:

  • cmake -B build-vk -DGGML_VULKAN=ON -DGGML_VULKAN_RUN_TESTS=ON && cmake --build build-vk --target ggml-vulkan compiles and links libggml-vulkan.so with 0 errors.
  • cmake -B build-cpu -DGGML_VULKAN=OFF && cmake --build build-cpu --target llama-cli compiles cleanly without regressions.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES - Used to locate missing declaration prototypes and peer-review C++17 explicit template instantiation against GCC/Clang.

PR ggml-org#28732 moved test functions into ggml-vulkan-debug.cpp while keeping their static
storage class, causing undeclared identifier and linkage errors when building with
-DGGML_VULKAN_RUN_TESTS=ON from caller ggml-vulkan.cpp.

- Add declarations in ggml-vulkan-common.h under GGML_VULKAN_RUN_TESTS
- Remove static from ggml_vk_test_dequant, ggml_vk_test_dequant_matmul, and ggml_vk_test_matmul
- Add explicit template instantiation for ggml_vk_test_matmul<ggml_fp16_t, float>
- Move default argument bool mmq = false to header declaration
- Fix signedness comparison in ggml_vk_test_dequant_matmul

Fixes ggml-org#29909
@sanjeevafk
sanjeevafk requested a review from a team as a code owner October 4, 2026 12:57
@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 Oct 4, 2026
@jeffbolznv

Copy link
Copy Markdown
Contributor

#29912 is already open for this.

@sanjeevafk

Copy link
Copy Markdown
Author

Thanks @jeffbolznv, missed #29912. Closing in favor of that!

@sanjeevafk sanjeevafk closed this Oct 4, 2026
@sanjeevafk
sanjeevafk deleted the fix-vulkan-run-tests-decl branch October 4, 2026 13:10
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.

Compile bug: undeclared identifier ggml_vk_test_dequant and ggml_vk_test_dequant_matmul when compiling with -DGGML_VULKAN_RUN_TESTS=ON

2 participants