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

Array multiplication example code needs to be updated everytime kompute have a build issue. #313

Closed
hungrymonkey opened this issue Nov 26, 2022 · 3 comments · Fixed by #314

Comments

@hungrymonkey
Copy link

hungrymonkey commented Nov 26, 2022

GIT_TAG 1344ece4ac278f9b3be3b4555ffaace7a032b91f) # The commit hash for a dev version before v0.9.0. Replace with the latest from: https://github.com/KomputeProject/kompute/releases

As it stands, array_multiplication fetches a hash on github. This example code will need continuous maintenance or else the fails to compile whenever somebody tries to build the example and a build issue is fixed upstream.

Steps to reproduce

  1. git clone https://github.com/KomputeProject/kompute.git
  2. cd examples/array_multiplication
  3. cmake -Bbuild
  4. cd build
  5. make
$make
[ 13%] Built target fmt
[ 22%] Built target kp_shader
[ 27%] Building CXX object _deps/kompute-build/src/logger/CMakeFiles/kp_logger.dir/Logger.cpp.o
[ 31%] Linking CXX static library libkp_logger.a
[ 31%] Built target kp_logger
[ 36%] Building CXX object _deps/kompute-build/src/CMakeFiles/kompute.dir/Algorithm.cpp.o
[ 40%] Building CXX object _deps/kompute-build/src/CMakeFiles/kompute.dir/Manager.cpp.o
[ 45%] Building CXX object _deps/kompute-build/src/CMakeFiles/kompute.dir/OpAlgoDispatch.cpp.o
[ 50%] Building CXX object _deps/kompute-build/src/CMakeFiles/kompute.dir/OpMemoryBarrier.cpp.o
[ 54%] Building CXX object _deps/kompute-build/src/CMakeFiles/kompute.dir/OpTensorCopy.cpp.o
In file included from /home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/operations/OpTensorCopy.hpp:6,
                 from /home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/OpTensorCopy.cpp:3:
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:55:27: error: expected ‘)’ before ‘<’ token
   55 |     Tensor(std::shared_ptr<vk::PhysicalDevice> physicalDevice,
      |           ~               ^
      |                           )
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:108:30: error: ‘std::shared_ptr’ has not been declared
  108 |                         std::shared_ptr<Tensor> copyFromTensor);
      |                              ^~~~~~~~~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:108:40: error: expected ‘,’ or ‘...’ before ‘<’ token
  108 |                         std::shared_ptr<Tensor> copyFromTensor);
      |                                        ^
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:256:10: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
  256 |     std::shared_ptr<vk::PhysicalDevice> mPhysicalDevice;
      |          ^~~~~~~~~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:6:1: note: ‘std::shared_ptr’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
    5 | #include "logger/Logger.hpp"
  +++ |+#include <memory>
    6 | #include <string>
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:257:10: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
  257 |     std::shared_ptr<vk::Device> mDevice;
      |          ^~~~~~~~~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:257:5: note: ‘std::shared_ptr’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
  257 |     std::shared_ptr<vk::Device> mDevice;
      |     ^~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:260:10: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
  260 |     std::shared_ptr<vk::Buffer> mPrimaryBuffer;
      |          ^~~~~~~~~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:260:5: note: ‘std::shared_ptr’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
  260 |     std::shared_ptr<vk::Buffer> mPrimaryBuffer;
      |     ^~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:262:10: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
  262 |     std::shared_ptr<vk::Buffer> mStagingBuffer;
      |          ^~~~~~~~~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:262:5: note: ‘std::shared_ptr’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
  262 |     std::shared_ptr<vk::Buffer> mStagingBuffer;
      |     ^~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:264:10: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
  264 |     std::shared_ptr<vk::DeviceMemory> mPrimaryMemory;
      |          ^~~~~~~~~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:264:5: note: ‘std::shared_ptr’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
  264 |     std::shared_ptr<vk::DeviceMemory> mPrimaryMemory;
      |     ^~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:266:10: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
  266 |     std::shared_ptr<vk::DeviceMemory> mStagingMemory;
      |          ^~~~~~~~~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:266:5: note: ‘std::shared_ptr’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
  266 |     std::shared_ptr<vk::DeviceMemory> mStagingMemory;
      |     ^~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:270:28: error: ‘std::shared_ptr’ has not been declared
  270 |     void createBuffer(std::shared_ptr<vk::Buffer> buffer,
      |                            ^~~~~~~~~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:270:38: error: expected ‘,’ or ‘...’ before ‘<’ token
  270 |     void createBuffer(std::shared_ptr<vk::Buffer> buffer,
      |                                      ^
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:272:34: error: ‘std::shared_ptr’ has not been declared
  272 |     void allocateBindMemory(std::shared_ptr<vk::Buffer> buffer,
      |                                  ^~~~~~~~~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:272:44: error: expected ‘,’ or ‘...’ before ‘<’ token
  272 |     void allocateBindMemory(std::shared_ptr<vk::Buffer> buffer,
      |                                            ^
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:276:32: error: ‘std::shared_ptr’ has not been declared
  276 |                           std::shared_ptr<vk::Buffer> bufferFrom,
      |                                ^~~~~~~~~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:276:42: error: expected ‘,’ or ‘...’ before ‘<’ token
  276 |                           std::shared_ptr<vk::Buffer> bufferFrom,
      |                                          ^
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:302:28: error: expected ‘)’ before ‘<’ token
  302 |     TensorT(std::shared_ptr<vk::PhysicalDevice> physicalDevice,
      |            ~               ^
      |                            )
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/OpTensorCopy.cpp: In member function ‘virtual void kp::OpTensorCopy::record(const vk::CommandBuffer&)’:
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/OpTensorCopy.cpp:49:42: error: cannot convert ‘__gnu_cxx::__alloc_traits<std::allocator<std::shared_ptr<kp::Tensor> >, std::shared_ptr<kp::Tensor> >::value_type’ {aka ‘std::shared_ptr<kp::Tensor>’} to ‘int’
   49 |         this->mTensors[i]->recordCopyFrom(commandBuffer, this->mTensors[0]);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/doof/gitrepo/kompute/examples/array_multiplication/build/_deps/kompute-src/src/include/kompute/Tensor.hpp:108:25: note:   initializing argument 2 of ‘void kp::Tensor::recordCopyFrom(const vk::CommandBuffer&, int)’
  108 |                         std::shared_ptr<Tensor> copyFromTensor);
      |                         ^~~~~~~~~~~~~~~
make[2]: *** [_deps/kompute-build/src/CMakeFiles/kompute.dir/build.make:132: _deps/kompute-build/src/CMakeFiles/kompute.dir/OpTensorCopy.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:263: _deps/kompute-build/src/CMakeFiles/kompute.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

As you can see here, we recently fix a gcc12 error. The example code does not build because cmake fetches an old unpatch version of kompute since hashes are hard coded.

@hungrymonkey
Copy link
Author

git log --oneline

637bfb1 (HEAD -> master, origin/master, origin/HEAD) Merge pull request #312 from KomputeProject/axsaucedo-patch-5
0cd2d7a Updating default headers to Vulkan v1.3.231
a40adf8 Merge pull request #311 from hungrymonkey/fixbuilderror
9eac80f (origin/fixbuilderror) Fixed build error on gcc 12
6b8b6e8 Merge pull request #309 from KomputeProject/1_3_vulkan_upgrade
b23e925 (origin/1_3_vulkan_upgrade) Removed parallel as caused issues in build
06e5c15 Updating cmake build from fork

@hungrymonkey
Copy link
Author

gcc --version
gcc (SUSE Linux) 12.2.1 20221020 [revision 0aaef83351473e8f4eb774f8f999bbe87a4866d7]
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@axsaucedo
Copy link
Member

axsaucedo commented Nov 26, 2022

Added #314 which allows for build against source or different commit - also now runs as part of CI

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

Successfully merging a pull request may close this issue.

2 participants