Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local build fails with latest Vulkan headers (KOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER=OFF) #3468

Open
glaubitz opened this issue Feb 6, 2025 · 4 comments

Comments

@glaubitz
Copy link

glaubitz commented Feb 6, 2025

The embedded copy of kompute fails to build with GCC 15 for two reasons.

For one, there is an issue with the declaration of vk:

[   33s] cd /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/build/deps/llama.cpp-mainline/ggml/src/kompute/src && /usr/bin/c++ -DFMT_HEADER_ONLY=1 -DFMT_SHARED -DKOMPUTE_DISABLE_VK_DEBUG_LAYERS=1 -DKOMPUTE_OPT_ACTIVE_LOG_LEVEL=KOMPUTE_LOG_LEVEL_CRITICAL -DKOMPUTE_OPT_BUILT_IN_VULKAN_HEADER_TAG -DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK -DKOMPUTE_OPT_LOG_LEVEL -DKOMPUTE_OPT_USE_BUILT_IN_SPDLOG -DVULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 -I/home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/build -I/home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/include -I/home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/build/deps/llama.cpp-mainline/ggml/src/kompute/src/shaders/glsl -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -Wall -Wextra -Wpedantic -Werror -Wno-error=array-bounds -O2 -g -DNDEBUG -std=gnu++14 -fPIC -MD -MT deps/llama.cpp-mainline/ggml/src/kompute/src/CMakeFiles/kompute.dir/Manager.cpp.o -MF CMakeFiles/kompute.dir/Manager.cpp.o.d -o CMakeFiles/kompute.dir/Manager.cpp.o -c /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/Manager.cpp
[   33s] In file included from /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/Manager.cpp:3:
[   33s] /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/include/kompute/Manager.hpp:258:25: error: ‘DynamicLoader’ is not a member of ‘vk’; did you mean ‘DynamicState’?
[   33s]   258 |     std::shared_ptr<vk::DynamicLoader> mDynamicLoader = nullptr;
[   33s]       |                         ^~~~~~~~~~~~~
[   33s]       |                         DynamicState
[   33s] /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/include/kompute/Manager.hpp:258:25: error: ‘DynamicLoader’ is not a member of ‘vk’; did you mean ‘DynamicState’?
[   33s]   258 |     std::shared_ptr<vk::DynamicLoader> mDynamicLoader = nullptr;
[   33s]       |                         ^~~~~~~~~~~~~
[   33s]       |                         DynamicState
[   33s] /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/include/kompute/Manager.hpp:258:38: error: template argument 1 is invalid
[   33s]   258 |     std::shared_ptr<vk::DynamicLoader> mDynamicLoader = nullptr;
[   33s]       |                                      ^
[   33s] /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/include/kompute/Manager.hpp:258:57: error: cannot convert ‘std::nullptr_t’ to ‘int’ in initialization
[   33s]   258 |     std::shared_ptr<vk::DynamicLoader> mDynamicLoader = nullptr;
[   33s]       |                                                         ^~~~~~~
[   33s] /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/include/kompute/Manager.hpp: In member function ‘bool kp::Manager::hasVulkan() const’:
[   33s] /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/include/kompute/Manager.hpp:42:37: error: request for member ‘get’ in ‘((const kp::Manager*)this)->kp::Manager::mDynamicLoader’, which is of non-class type ‘const int’
[   33s]    42 |         return this->mDynamicLoader.get();
[   33s]       |                                     ^~~
[   33s] /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/Manager.cpp: In member function ‘void kp::Manager::createInstance()’:
[   33s] /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/Manager.cpp:184:47: error: ‘DynamicLoader’ is not a member of ‘vk’; did you mean ‘DynamicState’?
[   33s]   184 |         mDynamicLoader = std::make_shared<vk::DynamicLoader>();
[   33s]       |                                               ^~~~~~~~~~~~~
[   33s]       |                                               DynamicState
[   33s] /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/Manager.cpp:184:47: error: ‘DynamicLoader’ is not a member of ‘vk’; did you mean ‘DynamicState’?
[   33s]   184 |         mDynamicLoader = std::make_shared<vk::DynamicLoader>();
[   33s]       |                                               ^~~~~~~~~~~~~
[   33s]       |                                               DynamicState
[   33s] /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/Manager.cpp:184:61: error: no matching function for call to ‘make_shared<<expression error> >()’
[   33s]   184 |         mDynamicLoader = std::make_shared<vk::DynamicLoader>();
[   33s]       |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
[   33s] /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/Manager.cpp:184:61: note: there is 1 candidate
[   33s] In file included from /usr/include/c++/15/memory:82,
[   33s]                  from /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/include/kompute/Tensor.hpp:6,
[   33s]                  from /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/include/kompute/Algorithm.hpp:7,
[   33s]                  from /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/include/kompute/operations/OpAlgoDispatch.hpp:4,
[   33s]                  from /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/include/kompute/Sequence.hpp:6,
[   33s]                  from /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/include/kompute/Manager.hpp:9:
[   33s] /usr/include/c++/15/bits/shared_ptr.h:1003:5: note: candidate 1: ‘template<class _Tp, class ... _Args> std::shared_ptr<typename std::enable_if<(! std::is_array<_Tp>::value), _Tp>::type> std::make_shared(_Args&& ...)’
[   33s]  1003 |     make_shared(_Args&&... __args)
[   33s]       |     ^~~~~~~~~~~
[   33s] /usr/include/c++/15/bits/shared_ptr.h:1003:5: note: template argument deduction/substitution failed:
[   33s] /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/Manager.cpp:184:61: error: template argument 1 is invalid
[   33s]   184 |         mDynamicLoader = std::make_shared<vk::DynamicLoader>();
[   33s]       |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
[   33s] /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/Manager.cpp:190:21: error: base operand of ‘->’ is not a pointer
[   33s]   190 |       mDynamicLoader->getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
[   33s]       |                     ^~
[   33s] /home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/deps/llama.cpp-mainline/ggml/src/kompute/src/Manager.cpp:190:63: error: expected primary-expression before ‘>’ token
[   33s]   190 |       mDynamicLoader->getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
[   33s]       |                                                               ^
[   33s] make[2]: *** [deps/llama.cpp-mainline/ggml/src/kompute/src/CMakeFiles/kompute.dir/build.make:96: deps/llama.cpp-mainline/ggml/src/kompute/src/CMakeFiles/kompute.dir/Manager.cpp.o] Error 1
[   33s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/python-gpt4all-3.4.2-build/gpt4all-3.4.2/gpt4all-backend/build'
[   33s] make[2]: *** Waiting for unfinished jobs....

And, secondly, there is an issue with the declarations of the functions ftell() and strtol() in the embedded copy of xxd.c (see: KomputeProject/kompute#410).

@Titaniumtown
Copy link

I can reproduce while trying to package the latest release for NixOS: NixOS/nixpkgs#372723 (comment)

@axsaucedo
Copy link

Thank you @glaubitz - happy to support, we haven't seen this issue on the main repo, I can't seem to reproduce on top level repo. Perhaps @cebtenzzre have you seen this issue?

In regards to the embedded xxd, it is used to create spirv binaries as cpp headers, if it's not used it can be amended accordingly.

@cebtenzzre
Copy link
Member

I can take a look but:

Note: GCC 15 has not been released yet, so this document is a work-in-progress.

So I assume you built GCC from the tip of its master branch?

@cebtenzzre
Copy link
Member

@axsaucedo We have not seen this issue in CI or local development, but by default we use version 1.3.239 of the Vulkan headers. I see that Kompute still defaults to v1.3.231.

The build that @Titaniumtown refers to presumably used v1.3.296, as that is the latest NixOS package, and the NixOS build uses the system Vulkan headers. We know that v1.4.303, the version available on Arch Linux, is not compatible, which is why we do not use it.

@glaubitz did not provide his cmake configuration, but presumably he also uses the system Vulkan headers.

Not even the latest upstream Kompute supports the latest Vulkan headers:

In file included from /home/jared/src/forks/kompute/src/Manager.cpp:3:
/home/jared/src/forks/kompute/src/include/kompute/Manager.hpp:543:9: error: ‘DispatchLoaderDynamic’ in namespace ‘vk’ does not name a type
  543 |     vk::DispatchLoaderDynamic mDebugDispatcher;
      |         ^~~~~~~~~~~~~~~~~~~~~
/home/jared/src/forks/kompute/src/Manager.cpp: In member function ‘void kp::Manager::destroy()’:
/home/jared/src/forks/kompute/src/Manager.cpp:141:54: error: ‘class kp::Manager’ has no member named ‘mDebugDispatcher’
  141 |           this->mDebugReportCallback, nullptr, this->mDebugDispatcher);
      |                                                      ^~~~~~~~~~~~~~~~
/home/jared/src/forks/kompute/src/Manager.cpp: In member function ‘void kp::Manager::createInstance()’:
/home/jared/src/forks/kompute/src/Manager.cpp:281:15: error: ‘class kp::Manager’ has no member named ‘mDebugDispatcher’
  281 |         this->mDebugDispatcher.init(*this->mInstance, &vkGetInstanceProcAddr);
      |               ^~~~~~~~~~~~~~~~
/home/jared/src/forks/kompute/src/Manager.cpp:284:45: error: ‘class kp::Manager’ has no member named ‘mDebugDispatcher’
  284 |             debugCreateInfo, nullptr, this->mDebugDispatcher);
      |                                             ^~~~~~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/kompute.dir/build.make:93: src/CMakeFiles/kompute.dir/Manager.cpp.o] Error 1

@cebtenzzre cebtenzzre changed the title Embedded kompute copy fails to build with GCC 15 Local build fails with latest Vulkan headers (-DKOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER=OFF) Feb 11, 2025
@cebtenzzre cebtenzzre changed the title Local build fails with latest Vulkan headers (-DKOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER=OFF) Local build fails with latest Vulkan headers (KOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER=OFF) Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants