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

Error compiling on ubuntu 20.04 #67

Closed
wziard opened this issue Oct 2, 2020 · 5 comments
Closed

Error compiling on ubuntu 20.04 #67

wziard opened this issue Oct 2, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@wziard
Copy link

wziard commented Oct 2, 2020

I tried compiling Kompute on ubuntu 20.04.

At first cmake failed with:
CMake 3.17.0 or higher is required. You are running version 3.16.3

I looked through CMakeLists.txt, but saw nothing which wouldn't work in cmake 3.16 (but I'm no cmake expert), so I just changed

'cmake_minimum_required(VERSION 3.17.0)'

to

'cmake_minimum_required(VERSION 3.16.0)'

Then cmake seemed to run ok.

However, when running make I get the following compiling error:

progs/vulkan/vulkan-kompute/src/Algorithm.cpp: In member function ‘void kp::Algorithm::createPipeline(std::vector<unsigned int>)’:
progs/vulkan/vulkan-kompute/src/Algorithm.cpp:268:43: error: conversion from ‘vk::ResultValueType<vk::Pipeline>::type’ {aka ‘vk::Pipeline’} to non-scalar type ‘vk::ResultValue<vk::Pipeline>’ requested
  268 |       this->mDevice->createComputePipeline(*this->mPipelineCache, pipelineInfo);
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


This is using gcc 9.3.0.

@axsaucedo
Copy link
Member

axsaucedo commented Oct 2, 2020

Thank you for reporting this @wziard! Concidentally I'm currently working on integration with Android NDK I have actually ran into this issue as well. My understanding is that this may not be due to the lower version on CMAKE, but instead if may be due to using a lower version of the Vulkan API - the Android NDK is using Vulkan 1.1 instead of 1.2. This is not for certain, so I want to dive into this further. The reason why I want to find exactly what the issue is, mainly to make sure we can have a MACRO guard based on the respective config.

The reason why I suspect it may be the Vulkan version is because, interestingly enough disjoint to this, I had opened a question on the VulkanHPP repo to get further understanding of why this particular function actually has different API KhronosGroup/Vulkan-Hpp#706

If you want to add a quick-fix for now, you can basically change this:

-    vk::ResultValue<vk::Pipeline> pipelineResult =
       this->mDevice->createComputePipeline(*this->mPipelineCache,
pipelineInfo);

-    if (pipelineResult.result != vk::Result::eSuccess) {
-        throw std::runtime_error("Failed to create pipeline result: " +
-                                 vk::to_string(pipelineResult.result));
-    }

     this->mFreePipeline = true;
-    this->mPipeline = std::make_shared<vk::Pipeline>(pipelineResult.value);
 }

Into this:

+    vk::Pipeline pipelineResult =
       this->mDevice->createComputePipeline(*this->mPipelineCache,
pipelineInfo);

+    //if (pipelineResult.result != vk::Result::eSuccess) {
+    //    throw std::runtime_error("Failed to create pipeline result: " +
+    //                             vk::to_string(pipelineResult.result));
+    //}

     this->mFreePipeline = true;
+    this->mPipeline = std::make_shared<vk::Pipeline>(pipelineResult);
 }

This was taken from my diff, hence why the + and - symbols.

If you try this, it would be great to get further insights on the points above, such as your version of Vulkan SDK, whether tests run successfully, etc. Thank you, looking forward to hear your thoughts.

@axsaucedo
Copy link
Member

Updated comment above as I forgot to add the assignment of the variable vk::Pipeline pipelineResult

@wziard
Copy link
Author

wziard commented Oct 2, 2020

Ik think it's vulkan 1.2 on ubuntu 20.04. The deb package version is is 1.2.131.2-1 , but I'm not really sure how to see which version of the spec it is by looking at the headers themselves.

Edit: btw, why didn't you just post the diff? Much easier to apply than copy pasting the code and removing all the + signs :-)
edit2: That change did the trick. Thanks a lot.

@axsaucedo
Copy link
Member

@wziard that's great! Thank you for trying it and confirming it worked. The android branch now contains the fix as well, I'll be doing some testing and will be adding this with a macro guard to ensure it can be enabled/disabled with compiler flags.

@axsaucedo
Copy link
Member

Fixed via eae63a3 - now you can compile with the flag -DKOMPUTE_CREATE_PIPELINE_RESULT_VALUE to force the return of ResultValue instead of Result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants