Merge pull request #83 from EthicalML/update_dependencies
Fix compatibility for Vulkan HPP 1.2.155 and above
This commit is contained in:
commit
9babbc54ee
20 changed files with 199 additions and 119 deletions
4
.ccls
4
.ccls
|
|
@ -13,7 +13,9 @@
|
|||
-DDEBUG=1
|
||||
-DKOMPUTE_INCLUDE_FOR_SYNTAX
|
||||
|
||||
-I/c/Users/axsau/Programming/lib/vcpkg/installed/x64-linux/include/
|
||||
-I./external/Vulkan-Headers/include/
|
||||
-I./external/googletest/googletest/include/
|
||||
-I./external/spdlog/include/
|
||||
-I./src/include/
|
||||
-I./single_include/
|
||||
-I./vk_ndk_wrapper_include/
|
||||
|
|
|
|||
12
.gitmodules
vendored
Normal file
12
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[submodule "external/googletest"]
|
||||
path = external/googletest
|
||||
url = https://github.com/google/googletest
|
||||
branch = release-1.10.0
|
||||
[submodule "external/Vulkan-Headers"]
|
||||
path = external/Vulkan-Headers
|
||||
url = https://github.com/KhronosGroup/Vulkan-Headers
|
||||
branch = v1.2.158
|
||||
[submodule "external/spdlog"]
|
||||
path = external/spdlog
|
||||
url = https://github.com/gabime/spdlog
|
||||
branch = v1.8.1
|
||||
|
|
@ -11,12 +11,13 @@ option(KOMPUTE_OPT_BUILD_TESTS "Enable if you want to build tests" 0)
|
|||
option(KOMPUTE_OPT_BUILD_DOCS "Enable if you want to build documentation" 0)
|
||||
option(KOMPUTE_OPT_BUILD_SHADERS "Enable if you want to re-build all shader files" 0)
|
||||
option(KOMPUTE_OPT_BUILD_SINGLE_HEADER "Enable if you want to build the single header file" 0)
|
||||
option(KOMPUTE_OPT_INSTALL "Enable if you want to enable installation" 1)
|
||||
option(KOMPUTE_OPT_INSTALL "Enable if you want to enable installation" 0)
|
||||
# Build options
|
||||
option(KOMPUTE_OPT_ENABLE_SPDLOG "Extra compile flags for Kompute, see docs for full list" 0)
|
||||
option(KOMPUTE_OPT_REPO_SUBMODULE_BUILD, "Use the submodule repos instead of external package manager" 0)
|
||||
option(KOMPUTE_OPT_ANDOID_BUILD "Enable android compilation flags required" 0)
|
||||
# TODO: Add on docs
|
||||
option(KOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS "Explicitly disable debug layers even on debug" 0)
|
||||
|
||||
# Build flags
|
||||
set(KOMPUTE_EXTRA_CXX_FLAGS "" CACHE STRING "Extra compile flags for Kompute, see docs for full list")
|
||||
|
||||
if(KOMPUTE_OPT_ENABLE_SPDLOG)
|
||||
|
|
|
|||
20
Makefile
20
Makefile
|
|
@ -48,16 +48,18 @@ MK_KOMPUTE_EXTRA_CXX_FLAGS ?= ""
|
|||
mk_cmake:
|
||||
cmake \
|
||||
-Bbuild \
|
||||
$(MK_CMAKE_EXTRA_FLAGS) \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$(VCPKG_UNIX_PATH) \
|
||||
-DCMAKE_BUILD_TYPE=$(MK_BUILD_TYPE) \
|
||||
-DCMAKE_INSTALL_PREFIX=$(MK_INSTALL_PATH) \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$(VCPKG_UNIX_PATH) \
|
||||
-DKOMPUTE_EXTRA_CXX_FLAGS=$(MK_KOMPUTE_EXTRA_CXX_FLAGS) \
|
||||
-DKOMPUTE_OPT_INSTALL=1 \
|
||||
-DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=0 \
|
||||
-DKOMPUTE_OPT_BUILD_TESTS=1 \
|
||||
-DKOMPUTE_OPT_BUILD_DOCS=1 \
|
||||
-DKOMPUTE_OPT_BUILD_SHADERS=1 \
|
||||
-DKOMPUTE_OPT_BUILD_SINGLE_HEADER=1 \
|
||||
-DKOMPUTE_OPT_ENABLE_SPDLOG=1 \
|
||||
$(MK_CMAKE_EXTRA_FLAGS) \
|
||||
-G "Unix Makefiles"
|
||||
|
||||
mk_build_all:
|
||||
|
|
@ -84,16 +86,18 @@ mk_run_tests: mk_build_tests
|
|||
VS_BUILD_TYPE ?= "Debug"
|
||||
# Run with multiprocessin / parallel build by default
|
||||
VS_CMAKE_EXTRA_FLAGS ?= ""
|
||||
VS_KOMPUTE_EXTRA_CXX_FLAGS ?= "/MP" # Adding multiprocessing by default
|
||||
VS_KOMPUTE_EXTRA_CXX_FLAGS ?= "/MP" # Adding multiprocessing by default. You should add "/MT" for submodule builds for compatibility with gtest
|
||||
VS_INSTALL_PATH ?= "build/src/CMakeFiles/Export/" # Set to "" if prefer default
|
||||
|
||||
vs_cmake:
|
||||
$(CMAKE_BIN) \
|
||||
-Bbuild \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$(VCPKG_WIN_PATH) \
|
||||
$(VS_CMAKE_EXTRA_FLAGS) \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$(VCPKG_WIN_PATH) \
|
||||
-DKOMPUTE_EXTRA_CXX_FLAGS=$(VS_KOMPUTE_EXTRA_CXX_FLAGS) \
|
||||
-DCMAKE_INSTALL_PREFIX=$(VS_INSTALL_PATH) \
|
||||
-DKOMPUTE_OPT_INSTALL=1 \
|
||||
-DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=0 \
|
||||
-DKOMPUTE_OPT_BUILD_TESTS=1 \
|
||||
-DKOMPUTE_OPT_BUILD_DOCS=1 \
|
||||
-DKOMPUTE_OPT_BUILD_SHADERS=1 \
|
||||
|
|
@ -125,7 +129,7 @@ vs_run_tests: vs_build_tests
|
|||
####### Create release ######
|
||||
|
||||
update_builder_image:
|
||||
docker build -f Dockerfile.linux . \
|
||||
docker build -f builders/Dockerfile.linux . \
|
||||
-t axsauze/kompute-builder:0.1
|
||||
docker push axsauze/kompute-builder:0.1
|
||||
|
||||
|
|
@ -152,12 +156,6 @@ build_shaders:
|
|||
--header-path test/compiled_shaders_include/kompute_test/shaders/ \
|
||||
-v
|
||||
|
||||
docker_vulkan_build:
|
||||
docker build . -t axsauze/vulkan-sum:0.1
|
||||
|
||||
push_vulkan_docker:
|
||||
docker push axsauze/vulkan-sum:0.1
|
||||
|
||||
build_single_header:
|
||||
quom \
|
||||
--include_directory \
|
||||
|
|
|
|||
63
README.md
63
README.md
|
|
@ -285,70 +285,15 @@ We are currently developing Vulkan Kompute not to hide the Vulkan SDK interface
|
|||
|
||||
The build system provided uses `cmake`, which allows for cross platform builds.
|
||||
|
||||
### Build parameters (cmake)
|
||||
The top level `Makefile` provides a set of optimized configurations for development as well as the docker image build, but you can start a build with the following command:
|
||||
|
||||
The recommended approach to build the project is as out-of-source build in the `build` folder. This project comes with a `Makefile` that provides a set of commands that help with developer workflows. You can see some of the commands if you want to add some of the more advanced commands.
|
||||
|
||||
For a base build you just have to run:
|
||||
```
|
||||
cmake -Bbuild
|
||||
cmake -Bbuild
|
||||
```
|
||||
|
||||
This by default configures without any of the extra build tasks (such as building shaders) and compiles without the optional dependencies. The table below provides more detail.
|
||||
|
||||
| Flag | Description |
|
||||
|-------------------------------------------------------|--------------------------------------------------------------------------|
|
||||
| -DCMAKE_INSTALL_PREFIX="build/src/CMakefiles/Export/" | Enables local installation (which won't require admin privileges) |
|
||||
| -DCMAKE_TOOLCHAIN_FILE="..." | This is the path for your package manager if you use it such as vcpkg |
|
||||
| -DKOMPUTE_OPT_BUILD_TESTS=1 | Enable if you wish to build and run the tests (must have deps installed. |
|
||||
| -DKOMPUTE_OPT_BUILD_DOCS=1 | Enable if you wish to build the docs (must have docs deps installed) |
|
||||
| -DKOMPUTE_OPT_BUILD_SINGLE_HEADER=1 | Option to build the single header file using "quom" utility |
|
||||
| -DKOMPUTE_EXTRA_CXX_FLAGS="..." | Allows you to pass extra config flags to compiler |
|
||||
| -DKOMPUTE_OPT_INSTALL=0 | Disables the install step in the cmake file (useful for android build) |
|
||||
| -DKOMPUTE_OPT_ANDROID_BUILD=1 | Enables android build which includes and excludes relevant libraries |
|
||||
|
||||
#### Compile Flags
|
||||
|
||||
|
||||
| Flag | Description |
|
||||
|--------------------------------------|-----------------------------------------------------------------------------------------|
|
||||
| KOMPUTE_CREATE_PIPELINE_RESULT_VALUE | Ensure the return value of createPipeline is processed as ResultValue instead of Result |
|
||||
| -DKOMPUTE_VK_API_VERSION="..." | Sets the default api version to use for vulkan kompute api |
|
||||
| -DKOMPUTE_VK_API_MAJOR_VERSION=1 | Major version to use for the Vulkan API |
|
||||
| -DKOMPUTE_VK_API_MINOR_VERSION=1 | Minor version to use for the Vulkan API |
|
||||
| -DKOMPUTE_ENABLE_SPDLOG=1 | Enables the build with SPDLOG and FMT dependencies (must be installed) |
|
||||
| -DKOMPUTE_LOG_VERRIDE=1 | Does not define the SPDLOG_<LEVEL> macros if these are to be overridden |
|
||||
| -DSPDLOG_ACTIVE_LEVEL | The level for the log level on compile level (whether spdlog is enabled) |
|
||||
| -DVVK_USE_PLATFORM_ANDROID_KHR | Flag to enable android imports in kompute (enabled with -DKOMPUTE_OPT_ANDROID_BUILD) |
|
||||
| -DRELEASE=1 | Enable release build (enabled by cmake release build) |
|
||||
| -DDEBUG=1 | Enable debug build including debug flags (enabled by cmake debug build) |
|
||||
| -DKOMPUTE_DISABLE_VK_DEBUG_LAYERS | Disable the debug Vulkan layers, mainly used for android builds |
|
||||
|
||||
### Dependencies
|
||||
|
||||
Given Kompute is expected to be used across a broad range of architectures and hardware, it will be important to make sure we are able to minimise dependencies.
|
||||
|
||||
#### Required dependencies
|
||||
|
||||
The only required dependency in the build is Vulkan. More specifically, the header files vulkan.h and vulkan.hpp, which are both part of the Vulkan SDK. If you haven't installed the Vulkan SDK yet, you can [download it here](https://vulkan.lunarg.com/).
|
||||
|
||||
#### Optional dependencies
|
||||
|
||||
SPDLOG is the preferred logging library, however by default Vulkan Kompute runs without SPDLOG by overriding the macros. It also provides an easy way to override the macros if you prefer to bring your own logging framework. The macro override is the following:
|
||||
|
||||
```c++
|
||||
#ifndef KOMPUTE_LOG_OVERRIDE // Use this if you want to define custom macro overrides
|
||||
#if KOMPUTE_SPDLOG_ENABLED // Use this if you want to enable SPDLOG
|
||||
#include <spdlog/spdlog.h>
|
||||
#endif //KOMPUTE_SPDLOG_ENABLED
|
||||
// ... Otherwise it adds macros that use std::cout (and only print first element)
|
||||
#endif // KOMPUTE_LOG_OVERRIDE
|
||||
```
|
||||
|
||||
You can choose to build with or without SPDLOG by using the cmake flag `KOMPUTE_OPT_ENABLE_SPDLOG`.
|
||||
|
||||
Finally, remember that you will still need to set both the compile time log level with `SPDLOG_ACTIVE_LEVEL`, and the runtime log level with `spdlog::set_level(spdlog::level::debug);`.
|
||||
You also are able to add Kompute in your repo with `add_subdirectory` - the [Android example CMakeLists.txt file](https://github.com/EthicalML/vulkan-kompute/blob/7c8c0eeba2cdc098349fcd999102bb2cca1bf711/examples/android/android-simple/app/src/main/cpp/CMakeLists.txt#L3) shows how this would be done.
|
||||
|
||||
For a more advanced overview of the build configuration check out the [Build System Deep Dive](https://kompute.cc/overview/build-system.html) documentation.
|
||||
|
||||
## Kompute Development
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
FROM amd64/ubuntu:20.04
|
||||
|
||||
ARG VULKAN_SDK_VERSION=1.2.154.0
|
||||
|
||||
# First install vulkan
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y curl unzip tar wget
|
||||
RUN wget -O VulkanSDK.tar.gz https://sdk.lunarg.com/sdk/download/1.2.141.2/linux/vulkansdk-linux-x86_64-1.2.141.2.tar.gz?u=true && \
|
||||
RUN wget -O VulkanSDK.tar.gz https://sdk.lunarg.com/sdk/download/${VULKAN_SDK_VERSION}/linux/vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.gz?u=true && \
|
||||
mkdir VulkanSDK && \
|
||||
cd VulkanSDK && \
|
||||
tar xvf /VulkanSDK.tar.gz
|
||||
|
||||
RUN cd VulkanSDK/1.2.141.2
|
||||
ENV VULKAN_SDK="/VulkanSDK/1.2.141.2/x86_64"
|
||||
RUN cd VulkanSDK/${VULKAN_SDK_VERSION}
|
||||
ENV VULKAN_SDK="/VulkanSDK/${VULKAN_SDK_VERSION}/x86_64"
|
||||
ENV PATH="${VULKAN_SDK}/bin:${PATH}"
|
||||
ENV LD_LIBRARY_PATH="${VULKAN_SDK}/lib"
|
||||
ENV VK_LAYER_PATH="${VULKAN_SDK}/etc/explicit_layer.d"
|
||||
|
|
@ -53,7 +55,7 @@ ENV VCPKG_PATH=/core/vcpkg
|
|||
ENV VCPKG_ROOT=/core/vcpkg
|
||||
|
||||
# INstall dependencies for kompute
|
||||
RUN vcpkg install catch2 fmt spdlog vulkan
|
||||
RUN /core/vcpkg/vcpkg install fmt spdlog vulkan-headers gtest
|
||||
|
||||
RUN mkdir /workspace
|
||||
WORKDIR /workspace
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ Index
|
|||
Advanced Examples <overview/advanced-examples>
|
||||
Asynchronous & Parallel Operations <overview/async-parallel>
|
||||
Memory Management Principles <overview/memory-management>
|
||||
Build System Deep Dive <overview/build-system>
|
||||
Converting GLSL/HLSL Shaders to C++ Headers <overview/shaders-to-headers>
|
||||
Mobile App Integration (Android) <overview/mobile-android>
|
||||
Game Engine Integration (Godot Engine) <overview/game-engine-godot>
|
||||
|
|
|
|||
96
docs/overview/build-system.rst
Normal file
96
docs/overview/build-system.rst
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
|
||||
Build System Deep Dive
|
||||
======================
|
||||
|
||||
The recommended approach to build the project is as out-of-source build in the ``build`` folder. This project comes with a ``Makefile`` that provides a set of commands that help with developer workflows. You can see some of the commands if you want to add some of the more advanced commands.
|
||||
|
||||
For a base build you just have to run:
|
||||
|
||||
.. code-block::
|
||||
|
||||
cmake -Bbuild
|
||||
|
||||
This by default configures without any of the extra build tasks (such as building shaders) and compiles without the optional dependencies. The table below provides more detail.
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Flag
|
||||
- Description
|
||||
* - -DCMAKE_INSTALL_PREFIX="build/src/CMakefiles/Export/"
|
||||
- Enables local installation (which won't require admin privileges)
|
||||
* - -DCMAKE_TOOLCHAIN_FILE="..."
|
||||
- This is the path for your package manager if you use it such as vcpkg
|
||||
* - -DKOMPUTE_OPT_BUILD_TESTS=1
|
||||
- Enable if you wish to build and run the tests (must have deps installed.
|
||||
* - -DKOMPUTE_OPT_BUILD_DOCS=1
|
||||
- Enable if you wish to build the docs (must have docs deps installed)
|
||||
* - -DKOMPUTE_OPT_BUILD_SINGLE_HEADER=1
|
||||
- Option to build the single header file using "quom" utility
|
||||
* - -DKOMPUTE_EXTRA_CXX_FLAGS="..."
|
||||
- Allows you to pass extra config flags to compiler
|
||||
* - -DKOMPUTE_OPT_INSTALL=0
|
||||
- Disables the install step in the cmake file (useful for android build)
|
||||
* - -DKOMPUTE_OPT_ANDROID_BUILD=1
|
||||
- Enables android build which includes and excludes relevant libraries
|
||||
|
||||
|
||||
Compile Flags
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Flag
|
||||
- Description
|
||||
* - KOMPUTE_CREATE_PIPELINE_RESULT_VALUE
|
||||
- Ensure the return value of createPipeline is processed as ResultValue instead of Result
|
||||
* - -DKOMPUTE_VK_API_VERSION="..."
|
||||
- Sets the default api version to use for vulkan kompute api
|
||||
* - -DKOMPUTE_VK_API_MAJOR_VERSION=1
|
||||
- Major version to use for the Vulkan API
|
||||
* - -DKOMPUTE_VK_API_MINOR_VERSION=1
|
||||
- Minor version to use for the Vulkan API
|
||||
* - -DKOMPUTE_ENABLE_SPDLOG=1
|
||||
- Enables the build with SPDLOG and FMT dependencies (must be installed)
|
||||
* - -DKOMPUTE_LOG_VERRIDE=1
|
||||
- Does not define the SPDLOG_\ :raw-html-m2r:`<LEVEL>` macros if these are to be overridden
|
||||
* - -DSPDLOG_ACTIVE_LEVEL
|
||||
- The level for the log level on compile level (whether spdlog is enabled)
|
||||
* - -DVVK_USE_PLATFORM_ANDROID_KHR
|
||||
- Flag to enable android imports in kompute (enabled with -DKOMPUTE_OPT_ANDROID_BUILD)
|
||||
* - -DRELEASE=1
|
||||
- Enable release build (enabled by cmake release build)
|
||||
* - -DDEBUG=1
|
||||
- Enable debug build including debug flags (enabled by cmake debug build)
|
||||
* - -DKOMPUTE_DISABLE_VK_DEBUG_LAYERS
|
||||
- Disable the debug Vulkan layers, mainly used for android builds
|
||||
|
||||
|
||||
Dependencies
|
||||
^^^^^^^^^^^^
|
||||
|
||||
Given Kompute is expected to be used across a broad range of architectures and hardware, it will be important to make sure we are able to minimise dependencies.
|
||||
|
||||
Required dependencies
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The only required dependency in the build is Vulkan. More specifically, the header files vulkan.h and vulkan.hpp, which are both part of the Vulkan SDK. If you haven't installed the Vulkan SDK yet, you can `download it here <https://vulkan.lunarg.com/>`_.
|
||||
|
||||
Optional dependencies
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
SPDLOG is the preferred logging library, however by default Vulkan Kompute runs without SPDLOG by overriding the macros. It also provides an easy way to override the macros if you prefer to bring your own logging framework. The macro override is the following:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
#ifndef KOMPUTE_LOG_OVERRIDE // Use this if you want to define custom macro overrides
|
||||
#if KOMPUTE_SPDLOG_ENABLED // Use this if you want to enable SPDLOG
|
||||
#include <spdlog/spdlog.h>
|
||||
#endif //KOMPUTE_SPDLOG_ENABLED
|
||||
// ... Otherwise it adds macros that use std::cout (and only print first element)
|
||||
#endif // KOMPUTE_LOG_OVERRIDE
|
||||
|
||||
You can choose to build with or without SPDLOG by using the cmake flag ``KOMPUTE_OPT_ENABLE_SPDLOG``.
|
||||
|
||||
Finally, remember that you will still need to set both the compile time log level with ``SPDLOG_ACTIVE_LEVEL``\ , and the runtime log level with ``spdlog::set_level(spdlog::level::debug);``.
|
||||
1
external/Vulkan-Headers
vendored
Submodule
1
external/Vulkan-Headers
vendored
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 320af06cbdd29848e1d7100d9b8e4e517db1dfd5
|
||||
1
external/googletest
vendored
Submodule
1
external/googletest
vendored
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 703bd9caab50b139428cea1aaff9974ebee5742e
|
||||
1
external/spdlog
vendored
Submodule
1
external/spdlog
vendored
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 01b350de96483cf00b267c6db4c25f3b739b3fee
|
||||
|
|
@ -34,7 +34,7 @@ Algorithm::~Algorithm()
|
|||
SPDLOG_ERROR("Kompute Algorithm Error requested to destroy "
|
||||
"pipeline but it is null");
|
||||
}
|
||||
this->mDevice->destroy(*this->mPipeline);
|
||||
this->mDevice->destroy(*this->mPipeline, (vk::Optional<const vk::AllocationCallbacks>)nullptr);
|
||||
}
|
||||
|
||||
if (this->mFreePipelineCache) {
|
||||
|
|
@ -43,7 +43,7 @@ Algorithm::~Algorithm()
|
|||
SPDLOG_ERROR("Kompute Algorithm Error requested to destroy "
|
||||
"pipeline cache but it is null");
|
||||
}
|
||||
this->mDevice->destroy(*this->mPipelineCache);
|
||||
this->mDevice->destroy(*this->mPipelineCache, (vk::Optional<const vk::AllocationCallbacks>)nullptr);
|
||||
}
|
||||
|
||||
if (this->mFreePipelineLayout) {
|
||||
|
|
@ -52,7 +52,7 @@ Algorithm::~Algorithm()
|
|||
SPDLOG_ERROR("Kompute Algorithm Error requested to destroy "
|
||||
"pipeline layout but it is null");
|
||||
}
|
||||
this->mDevice->destroy(*this->mPipelineLayout);
|
||||
this->mDevice->destroy(*this->mPipelineLayout, (vk::Optional<const vk::AllocationCallbacks>)nullptr);
|
||||
}
|
||||
|
||||
if (this->mFreeShaderModule) {
|
||||
|
|
@ -61,7 +61,7 @@ Algorithm::~Algorithm()
|
|||
SPDLOG_ERROR("Kompute Algorithm Error requested to destroy shader "
|
||||
"module but it is null");
|
||||
}
|
||||
this->mDevice->destroy(*this->mShaderModule);
|
||||
this->mDevice->destroy(*this->mShaderModule, (vk::Optional<const vk::AllocationCallbacks>)nullptr);
|
||||
}
|
||||
|
||||
if (this->mFreeDescriptorSet) {
|
||||
|
|
@ -80,7 +80,7 @@ Algorithm::~Algorithm()
|
|||
SPDLOG_ERROR("Kompute Algorithm Error requested to destroy "
|
||||
"descriptor set layout but it is null");
|
||||
}
|
||||
this->mDevice->destroy(*this->mDescriptorSetLayout);
|
||||
this->mDevice->destroy(*this->mDescriptorSetLayout, (vk::Optional<const vk::AllocationCallbacks>)nullptr);
|
||||
}
|
||||
|
||||
if (this->mFreeDescriptorPool) {
|
||||
|
|
@ -89,7 +89,7 @@ Algorithm::~Algorithm()
|
|||
SPDLOG_ERROR("Kompute Algorithm Error requested to destroy "
|
||||
"descriptor pool but it is null");
|
||||
}
|
||||
this->mDevice->destroy(*this->mDescriptorPool);
|
||||
this->mDevice->destroy(*this->mDescriptorPool, (vk::Optional<const vk::AllocationCallbacks>)nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,19 @@
|
|||
|
||||
if(KOMPUTE_OPT_ENABLE_SPDLOG)
|
||||
find_package(spdlog REQUIRED)
|
||||
find_package(fmt REQUIRED)
|
||||
if(KOMPUTE_OPT_REPO_SUBMODULE_BUILD)
|
||||
set(SPDLOG_INSTALL ON)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/external/spdlog ${CMAKE_CURRENT_BINARY_DIR}/kompute_spdlog)
|
||||
else()
|
||||
find_package(spdlog REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(KOMPUTE_OPT_ANDOID_BUILD)
|
||||
find_library(android android)
|
||||
endif()
|
||||
|
||||
# We don't import Vulkan library if Android build as its build dynamically
|
||||
# Otherwise it is expected that the Vulkan SDK and dependencies are installed
|
||||
if(NOT KOMPUTE_OPT_ANDOID_BUILD)
|
||||
find_package(Vulkan REQUIRED)
|
||||
endif()
|
||||
|
|
@ -62,10 +68,19 @@ else()
|
|||
)
|
||||
endif()
|
||||
|
||||
if(KOMPUTE_OPT_REPO_SUBMODULE_BUILD)
|
||||
# Override the default Vulkan::Vulkan headers
|
||||
# In this case we only use the build interface due to https://github.com/KhronosGroup/Vulkan-Headers/issues/157
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/external/Vulkan-Headers ${CMAKE_CURRENT_BINARY_DIR}/kompute_vulkan_headers)
|
||||
get_target_property(VULKAN_HEADERS_INCLUDES Vulkan-Headers INTERFACE_INCLUDE_DIRECTORIES)
|
||||
target_include_directories(
|
||||
kompute PUBLIC
|
||||
$<BUILD_INTERFACE:${VULKAN_HEADERS_INCLUDES}>)
|
||||
endif()
|
||||
|
||||
if(KOMPUTE_OPT_ENABLE_SPDLOG)
|
||||
target_link_libraries(
|
||||
kompute
|
||||
fmt::fmt
|
||||
spdlog::spdlog
|
||||
)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ Manager::~Manager()
|
|||
|
||||
if (this->mFreeDevice) {
|
||||
SPDLOG_INFO("Destroying device");
|
||||
this->mDevice->destroy();
|
||||
this->mDevice->destroy((vk::Optional<const vk::AllocationCallbacks>)nullptr);
|
||||
SPDLOG_DEBUG("Kompute Manager Destroyed Device");
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ Manager::~Manager()
|
|||
#endif
|
||||
|
||||
if (this->mFreeInstance) {
|
||||
this->mInstance->destroy();
|
||||
this->mInstance->destroy((vk::Optional<const vk::AllocationCallbacks>)nullptr);
|
||||
SPDLOG_DEBUG("Kompute Manager Destroyed Instance");
|
||||
}
|
||||
}
|
||||
|
|
@ -175,7 +175,7 @@ Manager::createInstance()
|
|||
std::vector<vk::LayerProperties> availableLayerProperties =
|
||||
vk::enumerateInstanceLayerProperties();
|
||||
for (vk::LayerProperties layerProperties : availableLayerProperties) {
|
||||
std::string layerName(layerProperties.layerName);
|
||||
std::string layerName(layerProperties.layerName.data());
|
||||
uniqueLayerNames.insert(layerName);
|
||||
}
|
||||
for (const char* desiredLayerName : desiredLayerNames) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ Sequence::~Sequence()
|
|||
"CommandPool pointer");
|
||||
return;
|
||||
}
|
||||
this->mDevice->destroy(*this->mCommandPool);
|
||||
this->mDevice->destroy(*this->mCommandPool, (vk::Optional<const vk::AllocationCallbacks>)nullptr);
|
||||
SPDLOG_DEBUG("Kompute Sequence Destroyed CommandPool");
|
||||
}
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ Sequence::evalAwait(uint64_t waitFor)
|
|||
|
||||
vk::Result result =
|
||||
this->mDevice->waitForFences(1, &this->mFence, VK_TRUE, waitFor);
|
||||
this->mDevice->destroy(this->mFence);
|
||||
this->mDevice->destroy(this->mFence, (vk::Optional<const vk::AllocationCallbacks>)nullptr);
|
||||
|
||||
this->mIsRunning = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,4 @@
|
|||
|
||||
#if DEBUG
|
||||
#if KOMPUTE_ENABLE_SPDLOG
|
||||
// Only enabled if spdlog is enabled
|
||||
#include <fmt/ranges.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "kompute/Tensor.hpp"
|
||||
|
||||
namespace kp {
|
||||
|
|
@ -20,7 +13,7 @@ Tensor::Tensor(const std::vector<float>& data, TensorTypes tensorType)
|
|||
{
|
||||
#if DEBUG
|
||||
SPDLOG_DEBUG(
|
||||
"Kompute Tensor constructor data: {}, and type: {}", data, tensorType);
|
||||
"Kompute Tensor constructor data length: {}, and type: {}", data.size(), tensorType);
|
||||
#endif
|
||||
|
||||
this->mData = data;
|
||||
|
|
@ -357,7 +350,7 @@ Tensor::freeMemoryDestroyGPUResources()
|
|||
"Kompose Tensor expected to free buffer but got null buffer");
|
||||
} else {
|
||||
SPDLOG_DEBUG("Kompose Tensor destroying buffer");
|
||||
this->mDevice->destroy(*this->mBuffer);
|
||||
this->mDevice->destroy(*this->mBuffer, (vk::Optional<const vk::AllocationCallbacks>)nullptr);
|
||||
this->mBuffer = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
@ -368,7 +361,7 @@ Tensor::freeMemoryDestroyGPUResources()
|
|||
"Kompose Tensor expected to free buffer but got null memory");
|
||||
} else {
|
||||
SPDLOG_DEBUG("Kompose Tensor freeing memory");
|
||||
this->mDevice->freeMemory(*this->mMemory);
|
||||
this->mDevice->freeMemory(*this->mMemory, (vk::Optional<const vk::AllocationCallbacks>)nullptr);
|
||||
this->mDevice = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
|
||||
enable_testing()
|
||||
find_package(GTest CONFIG REQUIRED)
|
||||
if(KOMPUTE_OPT_REPO_SUBMODULE_BUILD)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/external/googletest EXCLUDE_FROM_ALL
|
||||
${CMAKE_CURRENT_BINARY_DIR}/kompute_googletest)
|
||||
else()
|
||||
find_package(GTest CONFIG REQUIRED)
|
||||
endif()
|
||||
|
||||
file(GLOB test_kompute_CPP
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
|
||||
|
|
@ -14,9 +19,17 @@ target_include_directories(
|
|||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/compiled_shaders_include>
|
||||
)
|
||||
|
||||
target_link_libraries(test_kompute PRIVATE
|
||||
GTest::gtest
|
||||
GTest::gmock)
|
||||
if(KOMPUTE_OPT_REPO_SUBMODULE_BUILD)
|
||||
target_include_directories(
|
||||
test_kompute PRIVATE
|
||||
${gtest_SOURCE_DIR}/include)
|
||||
|
||||
target_link_libraries(test_kompute PRIVATE
|
||||
gtest_main)
|
||||
else()
|
||||
target_link_libraries(test_kompute PRIVATE
|
||||
GTest::gtest)
|
||||
endif()
|
||||
|
||||
target_link_libraries(test_kompute PRIVATE kompute)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "fmt/ranges.h"
|
||||
//#include <spdlog/fmt/bundled/ranges.h>
|
||||
#include "kompute/Kompute.hpp"
|
||||
|
||||
TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegression)
|
||||
|
|
@ -76,10 +76,10 @@ TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegression)
|
|||
EXPECT_LT(bIn->data()[0], 0.0);
|
||||
EXPECT_LT(bIn->data()[0], 0.0);
|
||||
|
||||
SPDLOG_WARN("Result wIn: {}, bIn: {}, loss: {}",
|
||||
wIn->data(),
|
||||
bIn->data(),
|
||||
lOut->data());
|
||||
//SPDLOG_WARN("Result wIn: {}, bIn: {}, loss: {}",
|
||||
// wIn->data(),
|
||||
// bIn->data(),
|
||||
// lOut->data());
|
||||
}
|
||||
|
||||
TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegressionManualCopy)
|
||||
|
|
@ -158,8 +158,8 @@ TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegressionManualCopy)
|
|||
EXPECT_GT(wIn->data()[1], 1.0);
|
||||
EXPECT_LT(bIn->data()[0], 0.0);
|
||||
|
||||
SPDLOG_WARN("Result wIn: {}, bIn: {}, loss: {}",
|
||||
wIn->data(),
|
||||
bIn->data(),
|
||||
lOut->data());
|
||||
//SPDLOG_WARN("Result wIn: {}, bIn: {}, loss: {}",
|
||||
// wIn->data(),
|
||||
// bIn->data(),
|
||||
// lOut->data());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <kompute/Kompute.hpp>
|
||||
|
||||
|
|
@ -7,7 +7,6 @@ int
|
|||
main(int argc, char* argv[])
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
testing::InitGoogleMock(&argc, argv);
|
||||
|
||||
#if KOMPUTE_ENABLE_SPDLOG
|
||||
spdlog::set_level(
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
"name": "example",
|
||||
"version-string": "0.0.1",
|
||||
"dependencies": [
|
||||
"fmt",
|
||||
"spdlog",
|
||||
"vulkan",
|
||||
"vulkan-hpp",
|
||||
"vulkan-headers",
|
||||
"gtest"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue