diff --git a/.ccls b/.ccls index 4c0b28e46..47d3fc315 100644 --- a/.ccls +++ b/.ccls @@ -21,7 +21,5 @@ -I./external/spdlog/include/ -I./external/fmt/include/ -I./src/include/ --I./single_include/ --I./vk_ndk_wrapper_include/ -I./test/compiled_shaders_include/ -I./test/utils/ diff --git a/.github/workflows/cpp_tests.yml b/.github/workflows/cpp_tests.yml index 2a564796a..bd12f3a3b 100644 --- a/.github/workflows/cpp_tests.yml +++ b/.github/workflows/cpp_tests.yml @@ -7,27 +7,106 @@ on: branches: [ master ] jobs: - cpp-tests: - - runs-on: ubuntu-18.04 + cpp-tests-debug-with-debug-layers: + runs-on: ubuntu-latest container: axsauze/kompute-builder:0.3 - steps: - - uses: actions/checkout@v2 + - name: Install vulkaninfo + run: apt update -y && apt install -y vulkan-tools + - name: Checkout + uses: actions/checkout@v3 with: - submodules: recursive - - name: configure-cpp - run: | - cmake -Bbuild/ \ - -DCMAKE_BUILD_TYPE=Debug \ - -DKOMPUTE_OPT_INSTALL=0 \ - -DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=1 \ - -DKOMPUTE_OPT_BUILD_TESTS=1 \ - -DKOMPUTE_OPT_ENABLE_SPDLOG=1 - - name: build-cpp - run: | - make mk_build_tests - - name: test-cpp - run: | - export VK_ICD_FILENAMES=/swiftshader/vk_swiftshader_icd.json - make mk_run_tests + submodules: false + - name: "[Release g++] Build & Test" + uses: ashutoshvarma/action-cmake-build@master + with: + build-dir: ${{github.workspace}}/build + source-dir: ${{github.workspace}} + cc: gcc + cxx: g++ + build-type: Debug + run-test: false + ctest-options: -V + configure-options: -DKOMPUTE_OPT_BUILD_TESTS=ON -DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS=OFF -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON -DKOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER=ON + - name: Run tests + env: + VK_ICD_FILENAMES: "/swiftshader/vk_swiftshader_icd.json" + run: make mk_run_tests + + cpp-tests-release-with-debug-layers: + runs-on: ubuntu-latest + container: axsauze/kompute-builder:0.3 + steps: + - name: Install vulkaninfo + run: apt update -y && apt install -y vulkan-tools + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: false + - name: "[Release g++] Build & Test" + uses: ashutoshvarma/action-cmake-build@master + with: + build-dir: ${{github.workspace}}/build + source-dir: ${{github.workspace}} + cc: gcc + cxx: g++ + build-type: Release + run-test: false + ctest-options: -V + configure-options: -DKOMPUTE_OPT_BUILD_TESTS=ON -DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS=OFF -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON -DKOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER=ON + - name: Run tests + env: + VK_ICD_FILENAMES: "/swiftshader/vk_swiftshader_icd.json" + run: make mk_run_tests + + cpp-tests-debug-without-debug-layers: + runs-on: ubuntu-latest + container: axsauze/kompute-builder:0.3 + steps: + - name: Install vulkaninfo + run: apt update -y && apt install -y vulkan-tools + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: false + - name: "[Release g++] Build & Test" + uses: ashutoshvarma/action-cmake-build@master + with: + build-dir: ${{github.workspace}}/build + source-dir: ${{github.workspace}} + cc: gcc + cxx: g++ + build-type: Debug + run-test: false + ctest-options: -V + configure-options: -DKOMPUTE_OPT_BUILD_TESTS=ON -DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS=ON -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON -DKOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER=ON + - name: Run tests + env: + VK_ICD_FILENAMES: "/swiftshader/vk_swiftshader_icd.json" + run: make mk_run_tests + + cpp-tests-release-without-debug-layers: + runs-on: ubuntu-latest + container: axsauze/kompute-builder:0.3 + steps: + - name: Install vulkaninfo + run: apt update -y && apt install -y vulkan-tools + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: false + - name: "[Release g++] Build & Test" + uses: ashutoshvarma/action-cmake-build@master + with: + build-dir: ${{github.workspace}}/build + source-dir: ${{github.workspace}} + cc: gcc + cxx: g++ + build-type: Release + run-test: false + ctest-options: -V + configure-options: -DKOMPUTE_OPT_BUILD_TESTS=ON -DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS=ON -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON -DKOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER=ON + - name: Run tests + env: + VK_ICD_FILENAMES: "/swiftshader/vk_swiftshader_icd.json" + run: make mk_run_tests diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index e28bcd2a4..08da971e3 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -8,21 +8,23 @@ on: jobs: python-tests: - - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest container: axsauze/kompute-builder:0.3 - steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v3 with: - submodules: recursive - - name: configure-python - run: | - pip3 install -r python/test/requirements-dev.txt - - name: build-python - run: | - pip3 install . - - name: test-python + submodules: false + - name: Install vulkaninfo + run: apt update -y && apt install -y vulkan-tools + - name: Install Python Requirements + run: pip3 install --user -r python/test/requirements-dev.txt + - name: Python Build + env: + KOMPUTE_PYTHON_NUM_PARALLEL_THREADS: 2 + KOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER: ON + run: pip3 install --user . -v + - name: Python run Tests run: | export VK_ICD_FILENAMES=/swiftshader/vk_swiftshader_icd.json make test_python diff --git a/.gitignore b/.gitignore index 4c684dc3a..9dc07073f 100644 --- a/.gitignore +++ b/.gitignore @@ -169,10 +169,9 @@ Content/StarterContent/* # VSCode Files /.vscode/* BuildingEscape.code-workspace - compile_commands.json - .clangd/ +.cache/ # Project files bin/ @@ -190,3 +189,6 @@ vk_swiftshader_icd.json tmp_kp_shader.comp.spv tmp_kp_shader.comp +# Docs +_build/ + diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 3c710d619..000000000 --- a/.gitmodules +++ /dev/null @@ -1,20 +0,0 @@ -[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 -[submodule "python/pybind11"] - path = python/pybind11 - url = https://github.com/pybind/pybind11 - branch = v2.6.1 -[submodule "external/fmt"] - path = external/fmt - url = https://github.com/fmtlib/fmt - branch = 7.1.3 diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b014c4a2..f5d2b477c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,94 +1,265 @@ # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.4.1) -project(kompute VERSION 0.8.1) +cmake_minimum_required(VERSION 3.20) +project(kompute VERSION 0.8.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 14) -set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -set(CMAKE_VERBOSE_MAKEFILE on) +# Only change the folder behavior if kompute is not a subproject +if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME}) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) + set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake") + set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) + set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) +endif() + +# Avoid the dll boilerplate code for windows +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}") + +set(KOMPUTE_LIBRARIES kompute CACHE INTERNAL "") + +# #################################################### +# Options +# #################################################### +macro(kompute_option OPTION_NAME OPTION_TEXT OPTION_DEFAULT) + option(${OPTION_NAME} ${OPTION_TEXT} ${OPTION_DEFAULT}) + + if(DEFINED ENV{${OPTION_NAME}}) + # Allow overriding the option through an environment variable + set(${OPTION_NAME} $ENV{${OPTION_NAME}}) + endif() + + if(${OPTION_NAME}) + add_definitions(-D${OPTION_NAME}) + endif() + + message(STATUS " ${OPTION_NAME}: ${${OPTION_NAME}}") +endmacro() + +macro(kompute_log_level OPTION_NAME OPTION_TEXT OPTION_DEFAULT) + set(${OPTION_NAME} ${OPTION_DEFAULT} CACHE STRING ${OPTION_TEXT}) + set_property(CACHE ${OPTION_NAME} PROPERTY STRINGS "Trace" "Debug" "Info" "Warn" "Error" "Critical" "Default" "Off") + + if(DEFINED ENV{${OPTION_NAME}}) + # Allow setting the option through an environment variable + set(${OPTION_NAME} $ENV{${OPTION_NAME}}) + endif() + + if(${OPTION_NAME}) + add_definitions(-D${OPTION_NAME}) + endif() + + # Allow disabling logging completely and prevent linking against it: + if(${KOMPUTE_OPT_LOG_LEVEL} STREQUAL "Off") + set(${OPTION_NAME}_DISABLED ON) + add_compile_definitions(${OPTION_NAME}_DISABLED=1) + endif() + + message(STATUS " ${OPTION_NAME}: ${${OPTION_NAME}}") +endmacro() + +macro(kompute_option_string OPTION_NAME OPTION_TEXT OPTION_DEFAULT) + set(${OPTION_NAME} ${OPTION_DEFAULT} CACHE STRING ${OPTION_TEXT}) + + if(DEFINED ENV{${OPTION_NAME}}) + # Allow setting the option through an environment variable + set(${OPTION_NAME} $ENV{${OPTION_NAME}}) + endif() + + if(${OPTION_NAME}) + add_definitions(-D${OPTION_NAME}) + endif() + + message(STATUS " ${OPTION_NAME}: ${${OPTION_NAME}}") +endmacro() + +message(STATUS "General purpose GPU compute framework built on Vulkan") +message(STATUS "=======================================================") # Enable or disable targets -option(KOMPUTE_OPT_BUILD_TESTS "Enable if you want to build tests" 0) -option(KOMPUTE_OPT_CODE_COVERAGE "Enable if you want code coverage" 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" 0) +kompute_option(KOMPUTE_OPT_BUILD_TESTS "Enable if you want to build tests." OFF) +kompute_option(KOMPUTE_OPT_CODE_COVERAGE "Enable if you want code coverage." OFF) +kompute_option(KOMPUTE_OPT_BUILD_DOCS "Enable if you want to build documentation." OFF) +kompute_option(KOMPUTE_OPT_INSTALL "Enable if you want to enable installation." OFF) + # Build options -option(KOMPUTE_OPT_BUILD_PYTHON "Enable if you want to build python bindings" 0) -option(KOMPUTE_OPT_ENABLE_SPDLOG "Enable to compile with spdlog as the internal logging framework" 0) -option(KOMPUTE_OPT_REPO_SUBMODULE_BUILD "Use the submodule repos instead of external package manager" 0) -option(KOMPUTE_OPT_ANDROID_BUILD "Enable android compilation flags required" 0) -option(KOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS "Explicitly disable debug layers even on debug" 0) -option(KOMPUTE_OPT_DEPENDENCIES_SHARED_LIBS "Whether to use shared libraries for dependencies for install" 0) -option(KOMPUTE_OPT_BUILD_AS_SHARED_LIB "Whether to build kompute as shared library" 0) -# Build flags -set(KOMPUTE_EXTRA_CXX_FLAGS "" CACHE STRING "Extra compile flags for Kompute, see docs for full list") +kompute_option(KOMPUTE_OPT_BUILD_PYTHON "Enable if you want to build python bindings." OFF) +kompute_log_level(KOMPUTE_OPT_LOG_LEVEL "Internally we use Spdlog or fmt for logging, depending on the value of 'KOMPUTE_OPT_USE_SPDLOG'. The log level used can be changed here. Possible values: 'Trace', 'Debug', 'Info', 'Warn', 'Error', 'Critical', 'Off', 'Default'. If set to 'Off' logging will be deactivated completely. If set to 'Default', the log level will be set to 'Info' for release builds and 'Debug' else." "Default") +kompute_option(KOMPUTE_OPT_USE_SPDLOG "If enabled, logging via KP_LOG_ will happen through Spdlog instead of plan fmt." OFF) +kompute_option(KOMPUTE_OPT_ANDROID_BUILD "Enable android compilation flags required." OFF) +kompute_option(KOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS "Explicitly disable debug layers even on debug." OFF) +kompute_option(KOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK "Whether to check if your driver supports the Vulkan Header version you are linking against. This might be useful in case you build shared on a different system than you run later." OFF) +kompute_option(KOMPUTE_OPT_BUILD_SHADERS "Rebuilds all compute shaders during compilation and does not use the already precompiled versions. Requires glslangValidator to be installed on your system." OFF) -if(KOMPUTE_OPT_ENABLE_SPDLOG) - set(KOMPUTE_EXTRA_CXX_FLAGS "${KOMPUTE_EXTRA_CXX_FLAGS} -DKOMPUTE_ENABLE_SPDLOG=1") - set(SPDLOG_FMT_EXTERNAL ON CACHE BOOL "Enables external fmt as its current dep" FORCE) - if(KOMPUTE_OPT_INSTALL) - # Enable install parameters for spdlog (overrides parameters passed) - set(SPDLOG_INSTALL ON CACHE BOOL "Enables install of spdlog" FORCE) +# External components +kompute_option(KOMPUTE_OPT_USE_BUILT_IN_SPDLOG "Use the built-in version of Spdlog. Requires 'KOMPUTE_OPT_USE_SPDLOG' to be set to ON in order to have any effect." ON) +kompute_option(KOMPUTE_OPT_USE_BUILT_IN_FMT "Use the built-in version of fmt." ON) +kompute_option(KOMPUTE_OPT_USE_BUILT_IN_GOOGLE_TEST "Use the built-in version of GoogleTest." ON) +kompute_option(KOMPUTE_OPT_USE_BUILT_IN_PYBIND11 "Use the built-in version of pybind11." ON) +kompute_option(KOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER "Use the built-in version of Vulkan Headers. This could be helpful in case your system Vulkan Headers are too new for your driver. If you set this to OFF, please make sure your system Vulkan Headers are supported by your driver." OFF) +kompute_option_string(KOMPUTE_OPT_BUILT_IN_VULKAN_HEADER_TAG "The git tag used for the built-in Vulkan Headers when 'KOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER' is enabled. A list of tags can be found here: https://github.com/KhronosGroup/Vulkan-Headers/tags" "v1.2.203") +message(STATUS "=======================================================") - if(KOMPUTE_OPT_DEPENDENCIES_SHARED_LIBS) - set(SPDLOG_BUILD_SHARED ON CACHE BOOL "Enables build of shared libraries" FORCE) +# #################################################### +# Deprecated Options +# #################################################### +include(cmake/deprecation_warnings.cmake) + +# #################################################### +# Dependencies +# #################################################### +include(cmake/vulkan_shader_compiler.cmake) +include(cmake/check_vulkan_version.cmake) +include(FetchContent) + +# Vulkan Header +# We don't import Vulkan library if Android build as it is built dynamically +# Otherwise it is expected that the Vulkan SDK and dependencies are installed +# Has to happen AFTER using the build-in Vulkan headers to prevent multiple targets with the name Vulkan::Headers +if(KOMPUTE_OPT_ANDROID_BUILD) + add_library(vulkanAndroid INTERFACE) + set(VULKAN_INCLUDE_DIR ${ANDROID_NDK}/sources/third_party/vulkan/src/include) + target_sources(vulkanAndroid INTERFACE ${VULKAN_INCLUDE_DIR}/vulkan/vulkan.hpp) + target_include_directories(vulkanAndroid INTERFACE ${VULKAN_INCLUDE_DIR}) + + target_compile_definitions(vulkanAndroid INTERFACE VK_NO_PROTOTYPES=1) + target_compile_definitions(vulkanAndroid INTERFACE VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1) +else() + if(KOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER) + FetchContent_Declare(vulkan_header GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Headers.git + GIT_TAG ${KOMPUTE_OPT_BUILT_IN_VULKAN_HEADER_TAG}) # Source: https://github.com/KhronosGroup/Vulkan-Headers/tags + FetchContent_MakeAvailable(vulkan_header) + + if(NOT KOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK) + # Ensure the driver supports this Vulkan version + check_vulkan_version(INCLUDE_DIR "${vulkan_header_SOURCE_DIR}/include") + endif() + endif() + + find_package(Vulkan REQUIRED) + + if(Vulkan_FOUND AND NOT TARGET Vulkan::Headers) + add_library(Vulkan::Headers INTERFACE IMPORTED) + set_target_properties(Vulkan::Headers PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}") + endif() + + if(NOT KOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER AND NOT KOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK) + # Ensure the driver supports this Vulkan version + check_vulkan_version(INCLUDE_DIR ${Vulkan_INCLUDE_DIR}) + endif() +endif() + +# Spdlog +if(KOMPUTE_OPT_USE_SPDLOG) + add_compile_definitions(KOMPUTE_OPT_USE_SPDLOG=1) + + if(NOT KOMPUTE_OPT_LOG_LEVEL_DISABLED) + if(KOMPUTE_OPT_USE_BUILT_IN_SPDLOG) + set(SPDLOG_INSTALL ${KOMPUTE_OPT_INSTALL}) + set(SPDLOG_BUILD_SHARED ${BUILD_SHARED_LIBS}) + + FetchContent_Declare(spdlog GIT_REPOSITORY https://github.com/gabime/spdlog.git + GIT_TAG v1.10.0) # Source: https://github.com/gabime/spdlog/releases + FetchContent_MakeAvailable(spdlog) + else() + find_package(spdlog REQUIRED) endif() endif() endif() -if(KOMPUTE_OPT_INSTALL) - # Enable install parameters for fmt (overrides parameters passed) - set(FMT_INSTALL ON CACHE BOOL "Enables install of fmt" FORCE) +# fmt +if(KOMPUTE_OPT_USE_BUILT_IN_FMT) + set(FMT_INSTALL ${KOMPUTE_OPT_INSTALL}) + FetchContent_Declare(fmt GIT_REPOSITORY https://github.com/fmtlib/fmt.git + GIT_TAG 8.1.1) # Source: https://github.com/fmtlib/fmt/releases + FetchContent_MakeAvailable(fmt) +else() + find_package(fmt REQUIRED) endif() +# GoogleTest +if(KOMPUTE_OPT_BUILD_TESTS) + if(KOMPUTE_OPT_USE_BUILT_IN_GOOGLE_TEST) + FetchContent_Declare(googletest GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.11.0) # Source: https://github.com/google/googletest/releases + + # Use a shared C runtime in case we build shared + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + FetchContent_MakeAvailable(googletest) + + add_library(gtest_int INTERFACE) + target_link_libraries(gtest_int INTERFACE gtest) + target_include_directories(gtest_int INTERFACE ${googletest_SOURCE_DIR}/include) + + add_library(GTest::GTest ALIAS gtest_int) + + # Group under the "tests/gtest" project folder in IDEs such as Visual Studio. + set_property(TARGET gtest PROPERTY FOLDER "tests/gtest") + set_property(TARGET gtest_main PROPERTY FOLDER "tests/gtest") + else() + find_package(GTest CONFIG REQUIRED) + endif() +endif() + +# pybind11 +if(KOMPUTE_OPT_BUILD_PYTHON) + if(KOMPUTE_OPT_USE_BUILT_IN_PYBIND11) + FetchContent_Declare(pybind GIT_REPOSITORY https://github.com/pybind/pybind11.git + GIT_TAG v2.9.2) # Source: https://github.com/pybind/pybind11/releases + FetchContent_MakeAvailable(pybind) + else() + find_package(pybind11 REQUIRED) + endif() + + find_package(PythonLibs REQUIRED) +endif() + +# #################################################### +# Preprocessor Macros +# #################################################### if(KOMPUTE_OPT_ANDROID_BUILD) - set(KOMPUTE_EXTRA_CXX_FLAGS "${KOMPUTE_EXTRA_CXX_FLAGS} -DVK_USE_PLATFORM_ANDROID_KHR") + add_compile_definitions(VK_USE_PLATFORM_ANDROID_KHR=1) endif() if(KOMPUTE_OPT_BUILD_PYTHON) - set(KOMPUTE_EXTRA_CXX_FLAGS "${KOMPUTE_EXTRA_CXX_FLAGS} -DKOMPUTE_BUILD_PYTHON") + add_compile_definitions(KOMPUTE_BUILD_PYTHON=1) endif() if(KOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS) - set(KOMPUTE_EXTRA_CXX_FLAGS "${KOMPUTE_EXTRA_CXX_FLAGS} -DKOMPUTE_DISABLE_VK_DEBUG_LAYERS=1") + add_compile_definitions(KOMPUTE_DISABLE_VK_DEBUG_LAYERS=1) endif() +# #################################################### +# Misc Options +# #################################################### if(KOMPUTE_OPT_INSTALL) # Enable install parameters for glslang (overrides parameters passed) # When install is enabled the glslang libraries become shared set(ENABLE_GLSLANG_INSTALL ON CACHE BOOL "Enables install of glslang" FORCE) - - # By default we enable shared library based installation - if(KOMPUTE_OPT_DEPENDENCIES_SHARED_LIBS) - set(BUILD_SHARED_LIBS ON CACHE BOOL "Enables build of shared libraries" FORCE) - endif() endif() -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1 ${KOMPUTE_EXTRA_CXX_FLAGS} -DUSE_DEBUG_EXTENTIONS") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DRELEASE=1 ${KOMPUTE_EXTRA_CXX_FLAGS}") +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror") +endif() if(KOMPUTE_OPT_CODE_COVERAGE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage --coverage") + if(NOT UNIX) + message(FATAL_ERROR "KOMPUTE_OPT_CODE_COVERAGE can only be enabled in unix based systems due to limitation on gcov.") + endif() - set(CODECOV_DIR - ${CMAKE_CURRENT_BINARY_DIR}/codecov/) - set(CODECOV_DIR_LCOV - ${CODECOV_DIR}lcov/) - set(CODECOV_FILENAME_LCOV_INFO - lcov.info) - set(CODECOV_FILENAME_LCOV_INFO_FULL - lcov_full.info) - set(CODECOV_DIR_HTML - ${CODECOV_DIR}html/) + include(cmake/code_coverage.cmake) endif() # If glslang is cloned, then SPIRV/GlslangToSpv.h will be used instead of glslang/SPIRV/GlslangToSpv.h # As after installation, SPIRV/ header files will be found in glslang/SPIRV/ , more info in #193 if(KOMPUTE_OPT_REPO_SUBMODULE_BUILD) - add_definitions(-DUSE_EXTERNAL_GLSLANG) + add_definitions(-DUSE_EXTERNAL_GLSLANG) endif() # Allow scripts to call main kompute Makefile @@ -100,6 +271,7 @@ endfunction() add_subdirectory(src) if(KOMPUTE_OPT_BUILD_TESTS) + enable_testing() add_subdirectory(test) endif() diff --git a/Makefile b/Makefile index 7e28ea46b..be34230ac 100644 --- a/Makefile +++ b/Makefile @@ -56,17 +56,14 @@ MK_KOMPUTE_EXTRA_CXX_FLAGS ?= "" mk_cmake: cmake \ -Bbuild \ - -DKOMPUTE_EXTRA_CXX_FLAGS=$(MK_KOMPUTE_EXTRA_CXX_FLAGS) \ + -DCMAKE_CXX_FLAGS=$(MK_KOMPUTE_EXTRA_CXX_FLAGS) \ -DCMAKE_BUILD_TYPE=$(MK_BUILD_TYPE) \ -DCMAKE_INSTALL_PREFIX=$(MK_INSTALL_PATH) \ - -DKOMPUTE_OPT_INSTALL=1 \ - -DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=1 \ - -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 \ - -DKOMPUTE_OPT_CODE_COVERAGE=1 \ + -DKOMPUTE_OPT_INSTALL=ON \ + -DKOMPUTE_OPT_BUILD_TESTS=ON \ + -DKOMPUTE_OPT_BUILD_DOCS=ON \ + -DKOMPUTE_OPT_BUILD_SHADERS=ON \ + -DKOMPUTE_OPT_CODE_COVERAGE=ON \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ $(MK_CMAKE_EXTRA_FLAGS) \ -G "Unix Makefiles" @@ -81,13 +78,16 @@ mk_build_kompute: cmake --build build/. --target kompute --parallel mk_build_tests: - cmake --build build/ --target test_kompute --parallel + cmake --build build/. --target kompute_tests --parallel mk_run_docs: mk_build_docs (cd build/docs/sphinx && python2.7 -m SimpleHTTPServer) +# An alternative would be: ctest -vv --test-dir build/. +# But this is not possible since we need to filter specific tests, not complete executables, which is not possible with ctest. +# https://gitlab.kitware.com/cmake/cmake/-/issues/13168 mk_run_tests: mk_build_tests - ./build/test/test_kompute --gtest_filter=$(FILTER_TESTS) + ./build/bin/kompute_tests --gtest_filter=$(FILTER_TESTS) mk_build_swiftshader_library: git clone https://github.com/google/swiftshader || echo "Assuming already cloned" @@ -104,7 +104,7 @@ mk_run_tests_cpu: mk_build_swiftshader_library mk_build_tests mk_run_tests_cpu_o VS_BUILD_TYPE ?= "Debug" # Run with multiprocessin / parallel build by default VS_CMAKE_EXTRA_FLAGS ?= "" -VS_KOMPUTE_EXTRA_CXX_FLAGS ?= "/MT" # /MP is for faster multiprocessing builds. You should add "/MT" for submodule builds for compatibility with gtest +VS_KOMPUTE_EXTRA_CXX_FLAGS ?= "" VS_INSTALL_PATH ?= "build/src/CMakeFiles/Export/" # Set to "" if prefer default vs_cmake: @@ -112,38 +112,36 @@ vs_cmake: -Bbuild \ $(VS_CMAKE_EXTRA_FLAGS) \ -DCMAKE_TOOLCHAIN_FILE=$(VCPKG_WIN_PATH) \ - -DKOMPUTE_EXTRA_CXX_FLAGS=$(VS_KOMPUTE_EXTRA_CXX_FLAGS) \ + -DCMAKE_CXX_FLAGS=$(VS_KOMPUTE_EXTRA_CXX_FLAGS) \ -DCMAKE_INSTALL_PREFIX=$(VS_INSTALL_PATH) \ - -DKOMPUTE_OPT_INSTALL=1 \ - -DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=1 \ - -DKOMPUTE_OPT_BUILD_TESTS=1 \ - -DKOMPUTE_OPT_BUILD_SHADERS=1 \ - -DKOMPUTE_OPT_BUILD_SINGLE_HEADER=1 \ - -DKOMPUTE_OPT_ENABLE_SPDLOG=1 \ - -DKOMPUTE_OPT_CODE_COVERAGE=0 \ - -DKOMPUTE_OPT_BUILD_DOCS=0 \ - -G "Visual Studio 16 2019" + -DKOMPUTE_OPT_INSTALL=ON \ + -DKOMPUTE_OPT_BUILD_TESTS=ON \ + -DKOMPUTE_OPT_BUILD_SHADERS=ON \ + -DKOMPUTE_OPT_CODE_COVERAGE=OFF \ + -DKOMPUTE_OPT_BUILD_DOCS=OFF \ + -G "Visual Studio 16 2019" \ + -DCMAKE_BUILD_TYPE=$(VS_BUILD_TYPE) vs_build_all: - $(MSBUILD_BIN) build/kompute.sln -p:Configuration$(VS_BUILD_TYPE) + cmake --build build/. --parallel vs_build_docs: - $(MSBUILD_BIN) build/docs/gendocsall.vcxproj -p:Configuration=$(VS_BUILD_TYPE) + cmake --build build/. --target gendocsall --parallel vs_install_kompute: - $(MSBUILD_BIN) build/src/INSTALL.vcxproj -p:Configuration=$(VS_BUILD_TYPE) + cmake --build build/. --target install --parallel vs_build_kompute: - $(MSBUILD_BIN) build/src/kompute.vcxproj -p:Configuration=$(VS_BUILD_TYPE) + cmake --build build/. --target kompute --parallel vs_build_tests: - $(MSBUILD_BIN) build/test/test_kompute.vcxproj -p:Configuration=$(VS_BUILD_TYPE) + cmake --build build/. --target kompute_tests --parallel vs_run_docs: vs_build_docs (cd build/docs/sphinx && python2.7 -m SimpleHTTPServer) vs_run_tests: vs_build_tests - ./build/test/$(VS_BUILD_TYPE)/test_kompute.exe --gtest_filter=$(FILTER_TESTS) + ./build/test/$(VS_BUILD_TYPE)/bin/kompute_tests.exe --gtest_filter=$(FILTER_TESTS) #### PYTHONG #### @@ -163,7 +161,7 @@ run_ci: generate_python_docstrings: python -m pybind11_mkdoc \ -o python/src/docstrings.hpp \ - single_include/kompute/Kompute.hpp \ + kompute/Kompute.hpp \ -Iexternal/fmt/include/ \ -Iexternal/spdlog/include/ \ -Iexternal/glslang/ \ diff --git a/cmake/bin2h.cmake b/cmake/bin2h.cmake new file mode 100644 index 000000000..21ad56cb1 --- /dev/null +++ b/cmake/bin2h.cmake @@ -0,0 +1,106 @@ +################################################################################## +# Based on: https://github.com/sivachandran/cmake-bin2h +# +# Copyright 2020 Sivachandran Paramasivam +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +################################################################################## + +include(CMakeParseArguments) + +# Function to wrap a given string into multiple lines at the given column position. +# Parameters: +# VARIABLE - The name of the CMake variable holding the string. +# AT_COLUMN - The column position at which string will be wrapped. +function(WRAP_STRING) + set(oneValueArgs VARIABLE AT_COLUMN) + cmake_parse_arguments(WRAP_STRING "${options}" "${oneValueArgs}" "" ${ARGN}) + + string(LENGTH ${${WRAP_STRING_VARIABLE}} stringLength) + math(EXPR offset "0") + + while(stringLength GREATER 0) + + if(stringLength GREATER ${WRAP_STRING_AT_COLUMN}) + math(EXPR length "${WRAP_STRING_AT_COLUMN}") + else() + math(EXPR length "${stringLength}") + endif() + + string(SUBSTRING ${${WRAP_STRING_VARIABLE}} ${offset} ${length} line) + set(lines "${lines}\n${line}") + + math(EXPR stringLength "${stringLength} - ${length}") + math(EXPR offset "${offset} + ${length}") + endwhile() + + set(${WRAP_STRING_VARIABLE} "${lines}" PARENT_SCOPE) +endfunction() + +# Function to embed contents of a file as byte array in C/C++ header file(.h). The header file +# will contain a byte array and integer variable holding the size of the array. +# Parameters +# SOURCE_FILE - The path of source file whose contents will be embedded in the header file. +# VARIABLE_NAME - The name of the variable for the byte array. The string "_SIZE" will be append +# to this name and will be used a variable name for size variable. +# HEADER_FILE - The path of header file. +# APPEND - If specified appends to the header file instead of overwriting it +# NULL_TERMINATE - If specified a null byte(zero) will be append to the byte array. This will be +# useful if the source file is a text file and we want to use the file contents +# as string. But the size variable holds size of the byte array without this +# null byte. +# HEADER_NAMESPACE - The namespace, where the array should be located in. +# IS_BIG_ENDIAN - If set to true, will not revers the byte order for the uint32_t to match the +# big endian system architecture +# Usage: +# bin2h(SOURCE_FILE "Logo.png" HEADER_FILE "Logo.h" VARIABLE_NAME "LOGO_PNG") +function(BIN2H) + set(options APPEND NULL_TERMINATE) + set(oneValueArgs SOURCE_FILE VARIABLE_NAME HEADER_FILE) + cmake_parse_arguments(BIN2H "${options}" "${oneValueArgs}" "" ${ARGN}) + + # reads source file contents as hex string + file(READ ${BIN2H_SOURCE_FILE} hexString HEX) + string(LENGTH ${hexString} hexStringLength) + + # appends null byte if asked + if(BIN2H_NULL_TERMINATE) + set(hexString "${hexString}00") + endif() + + # wraps the hex string into multiple lines at column 32(i.e. 16 bytes per line) + wrap_string(VARIABLE hexString AT_COLUMN 32) + math(EXPR arraySize "${hexStringLength} / 8") + + # adds '0x' prefix and comma suffix before and after every byte respectively + if(IS_BIG_ENDIAN) + message(STATUS "Interpreting shader in big endian...") + string(REGEX REPLACE "([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])" "0x\\1\\2\\3\\4, " arrayValues ${hexString}) + else() + message(STATUS "Interpreting shader in little endian...") + string(REGEX REPLACE "([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])" "0x\\4\\3\\2\\1, " arrayValues ${hexString}) + endif() + # removes trailing comma + string(REGEX REPLACE ", $" "" arrayValues ${arrayValues}) + + # converts the variable name into proper C identifier + string(MAKE_C_IDENTIFIER "${BIN2H_VARIABLE_NAME}" BIN2H_VARIABLE_NAME) + string(TOUPPER "${BIN2H_VARIABLE_NAME}" BIN2H_VARIABLE_NAME) + + # declares byte array and the length variables + set(namespaceStart "namespace ${HEADER_NAMESPACE} {") + set(namespaceEnd "} // namespace ${HEADER_NAMESPACE}") + set(arrayIncludes "#pragma once\n#include \n#include ") + set(arrayDefinition "const std::array ${BIN2H_VARIABLE_NAME} = { ${arrayValues} };") + + set(declarations "${arrayIncludes}\n\n${namespaceStart}\n${arrayDefinition}\n${namespaceEnd}\n\n") + if(BIN2H_APPEND) + file(APPEND ${BIN2H_HEADER_FILE} "${declarations}") + else() + file(WRITE ${BIN2H_HEADER_FILE} "${declarations}") + endif() +endfunction() \ No newline at end of file diff --git a/cmake/bin_file_to_header.cmake b/cmake/bin_file_to_header.cmake new file mode 100644 index 000000000..b47b36139 --- /dev/null +++ b/cmake/bin_file_to_header.cmake @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.20) + +if(${INPUT_SHADER_FILE} STREQUAL "") + message(FATAL_ERROR "No input file path provided via 'INPUT_SHADER_FILE'.") +endif() + +if(${OUTPUT_HEADER_FILE} STREQUAL "") + message(FATAL_ERROR "No output file path provided via 'OUTPUT_HEADER_FILE'.") +endif() + +if(${HEADER_NAMESPACE} STREQUAL "") + message(FATAL_ERROR "No header namespace provided via 'HEADER_NAMESPACE'.") +endif() + +include(bin2h.cmake) + +get_filename_component(BINARY_FILE_CONTENT ${INPUT_SHADER_FILE} NAME) +bin2h(SOURCE_FILE ${INPUT_SHADER_FILE} HEADER_FILE ${OUTPUT_HEADER_FILE} VARIABLE_NAME ${BINARY_FILE_CONTENT} HEADER_NAMESPACE ${HEADER_NAMESPACE}) +file(APPEND ${OUTPUT_HEADER_FILE} "\n") \ No newline at end of file diff --git a/cmake/check_vulkan_version.cmake b/cmake/check_vulkan_version.cmake new file mode 100644 index 000000000..56d8c44f7 --- /dev/null +++ b/cmake/check_vulkan_version.cmake @@ -0,0 +1,139 @@ +# Current issue: Only checks the result of GPU0 +function(check_vulkan_version) + cmake_parse_arguments(VULKAN_CHECK_VERSION "" "INCLUDE_DIR" "" ${ARGN}) + message(STATUS "Ensuring the currently installed driver supports the Vulkan version requested by the Vulkan Header.") + + # Get the current Vulkan Header version (e.g. 1.2.189). + # This snippet is based on: https://gitlab.kitware.com/cmake/cmake/-/blob/v3.23.1/Modules/FindVulkan.cmake#L140-156 + if(VULKAN_CHECK_VERSION_INCLUDE_DIR) + set(VULKAN_CORE_H ${VULKAN_CHECK_VERSION_INCLUDE_DIR}/vulkan/vulkan_core.h) + if(EXISTS ${VULKAN_CORE_H}) + file(STRINGS ${VULKAN_CORE_H} VULKAN_HEADER_VERSION_LINE REGEX "^#define VK_HEADER_VERSION ") + string(REGEX MATCHALL "[0-9]+" VULKAN_HEADER_VERSION "${VULKAN_HEADER_VERSION_LINE}") + file(STRINGS ${VULKAN_CORE_H} VULKAN_HEADER_VERSION_LINE2 REGEX "^#define VK_HEADER_VERSION_COMPLETE ") + if(${VULKAN_HEADER_VERSION_LINE2}) + string(REGEX MATCHALL "[0-9]+" VULKAN_HEADER_VERSION2 "${VULKAN_HEADER_VERSION_LINE2}") + list(LENGTH VULKAN_HEADER_VERSION2 _len) + # Versions >= 1.2.175 have an additional numbers in front of e.g. '0, 1, 2' instead of '1, 2' + if(_len EQUAL 3) + list(REMOVE_AT VULKAN_HEADER_VERSION2 0) + endif() + list(APPEND VULKAN_HEADER_VERSION2 ${VULKAN_HEADER_VERSION}) + list(JOIN VULKAN_HEADER_VERSION2 "." VULKAN_HEADER_VERSION) + else() + file(STRINGS ${VULKAN_CORE_H} VULKAN_HEADER_API_VERSION_1_2 REGEX "^#define VK_API_VERSION_1_2.*") + if(NOT ${VULKAN_HEADER_API_VERSION_1_2} STREQUAL "") + set(VULKAN_HEADER_VERSION "1.2.${VULKAN_HEADER_VERSION}") + else() + file(STRINGS ${VULKAN_CORE_H} VULKAN_HEADER_API_VERSION_1_1 REGEX "^#define VK_API_VERSION_1_1.*") + if(NOT ${VULKAN_HEADER_API_VERSION_1_1} STREQUAL "") + set(VULKAN_HEADER_VERSION "1.1.${VULKAN_HEADER_VERSION}") + else() + message(FATAL_ERROR "'${VULKAN_CORE_H}' does not contain a supported Vulkan version. Probably because its < 1.2.0.") + endif() + endif() + endif() + else() + message(FATAL_ERROR "'${VULKAN_CORE_H}' does not exist. Try calling 'find_package(Vulkan REQUIRED)' before you call this function or set 'Vulkan_INCLUDE_DIR' manually!") + return() + endif() + else() + message(FATAL_ERROR "Invalid Vulkan include directory given. Try calling 'find_package(Vulkan REQUIRED)' before you call this function or set 'Vulkan_INCLUDE_DIR' manually!") + return() + endif() + message(STATUS "Found Vulkan Header version: ${VULKAN_HEADER_VERSION}") + + # Get Vulkan version supported by driver + find_program(VULKAN_INFO_PATH NAMES vulkaninfo) + if(VULKAN_INFO_PATH STREQUAL "VULKAN_INFO_PATH-NOTFOUND") + message(FATAL_ERROR "vulkaninfo not found. The Vulkan SDK might not be installed properly. If you know what you are doing, you can disable the Vulkan version check by setting 'KOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK' to 'ON' (-DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON).") + return() + endif() + + execute_process(COMMAND "vulkaninfo" + OUTPUT_VARIABLE VULKAN_INFO_OUTPUT + RESULT_VARIABLE VULKAN_INFO_RETURN) + if(NOT ${VULKAN_INFO_RETURN} EQUAL 0) + message(FATAL_ERROR "Running vulkaninfo failed with return code ${VULKAN_INFO_RETURN}. Make sure you have 'vulkan-tools' installed. Result:\n${VULKAN_INFO_OUTPUT}?") + return() + else() + message(STATUS "Running vulkaninfo was successful. Parsing the output...") + endif() + + # Check if running vulkaninfo was successfully + string(FIND "${VULKAN_INFO_OUTPUT}" "Vulkan Instance Version" VULKAN_INFO_SUCCESSFUL) + if(VULKAN_INFO_SUCCESSFUL LESS 0) + message(FATAL_ERROR "Running vulkaninfo failed. Make sure you have 'vulkan-tools' installed and DISPLAY is configured. If you know what you are doing, you can disable the Vulkan version check by setting 'KOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK' to 'ON' (-DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON). Result:\n${VULKAN_INFO_OUTPUT}?") + endif() + + string(REGEX MATCHALL "(GPU[0-9]+)" GPU_IDS "${VULKAN_INFO_OUTPUT}") + if(NOT GPU_IDS) + message(FATAL_ERROR "No GPU supporting Vulkan found in vulkaninfo. Does your GPU (driver) support Vulkan?") + endif() + + string(REGEX MATCHALL "apiVersion[ ]*=[ ]*[0-9a-fA-F]+[ ]+[(]([0-9]+[.][0-9]+[.][0-9]+)[)]" GPU_API_VERSIONS ${VULKAN_INFO_OUTPUT}) + if(NOT GPU_API_VERSIONS) + message(FATAL_ERROR "No valid Vulkan API version found in vulkaninfo. Does your GPU (driver) support Vulkan?") + endif() + + # Check length + # message(FATAL_ERROR "GPUS: ${GPU_IDS}") + list(LENGTH GPU_IDS GPU_IDS_LENGTH) + list(LENGTH GPU_API_VERSIONS GPU_API_VERSIONS_LENGTH) + if(NOT ${GPU_IDS_LENGTH} EQUAL ${GPU_API_VERSIONS_LENGTH}) + message(FATAL_ERROR "Found ${GPU_IDS_LENGTH} GPUs, but ${GPU_API_VERSIONS_LENGTH} API versions in vulkaninfo. We expected to find an equal amount of them.") + endif() + + # Compare versions + set(VALID_GPU "") + set(VALID_VULKAN_VERSION "") + math(EXPR ITER_LEN "${GPU_IDS_LENGTH} - 1") + foreach(INDEX RANGE ${ITER_LEN}) + list(GET GPU_IDS ${INDEX} GPU) + list(GET GPU_API_VERSIONS ${INDEX} API_VERSION) + + # Extract API version + if(${API_VERSION} MATCHES "apiVersion[ ]*=[ ]*[0-9a-fA-F]+[ ]+[(]([0-9]+[.][0-9]+[.][0-9]+)[)]") + set(VULKAN_DRIVER_VERSION ${CMAKE_MATCH_1}) + else() + message(FATAL_ERROR "API version match failed. This should not have happened...") + endif() + + message(STATUS "${GPU} supports Vulkan API version '${VULKAN_DRIVER_VERSION}'.") + + # Compare driver and header version + if(${VULKAN_DRIVER_VERSION} VERSION_LESS ${VULKAN_HEADER_VERSION}) + # Version missmatch. Let us check if the minor version is the same. + if(${VULKAN_DRIVER_VERSION} MATCHES "[0-9]+[.]([0-9]+)[.][0-9]+") + set(VULKAN_DRIVER_MINOR_VERSION ${CMAKE_MATCH_1}) + else() + message(FATAL_ERROR "Invalid Vulkan driver version '${VULKAN_DRIVER_VERSION}' found. Expected version in the following format: '[0-9]+.[0-9]+.[0-9]+'") + endif() + if(${VULKAN_HEADER_VERSION} MATCHES "[0-9]+[.]([0-9]+)[.][0-9]+") + set(VULKAN_HEADER_MINOR_VERSION ${CMAKE_MATCH_1}) + else() + message(FATAL_ERROR "Invalid Vulkan Header version '${VULKAN_HEADER_VERSION}' found. Expected version in the following format: '[0-9]+.[0-9]+.[0-9]+'") + endif() + + if(${VULKAN_DRIVER_MINOR_VERSION} EQUAL ${VULKAN_HEADER_MINOR_VERSION}) + message(WARNING "Your GPU driver does not support Vulkan > ${VULKAN_DRIVER_VERSION}, but you try to use Vulkan Header ${VULKAN_HEADER_VERSION}. At least your driver supports the same minor version (${VULKAN_DRIVER_MINOR_VERSION}), so this should be fine but keep it in mind in case you encounter any strange behavior.") + set(VALID_GPU ${GPU}) + set(VALID_VULKAN_VERSION ${VULKAN_DRIVER_VERSION}) + break() + else() + message(STATUS "${GPU} does not support Vulkan > ${VULKAN_DRIVER_VERSION}.") + endif() + else() + set(VALID_GPU ${GPU}) + set(VALID_VULKAN_VERSION ${VULKAN_DRIVER_VERSION}) + break() + endif() + endforeach() + + if("${VALID_GPU}" STREQUAL "") + message(FATAL_ERROR "None of your GPUs supports Vulkan Header ${VULKAN_HEADER_VERSION}. Please try updating your driver, or downgrade your Vulkan headers. If you know what you are doing, you can disable the Vulkan version check by setting 'KOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK' to 'ON' (-DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON).") + else() + message("Valid GPU (${VALID_GPU}) for Vulkan header version ${VULKAN_HEADER_VERSION} found. ${VALID_GPU} supports up to Vulkan ${VALID_VULKAN_VERSION}.") + endif() + +endfunction() diff --git a/cmake/code_coverage.cmake b/cmake/code_coverage.cmake new file mode 100644 index 000000000..7fb6ce264 --- /dev/null +++ b/cmake/code_coverage.cmake @@ -0,0 +1,35 @@ +# Code coverage +set(CMAKE_BUILD_TYPE COVERAGE CACHE INTERNAL "Coverage build enabled") +message(STATUS "Enabling gcov support") + +if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(COVERAGE_FLAG "--coverage") +endif() + +set(CMAKE_CXX_FLAGS_COVERAGE + "-g -O0 ${COVERAGE_FLAG} -fprofile-arcs -ftest-coverage" + CACHE STRING "Flags used by the C++ compiler during coverage builds." + FORCE) +set(CMAKE_C_FLAGS_COVERAGE + "-g -O0 ${COVERAGE_FLAG} -fprofile-arcs -ftest-coverage" + CACHE STRING "Flags used by the C compiler during coverage builds." + FORCE) +set(CMAKE_EXE_LINKER_FLAGS_COVERAGE + "" + CACHE STRING "Flags used for linking binaries during coverage builds." + FORCE) +set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE + "" + CACHE STRING "Flags used by the shared libraries linker during coverage builds." + FORCE) + +set(CODECOV_DIR ${CMAKE_CURRENT_BINARY_DIR}/codecov/) +set(CODECOV_DIR_LCOV ${CODECOV_DIR}lcov/) +set(CODECOV_FILENAME_LCOV_INFO lcov.info) +set(CODECOV_FILENAME_LCOV_INFO_FULL lcov_full.info) +set(CODECOV_DIR_HTML ${CODECOV_DIR}html/) + +mark_as_advanced(CMAKE_CXX_FLAGS_COVERAGE + CMAKE_C_FLAGS_COVERAGE + CMAKE_EXE_LINKER_FLAGS_COVERAGE + CMAKE_SHARED_LINKER_FLAGS_COVERAGE) diff --git a/cmake/deprecation_warnings.cmake b/cmake/deprecation_warnings.cmake new file mode 100644 index 000000000..1ed1f4555 --- /dev/null +++ b/cmake/deprecation_warnings.cmake @@ -0,0 +1,15 @@ +if(KOMPUTE_OPT_REPO_SUBMODULE_BUILD) + message(FATAL_ERROR "'KOMPUTE_OPT_REPO_SUBMODULE_BUILD' got replaced by 'KOMPUTE_OPT_USE_BUILT_IN_SPDLOG', 'KOMPUTE_OPT_USE_BUILT_IN_FMT', 'KOMPUTE_OPT_USE_BUILT_IN_GOOGLE_TEST', 'KOMPUTE_OPT_USE_BUILT_IN_PYBIND11' and 'KOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER'. Please use them instead.") +endif() + +if(KOMPUTE_OPT_BUILD_AS_SHARED_LIB) + message(FATAL_ERROR "'KOMPUTE_OPT_BUILD_AS_SHARED_LIB' is deprecated and should not be used. Instead use the default 'BUILD_SHARED_LIBS' CMake switch.") +endif() + +if(KOMPUTE_OPT_BUILD_SINGLE_HEADER) + message(FATAL_ERROR "'KOMPUTE_OPT_BUILD_SINGLE_HEADER' is deprecated and should not be used. The single header will now always be build and can be included via '#include'.") +endif() + +if(KOMPUTE_OPT_ENABLE_SPDLOG) + message(FATAL_ERROR "'KOMPUTE_OPT_ENABLE_SPDLOG' is deprecated and should not be used. It got replaced by 'KOMPUTE_OPT_LOG_LEVEL'. This option can be set to a variety of log levels (e.g. 'Off', 'Trace', 'Debug', 'Default', ...).") +endif() \ No newline at end of file diff --git a/cmake/komputeConfig.cmake.in b/cmake/komputeConfig.cmake.in new file mode 100644 index 000000000..87e8a99e2 --- /dev/null +++ b/cmake/komputeConfig.cmake.in @@ -0,0 +1,8 @@ +include(CMakeFindDependencyMacro) +@PACKAGE_INIT@ + +find_dependency(VULKAN REQUIRED) + +include(${CMAKE_CURRENT_LIST_DIR}/komputeTargets.cmake) + +check_required_components(kompute) \ No newline at end of file diff --git a/cmake/vulkan_shader_compiler.cmake b/cmake/vulkan_shader_compiler.cmake new file mode 100644 index 000000000..acc27b57c --- /dev/null +++ b/cmake/vulkan_shader_compiler.cmake @@ -0,0 +1,43 @@ +function(vulkan_compile_shader) + find_program(GLS_LANG_VALIDATOR_PATH NAMES glslangValidator) + if(GLS_LANG_VALIDATOR_PATH STREQUAL "GLS_LANG_VALIDATOR_PATH-NOTFOUND") + message(FATAL_ERROR "glslangValidator not found.") + return() + endif() + + cmake_parse_arguments(SHADER_COMPILE "" "INFILE;OUTFILE;NAMESPACE;RELATIVE_PATH" "" ${ARGN}) + set(SHADER_COMPILE_INFILE_FULL "${CMAKE_CURRENT_SOURCE_DIR}/${SHADER_COMPILE_INFILE}") + set(SHADER_COMPILE_SPV_FILE_FULL "${CMAKE_CURRENT_BINARY_DIR}/${SHADER_COMPILE_INFILE}.spv") + set(SHADER_COMPILE_HEADER_FILE_FULL "${CMAKE_CURRENT_BINARY_DIR}/${SHADER_COMPILE_OUTFILE}") + + if(NOT SHADER_COMPILE_RELATIVE_PATH) + set(SHADER_COMPILE_RELATIVE_PATH "${PROJECT_SOURCE_DIR}/cmake") + endif() + + # .comp -> .spv + add_custom_command(OUTPUT "${SHADER_COMPILE_SPV_FILE_FULL}" + COMMAND "${GLS_LANG_VALIDATOR_PATH}" + ARGS "-V" + "${SHADER_COMPILE_INFILE_FULL}" + "-o" + "${SHADER_COMPILE_SPV_FILE_FULL}" + COMMENT "Compile vulkan compute shader from file '${SHADER_COMPILE_INFILE_FULL}' to '${SHADER_COMPILE_SPV_FILE_FULL}'." + MAIN_DEPENDENCY "${SHADER_COMPILE_INFILE_FULL}") + + # Check if big or little endian + include (TestBigEndian) + TEST_BIG_ENDIAN(IS_BIG_ENDIAN) + + # .spv -> .hpp + add_custom_command(OUTPUT "${SHADER_COMPILE_HEADER_FILE_FULL}" + COMMAND ${CMAKE_COMMAND} + ARGS "-DINPUT_SHADER_FILE=${SHADER_COMPILE_SPV_FILE_FULL}" + "-DOUTPUT_HEADER_FILE=${SHADER_COMPILE_HEADER_FILE_FULL}" + "-DHEADER_NAMESPACE=${SHADER_COMPILE_NAMESPACE}" + "-DIS_BIG_ENDIAN=${IS_BIG_ENDIAN}" + "-P" + "${SHADER_COMPILE_RELATIVE_PATH}/bin_file_to_header.cmake" + WORKING_DIRECTORY "${SHADER_COMPILE_RELATIVE_PATH}" + COMMENT "Converting compiled shader '${SHADER_COMPILE_SPV_FILE_FULL}' to header file '${SHADER_COMPILE_HEADER_FILE_FULL}'." + MAIN_DEPENDENCY "${SHADER_COMPILE_SPV_FILE_FULL}") +endfunction() diff --git a/config/FindSphinx.cmake b/config/FindSphinx.cmake index 017ef1724..c645ccc9f 100644 --- a/config/FindSphinx.cmake +++ b/config/FindSphinx.cmake @@ -1,11 +1,15 @@ - -#Look for an executable called sphinx-build +# Look for an executable called sphinx-build find_program(SPHINX_EXECUTABLE - NAMES sphinx-build - DOC "Path to sphinx-build executable") + NAMES sphinx-build + DOC "Path to sphinx-build executable") + +if(SPHINX_EXECUTABLE STREQUAL "SPHINX_EXECUTABLE-NOTFOUND") + message(FATAL_ERROR "sphinx-build not found.") +endif() include(FindPackageHandleStandardArgs) -#Handle standard arguments to find_package like REQUIRED and QUIET + +# Handle standard arguments to find_package like REQUIRED and QUIET find_package_handle_standard_args( Sphinx "Failed to find sphinx-build executable" diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index c6bb09f4b..53dbdc4b1 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -28,7 +28,7 @@ set(SPHINX_BUILD set(CODECOV_DOCS_DIR ${SPHINX_BUILD}/codecov/) set(CODECOV_DOCS_INDEX_FILE - ${CODECOV_DOCS_DIR}/index.html}) + ${CODECOV_DOCS_DIR}/index.html) # Perform replacement with cmake vars inside Doxifine.in configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY) diff --git a/docs/overview/build-system.rst b/docs/overview/build-system.rst index ddb84ebda..7764ff4ed 100644 --- a/docs/overview/build-system.rst +++ b/docs/overview/build-system.rst @@ -2,13 +2,18 @@ C++ 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. +The recommended approach to build the project is as out-of-source built-in the ``build`` folder. This project uses CMake as build system. For a base build you just have to run: -.. code-block:: +.. code-block:: bash - cmake -Bbuild + git clone https://github.com/KomputeProject/kompute.git + cd kompute + mkdir build + cd build + cmake .. + cmake --build . 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. @@ -20,36 +25,41 @@ This by default configures without any of the extra build tasks (such as buildin * - -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_CODE_COVERAGE=1 - - Enable if you wish to build and run code coverage (must have deps installed which are limited to Windows platform) - * - -DKOMPUTE_OPT_BUILD_DOCS=1 - - Enable if you wish to build the docs (must have docs deps installed) - * - -DKOMPUTE_OPT_BUILD_SHADERS=1 - - Enable if you wish to build the shaders into header files (must have docs deps installed) - * - -DKOMPUTE_OPT_BUILD_SINGLE_HEADER=1 - - Option to build the single header file using "quom" utility - * - -DKOMPUTE_OPT_INSTALL=0 - - Disables the install step in the cmake file (useful for android build) - * - -DKOMPUTE_OPT_BUILD_PYTHON=1 - - Enable to build python bindings (used internally for python package) - * - -DKOMPUTE_OPT_ENABLE_SPDLOG=1 - - Enable to compile with spdlog as the internal logging framework - * - -DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=1 - - Use the submodule repos instead of external packages / manager - * - -DKOMPUTE_OPT_ANDROID_BUILD=1 - - Enables android build which includes and excludes relevant libraries - * - -DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS=1 - - Explicitly disables debug layers even when on debug mode - * - -DKOMPUTE_OPT_DEPENDENCIES_SHARED_LIBS=1 - - Ensures dependencies are referenced as shared libraries for kompute install - * - -DKOMPUTE_OPT_BUILD_AS_SHARED_LIB=1 - - Whether to build Kompute as shared lib instead of static - * - -DKOMPUTE_EXTRA_CXX_FLAGS="..." - - Allows you to pass extra config flags to compiler - + - This is the path for your package manager if you use it such as vcpkg. + * - -DKOMPUTE_OPT_BUILD_TESTS=ON + - Enable if you want to build tests. + * - -DKOMPUTE_OPT_CODE_COVERAGE=ON + - Enable if you want code coverage. + * - -DKOMPUTE_OPT_BUILD_DOCS=ON + - Enable if you want to build documentation. + * - -DKOMPUTE_OPT_INSTALL=ON + - Enable if you want to enable installation. + * - -DKOMPUTE_OPT_BUILD_PYTHON=ON + - Enable if you want to build python bindings. + * - -DKOMPUTE_OPT_LOG_LEVEL="Default" + - Internally we use Spdlog or fmt for logging, depending on the value of 'KOMPUTE_OPT_USE_SPDLOG'. The log level used can be changed here. Possible values: 'Trace', 'Debug', 'Info', 'Warn', 'Error', 'Critical', 'Off', 'Default'. If set to 'Off' logging will be deactivated completely. If set to 'Default', the log level will be set to 'Info' for release builds and 'Debug' else. + * - -DKOMPUTE_OPT_USE_SPDLOG=OFF + - If enabled, logging via KP_LOG_ will happen through Spdlog instead of plan fmt. + * - -DKOMPUTE_OPT_ANDROID_BUILD=ON + - Enable android compilation flags required. + * - -DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS=ON + - Explicitly disable debug layers even on debug. + * - -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON + - Whether to check if your driver supports the Vulkan Header version you are linking against. This might be useful in case you build shared on a different system than you run later. + * - -DKOMPUTE_OPT_BUILD_SHADERS=OFF + - Rebuilds all compute shaders during compilation and does not use the already precompiled versions. Requires glslangValidator to be installed on your system. + * - -DKOMPUTE_OPT_USE_BUILT_IN_SPDLOG=ON + - Use the built-in version of Spdlog. Requires 'KOMPUTE_OPT_USE_SPDLOG' to be set to ON in order to have any effect. + * - -DKOMPUTE_OPT_USE_BUILT_IN_FMT=ON + - Use the built-in version of fmt. + * - -DKOMPUTE_OPT_USE_BUILT_IN_GOOGLE_TEST=ON + - Use the built-in version of GoogleTest. + * - -DKOMPUTE_OPT_USE_BUILT_IN_PYBIND11=ON + - Use the built-in version of pybind11. + * - -DKOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER=OFF + - Use the built-in version of Vulkan Headers. This could be helpful in case your system Vulkan Headers are too new for your driver. If you set this to OFF, please make sure your system Vulkan Headers are supported by your driver. + * - -DKOMPUTE_OPT_BUILT_IN_VULKAN_HEADER_TAG="v1.2.203" + - The git tag used for the built-in Vulkan Headers when 'KOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER' is enabled. A list of tags can be found here: https://github.com/KhronosGroup/Vulkan-Headers/tags Compile Flags ~~~~~~~~~~~~~ @@ -61,27 +71,7 @@ Compile Flags - 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 kompute api - * - -DKOMPUTE_VK_API_MAJOR_VERSION=1 - - Major version to use for the Vulkan SDK - * - -DKOMPUTE_VK_API_MINOR_VERSION=1 - - Minor version to use for the Vulkan SDK - * - -DKOMPUTE_ENABLE_SPDLOG=1 - - Enables the build with SPDLOG and FMT dependencies (must be installed) - * - -DKOMPUTE_LOG_OVERRIDE=1 - - Does not define the SPDLOG_\ :raw-html-m2r:`` macros if these are to be overridden - * - -DKOMPUTE_LOG_LEVEL - - The level for the log level on compile level (also sets spdlog level if 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 SDK Layers, mainly used for android builds - + Other CMake Flags ~~~~~~~~~~~~~~~~~ @@ -106,21 +96,3 @@ Required dependencies ~~~~~~~~~~~~~~~~~~~~~ The only required dependency in the build is the Vulkan SDK. 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 `_. - -Optional dependencies -~~~~~~~~~~~~~~~~~~~~~ - -SPDLOG is the preferred logging library, however by default 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 - #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);``. diff --git a/docs/overview/shaders-to-headers.rst b/docs/overview/shaders-to-headers.rst index 77d46ddc4..9b8419a13 100644 --- a/docs/overview/shaders-to-headers.rst +++ b/docs/overview/shaders-to-headers.rst @@ -1,10 +1,10 @@ Processing Shaders with Kompute -===================== +=============================== Demo / testing function to compile shaders ----------------------------------- +------------------------------------------ GLSLANG was initially integrated as part of the framework but it now has been removed due to the license of the glslang pre-processor being under a custom NVIDIA license which explicitly excludes grant of any licenses to NVIDIA's patents in the preprocessor. This is covered in more detail here: https://github.com/KomputeProject/kompute/pull/235 @@ -29,9 +29,8 @@ For users that are looking to quickly test the processors it is possible to use return {(uint32_t*)buffer.data(), (uint32_t*)(buffer.data() + buffer.size())}; } - Converting Shaders into C / C++ Header Files ----------------------------------- +-------------------------------------------- Kompute allows for shaders to be loaded directly through the :class:`kp::OpAlgoBase` as either raw strings (through shaderc) or compiled SPIRV bytes. For this latter, the traditional method of including the SPIRV bytes is by loading the SPIRV file directly and passing the contents. @@ -69,9 +68,64 @@ You can run `python3 scripts/convert_shaders.py --help` to see all the options a -c, --header-path TEXT The (optional) output file for the cpp header files - -v, --verbose Enable versbosity if flag is provided + -v, --verbose Enable verbosity if flag is provided --help Show this message and exit. You can see the command that converts the shaders `in the makefile `_ to get an idea of how you would be able to use this utility. +Compiling Shaders Using CMake +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you are using CMake as build system you can use CMake to directly convert your compute shaders into C++ header files. + +.. code-block:: cmake + :linenos: + + # Consume Kompute via CMake fetch_content + include(FetchContent) + FetchContent_Declare(kompute GIT_REPOSITORY https://github.com/KomputeProject/kompute.git + GIT_TAG f4d72e2aa7b23ffe05d5ea3191bf72ad00def0ec) # The commit hash for a dev version before v0.9.0. Replace with the latest from: https://github.com/KomputeProject/kompute/releases + FetchContent_MakeAvailable(kompute) + include_directories(${kompute_SOURCE_DIR}/src/include) + + # Add to the list, so CMake can later find the code to compile shaders to header files + list(APPEND CMAKE_PREFIX_PATH "${kompute_SOURCE_DIR}/cmake") + + # To add more shaders simply copy the vulkan_compile_shader command and replace it with your new shader + vulkan_compile_shader(INFILE my_shader.comp + OUTFILE my_shader.hpp + NAMESPACE "shader" + RELATIVE_PATH "${kompute_SOURCE_DIR}/cmake") + + # vulkan_compile_shader(INFILE my_shader2.comp + # OUTFILE my_shader2.hpp + # NAMESPACE "shader" + # RELATIVE_PATH "${kompute_SOURCE_DIR}/cmake") + + # Then add it to the library, so you can access it later in your code + add_library(shader INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/my_shader.hpp" + # "${CMAKE_CURRENT_BINARY_DIR}/my_shader2.hpp" + ) + + target_include_directories(shader INTERFACE $) + +Once your code then compiles, you can simply include and use your shader header files. + +.. code-block:: cpp + :linenos: + + #include + + #include "my_shader.hpp" + + int main() { + // [...] + + const std::vector> params = ... + + const std::vector shader = std::vector(shader::MY_SHADER_COMP_SPV.begin(), shader::MY_SHADER_COMP_SPV.end()); + std::shared_ptr algo = mgr.algorithm(params, shader); + + // [...] + } diff --git a/examples/android/android-simple/README.md b/examples/android/android-simple/README.md index 23678e520..8ef2e21fe 100644 --- a/examples/android/android-simple/README.md +++ b/examples/android/android-simple/README.md @@ -12,9 +12,9 @@ This is the accompanying code for the Blog post ["Supercharging your Mobile Apps

This example provides an end to end example that can be run using android studio. -The example uses the Kompute build in the relative folder to build the respective binaries for android. +The example uses the Kompute built-in the relative folder to build the respective binaries for android. -The build structure provides a range of options to build in different Android hardware. This example was tested in various emulators including Pixel 2, and a physical Samsung S7 phone. +The build structure provides a range of options to built-in different Android hardware. This example was tested in various emulators including Pixel 2, and a physical Samsung S7 phone.


diff --git a/examples/android/android-simple/app/build.gradle b/examples/android/android-simple/app/build.gradle index 146bb4163..d49860eb2 100644 --- a/examples/android/android-simple/app/build.gradle +++ b/examples/android/android-simple/app/build.gradle @@ -3,29 +3,25 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 29 - ndkVersion '21.2.6472646' + compileSdkVersion 33 + ndkVersion '25.1.8937393' defaultConfig { applicationId "com.ethicalml.kompute" - minSdkVersion 23 - targetSdkVersion 29 + minSdkVersion 26 + targetSdkVersion 33 versionCode = 1 versionName = "0.0.1" externalNativeBuild { cmake { - abiFilters "armeabi-v7a", 'arm64-v8a', 'x86', 'x86_64' arguments '-DANDROID_TOOLCHAIN=clang', - '-DANDROID_STL=c++_static', - '-DKOMPUTE_OPT_ANDROID_BUILD=1', - '-DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=1', - '-DKOMPUTE_OPT_INSTALL=0', - '-DKOMPUTE_OPT_ENABLE_SPDLOG=0', - '-DKOMPUTE_OPT_BUILD_SINGLE_HEADER=0', - '-DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS=1', - '-DKOMPUTE_EXTRA_CXX_FLAGS=-DKOMPUTE_VK_API_MINOR_VERSION=0' + '-DANDROID_STL=c++_static' } } + ndk { + abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' + } + } buildFeatures { @@ -41,6 +37,7 @@ android { externalNativeBuild { cmake { path 'src/main/cpp/CMakeLists.txt' + version '3.22.2' } } @@ -64,6 +61,7 @@ android { // armeabi-v7a, arm64-v8a, x86, x86_64 } } + namespace 'com.ethicalml.kompute' } dependencies { diff --git a/examples/android/android-simple/app/src/main/AndroidManifest.xml b/examples/android/android-simple/app/src/main/AndroidManifest.xml index 4965abb44..8e8beb56c 100755 --- a/examples/android/android-simple/app/src/main/AndroidManifest.xml +++ b/examples/android/android-simple/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ - + - + diff --git a/examples/android/android-simple/app/src/main/cpp/CMakeLists.txt b/examples/android/android-simple/app/src/main/cpp/CMakeLists.txt index 868be9ca7..e55114e6e 100644 --- a/examples/android/android-simple/app/src/main/cpp/CMakeLists.txt +++ b/examples/android/android-simple/app/src/main/cpp/CMakeLists.txt @@ -1,27 +1,22 @@ -cmake_minimum_required(VERSION 3.4.1) +cmake_minimum_required(VERSION 3.20) -add_subdirectory(../../../../../../../ ${CMAKE_CURRENT_BINARY_DIR}/kompute_build) +set(CMAKE_CXX_STANDARD 17) -set(VK_ANDROID_INCLUDE_DIR ${ANDROID_NDK}/sources/third_party/vulkan/src/include) +include(FetchContent) +FetchContent_Declare(kompute GIT_REPOSITORY https://github.com/COM8/kompute.git + GIT_TAG 675f6dc771cea044ead99a5467a9b817c2d8feb6) # The commit hash for a dev version before v0.9.0. Replace with the latest from: https://github.com/KomputeProject/kompute/releases +set(KOMPUTE_OPT_ANDROID_BUILD ON) +set(KOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS ON) +FetchContent_MakeAvailable(kompute) +include_directories(${kompute_SOURCE_DIR}/src/include) -add_library(kompute-jni SHARED - KomputeJniNative.cpp - KomputeModelML.cpp) +# Add to the list, so CMake can later find the code to compile shaders to header files +list(APPEND CMAKE_PREFIX_PATH "${kompute_SOURCE_DIR}/cmake") +add_subdirectory(shader) -include_directories( - ${VK_ANDROID_COMMON_DIR} - ${VK_ANDROID_INCLUDE_DIR} - ../../../../../../../single_include/ - ../../../../../../../vk_ndk_wrapper_include/) +add_library(kompute-jni SHARED KomputeJniNative.cpp + KomputeModelML.cpp + KomputeModelML.hpp) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 \ - -DVK_USE_PLATFORM_ANDROID_KHR=1 \ - -DKOMPUTE_DISABLE_VK_DEBUG_LAYERS=1") +target_link_libraries(kompute-jni PRIVATE kompute::kompute shader log android) -target_link_libraries(kompute-jni - # Libraries from kompute build - kompute - kompute_vk_ndk_wrapper - # Libraries from android build - log - android) \ No newline at end of file diff --git a/examples/android/android-simple/app/src/main/cpp/KomputeJniNative.cpp b/examples/android/android-simple/app/src/main/cpp/KomputeJniNative.cpp index 92939c4de..ecbc70c40 100644 --- a/examples/android/android-simple/app/src/main/cpp/KomputeJniNative.cpp +++ b/examples/android/android-simple/app/src/main/cpp/KomputeJniNative.cpp @@ -24,10 +24,7 @@ // Allows us to use the C++ sleep function to wait when loading the // Vulkan library in android #include - -#ifndef KOMPUTE_VK_INIT_RETRIES -#define KOMPUTE_VK_INIT_RETRIES 5 -#endif +#include static std::vector jfloatArrayToVector(JNIEnv* env, const jfloatArray& fromArray) @@ -53,27 +50,6 @@ vectorToJFloatArray(JNIEnv* env, const std::vector& fromVector) extern "C" { - - JNIEXPORT jboolean JNICALL - Java_com_ethicalml_kompute_KomputeJni_initVulkan(JNIEnv* env, jobject thiz) - { - - KP_LOG_INFO("Initialising vulkan"); - - uint32_t totalRetries = 0; - - while (totalRetries < KOMPUTE_VK_INIT_RETRIES) { - KP_LOG_INFO("VULKAN LOAD TRY NUMBER: %u", totalRetries); - if (InitVulkan()) { - break; - } - sleep(1); - totalRetries++; - } - - return totalRetries < KOMPUTE_VK_INIT_RETRIES; - } - JNIEXPORT jfloatArray JNICALL Java_com_ethicalml_kompute_KomputeJni_kompute(JNIEnv* env, jobject thiz, diff --git a/examples/android/android-simple/app/src/main/cpp/KomputeModelML.cpp b/examples/android/android-simple/app/src/main/cpp/KomputeModelML.cpp index 3f674a783..1ff158553 100644 --- a/examples/android/android-simple/app/src/main/cpp/KomputeModelML.cpp +++ b/examples/android/android-simple/app/src/main/cpp/KomputeModelML.cpp @@ -1,5 +1,8 @@ #include "KomputeModelML.hpp" +#include "my_shader.hpp" +#include + KomputeModelML::KomputeModelML() {} @@ -10,7 +13,6 @@ KomputeModelML::train(std::vector yData, std::vector xIData, std::vector xJData) { - std::vector zerosData; for (size_t i = 0; i < yData.size(); i++) { @@ -41,15 +43,11 @@ KomputeModelML::train(std::vector yData, wIn, wOutI, wOutJ, bIn, bOut, lOut }; - std::vector spirv = std::vector( - (uint32_t*)kp::shader_data::shaders_glsl_logisticregression_comp_spv, - (uint32_t*)(kp::shader_data:: - shaders_glsl_logisticregression_comp_spv + - kp::shader_data:: - shaders_glsl_logisticregression_comp_spv_len)); + const std::vector shader = std::vector( + shader::MY_SHADER_COMP_SPV.begin(), shader::MY_SHADER_COMP_SPV.end()); std::shared_ptr algorithm = mgr.algorithm( - params, spirv, kp::Workgroup({ 5 }), std::vector({ 5.0 })); + params, shader, kp::Workgroup({ 5 }), std::vector({ 5.0 })); mgr.sequence()->eval(params); @@ -84,7 +82,6 @@ KomputeModelML::train(std::vector yData, std::vector KomputeModelML::predict(std::vector xI, std::vector xJ) { - KP_LOG_INFO("Running prediction inference"); assert(xI.size() == xJ.size()); @@ -113,7 +110,6 @@ KomputeModelML::predict(std::vector xI, std::vector xJ) std::vector KomputeModelML::get_params() { - KP_LOG_INFO("Displaying results"); std::vector retVector; diff --git a/examples/android/android-simple/app/src/main/cpp/KomputeModelML.hpp b/examples/android/android-simple/app/src/main/cpp/KomputeModelML.hpp index 779c6db7f..633877376 100644 --- a/examples/android/android-simple/app/src/main/cpp/KomputeModelML.hpp +++ b/examples/android/android-simple/app/src/main/cpp/KomputeModelML.hpp @@ -1,13 +1,8 @@ -#ifndef KOMPUTEMODELML_HPP -#define KOMPUTEMODELML_HPP +#pragma once -#include -#include #include -#include "kompute/Kompute.hpp" - class KomputeModelML { @@ -27,62 +22,3 @@ class KomputeModelML std::vector mWeights; std::vector mBias; }; - -static std::string LR_SHADER = R"( -#version 450 - -layout (constant_id = 0) const uint M = 0; - -layout (local_size_x = 1) in; - -layout(set = 0, binding = 0) buffer bxi { float xi[]; }; -layout(set = 0, binding = 1) buffer bxj { float xj[]; }; -layout(set = 0, binding = 2) buffer by { float y[]; }; -layout(set = 0, binding = 3) buffer bwin { float win[]; }; -layout(set = 0, binding = 4) buffer bwouti { float wouti[]; }; -layout(set = 0, binding = 5) buffer bwoutj { float woutj[]; }; -layout(set = 0, binding = 6) buffer bbin { float bin[]; }; -layout(set = 0, binding = 7) buffer bbout { float bout[]; }; -layout(set = 0, binding = 8) buffer blout { float lout[]; }; - -float m = float(M); - -float sigmoid(float z) { - return 1.0 / (1.0 + exp(-z)); -} - -float inference(vec2 x, vec2 w, float b) { - // Compute the linear mapping function - float z = dot(w, x) + b; - // Calculate the y-hat with sigmoid - float yHat = sigmoid(z); - return yHat; -} - -float calculateLoss(float yHat, float y) { - return -(y * log(yHat) + (1.0 - y) * log(1.0 - yHat)); -} - -void main() { - uint idx = gl_GlobalInvocationID.x; - - vec2 wCurr = vec2(win[0], win[1]); - float bCurr = bin[0]; - - vec2 xCurr = vec2(xi[idx], xj[idx]); - float yCurr = y[idx]; - - float yHat = inference(xCurr, wCurr, bCurr); - - float dZ = yHat - yCurr; - vec2 dW = (1. / m) * xCurr * dZ; - float dB = (1. / m) * dZ; - wouti[idx] = dW.x; - woutj[idx] = dW.y; - bout[idx] = dB; - - lout[idx] = calculateLoss(yHat, yCurr); -} -)"; - -#endif // ANDROID_SIMPLE_KOMPUTEMODELML_HPP diff --git a/examples/android/android-simple/app/src/main/cpp/shader/CMakeLists.txt b/examples/android/android-simple/app/src/main/cpp/shader/CMakeLists.txt new file mode 100644 index 000000000..684a6a82a --- /dev/null +++ b/examples/android/android-simple/app/src/main/cpp/shader/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.20) + +# To add more shaders simply copy the vulkan_compile_shader command and replace it with your new shader +vulkan_compile_shader(INFILE my_shader.comp + OUTFILE my_shader.hpp + NAMESPACE "shader" + RELATIVE_PATH "${kompute_SOURCE_DIR}/cmake") + +# Then add it to the library, so you can access it later in your code +add_library(shader INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/my_shader.hpp" + + # "${CMAKE_CURRENT_BINARY_DIR}/my_shader2.hpp" +) + +target_include_directories(shader INTERFACE $) diff --git a/examples/android/android-simple/app/src/main/cpp/shader/my_shader.comp b/examples/android/android-simple/app/src/main/cpp/shader/my_shader.comp new file mode 100644 index 000000000..a448dde2e --- /dev/null +++ b/examples/android/android-simple/app/src/main/cpp/shader/my_shader.comp @@ -0,0 +1,54 @@ +#version 450 + +layout (constant_id = 0) const uint M = 0; + +layout (local_size_x = 1) in; + +layout(set = 0, binding = 0) buffer bxi { float xi[]; }; +layout(set = 0, binding = 1) buffer bxj { float xj[]; }; +layout(set = 0, binding = 2) buffer by { float y[]; }; +layout(set = 0, binding = 3) buffer bwin { float win[]; }; +layout(set = 0, binding = 4) buffer bwouti { float wouti[]; }; +layout(set = 0, binding = 5) buffer bwoutj { float woutj[]; }; +layout(set = 0, binding = 6) buffer bbin { float bin[]; }; +layout(set = 0, binding = 7) buffer bbout { float bout[]; }; +layout(set = 0, binding = 8) buffer blout { float lout[]; }; + +float m = float(M); + +float sigmoid(float z) { + return 1.0 / (1.0 + exp(-z)); +} + +float inference(vec2 x, vec2 w, float b) { + // Compute the linear mapping function + float z = dot(w, x) + b; + // Calculate the y-hat with sigmoid + float yHat = sigmoid(z); + return yHat; +} + +float calculateLoss(float yHat, float y) { + return -(y * log(yHat) + (1.0 - y) * log(1.0 - yHat)); +} + +void main() { + uint idx = gl_GlobalInvocationID.x; + + vec2 wCurr = vec2(win[0], win[1]); + float bCurr = bin[0]; + + vec2 xCurr = vec2(xi[idx], xj[idx]); + float yCurr = y[idx]; + + float yHat = inference(xCurr, wCurr, bCurr); + + float dZ = yHat - yCurr; + vec2 dW = (1. / m) * xCurr * dZ; + float dB = (1. / m) * dZ; + wouti[idx] = dW.x; + woutj[idx] = dW.y; + bout[idx] = dB; + + lout[idx] = calculateLoss(yHat, yCurr); +} \ No newline at end of file diff --git a/examples/android/android-simple/app/src/main/java/com/ethicalml/kompute/KomputeJni.kt b/examples/android/android-simple/app/src/main/java/com/ethicalml/kompute/KomputeJni.kt index b68e197eb..3221cf6d5 100755 --- a/examples/android/android-simple/app/src/main/java/com/ethicalml/kompute/KomputeJni.kt +++ b/examples/android/android-simple/app/src/main/java/com/ethicalml/kompute/KomputeJni.kt @@ -22,16 +22,7 @@ class KomputeJni : AppCompatActivity() { binding.komputeGifView.getSettings().setUseWideViewPort(true) binding.komputeGifView.getSettings().setLoadWithOverviewMode(true) - - val successVulkanInit = initVulkan() - if (successVulkanInit) { - Toast.makeText(applicationContext, "Vulkan Loaded SUCCESS", Toast.LENGTH_SHORT).show() - } else { - binding.KomputeButton.isEnabled = false - Toast.makeText(applicationContext, "Vulkan Load FAILED", Toast.LENGTH_SHORT).show() - } - Log.i("KomputeJni", "Vulkan Result: " + successVulkanInit) - + binding.predictionTextView.text = "N/A" } diff --git a/examples/android/android-simple/build.gradle b/examples/android/android-simple/build.gradle index 31a2d163f..6ed042a42 100644 --- a/examples/android/android-simple/build.gradle +++ b/examples/android/android-simple/build.gradle @@ -1,14 +1,14 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.72' + ext.kotlin_version = '1.6.20' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.0.0' + classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/examples/android/android-simple/gradle/wrapper/gradle-wrapper.properties b/examples/android/android-simple/gradle/wrapper/gradle-wrapper.properties index 12582e2e7..cfcf34b60 100644 --- a/examples/android/android-simple/gradle/wrapper/gradle-wrapper.properties +++ b/examples/android/android-simple/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip diff --git a/examples/array_multiplication/CMakeLists.txt b/examples/array_multiplication/CMakeLists.txt index bfc4c1c79..68f9b5ea7 100644 --- a/examples/array_multiplication/CMakeLists.txt +++ b/examples/array_multiplication/CMakeLists.txt @@ -1,40 +1,37 @@ -cmake_minimum_required(VERSION 3.4.1) -project(kompute_array_mult VERSION 0.1.0) +cmake_minimum_required(VERSION 3.20) +project(kompute_array_mult) set(CMAKE_CXX_STANDARD 14) -option(KOMPUTE_ARR_OPT_INSTALLED_KOMPUTE "Enable if you prefer to use your installed Kompute library" 0) -option(KOMPUTE_OPT_ENABLE_SPDLOG "Extra compile flags for Kompute, see docs for full list" 0) -set(KOMPUTE_EXTRA_CXX_FLAGS "" CACHE STRING "Extra compile flags for Kompute, see docs for full list") +# Set a default build type if none was specified +# Based on: https://github.com/openchemistry/tomviz/blob/master/cmake/BuildType.cmake +set(DEFAULT_BUILD_TYPE "Release") -if(KOMPUTE_OPT_ENABLE_SPDLOG) - set(KOMPUTE_EXTRA_CXX_FLAGS "${KOMPUTE_EXTRA_CXX_FLAGS} -DKOMPUTE_ENABLE_SPDLOG=1") +if(EXISTS "${CMAKE_SOURCE_DIR}/.git") + set(DEFAULT_BUILD_TYPE "Debug") endif() -# It is necessary to pass the DEBUG or RELEASE flag accordingly to Kompute -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1 ${KOMPUTE_EXTRA_CXX_FLAGS}") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DRELEASE=1 ${KOMPUTE_EXTRA_CXX_FLAGS}") +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.") + set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE) -if(KOMPUTE_ARR_OPT_INSTALLED_KOMPUTE) - find_package(kompute REQUIRED) -else() - add_subdirectory(../../ ${CMAKE_CURRENT_BINARY_DIR}/kompute_build) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") endif() -find_package(Vulkan REQUIRED) - -add_executable(kompute_array_mult - src/Main.cpp) - -target_link_libraries(kompute_array_mult - kompute::kompute - Vulkan::Vulkan) - -include_directories( - ../../single_include/) - -if(KOMPUTE_OPT_ENABLE_SPDLOG) - target_link_libraries(kompute_array_mult - spdlog::spdlog) +if(WIN32) # Install dlls in the same directory as the executable on Windows + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) endif() +include(FetchContent) +FetchContent_Declare(kompute GIT_REPOSITORY https://github.com/COM8/kompute.git + GIT_TAG f4d72e2aa7b23ffe05d5ea3191bf72ad00def0ec) # The commit hash for a dev version before v0.9.0. Replace with the latest from: https://github.com/KomputeProject/kompute/releases +FetchContent_MakeAvailable(kompute) +include_directories(${kompute_SOURCE_DIR}/src/include) + +# Add to the list, so CMake can later find the code to compile shaders to header files +list(APPEND CMAKE_PREFIX_PATH "${kompute_SOURCE_DIR}/cmake") + +add_subdirectory(shader) +add_subdirectory(src) diff --git a/examples/array_multiplication/README.md b/examples/array_multiplication/README.md index c783e133c..ba6f9cab5 100644 --- a/examples/array_multiplication/README.md +++ b/examples/array_multiplication/README.md @@ -1,31 +1,39 @@ # Kompute Array Multiplication Example This folder contains an end to end Kompute Example that implements logistic regression. - This example is structured such that you will be able to extend it for your project. - -It contains a cmake build configuration that can be used in your production applications. +It contains a CMake build configuration that can be used in your production applications. ## Building the example You will notice that it's a standalone project, so you can re-use it for your application. +It uses CMake's [`fetch_content`](https://cmake.org/cmake/help/latest/module/FetchContent.html) to consume Kompute as a dependency. +To build you just need to run the CMake command in this folder as follows: -This project has the option to either import the Kompute dependency relative to the project or use your existing installation of Kompute. - -To build you just need to run the cmake command in this folder as follows: - -``` -cmake -Bbuild/ \ - -DCMAKE_BUILD_TYPE=Debug \ - -DKOMPUTE_OPT_INSTALL=0 \ - -DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=1 \ - -DKOMPUTE_OPT_ENABLE_SPDLOG=1 +```bash +git clone https://github.com/KomputeProject/kompute.git +cd kompute/examples/array_multiplication +mkdir build +cd build +cmake .. +cmake --build . ``` -You can pass the following optional parameters based on your desired configuration: -* If you wish to install with spdlog support you just have to pass `-DKOMPUTE_OPT_ENABLE_SPDLOG=1`. -* If you are using a package manager such as `vcpkg` make sure you pass the `-DCMAKE_TOOLCHAIN_FILE=` parameter -* If you wish to load shader from raw glsl string instead of spirv bytes you can use `-DKOMPUTE_ANDROID_SHADER_FROM_STRING` +## Executing + +Form inside the `build/` directory run: + +### Linux + +```bash +./kompute_array_mult +``` + +### Windows + +```bash +.\Debug\kompute_array_mult.exe +``` ## Pre-requisites @@ -33,18 +41,5 @@ In order to run this example, you will need the following dependencies: * REQUIRED + The Vulkan SDK must be installed -* OPTIONAL - + Kompute library must be accessible (by default it uses the source directory) - + SPDLOG - for logging - + FMT - for text formatting - -We will cover how you can install Kompute in the next section. For the Vulkan SDK, the simplest way to install it is through [their website](https://vulkan.lunarg.com/sdk/home). You just have to follow the instructions for the relevant platform. - -For the other libraries, because they are optional you can just make sure you build and install Kompute with these disabled (this will be covered in more detail below). - -Alternatively you can use package managers such as vcpkg to help you install them, although to simplify things you can start without the dependencies first. - - - diff --git a/examples/array_multiplication/shader/CMakeLists.txt b/examples/array_multiplication/shader/CMakeLists.txt new file mode 100644 index 000000000..684a6a82a --- /dev/null +++ b/examples/array_multiplication/shader/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.20) + +# To add more shaders simply copy the vulkan_compile_shader command and replace it with your new shader +vulkan_compile_shader(INFILE my_shader.comp + OUTFILE my_shader.hpp + NAMESPACE "shader" + RELATIVE_PATH "${kompute_SOURCE_DIR}/cmake") + +# Then add it to the library, so you can access it later in your code +add_library(shader INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/my_shader.hpp" + + # "${CMAKE_CURRENT_BINARY_DIR}/my_shader2.hpp" +) + +target_include_directories(shader INTERFACE $) diff --git a/examples/array_multiplication/shader/my_shader.comp b/examples/array_multiplication/shader/my_shader.comp new file mode 100644 index 000000000..d4cfe6990 --- /dev/null +++ b/examples/array_multiplication/shader/my_shader.comp @@ -0,0 +1,14 @@ +#version 450 + +// The execution structure +layout (local_size_x = 1) in; + +// The buffers are provided via the tensors +layout(binding = 0) buffer bufA { float a[]; }; +layout(binding = 1) buffer bufB { float b[]; }; +layout(binding = 2) buffer bufOut { float o[]; }; + +void main() { + uint index = gl_GlobalInvocationID.x; + o[index] = a[index] * b[index]; +} \ No newline at end of file diff --git a/examples/array_multiplication/src/CMakeLists.txt b/examples/array_multiplication/src/CMakeLists.txt new file mode 100644 index 000000000..4b85931b1 --- /dev/null +++ b/examples/array_multiplication/src/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.20) + +add_executable(kompute_array_mult main.cpp) +target_link_libraries(kompute_array_mult PRIVATE shader kompute::kompute) diff --git a/examples/array_multiplication/src/Main.cpp b/examples/array_multiplication/src/Main.cpp deleted file mode 100644 index 4ba17cef1..000000000 --- a/examples/array_multiplication/src/Main.cpp +++ /dev/null @@ -1,79 +0,0 @@ - -#include -#include -#include - -#include "kompute/Kompute.hpp" - -static std::vector -compileSource(const std::string& source) -{ - std::ofstream fileOut("tmp_kp_shader.comp"); - fileOut << source; - fileOut.close(); - if (system( - std::string( - "glslangValidator -V tmp_kp_shader.comp -o tmp_kp_shader.comp.spv") - .c_str())) - throw std::runtime_error("Error running glslangValidator command"); - std::ifstream fileStream("tmp_kp_shader.comp.spv", std::ios::binary); - std::vector buffer; - buffer.insert( - buffer.begin(), std::istreambuf_iterator(fileStream), {}); - return { (uint32_t*)buffer.data(), - (uint32_t*)(buffer.data() + buffer.size()) }; -} - -int -main() -{ -#if KOMPUTE_ENABLE_SPDLOG - spdlog::set_level( - static_cast(SPDLOG_ACTIVE_LEVEL)); -#endif - - kp::Manager mgr; - - auto tensorInA = mgr.tensor({ 2.0, 4.0, 6.0 }); - auto tensorInB = mgr.tensor({ 0.0, 1.0, 2.0 }); - auto tensorOut = mgr.tensor({ 0.0, 0.0, 0.0 }); - - std::string shader(R"( - // The version to use - #version 450 - - // The execution structure - layout (local_size_x = 1) in; - - // The buffers are provided via the tensors - layout(binding = 0) buffer bufA { float a[]; }; - layout(binding = 1) buffer bufB { float b[]; }; - layout(binding = 2) buffer bufOut { float o[]; }; - - void main() { - uint index = gl_GlobalInvocationID.x; - - o[index] = a[index] * b[index]; - } - )"); - - std::vector> params = { tensorInA, - tensorInB, - tensorOut }; - - std::shared_ptr algo = - mgr.algorithm(params, compileSource(shader)); - - mgr.sequence() - ->record(params) - ->record(algo) - ->record(params) - ->eval(); - - // prints "Output { 0 4 12 }" - std::cout << "Output: { "; - for (const float& elem : tensorOut->vector()) { - std::cout << elem << " "; - } - std::cout << "}" << std::endl; -} diff --git a/examples/array_multiplication/src/main.cpp b/examples/array_multiplication/src/main.cpp new file mode 100644 index 000000000..56e1c06d2 --- /dev/null +++ b/examples/array_multiplication/src/main.cpp @@ -0,0 +1,41 @@ + +#include +#include +#include + +#include "my_shader.hpp" +#include + +int +main() +{ + kp::Manager mgr; + + std::shared_ptr> tensorInA = + mgr.tensor({ 2.0, 4.0, 6.0 }); + std::shared_ptr> tensorInB = + mgr.tensor({ 0.0, 1.0, 2.0 }); + std::shared_ptr> tensorOut = + mgr.tensor({ 0.0, 0.0, 0.0 }); + + const std::vector> params = { tensorInA, + tensorInB, + tensorOut }; + + const std::vector shader = std::vector( + shader::MY_SHADER_COMP_SPV.begin(), shader::MY_SHADER_COMP_SPV.end()); + std::shared_ptr algo = mgr.algorithm(params, shader); + + mgr.sequence() + ->record(params) + ->record(algo) + ->record(params) + ->eval(); + + // prints "Output { 0 4 12 }" + std::cout << "Output: { "; + for (const float& elem : tensorOut->vector()) { + std::cout << elem << " "; + } + std::cout << "}" << std::endl; +} diff --git a/examples/logistic_regression/CMakeLists.txt b/examples/logistic_regression/CMakeLists.txt index 8c8e0eb8f..899739d97 100644 --- a/examples/logistic_regression/CMakeLists.txt +++ b/examples/logistic_regression/CMakeLists.txt @@ -1,41 +1,37 @@ -cmake_minimum_required(VERSION 3.4.1) -project(kompute_linear_reg VERSION 0.1.0) +cmake_minimum_required(VERSION 3.20) +project(kompute_logistic_regression) set(CMAKE_CXX_STANDARD 14) -option(KOMPUTE_ARR_OPT_INSTALLED_KOMPUTE "Enable if you prefer to use your installed Kompute library" 0) -option(KOMPUTE_OPT_ENABLE_SPDLOG "Extra compile flags for Kompute, see docs for full list" 0) -set(KOMPUTE_EXTRA_CXX_FLAGS "" CACHE STRING "Extra compile flags for Kompute, see docs for full list") +# Set a default build type if none was specified +# Based on: https://github.com/openchemistry/tomviz/blob/master/cmake/BuildType.cmake +set(DEFAULT_BUILD_TYPE "Release") -if(KOMPUTE_OPT_ENABLE_SPDLOG) - set(KOMPUTE_EXTRA_CXX_FLAGS "${KOMPUTE_EXTRA_CXX_FLAGS} -DKOMPUTE_ENABLE_SPDLOG=1") +if(EXISTS "${CMAKE_SOURCE_DIR}/.git") + set(DEFAULT_BUILD_TYPE "Debug") endif() -# It is necessary to pass the DEBUG or RELEASE flag accordingly to Kompute -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1 ${KOMPUTE_EXTRA_CXX_FLAGS}") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DRELEASE=1 ${KOMPUTE_EXTRA_CXX_FLAGS}") +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.") + set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE) -if(KOMPUTE_ARR_OPT_INSTALLED_KOMPUTE) - find_package(kompute REQUIRED) -else() - add_subdirectory(../../ ${CMAKE_CURRENT_BINARY_DIR}/kompute_build) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") endif() -find_package(Vulkan REQUIRED) - -add_executable(kompute_linear_reg - src/Main.cpp) - -target_link_libraries(kompute_linear_reg - kompute::kompute - Vulkan::Vulkan -) - -include_directories( - ../../single_include/) - -if(KOMPUTE_OPT_ENABLE_SPDLOG) - target_link_libraries(kompute_linear_reg - spdlog::spdlog) +if(WIN32) # Install dlls in the same directory as the executable on Windows + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) endif() +include(FetchContent) +FetchContent_Declare(kompute GIT_REPOSITORY https://github.com/COM8/kompute.git + GIT_TAG f4d72e2aa7b23ffe05d5ea3191bf72ad00def0ec) # The commit hash for a dev version before v0.9.0. Replace with the latest from: https://github.com/KomputeProject/kompute/releases +FetchContent_MakeAvailable(kompute) +include_directories(${kompute_SOURCE_DIR}/src/include) + +# Add to the list, so CMake can later find the code to compile shaders to header files +list(APPEND CMAKE_PREFIX_PATH "${kompute_SOURCE_DIR}/cmake") + +add_subdirectory(shader) +add_subdirectory(src) diff --git a/examples/logistic_regression/README.md b/examples/logistic_regression/README.md index 9f21968ff..204180f0a 100644 --- a/examples/logistic_regression/README.md +++ b/examples/logistic_regression/README.md @@ -1,31 +1,39 @@ # Kompute Logistic Regression Example This folder contains an end to end Kompute Example that implements logistic regression. - This example is structured such that you will be able to extend it for your project. - -It contains a cmake build configuration that can be used in your production applications. +It contains a CMake build configuration that can be used in your production applications. ## Building the example You will notice that it's a standalone project, so you can re-use it for your application. +It uses CMake's [`fetch_content`](https://cmake.org/cmake/help/latest/module/FetchContent.html) to consume Kompute as a dependency. +To build you just need to run the CMake command in this folder as follows: -This project has the option to either import the Kompute dependency relative to the project or use your existing installation of Kompute. - -To build you just need to run the cmake command in this folder as follows: - -``` -cmake -Bbuild/ \ - -DCMAKE_BUILD_TYPE=Debug \ - -DKOMPUTE_OPT_INSTALL=0 \ - -DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=1 \ - -DKOMPUTE_OPT_ENABLE_SPDLOG=1 +```bash +git clone https://github.com/KomputeProject/kompute.git +cd kompute/examples/logistic_regression +mkdir build +cd build +cmake .. +cmake --build . ``` -You can pass the following optional parameters based on your desired configuration: -* If you wish to install with spdlog support you just have to pass `-DKOMPUTE_OPT_ENABLE_SPDLOG=1`. -* If you are using a package manager such as `vcpkg` make sure you pass the `-DCMAKE_TOOLCHAIN_FILE=` parameter -* If you wish to load shader from raw glsl string instead of spirv bytes you can use `-DKOMPUTE_ANDROID_SHADER_FROM_STRING` +## Executing + +Form inside the `build/` directory run: + +### Linux + +```bash +./kompute_logistic_regression +``` + +### Windows + +```bash +.\Debug\kompute_logistic_regression.exe +``` ## Pre-requisites @@ -33,8 +41,5 @@ In order to run this example, you will need the following dependencies: * REQUIRED + The Vulkan SDK must be installed -* OPTIONAL - + Kompute library must be accessible (by default it uses the source directory) - + SPDLOG - for logging - + FMT - for text formatting +For the Vulkan SDK, the simplest way to install it is through [their website](https://vulkan.lunarg.com/sdk/home). You just have to follow the instructions for the relevant platform. diff --git a/examples/logistic_regression/shader/CMakeLists.txt b/examples/logistic_regression/shader/CMakeLists.txt new file mode 100644 index 000000000..684a6a82a --- /dev/null +++ b/examples/logistic_regression/shader/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.20) + +# To add more shaders simply copy the vulkan_compile_shader command and replace it with your new shader +vulkan_compile_shader(INFILE my_shader.comp + OUTFILE my_shader.hpp + NAMESPACE "shader" + RELATIVE_PATH "${kompute_SOURCE_DIR}/cmake") + +# Then add it to the library, so you can access it later in your code +add_library(shader INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/my_shader.hpp" + + # "${CMAKE_CURRENT_BINARY_DIR}/my_shader2.hpp" +) + +target_include_directories(shader INTERFACE $) diff --git a/examples/logistic_regression/shaders/glsl/logistic_regression.comp b/examples/logistic_regression/shader/my_shader.comp similarity index 99% rename from examples/logistic_regression/shaders/glsl/logistic_regression.comp rename to examples/logistic_regression/shader/my_shader.comp index 9fd76619b..a7f75b0f3 100644 --- a/examples/logistic_regression/shaders/glsl/logistic_regression.comp +++ b/examples/logistic_regression/shader/my_shader.comp @@ -52,5 +52,3 @@ void main() { lout[idx] = calculateLoss(yHat, yCurr); } - - diff --git a/examples/logistic_regression/src/CMakeLists.txt b/examples/logistic_regression/src/CMakeLists.txt new file mode 100644 index 000000000..75273e79c --- /dev/null +++ b/examples/logistic_regression/src/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.20) + +add_executable(kompute_logistic_regression main.cpp) +target_link_libraries(kompute_logistic_regression PRIVATE shader kompute::kompute) diff --git a/examples/logistic_regression/src/Main.cpp b/examples/logistic_regression/src/Main.cpp deleted file mode 100644 index 8feee258f..000000000 --- a/examples/logistic_regression/src/Main.cpp +++ /dev/null @@ -1,72 +0,0 @@ - -#include -#include -#include - -#include "kompute/Kompute.hpp" - -int -main() -{ -#if KOMPUTE_ENABLE_SPDLOG - spdlog::set_level( - static_cast(SPDLOG_ACTIVE_LEVEL)); -#endif - - uint32_t ITERATIONS = 100; - float learningRate = 0.1; - - kp::Manager mgr; - - auto xI = mgr.tensor({ 0, 1, 1, 1, 1 }); - auto xJ = mgr.tensor({ 0, 0, 0, 1, 1 }); - - auto y = mgr.tensor({ 0, 0, 0, 1, 1 }); - - auto wIn = mgr.tensor({ 0.001, 0.001 }); - auto wOutI = mgr.tensor({ 0, 0, 0, 0, 0 }); - auto wOutJ = mgr.tensor({ 0, 0, 0, 0, 0 }); - - auto bIn = mgr.tensor({ 0 }); - auto bOut = mgr.tensor({ 0, 0, 0, 0, 0 }); - - auto lOut = mgr.tensor({ 0, 0, 0, 0, 0 }); - - std::vector> params = { xI, xJ, y, - wIn, wOutI, wOutJ, - bIn, bOut, lOut }; - - std::vector spirv( - (uint32_t*)kp::shader_data::shaders_glsl_logisticregression_comp_spv, - (uint32_t*)(kp::shader_data::shaders_glsl_logisticregression_comp_spv + - kp::shader_data:: - shaders_glsl_logisticregression_comp_spv_len)); - - std::shared_ptr algo = mgr.algorithm( - params, spirv, kp::Workgroup({ 5 }), std::vector({ 5.0 })); - - mgr.sequence()->eval(params); - - std::shared_ptr sq = - mgr.sequence() - ->record({ wIn, bIn }) - ->record(algo) - ->record({ wOutI, wOutJ, bOut, lOut }); - - // Iterate across all expected iterations - for (size_t i = 0; i < ITERATIONS; i++) { - - sq->eval(); - - for (size_t j = 0; j < bOut->size(); j++) { - wIn->data()[0] -= learningRate * wOutI->data()[j]; - wIn->data()[1] -= learningRate * wOutJ->data()[j]; - bIn->data()[0] -= learningRate * bOut->data()[j]; - } - } - - std::cout << "RESULTS" << std::endl; - std::cout << "w1: " << wIn->data()[0] << std::endl; - std::cout << "w2: " << wIn->data()[1] << std::endl; - std::cout << "b: " << bIn->data()[0] << std::endl; -} diff --git a/examples/logistic_regression/src/main.cpp b/examples/logistic_regression/src/main.cpp new file mode 100644 index 000000000..bc249a36f --- /dev/null +++ b/examples/logistic_regression/src/main.cpp @@ -0,0 +1,66 @@ + +#include +#include +#include + +#include "kompute/Tensor.hpp" +#include "my_shader.hpp" +#include + +int +main() +{ + uint32_t ITERATIONS = 100; + float learningRate = 0.1; + + kp::Manager mgr; + + std::shared_ptr> xI = mgr.tensor({ 0, 1, 1, 1, 1 }); + std::shared_ptr> xJ = mgr.tensor({ 0, 0, 0, 1, 1 }); + + std::shared_ptr> y = mgr.tensor({ 0, 0, 0, 1, 1 }); + + std::shared_ptr> wIn = mgr.tensor({ 0.001, 0.001 }); + std::shared_ptr> wOutI = mgr.tensor({ 0, 0, 0, 0, 0 }); + std::shared_ptr> wOutJ = mgr.tensor({ 0, 0, 0, 0, 0 }); + + std::shared_ptr> bIn = mgr.tensor({ 0 }); + std::shared_ptr> bOut = mgr.tensor({ 0, 0, 0, 0, 0 }); + + std::shared_ptr> lOut = mgr.tensor({ 0, 0, 0, 0, 0 }); + + const std::vector> params = { + xI, xJ, y, wIn, wOutI, wOutJ, bIn, bOut, lOut + }; + + const std::vector shader = std::vector( + shader::MY_SHADER_COMP_SPV.begin(), shader::MY_SHADER_COMP_SPV.end()); + + std::shared_ptr algo = mgr.algorithm( + params, shader, kp::Workgroup({ 5 }), std::vector({ 5.0 })); + + mgr.sequence()->eval(params); + + std::shared_ptr sq = + mgr.sequence() + ->record({ wIn, bIn }) + ->record(algo) + ->record({ wOutI, wOutJ, bOut, lOut }); + + // Iterate across all expected iterations + for (size_t i = 0; i < ITERATIONS; i++) { + + sq->eval(); + + for (size_t j = 0; j < bOut->size(); j++) { + wIn->data()[0] -= learningRate * wOutI->data()[j]; + wIn->data()[1] -= learningRate * wOutJ->data()[j]; + bIn->data()[0] -= learningRate * bOut->data()[j]; + } + } + + std::cout << "RESULTS" << std::endl; + std::cout << "w1: " << wIn->data()[0] << std::endl; + std::cout << "w2: " << wIn->data()[1] << std::endl; + std::cout << "b: " << bIn->data()[0] << std::endl; +} \ No newline at end of file diff --git a/external/Vulkan-Headers b/external/Vulkan-Headers deleted file mode 160000 index 320af06cb..000000000 --- a/external/Vulkan-Headers +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 320af06cbdd29848e1d7100d9b8e4e517db1dfd5 diff --git a/external/fmt b/external/fmt deleted file mode 160000 index 7bdf0628b..000000000 --- a/external/fmt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7bdf0628b1276379886c7f6dda2cef2b3b374f0b diff --git a/external/googletest b/external/googletest deleted file mode 160000 index 703bd9caa..000000000 --- a/external/googletest +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 703bd9caab50b139428cea1aaff9974ebee5742e diff --git a/external/spdlog b/external/spdlog deleted file mode 160000 index 01b350de9..000000000 --- a/external/spdlog +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 01b350de96483cf00b267c6db4c25f3b739b3fee diff --git a/kompute-config.cmake b/kompute-config.cmake new file mode 100644 index 000000000..10425252c --- /dev/null +++ b/kompute-config.cmake @@ -0,0 +1,28 @@ +# General purpose GPU compute framework built on Vulkan to +# support 1000s of cross vendor graphics cards +# (AMD, Qualcomm, NVIDIA & friends). Blazing fast, mobile-enabled, +# asynchronous and optimized for advanced GPU data processing use cases. +# Backed by the Linux Foundation. +# +# Finding this module will define the following variables: +# KOMPUTE_FOUND - True if the core library has been found +# KOMPUTE_LIBRARIES - Path to the core library archive +# KOMPUTE_INCLUDE_DIRS - Path to the include directories. Gives access +# to kompute.h, as a single include which must be included in every +# file that uses this interface. Else it also points to the +# directory for individual includes. + +find_path(KOMPUTE_INCLUDE_DIR + NAMES kompute.h) + +find_library(KOMPUTE_LIBRARY + NAMES kompute + HINTS ${KOMPUTE_LIBRARY_ROOT}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(KOMPUTE REQUIRED_VARS KOMPUTE_LIBRARY KOMPUTE_INCLUDE_DIR) + +if(KOMPUTE_FOUND) + set(KOMPUTE_LIBRARIES ${KOMPUTE_LIBRARY}) + set(KOMPUTE_INCLUDE_DIRS ${KOMPUTE_INCLUDE_DIR}) +endif() diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 5f3036986..1b4598fb7 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,11 +1,9 @@ -add_subdirectory(pybind11) pybind11_add_module(kp src/main.cpp) include_directories( - ${PROJECT_SOURCE_DIR}/single_include/) + ${PROJECT_SOURCE_DIR}/include/) target_link_libraries( - kp PRIVATE - kompute::kompute) - + kp PRIVATE + kompute::kompute) diff --git a/python/pybind11 b/python/pybind11 deleted file mode 160000 index 06a54018c..000000000 --- a/python/pybind11 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 06a54018c8a9fd9a7be5f5b56414b5da9259f637 diff --git a/python/src/main.cpp b/python/src/main.cpp index d0447fe8e..6c0f640c6 100644 --- a/python/src/main.cpp +++ b/python/src/main.cpp @@ -1,333 +1,558 @@ +#include #include #include -#include + +#include #include -#include "fmt/ranges.h" - -#include "utils.hpp" #include "docstrings.hpp" +#include "utils.hpp" namespace py = pybind11; -//used in Core.hpp -py::object kp_debug, kp_info, kp_warning, kp_error; +// used in Core.hpp +py::object kp_trace, kp_debug, kp_info, kp_warning, kp_error; -std::unique_ptr opAlgoDispatchPyInit( - std::shared_ptr& algorithm, - const py::array& push_consts) { - const py::buffer_info info = push_consts.request(); - KP_LOG_DEBUG("Kompute Python Manager creating tensor_T with push_consts size {} dtype {}", - push_consts.size(), std::string(py::str(push_consts.dtype()))); +std::unique_ptr +opAlgoDispatchPyInit(std::shared_ptr& algorithm, + const py::array& push_consts) +{ + const py::buffer_info info = push_consts.request(); + KP_LOG_DEBUG("Kompute Python Manager creating tensor_T with push_consts " + "size {} dtype {}", + push_consts.size(), + std::string(py::str(push_consts.dtype()))); - - if (push_consts.dtype() == py::dtype::of()) { - std::vector dataVec((float*)info.ptr, ((float*)info.ptr) + info.size); - return std::unique_ptr{new kp::OpAlgoDispatch(algorithm, dataVec)}; - } else if (push_consts.dtype() == py::dtype::of()) { - std::vector dataVec((uint32_t*)info.ptr, ((uint32_t*)info.ptr) + info.size); - return std::unique_ptr{new kp::OpAlgoDispatch(algorithm, dataVec)}; - } else if (push_consts.dtype() == py::dtype::of()) { - std::vector dataVec((int32_t*)info.ptr, ((int32_t*)info.ptr) + info.size); - return std::unique_ptr{new kp::OpAlgoDispatch(algorithm, dataVec)}; - } else if (push_consts.dtype() == py::dtype::of()) { - std::vector dataVec((double*)info.ptr, ((double*)info.ptr) + info.size); - return std::unique_ptr{new kp::OpAlgoDispatch(algorithm, dataVec)}; + if (push_consts.dtype().is(py::dtype::of())) { + std::vector dataVec((float*)info.ptr, + ((float*)info.ptr) + info.size); + return std::unique_ptr{ new kp::OpAlgoDispatch( + algorithm, dataVec) }; + } else if (push_consts.dtype().is(py::dtype::of())) { + std::vector dataVec((uint32_t*)info.ptr, + ((uint32_t*)info.ptr) + info.size); + return std::unique_ptr{ new kp::OpAlgoDispatch( + algorithm, dataVec) }; + } else if (push_consts.dtype().is(py::dtype::of())) { + std::vector dataVec((int32_t*)info.ptr, + ((int32_t*)info.ptr) + info.size); + return std::unique_ptr{ new kp::OpAlgoDispatch( + algorithm, dataVec) }; + } else if (push_consts.dtype().is(py::dtype::of())) { + std::vector dataVec((double*)info.ptr, + ((double*)info.ptr) + info.size); + return std::unique_ptr{ new kp::OpAlgoDispatch( + algorithm, dataVec) }; } else { throw std::runtime_error("Kompute Python no valid dtype supported"); } } -PYBIND11_MODULE(kp, m) { +PYBIND11_MODULE(kp, m) +{ // The logging modules are used in the Kompute.hpp file - py::module_ logging = py::module_::import("logging"); + py::module_ logging = py::module_::import("logging"); py::object kp_logger = logging.attr("getLogger")("kp"); - kp_debug = kp_logger.attr("debug"); - kp_info = kp_logger.attr("info"); - kp_warning = kp_logger.attr("warning"); - kp_error = kp_logger.attr("error"); + kp_trace = kp_logger.attr( + "debug"); // Same as for debug since python has no trace logging level + kp_debug = kp_logger.attr("debug"); + kp_info = kp_logger.attr("info"); + kp_warning = kp_logger.attr("warning"); + kp_error = kp_logger.attr("error"); logging.attr("basicConfig")(); py::module_ np = py::module_::import("numpy"); py::enum_(m, "TensorTypes") - .value("device", kp::Tensor::TensorTypes::eDevice, DOC(kp, Tensor, TensorTypes, eDevice)) - .value("host", kp::Tensor::TensorTypes::eHost, DOC(kp, Tensor, TensorTypes, eHost)) - .value("storage", kp::Tensor::TensorTypes::eStorage, DOC(kp, Tensor, TensorTypes, eStorage)) - .export_values(); + .value("device", + kp::Tensor::TensorTypes::eDevice, + DOC(kp, Tensor, TensorTypes, eDevice)) + .value("host", + kp::Tensor::TensorTypes::eHost, + DOC(kp, Tensor, TensorTypes, eHost)) + .value("storage", + kp::Tensor::TensorTypes::eStorage, + DOC(kp, Tensor, TensorTypes, eStorage)) + .export_values(); - py::class_>(m, "OpBase", DOC(kp, OpBase)); + py::class_>( + m, "OpBase", DOC(kp, OpBase)); - py::class_>( - m, "OpTensorSyncDevice", py::base(), DOC(kp, OpTensorSyncDevice)) - .def(py::init>&>(), DOC(kp, OpTensorSyncDevice, OpTensorSyncDevice)); + py::class_>( + m, "OpTensorSyncDevice", DOC(kp, OpTensorSyncDevice)) + .def(py::init>&>(), + DOC(kp, OpTensorSyncDevice, OpTensorSyncDevice)); - py::class_>( - m, "OpTensorSyncLocal", py::base(), DOC(kp, OpTensorSyncLocal)) - .def(py::init>&>(), DOC(kp, OpTensorSyncLocal, OpTensorSyncLocal)); + py::class_>( + m, "OpTensorSyncLocal", DOC(kp, OpTensorSyncLocal)) + .def(py::init>&>(), + DOC(kp, OpTensorSyncLocal, OpTensorSyncLocal)); - py::class_>( - m, "OpTensorCopy", py::base(), DOC(kp, OpTensorCopy)) - .def(py::init>&>(), DOC(kp, OpTensorCopy, OpTensorCopy)); + py::class_>( + m, "OpTensorCopy", DOC(kp, OpTensorCopy)) + .def(py::init>&>(), + DOC(kp, OpTensorCopy, OpTensorCopy)); - py::class_>( - m, "OpAlgoDispatch", py::base(), DOC(kp, OpAlgoDispatch)) - .def(py::init&,const std::vector&>(), - DOC(kp, OpAlgoDispatch, OpAlgoDispatch), - py::arg("algorithm"), py::arg("push_consts") = std::vector()) - .def(py::init(&opAlgoDispatchPyInit), - DOC(kp, OpAlgoDispatch, OpAlgoDispatch), - py::arg("algorithm"), py::arg("push_consts")); + py::class_>( + m, "OpAlgoDispatch", DOC(kp, OpAlgoDispatch)) + .def(py::init&, + const std::vector&>(), + DOC(kp, OpAlgoDispatch, OpAlgoDispatch), + py::arg("algorithm"), + py::arg("push_consts") = std::vector()) + .def(py::init(&opAlgoDispatchPyInit), + DOC(kp, OpAlgoDispatch, OpAlgoDispatch), + py::arg("algorithm"), + py::arg("push_consts")); - py::class_>( - m, "OpMult", py::base(), DOC(kp, OpMult)) - .def(py::init>&,const std::shared_ptr&>(), - DOC(kp, OpMult, OpMult)); + py::class_>( + m, "OpMult", DOC(kp, OpMult)) + .def(py::init>&, + const std::shared_ptr&>(), + DOC(kp, OpMult, OpMult)); - py::class_>(m, "Algorithm", DOC(kp, Algorithm, Algorithm)) - .def("get_tensors", &kp::Algorithm::getTensors, DOC(kp, Algorithm, getTensors)) - .def("destroy", &kp::Algorithm::destroy, DOC(kp, Algorithm, destroy)) - .def("is_init", &kp::Algorithm::isInit, DOC(kp, Algorithm, isInit)); + py::class_>( + m, "Algorithm", DOC(kp, Algorithm, Algorithm)) + .def("get_tensors", + &kp::Algorithm::getTensors, + DOC(kp, Algorithm, getTensors)) + .def("destroy", &kp::Algorithm::destroy, DOC(kp, Algorithm, destroy)) + .def("is_init", &kp::Algorithm::isInit, DOC(kp, Algorithm, isInit)); - py::class_>(m, "Tensor", DOC(kp, Tensor)) - .def("data", [](kp::Tensor& self) { - // Non-owning container exposing the underlying pointer - switch (self.dataType()) { + py::class_>( + m, "Tensor", DOC(kp, Tensor)) + .def( + "data", + [](kp::Tensor& self) { + // Non-owning container exposing the underlying pointer + switch (self.dataType()) { case kp::Tensor::TensorDataTypes::eFloat: - return py::array(self.size(), self.data(), py::cast(&self)); + return py::array( + self.size(), self.data(), py::cast(&self)); case kp::Tensor::TensorDataTypes::eUnsignedInt: - return py::array(self.size(), self.data(), py::cast(&self)); + return py::array( + self.size(), self.data(), py::cast(&self)); case kp::Tensor::TensorDataTypes::eInt: - return py::array(self.size(), self.data(), py::cast(&self)); + return py::array( + self.size(), self.data(), py::cast(&self)); case kp::Tensor::TensorDataTypes::eDouble: - return py::array(self.size(), self.data(), py::cast(&self)); + return py::array( + self.size(), self.data(), py::cast(&self)); case kp::Tensor::TensorDataTypes::eBool: - return py::array(self.size(), self.data(), py::cast(&self)); + return py::array( + self.size(), self.data(), py::cast(&self)); default: - throw std::runtime_error("Kompute Python data type not supported"); - } - }, DOC(kp, Tensor, data)) - .def("size", &kp::Tensor::size, DOC(kp, Tensor, size)) - .def("__len__", &kp::Tensor::size, DOC(kp, Tensor, size)) - .def("tensor_type", &kp::Tensor::tensorType, DOC(kp, Tensor, tensorType)) - .def("data_type", &kp::Tensor::dataType, DOC(kp, Tensor, dataType)) - .def("is_init", &kp::Tensor::isInit, DOC(kp, Tensor, isInit)) - .def("destroy", &kp::Tensor::destroy, DOC(kp, Tensor, destroy)); + throw std::runtime_error( + "Kompute Python data type not supported"); + } + }, + DOC(kp, Tensor, data)) + .def("size", &kp::Tensor::size, DOC(kp, Tensor, size)) + .def("__len__", &kp::Tensor::size, DOC(kp, Tensor, size)) + .def("tensor_type", &kp::Tensor::tensorType, DOC(kp, Tensor, tensorType)) + .def("data_type", &kp::Tensor::dataType, DOC(kp, Tensor, dataType)) + .def("is_init", &kp::Tensor::isInit, DOC(kp, Tensor, isInit)) + .def("destroy", &kp::Tensor::destroy, DOC(kp, Tensor, destroy)); py::class_>(m, "Sequence") - .def("record", [](kp::Sequence& self, std::shared_ptr op) { return self.record(op); }, - DOC(kp, Sequence, record)) - .def("eval", [](kp::Sequence& self) { return self.eval(); }, - DOC(kp, Sequence, eval)) - .def("eval", [](kp::Sequence& self, std::shared_ptr op) { return self.eval(op); }, - DOC(kp, Sequence, eval_2)) - .def("eval_async", [](kp::Sequence& self) { return self.eval(); }, - DOC(kp, Sequence, evalAwait)) - .def("eval_async", [](kp::Sequence& self, std::shared_ptr op) { return self.evalAsync(op); }, - DOC(kp, Sequence, evalAsync)) - .def("eval_await", [](kp::Sequence& self) { return self.evalAwait(); }, - DOC(kp, Sequence, evalAwait)) - .def("eval_await", [](kp::Sequence& self, uint32_t wait) { return self.evalAwait(wait); }, - DOC(kp, Sequence, evalAwait)) - .def("is_recording", &kp::Sequence::isRecording, - DOC(kp, Sequence, isRecording)) - .def("is_running", &kp::Sequence::isRunning, - DOC(kp, Sequence, isRunning)) - .def("is_init", &kp::Sequence::isInit, - DOC(kp, Sequence, isInit)) - .def("clear", &kp::Sequence::clear, - DOC(kp, Sequence, clear)) - .def("rerecord", &kp::Sequence::rerecord, - DOC(kp, Sequence, rerecord)) - .def("get_timestamps", &kp::Sequence::getTimestamps, - DOC(kp, Sequence, getTimestamps)) - .def("destroy", &kp::Sequence::destroy, - DOC(kp, Sequence, destroy)); + .def( + "record", + [](kp::Sequence& self, std::shared_ptr op) { + return self.record(op); + }, + DOC(kp, Sequence, record)) + .def( + "eval", + [](kp::Sequence& self) { return self.eval(); }, + DOC(kp, Sequence, eval)) + .def( + "eval", + [](kp::Sequence& self, std::shared_ptr op) { + return self.eval(op); + }, + DOC(kp, Sequence, eval_2)) + .def( + "eval_async", + [](kp::Sequence& self) { return self.eval(); }, + DOC(kp, Sequence, evalAwait)) + .def( + "eval_async", + [](kp::Sequence& self, std::shared_ptr op) { + return self.evalAsync(op); + }, + DOC(kp, Sequence, evalAsync)) + .def( + "eval_await", + [](kp::Sequence& self) { return self.evalAwait(); }, + DOC(kp, Sequence, evalAwait)) + .def( + "eval_await", + [](kp::Sequence& self, uint32_t wait) { return self.evalAwait(wait); }, + DOC(kp, Sequence, evalAwait)) + .def("is_recording", + &kp::Sequence::isRecording, + DOC(kp, Sequence, isRecording)) + .def("is_running", &kp::Sequence::isRunning, DOC(kp, Sequence, isRunning)) + .def("is_init", &kp::Sequence::isInit, DOC(kp, Sequence, isInit)) + .def("clear", &kp::Sequence::clear, DOC(kp, Sequence, clear)) + .def("rerecord", &kp::Sequence::rerecord, DOC(kp, Sequence, rerecord)) + .def("get_timestamps", + &kp::Sequence::getTimestamps, + DOC(kp, Sequence, getTimestamps)) + .def("destroy", &kp::Sequence::destroy, DOC(kp, Sequence, destroy)); - py::class_>(m, "Manager", DOC(kp, Manager)) - .def(py::init(), DOC(kp, Manager, Manager)) - .def(py::init(), DOC(kp, Manager, Manager_2)) - .def(py::init&,const std::vector&>(), - DOC(kp, Manager, Manager_2), - py::arg("device") = 0, - py::arg("family_queue_indices") = std::vector(), - py::arg("desired_extensions") = std::vector()) - .def("destroy", &kp::Manager::destroy, - DOC(kp, Manager, destroy)) - .def("sequence", &kp::Manager::sequence, DOC(kp, Manager, sequence), - py::arg("queue_index") = 0, py::arg("total_timestamps") = 0) - .def("tensor", [np](kp::Manager& self, - const py::array_t& data, - kp::Tensor::TensorTypes tensor_type) { - const py::array_t& flatdata = np.attr("ravel")(data); - const py::buffer_info info = flatdata.request(); - KP_LOG_DEBUG("Kompute Python Manager tensor() creating tensor float with data size {}", flatdata.size()); - return self.tensor( - info.ptr, - flatdata.size(), - sizeof(float), - kp::Tensor::TensorDataTypes::eFloat, - tensor_type); - }, - DOC(kp, Manager, tensor), - py::arg("data"), py::arg("tensor_type") = kp::Tensor::TensorTypes::eDevice) - .def("tensor_t", [np](kp::Manager& self, - const py::array& data, - kp::Tensor::TensorTypes tensor_type) { - // TODO: Suppport strides in numpy format - const py::array& flatdata = np.attr("ravel")(data); - const py::buffer_info info = flatdata.request(); - KP_LOG_DEBUG("Kompute Python Manager creating tensor_T with data size {} dtype {}", - flatdata.size(), std::string(py::str(flatdata.dtype()))); - if (flatdata.dtype() == py::dtype::of()) { - return self.tensor( - info.ptr, flatdata.size(), sizeof(float), kp::Tensor::TensorDataTypes::eFloat, tensor_type); - } else if (flatdata.dtype() == py::dtype::of()) { - return self.tensor( - info.ptr, flatdata.size(), sizeof(uint32_t), kp::Tensor::TensorDataTypes::eUnsignedInt, tensor_type); - } else if (flatdata.dtype() == py::dtype::of()) { - return self.tensor( - info.ptr, flatdata.size(), sizeof(int32_t), kp::Tensor::TensorDataTypes::eInt, tensor_type); - } else if (flatdata.dtype() == py::dtype::of()) { - return self.tensor( - info.ptr, flatdata.size(), sizeof(double), kp::Tensor::TensorDataTypes::eDouble, tensor_type); - } else if (flatdata.dtype() == py::dtype::of()) { - return self.tensor( - info.ptr, flatdata.size(), sizeof(bool), kp::Tensor::TensorDataTypes::eBool, tensor_type); - } else { - throw std::runtime_error("Kompute Python no valid dtype supported"); + py::class_>( + m, "Manager", DOC(kp, Manager)) + .def(py::init(), DOC(kp, Manager, Manager)) + .def(py::init(), DOC(kp, Manager, Manager_2)) + .def(py::init&, + const std::vector&>(), + DOC(kp, Manager, Manager_2), + py::arg("device") = 0, + py::arg("family_queue_indices") = std::vector(), + py::arg("desired_extensions") = std::vector()) + .def("destroy", &kp::Manager::destroy, DOC(kp, Manager, destroy)) + .def("sequence", + &kp::Manager::sequence, + DOC(kp, Manager, sequence), + py::arg("queue_index") = 0, + py::arg("total_timestamps") = 0) + .def( + "tensor", + [np](kp::Manager& self, + const py::array_t& data, + kp::Tensor::TensorTypes tensor_type) { + const py::array_t& flatdata = np.attr("ravel")(data); + const py::buffer_info info = flatdata.request(); + KP_LOG_DEBUG("Kompute Python Manager tensor() creating tensor " + "float with data size {}", + flatdata.size()); + return self.tensor(info.ptr, + flatdata.size(), + sizeof(float), + kp::Tensor::TensorDataTypes::eFloat, + tensor_type); + }, + DOC(kp, Manager, tensor), + py::arg("data"), + py::arg("tensor_type") = kp::Tensor::TensorTypes::eDevice) + .def( + "tensor_t", + [np](kp::Manager& self, + const py::array& data, + kp::Tensor::TensorTypes tensor_type) { + // TODO: Suppport strides in numpy format + const py::array& flatdata = np.attr("ravel")(data); + const py::buffer_info info = flatdata.request(); + KP_LOG_DEBUG("Kompute Python Manager creating tensor_T with data " + "size {} dtype {}", + flatdata.size(), + std::string(py::str(flatdata.dtype()))); + if (flatdata.dtype().is(py::dtype::of())) { + return self.tensor(info.ptr, + flatdata.size(), + sizeof(float), + kp::Tensor::TensorDataTypes::eFloat, + tensor_type); + } else if (flatdata.dtype().is(py::dtype::of())) { + return self.tensor(info.ptr, + flatdata.size(), + sizeof(uint32_t), + kp::Tensor::TensorDataTypes::eUnsignedInt, + tensor_type); + } else if (flatdata.dtype().is(py::dtype::of())) { + return self.tensor(info.ptr, + flatdata.size(), + sizeof(int32_t), + kp::Tensor::TensorDataTypes::eInt, + tensor_type); + } else if (flatdata.dtype().is(py::dtype::of())) { + return self.tensor(info.ptr, + flatdata.size(), + sizeof(double), + kp::Tensor::TensorDataTypes::eDouble, + tensor_type); + } else if (flatdata.dtype().is(py::dtype::of())) { + return self.tensor(info.ptr, + flatdata.size(), + sizeof(bool), + kp::Tensor::TensorDataTypes::eBool, + tensor_type); + } else { + throw std::runtime_error( + "Kompute Python no valid dtype supported"); + } + }, + DOC(kp, Manager, tensorT), + py::arg("data"), + py::arg("tensor_type") = kp::Tensor::TensorTypes::eDevice) + .def( + "algorithm", + [](kp::Manager& self, + const std::vector>& tensors, + const py::bytes& spirv, + const kp::Workgroup& workgroup, + const std::vector& spec_consts, + const std::vector& push_consts) { + py::buffer_info info(py::buffer(spirv).request()); + const char* data = reinterpret_cast(info.ptr); + size_t length = static_cast(info.size); + std::vector spirvVec((uint32_t*)data, + (uint32_t*)(data + length)); + return self.algorithm( + tensors, spirvVec, workgroup, spec_consts, push_consts); + }, + DOC(kp, Manager, algorithm), + py::arg("tensors"), + py::arg("spirv"), + py::arg("workgroup") = kp::Workgroup(), + py::arg("spec_consts") = std::vector(), + py::arg("push_consts") = std::vector()) + .def( + "algorithm", + [np](kp::Manager& self, + const std::vector>& tensors, + const py::bytes& spirv, + const kp::Workgroup& workgroup, + const py::array& spec_consts, + const py::array& push_consts) { + py::buffer_info info(py::buffer(spirv).request()); + const char* data = reinterpret_cast(info.ptr); + size_t length = static_cast(info.size); + std::vector spirvVec((uint32_t*)data, + (uint32_t*)(data + length)); + + const py::buffer_info pushInfo = push_consts.request(); + const py::buffer_info specInfo = spec_consts.request(); + + KP_LOG_DEBUG("Kompute Python Manager creating Algorithm_T with " + "push consts data size {} dtype {} and spec const " + "data size {} dtype {}", + push_consts.size(), + std::string(py::str(push_consts.dtype())), + spec_consts.size(), + std::string(py::str(spec_consts.dtype()))); + + // We have to iterate across a combination of parameters due to the + // lack of support for templating + if (spec_consts.dtype().is(py::dtype::of())) { + std::vector specConstsVec( + (float*)specInfo.ptr, ((float*)specInfo.ptr) + specInfo.size); + if (spec_consts.dtype().is(py::dtype::of())) { + std::vector pushConstsVec((float*)pushInfo.ptr, + ((float*)pushInfo.ptr) + + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specConstsVec, + pushConstsVec); + } else if (spec_consts.dtype().is( + py::dtype::of())) { + std::vector pushConstsVec( + (int32_t*)pushInfo.ptr, + ((int32_t*)pushInfo.ptr) + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specConstsVec, + pushConstsVec); + } else if (spec_consts.dtype().is( + py::dtype::of())) { + std::vector pushConstsVec( + (uint32_t*)pushInfo.ptr, + ((uint32_t*)pushInfo.ptr) + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specConstsVec, + pushConstsVec); + } else if (spec_consts.dtype().is( + py::dtype::of())) { + std::vector pushConstsVec((double*)pushInfo.ptr, + ((double*)pushInfo.ptr) + + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specConstsVec, + pushConstsVec); } - }, - DOC(kp, Manager, tensorT), - py::arg("data"), py::arg("tensor_type") = kp::Tensor::TensorTypes::eDevice) - .def("algorithm", [](kp::Manager& self, - const std::vector>& tensors, - const py::bytes& spirv, - const kp::Workgroup& workgroup, - const std::vector& spec_consts, - const std::vector& push_consts) { - py::buffer_info info(py::buffer(spirv).request()); - const char *data = reinterpret_cast(info.ptr); - size_t length = static_cast(info.size); - std::vector spirvVec((uint32_t*)data, (uint32_t*)(data + length)); - return self.algorithm(tensors, spirvVec, workgroup, spec_consts, push_consts); - }, - DOC(kp, Manager, algorithm), - py::arg("tensors"), - py::arg("spirv"), - py::arg("workgroup") = kp::Workgroup(), - py::arg("spec_consts") = std::vector(), - py::arg("push_consts") = std::vector()) - .def("algorithm", [np](kp::Manager& self, - const std::vector>& tensors, - const py::bytes& spirv, - const kp::Workgroup& workgroup, - const py::array& spec_consts, - const py::array& push_consts) { - - py::buffer_info info(py::buffer(spirv).request()); - const char *data = reinterpret_cast(info.ptr); - size_t length = static_cast(info.size); - std::vector spirvVec((uint32_t*)data, (uint32_t*)(data + length)); - - const py::buffer_info pushInfo = push_consts.request(); - const py::buffer_info specInfo = spec_consts.request(); - - KP_LOG_DEBUG("Kompute Python Manager creating Algorithm_T with " - "push consts data size {} dtype {} and spec const data size {} dtype {}", - push_consts.size(), std::string(py::str(push_consts.dtype())), - spec_consts.size(), std::string(py::str(spec_consts.dtype()))); - - // We have to iterate across a combination of parameters due to the lack of support for templating - if (spec_consts.dtype() == py::dtype::of()) { - std::vector specConstsVec((float*)specInfo.ptr, ((float*)specInfo.ptr) + specInfo.size); - if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushConstsVec((float*)pushInfo.ptr, ((float*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specConstsVec, pushConstsVec); - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushConstsVec((int32_t*)pushInfo.ptr, ((int32_t*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specConstsVec, pushConstsVec); - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushConstsVec((uint32_t*)pushInfo.ptr, ((uint32_t*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specConstsVec, pushConstsVec); - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushConstsVec((double*)pushInfo.ptr, ((double*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specConstsVec, pushConstsVec); - } - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector specconstsvec((int32_t*)specInfo.ptr, ((int32_t*)specInfo.ptr) + specInfo.size); - if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushconstsvec((float*)pushInfo.ptr, ((float*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specconstsvec, pushconstsvec); - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushconstsvec((int32_t*)pushInfo.ptr, ((int32_t*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specconstsvec, pushconstsvec); - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushconstsvec((uint32_t*)pushInfo.ptr, ((uint32_t*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specconstsvec, pushconstsvec); - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushconstsvec((double*)pushInfo.ptr, ((double*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specconstsvec, pushconstsvec); - } - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector specconstsvec((uint32_t*)specInfo.ptr, ((uint32_t*)specInfo.ptr) + specInfo.size); - if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushconstsvec((float*)pushInfo.ptr, ((float*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specconstsvec, pushconstsvec); - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushconstsvec((int32_t*)pushInfo.ptr, ((int32_t*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specconstsvec, pushconstsvec); - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushconstsvec((uint32_t*)pushInfo.ptr, ((uint32_t*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specconstsvec, pushconstsvec); - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushconstsvec((double*)pushInfo.ptr, ((double*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specconstsvec, pushconstsvec); - } - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector specconstsvec((double*)specInfo.ptr, ((double*)specInfo.ptr) + specInfo.size); - if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushconstsvec((float*)pushInfo.ptr, ((float*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specconstsvec, pushconstsvec); - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushconstsvec((int32_t*)pushInfo.ptr, ((int32_t*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specconstsvec, pushconstsvec); - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushconstsvec((uint32_t*)pushInfo.ptr, ((uint32_t*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specconstsvec, pushconstsvec); - } else if (spec_consts.dtype() == py::dtype::of()) { - std::vector pushconstsvec((double*)pushInfo.ptr, ((double*)pushInfo.ptr) + pushInfo.size); - return self.algorithm(tensors, spirvVec, workgroup, specconstsvec, pushconstsvec); - } - } else { - // If reach then no valid dtype supported - throw std::runtime_error("Kompute Python no valid dtype supported"); + } else if (spec_consts.dtype().is(py::dtype::of())) { + std::vector specconstsvec((int32_t*)specInfo.ptr, + ((int32_t*)specInfo.ptr) + + specInfo.size); + if (spec_consts.dtype().is(py::dtype::of())) { + std::vector pushconstsvec((float*)pushInfo.ptr, + ((float*)pushInfo.ptr) + + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specconstsvec, + pushconstsvec); + } else if (spec_consts.dtype().is( + py::dtype::of())) { + std::vector pushconstsvec( + (int32_t*)pushInfo.ptr, + ((int32_t*)pushInfo.ptr) + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specconstsvec, + pushconstsvec); + } else if (spec_consts.dtype().is( + py::dtype::of())) { + std::vector pushconstsvec( + (uint32_t*)pushInfo.ptr, + ((uint32_t*)pushInfo.ptr) + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specconstsvec, + pushconstsvec); + } else if (spec_consts.dtype().is( + py::dtype::of())) { + std::vector pushconstsvec((double*)pushInfo.ptr, + ((double*)pushInfo.ptr) + + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specconstsvec, + pushconstsvec); } - }, - DOC(kp, Manager, algorithm), - py::arg("tensors"), - py::arg("spirv"), - py::arg("workgroup") = kp::Workgroup(), - py::arg("spec_consts") = std::vector(), - py::arg("push_consts") = std::vector()) - .def("list_devices", [](kp::Manager& self){ + } else if (spec_consts.dtype().is(py::dtype::of())) { + std::vector specconstsvec((uint32_t*)specInfo.ptr, + ((uint32_t*)specInfo.ptr) + + specInfo.size); + if (spec_consts.dtype().is(py::dtype::of())) { + std::vector pushconstsvec((float*)pushInfo.ptr, + ((float*)pushInfo.ptr) + + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specconstsvec, + pushconstsvec); + } else if (spec_consts.dtype().is( + py::dtype::of())) { + std::vector pushconstsvec( + (int32_t*)pushInfo.ptr, + ((int32_t*)pushInfo.ptr) + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specconstsvec, + pushconstsvec); + } else if (spec_consts.dtype().is( + py::dtype::of())) { + std::vector pushconstsvec( + (uint32_t*)pushInfo.ptr, + ((uint32_t*)pushInfo.ptr) + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specconstsvec, + pushconstsvec); + } else if (spec_consts.dtype().is( + py::dtype::of())) { + std::vector pushconstsvec((double*)pushInfo.ptr, + ((double*)pushInfo.ptr) + + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specconstsvec, + pushconstsvec); + } + } else if (spec_consts.dtype().is(py::dtype::of())) { + std::vector specconstsvec((double*)specInfo.ptr, + ((double*)specInfo.ptr) + + specInfo.size); + if (spec_consts.dtype().is(py::dtype::of())) { + std::vector pushconstsvec((float*)pushInfo.ptr, + ((float*)pushInfo.ptr) + + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specconstsvec, + pushconstsvec); + } else if (spec_consts.dtype().is( + py::dtype::of())) { + std::vector pushconstsvec((int32_t*)pushInfo.ptr, + ((int32_t*)pushInfo.ptr) + + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specconstsvec, + pushconstsvec); + } else if (spec_consts.dtype().is( + py::dtype::of())) { + std::vector pushconstsvec((uint32_t*)pushInfo.ptr, + ((uint32_t*)pushInfo.ptr) + + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specconstsvec, + pushconstsvec); + } else if (spec_consts.dtype().is( + py::dtype::of())) { + std::vector pushconstsvec((double*)pushInfo.ptr, + ((double*)pushInfo.ptr) + + pushInfo.size); + return self.algorithm(tensors, + spirvVec, + workgroup, + specconstsvec, + pushconstsvec); + } + } + // If reach then no valid dtype supported + throw std::runtime_error("Kompute Python no valid dtype supported"); + }, + DOC(kp, Manager, algorithm), + py::arg("tensors"), + py::arg("spirv"), + py::arg("workgroup") = kp::Workgroup(), + py::arg("spec_consts") = std::vector(), + py::arg("push_consts") = std::vector()) + .def( + "list_devices", + [](kp::Manager& self) { const std::vector devices = self.listDevices(); py::list list; for (const vk::PhysicalDevice& device : devices) { list.append(kp::py::vkPropertiesToDict(device.getProperties())); } return list; - }, "Return a dict containing information about the device") - .def("get_device_properties", [](kp::Manager& self){ - const vk::PhysicalDeviceProperties properties = self.getDeviceProperties(); + }, + "Return a dict containing information about the device") + .def( + "get_device_properties", + [](kp::Manager& self) { + const vk::PhysicalDeviceProperties properties = + self.getDeviceProperties(); return kp::py::vkPropertiesToDict(properties); - }, "Return a dict containing information about the device"); + }, + "Return a dict containing information about the device"); auto atexit = py::module_::import("atexit"); - atexit.attr("register")(py::cpp_function([](){ + atexit.attr("register")(py::cpp_function([]() { + kp_trace = py::none(); kp_debug = py::none(); kp_info = py::none(); kp_warning = py::none(); @@ -340,4 +565,3 @@ PYBIND11_MODULE(kp, m) { m.attr("__version__") = "dev"; #endif } - diff --git a/python/src/utils.hpp b/python/src/utils.hpp index 367871344..69cd2a653 100644 --- a/python/src/utils.hpp +++ b/python/src/utils.hpp @@ -1,24 +1,30 @@ #include #include +#include using namespace pybind11::literals; // for the `_a` literal namespace kp { namespace py { -static pybind11::dict vkPropertiesToDict(const vk::PhysicalDeviceProperties& properties) { - +static pybind11::dict +vkPropertiesToDict(const vk::PhysicalDeviceProperties& properties) +{ + std::string deviceName = properties.deviceName; pybind11::dict pyDict( - "device_name"_a = std::string(properties.deviceName.data()), - "max_work_group_count"_a = pybind11::make_tuple(properties.limits.maxComputeWorkGroupCount[0], - properties.limits.maxComputeWorkGroupCount[1], - properties.limits.maxComputeWorkGroupCount[2]), - "max_work_group_invocations"_a = properties.limits.maxComputeWorkGroupInvocations, - "max_work_group_size"_a = pybind11::make_tuple(properties.limits.maxComputeWorkGroupSize[0], - properties.limits.maxComputeWorkGroupSize[1], - properties.limits.maxComputeWorkGroupSize[2]), - "timestamps_supported"_a = (bool)properties.limits.timestampComputeAndGraphics - ); + "device_name"_a = deviceName, + "max_work_group_count"_a = + pybind11::make_tuple(properties.limits.maxComputeWorkGroupCount[0], + properties.limits.maxComputeWorkGroupCount[1], + properties.limits.maxComputeWorkGroupCount[2]), + "max_work_group_invocations"_a = + properties.limits.maxComputeWorkGroupInvocations, + "max_work_group_size"_a = + pybind11::make_tuple(properties.limits.maxComputeWorkGroupSize[0], + properties.limits.maxComputeWorkGroupSize[1], + properties.limits.maxComputeWorkGroupSize[2]), + "timestamps_supported"_a = + (bool)properties.limits.timestampComputeAndGraphics); return pyDict; } diff --git a/python/test/requirements-dev.txt b/python/test/requirements-dev.txt index 85d2f72a2..99d811d39 100644 --- a/python/test/requirements-dev.txt +++ b/python/test/requirements-dev.txt @@ -1,4 +1,4 @@ pyshader==0.7.0 -numpy==1.19.5 -pytest==6.2.1 +numpy==1.22.4 +pytest==7.1.2 diff --git a/setup.py b/setup.py index e6feb9ab8..09faa8d1a 100644 --- a/setup.py +++ b/setup.py @@ -28,8 +28,8 @@ class CMakeBuild(build_ext): ", ".join(e.name for e in self.extensions)) cmake_version = LooseVersion(re.search(r'version\s*([\d.]+)', out.decode()).group(1)) - if cmake_version < '3.4.1': - raise RuntimeError("CMake >= 3.4.1 is required") + if cmake_version < '3.15': + raise RuntimeError("CMake >= 3.15 is required") for ext in self.extensions: self.build_extension(ext) @@ -41,9 +41,10 @@ class CMakeBuild(build_ext): extdir += os.path.sep cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, - '-DKOMPUTE_OPT_BUILD_PYTHON=1', - '-DKOMPUTE_OPT_ENABLE_SPDLOG=0', - '-DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=1', + '-DKOMPUTE_OPT_BUILD_PYTHON=ON', + '-DKOMPUTE_OPT_LOG_LEVEL=Off', + '-DKOMPUTE_OPT_USE_SPDLOG=Off', + '-DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON' '-DPYTHON_EXECUTABLE=' + sys.executable, '-DPYTHON_INCLUDE_DIR=' + sysconfig.get_path('include'), '-DPYTHON_LIBRARY=' + sysconfig.get_path('stdlib'), @@ -52,20 +53,23 @@ class CMakeBuild(build_ext): cfg = 'Debug' if self.debug else 'Release' build_args = ['--config', cfg] + env = os.environ.copy() + oldCxxFlags = env.get('CXXFLAGS', '') + env['CXXFLAGS'] = f'{oldCxxFlags} -DVERSION_INFO=\\"{self.distribution.get_version()}\\"' + if platform.system() == "Windows": - cmake_args += ['-DKOMPUTE_EXTRA_CXX_FLAGS=""'] - cmake_args += ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(cfg.upper(), extdir)] + cmake_args += [f'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{cfg.upper()}={extdir}'] if sys.maxsize > 2**32: cmake_args += ['-A', 'x64'] build_args += ['--', '/m'] else: - cmake_args += ['-DKOMPUTE_EXTRA_CXX_FLAGS="-fPIC"'] + env['CXXFLAGS'] += ' -fPIC' cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg] build_args += ['--', '-j'] + # Optional environment variable to limit the number of parallel jobs for GitHub actions to reduce RAM usage + if 'KOMPUTE_PYTHON_NUM_PARALLEL_THREADS' in env: + build_args += env['KOMPUTE_PYTHON_NUM_PARALLEL_THREADS'] - env = os.environ.copy() - env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(env.get('CXXFLAGS', ''), - self.distribution.get_version()) if not os.path.exists(self.build_temp): os.makedirs(self.build_temp) diff --git a/shaders/glsl/logisticregression.comp.spv b/shaders/glsl/logisticregression.comp.spv deleted file mode 100755 index 2f6883dac..000000000 Binary files a/shaders/glsl/logisticregression.comp.spv and /dev/null differ diff --git a/shaders/glsl/opmult.comp.spv b/shaders/glsl/opmult.comp.spv deleted file mode 100755 index 63eea751b..000000000 Binary files a/shaders/glsl/opmult.comp.spv and /dev/null differ diff --git a/single_include/AggregateHeaders.cpp b/single_include/AggregateHeaders.cpp deleted file mode 100644 index 0498fc01a..000000000 --- a/single_include/AggregateHeaders.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once -#include "kompute/Algorithm.hpp" -#include "kompute/Core.hpp" -#include "kompute/Manager.hpp" -#include "kompute/Sequence.hpp" -#include "kompute/Tensor.hpp" -#include "kompute/operations/OpAlgoDispatch.hpp" -#include "kompute/operations/OpBase.hpp" -#include "kompute/operations/OpMemoryBarrier.hpp" -#include "kompute/operations/OpMult.hpp" -#include "kompute/operations/OpTensorCopy.hpp" -#include "kompute/operations/OpTensorSyncDevice.hpp" -#include "kompute/operations/OpTensorSyncLocal.hpp" -#include "kompute/shaders/shaderlogisticregression.hpp" -#include "kompute/shaders/shaderopmult.hpp" diff --git a/single_include/kompute/Kompute.hpp b/single_include/kompute/Kompute.hpp index e725b8bbd..e69de29bb 100644 --- a/single_include/kompute/Kompute.hpp +++ b/single_include/kompute/Kompute.hpp @@ -1,2432 +0,0 @@ -#pragma once -/* - THIS FILE HAS BEEN AUTOMATICALLY GENERATED - DO NOT EDIT - - --- - - Copyright 2020 The Institute for Ethical AI & Machine Learning - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef SHADEROP_SHADEROPMULT_HPP -#define SHADEROP_SHADEROPMULT_HPP - -namespace kp { -namespace shader_data { -static const unsigned char shaders_glsl_opmult_comp_spv[] = { - 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x08, 0x00, - 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x06, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x10, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, - 0xc2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x47, - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x49, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x4f, 0x75, - 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x05, 0x00, 0x19, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6e, 0x73, - 0x6f, 0x72, 0x4c, 0x68, 0x73, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x4c, 0x68, 0x73, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x52, 0x68, - 0x73, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x52, 0x68, - 0x73, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, - 0x4c, 0x45, 0x4e, 0x5f, 0x4c, 0x48, 0x53, 0x00, 0x05, 0x00, 0x04, 0x00, - 0x2a, 0x00, 0x00, 0x00, 0x4c, 0x45, 0x4e, 0x5f, 0x52, 0x48, 0x53, 0x00, - 0x05, 0x00, 0x04, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x4c, 0x45, 0x4e, 0x5f, - 0x4f, 0x55, 0x54, 0x00, 0x47, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x48, 0x00, 0x05, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x19, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x03, 0x00, 0x21, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x29, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x2b, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x2d, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x16, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x1d, 0x00, 0x03, 0x00, 0x11, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x03, 0x00, 0x12, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, - 0x15, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x2b, 0x00, 0x04, 0x00, 0x15, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x19, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1a, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x1a, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x32, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, - 0x2d, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, - 0x2c, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x1c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, - 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, - 0x16, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x1d, 0x00, 0x00, 0x00, - 0x25, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, - 0x24, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x26, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, - 0x26, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x1d, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x28, 0x00, 0x00, 0x00, - 0x27, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00 -}; -static const unsigned int shaders_glsl_opmult_comp_spv_len = 1464; -} -} -#endif // define SHADEROP_SHADEROPMULT_HPP - -/* - THIS FILE HAS BEEN AUTOMATICALLY GENERATED - DO NOT EDIT - - --- - - Copyright 2020 The Institute for Ethical AI & Machine Learning - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef SHADEROP_SHADERLOGISTICREGRESSION_HPP -#define SHADEROP_SHADERLOGISTICREGRESSION_HPP - -namespace kp { -namespace shader_data { -static const unsigned char shaders_glsl_logisticregression_comp_spv[] = { - 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x08, 0x00, - 0xae, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x06, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x00, 0x00, 0x10, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, - 0xc2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x73, 0x69, 0x67, 0x6d, 0x6f, 0x69, 0x64, 0x28, - 0x66, 0x31, 0x3b, 0x00, 0x05, 0x00, 0x03, 0x00, 0x09, 0x00, 0x00, 0x00, - 0x7a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x12, 0x00, 0x00, 0x00, - 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x28, 0x76, 0x66, - 0x32, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x11, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x08, 0x00, 0x17, 0x00, 0x00, 0x00, 0x63, 0x61, 0x6c, 0x63, - 0x75, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x73, 0x73, 0x28, 0x66, 0x31, - 0x3b, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, - 0x15, 0x00, 0x00, 0x00, 0x79, 0x48, 0x61, 0x74, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x16, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x21, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x79, 0x48, 0x61, 0x74, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, - 0x3e, 0x00, 0x00, 0x00, 0x69, 0x64, 0x78, 0x00, 0x05, 0x00, 0x08, 0x00, - 0x41, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x47, 0x6c, 0x6f, 0x62, 0x61, - 0x6c, 0x49, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, - 0x44, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, - 0x77, 0x43, 0x75, 0x72, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, - 0x48, 0x00, 0x00, 0x00, 0x62, 0x77, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x77, 0x69, 0x6e, 0x00, 0x05, 0x00, 0x03, 0x00, 0x4a, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x54, 0x00, 0x00, 0x00, - 0x62, 0x43, 0x75, 0x72, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, - 0x56, 0x00, 0x00, 0x00, 0x62, 0x62, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x04, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x62, 0x69, 0x6e, 0x00, 0x05, 0x00, 0x03, 0x00, 0x58, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x5b, 0x00, 0x00, 0x00, - 0x78, 0x43, 0x75, 0x72, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, - 0x5d, 0x00, 0x00, 0x00, 0x62, 0x78, 0x69, 0x00, 0x06, 0x00, 0x04, 0x00, - 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x69, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x64, 0x00, 0x00, 0x00, 0x62, 0x78, 0x6a, 0x00, - 0x06, 0x00, 0x04, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x78, 0x6a, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x66, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x6b, 0x00, 0x00, 0x00, - 0x79, 0x43, 0x75, 0x72, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, - 0x6d, 0x00, 0x00, 0x00, 0x62, 0x79, 0x00, 0x00, 0x06, 0x00, 0x04, 0x00, - 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x04, 0x00, 0x73, 0x00, 0x00, 0x00, 0x79, 0x48, 0x61, 0x74, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x74, 0x00, 0x00, 0x00, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, - 0x76, 0x00, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x04, 0x00, 0x78, 0x00, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7b, 0x00, 0x00, 0x00, - 0x64, 0x5a, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x00, 0x00, - 0x64, 0x57, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x86, 0x00, 0x00, 0x00, - 0x64, 0x42, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x8b, 0x00, 0x00, 0x00, - 0x62, 0x77, 0x6f, 0x75, 0x74, 0x69, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, - 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x6f, 0x75, 0x74, - 0x69, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x8d, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x93, 0x00, 0x00, 0x00, - 0x62, 0x77, 0x6f, 0x75, 0x74, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, - 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x6f, 0x75, 0x74, - 0x6a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x95, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9c, 0x00, 0x00, 0x00, - 0x62, 0x62, 0x6f, 0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, - 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x6f, 0x75, 0x74, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x9e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xa3, 0x00, 0x00, 0x00, - 0x62, 0x6c, 0x6f, 0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, - 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x6f, 0x75, 0x74, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xa5, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xa7, 0x00, 0x00, 0x00, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, - 0xa9, 0x00, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x41, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, - 0x1c, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x47, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, - 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x48, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4a, 0x00, 0x00, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x4a, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x55, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x56, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x03, 0x00, 0x56, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x5c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x48, 0x00, 0x05, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, - 0x5d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x5f, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x63, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, - 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x64, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x66, 0x00, 0x00, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x66, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x6d, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x03, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x6f, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8b, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x03, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x8d, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x92, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x48, 0x00, 0x05, 0x00, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, - 0x93, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x95, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x95, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x9b, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, - 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x9c, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x9e, 0x00, 0x00, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x9e, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa3, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x03, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0xa5, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa5, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0xad, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x05, 0x00, 0x14, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, - 0x15, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3d, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, - 0x3f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x3f, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x40, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, - 0x3c, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x43, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x3c, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, 0x47, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x48, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x49, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x49, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x15, 0x00, 0x04, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x4b, 0x00, 0x00, 0x00, - 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x4d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x2b, 0x00, 0x04, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, 0x55, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x56, 0x00, 0x00, 0x00, - 0x55, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x57, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x57, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x1d, 0x00, 0x03, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x03, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x5d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5e, 0x00, 0x00, 0x00, - 0x5f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, - 0x63, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, - 0x64, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, 0x6c, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x6d, 0x00, 0x00, 0x00, - 0x6c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x6e, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x6e, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x32, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, 0x8a, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x8b, 0x00, 0x00, 0x00, - 0x8a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8c, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x8c, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x1d, 0x00, 0x03, 0x00, 0x92, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x03, 0x00, 0x93, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x94, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x93, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x94, 0x00, 0x00, 0x00, - 0x95, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, - 0x3c, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1d, 0x00, 0x03, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x03, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x9c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9d, 0x00, 0x00, 0x00, - 0x9e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, - 0xa2, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, - 0xa3, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0xa4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xa5, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, 0x00, 0x3f, 0x00, 0x00, 0x00, - 0xad, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, - 0x97, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x3d, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x54, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x73, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x78, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x86, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x07, 0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x44, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, - 0x44, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x3e, 0x00, 0x00, 0x00, - 0x45, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, - 0x4e, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, - 0x4c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x4f, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, - 0x4d, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, - 0x4c, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, - 0x50, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, - 0x4f, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x46, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, - 0x4d, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, - 0x4c, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x54, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, - 0x61, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, - 0x60, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x62, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x3c, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, - 0x66, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, - 0x68, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x6a, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, - 0x71, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, - 0x70, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x72, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x6b, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x74, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, - 0x46, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x76, 0x00, 0x00, 0x00, - 0x77, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x79, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x78, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, - 0x74, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x73, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, - 0x73, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x7d, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, - 0x7d, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x7b, 0x00, 0x00, 0x00, - 0x7e, 0x00, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x81, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, - 0x5b, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x83, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, - 0x7b, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x85, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, - 0x88, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, - 0x85, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, - 0x87, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x86, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x3c, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, - 0x7f, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, - 0x8d, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x91, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x98, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, - 0x98, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, - 0x9a, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, - 0x96, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x00, 0x00, 0x00, - 0x99, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, - 0x9f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, - 0x9e, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0xa1, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0xa8, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0xa7, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0xa9, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, - 0x39, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, - 0xa5, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0xac, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, - 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x0b, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, - 0x1c, 0x00, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, - 0xfe, 0x00, 0x02, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, - 0x36, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, - 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x94, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x81, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, - 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x28, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, - 0x39, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x27, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, - 0xfe, 0x00, 0x02, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, - 0x36, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x2e, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, - 0x85, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, - 0x2e, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, - 0x83, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, - 0x83, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1c, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, - 0x36, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x38, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, - 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, - 0x38, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x39, 0x00, 0x00, 0x00, - 0x38, 0x00, 0x01, 0x00 -}; -static const unsigned int shaders_glsl_logisticregression_comp_spv_len = 4816; -} -} -#endif // define SHADEROP_SHADERLOGISTICREGRESSION_HPP - -// SPDX-License-Identifier: Apache-2.0 - -#if VK_USE_PLATFORM_ANDROID_KHR -#include -#include -// VK_NO_PROTOTYPES required before vulkan import but after wrapper.hpp -#undef VK_NO_PROTOTYPES -static const char* KOMPUTE_LOG_TAG = "KomputeLog"; -#endif - -#include -#include -#include - -#include - -// Typedefs to simplify interaction with core types -namespace kp { -typedef std::array Workgroup; -typedef std::vector Constants; -} - -// Must be after vulkan is included -#ifndef KOMPUTE_VK_API_VERSION -#ifndef KOMPUTE_VK_API_MAJOR_VERSION -#define KOMPUTE_VK_API_MAJOR_VERSION 1 -#endif // KOMPUTE_VK_API_MAJOR_VERSION -#ifndef KOMPUTE_VK_API_MINOR_VERSION -#define KOMPUTE_VK_API_MINOR_VERSION 1 -#endif // KOMPUTE_VK_API_MINOR_VERSION -#define KOMPUTE_VK_API_VERSION \ - VK_MAKE_VERSION( \ - KOMPUTE_VK_API_MAJOR_VERSION, KOMPUTE_VK_API_MINOR_VERSION, 0) -#endif // KOMPUTE_VK_API_VERSION - -// Defining kompute log levels analogous to spdlog log levels -#define KOMPUTE_LOG_LEVEL_TRACE 0 -#define KOMPUTE_LOG_LEVEL_DEBUG 1 -#define KOMPUTE_LOG_LEVEL_INFO 2 -#define KOMPUTE_LOG_LEVEL_WARN 3 -#define KOMPUTE_LOG_LEVEL_ERROR 4 -#define KOMPUTE_LOG_LEVEL_CRITICAL 5 -#define KOMPUTE_LOG_LEVEL_OFF 6 - -#ifndef KOMPUTE_LOG_LEVEL -#if DEBUG -#define KOMPUTE_LOG_LEVEL KOMPUTE_LOG_LEVEL_DEBUG -#else -#define KOMPUTE_LOG_LEVEL KOMPUTE_LOG_LEVEL_INFO -#endif -#endif // KOMPUTE_LOG_LEVEL - -// SPDLOG_ACTIVE_LEVEL must be defined before spdlog.h import -// It is recommended that it's set via KOMPUTE_LOG_LEVEL -// but if required it can be set directly as override -#ifndef SPDLOG_ACTIVE_LEVEL -#define SPDLOG_ACTIVE_LEVEL KOMPUTE_LOG_LEVEL -#endif - -#if defined(KOMPUTE_BUILD_PYTHON) -#include -namespace py = pybind11; -// from python/src/main.cpp -extern py::object kp_debug, kp_info, kp_warning, kp_error; -#endif - -#ifndef KOMPUTE_LOG_OVERRIDE -#if KOMPUTE_ENABLE_SPDLOG -#include -#define KP_LOG_DEBUG(...) SPDLOG_DEBUG(__VA_ARGS__) -#define KP_LOG_INFO(...) SPDLOG_INFO(__VA_ARGS__) -#define KP_LOG_WARN(...) SPDLOG_WARN(__VA_ARGS__) -#define KP_LOG_ERROR(...) SPDLOG_ERROR(__VA_ARGS__) -#else -#include -#if KOMPUTE_LOG_LEVEL > 1 -#define KP_LOG_DEBUG(...) -#else -#if defined(VK_USE_PLATFORM_ANDROID_KHR) -#define KP_LOG_DEBUG(...) \ - ((void)__android_log_write( \ - ANDROID_LOG_DEBUG, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str())) -#elif defined(KOMPUTE_BUILD_PYTHON) -#define KP_LOG_DEBUG(...) kp_debug(fmt::format(__VA_ARGS__)) -#else -#define KP_LOG_DEBUG(...) \ - fmt::print("[{} {}] [debug] [{}:{}] {}\n", \ - __DATE__, \ - __TIME__, \ - __FILE__, \ - __LINE__, \ - fmt::format(__VA_ARGS__)) -#endif // VK_USE_PLATFORM_ANDROID_KHR -#endif // KOMPUTE_LOG_LEVEL > 1 - -#if KOMPUTE_LOG_LEVEL > 2 -#define KP_LOG_INFO(...) -#else -#if defined(VK_USE_PLATFORM_ANDROID_KHR) -#define KP_LOG_INFO(...) \ - ((void)__android_log_write( \ - ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str())) -#elif defined(KOMPUTE_BUILD_PYTHON) -#define KP_LOG_INFO(...) kp_info(fmt::format(__VA_ARGS__)) -#else -#define KP_LOG_INFO(...) \ - fmt::print("[{} {}] [debug] [{}:{}] {}\n", \ - __DATE__, \ - __TIME__, \ - __FILE__, \ - __LINE__, \ - fmt::format(__VA_ARGS__)) -#endif // VK_USE_PLATFORM_ANDROID_KHR -#endif // KOMPUTE_LOG_LEVEL > 2 - -#if KOMPUTE_LOG_LEVEL > 3 -#define KP_LOG_WARN(...) -#else -#if defined(VK_USE_PLATFORM_ANDROID_KHR) -#define KP_LOG_WARN(...) \ - ((void)__android_log_write( \ - ANDROID_LOG_WARN, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str())) -#elif defined(KOMPUTE_BUILD_PYTHON) -#define KP_LOG_WARN(...) kp_warning(fmt::format(__VA_ARGS__)) -#else -#define KP_LOG_WARN(...) \ - fmt::print("[{} {}] [debug] [{}:{}] {}\n", \ - __DATE__, \ - __TIME__, \ - __FILE__, \ - __LINE__, \ - fmt::format(__VA_ARGS__)) -#endif // VK_USE_PLATFORM_ANDROID_KHR -#endif // KOMPUTE_LOG_LEVEL > 3 - -#if KOMPUTE_LOG_LEVEL > 4 -#define KP_LOG_ERROR(...) -#else -#if defined(VK_USE_PLATFORM_ANDROID_KHR) -#define KP_LOG_ERROR(...) \ - ((void)__android_log_write( \ - ANDROID_LOG_ERROR, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str())) -#elif defined(KOMPUTE_BUILD_PYTHON) -#define KP_LOG_ERROR(...) kp_error(fmt::format(__VA_ARGS__)) -#else -#define KP_LOG_ERROR(...) \ - fmt::print("[{} {}] [debug] [{}:{}] {}\n", \ - __DATE__, \ - __TIME__, \ - __FILE__, \ - __LINE__, \ - fmt::format(__VA_ARGS__)) -#endif // VK_USE_PLATFORM_ANDROID_KHR -#endif // KOMPUTE_LOG_LEVEL > 4 -#endif // KOMPUTE_SPDLOG_ENABLED -#endif // KOMPUTE_LOG_OVERRIDE - -// SPDX-License-Identifier: Apache-2.0 - -namespace kp { - -/** - * Structured data used in GPU operations. - * - * Tensors are the base building block in Kompute to perform operations across - * GPUs. Each tensor would have a respective Vulkan memory and buffer, which - * would be used to store their respective data. The tensors can be used for GPU - * data storage or transfer. - */ -class Tensor -{ - public: - /** - * Type for tensors created: Device allows memory to be transferred from - * staging buffers. Staging are host memory visible. Storage are device - * visible but are not set up to transfer or receive data (only for shader - * storage). - */ - enum class TensorTypes - { - eDevice = 0, ///< Type is device memory, source and destination - eHost = 1, ///< Type is host memory, source and destination - eStorage = 2, ///< Type is Device memory (only) - }; - enum class TensorDataTypes - { - eBool = 0, - eInt = 1, - eUnsignedInt = 2, - eFloat = 3, - eDouble = 4, - }; - - /** - * Constructor with data provided which would be used to create the - * respective vulkan buffer and memory. - * - * @param physicalDevice The physical device to use to fetch properties - * @param device The device to use to create the buffer and memory from - * @param data Non-zero-sized vector of data that will be used by the - * tensor - * @param tensorTypes Type for the tensor which is of type TensorTypes - */ - Tensor(std::shared_ptr physicalDevice, - std::shared_ptr device, - void* data, - uint32_t elementTotalCount, - uint32_t elementMemorySize, - const TensorDataTypes& dataType, - const TensorTypes& tensorType = TensorTypes::eDevice); - - /** - * Destructor which is in charge of freeing vulkan resources unless they - * have been provided externally. - */ - virtual ~Tensor(); - - /** - * Function to trigger reinitialisation of the tensor buffer and memory with - * new data as well as new potential device type. - * - * @param data Vector of data to use to initialise vector from - * @param tensorType The type to use for the tensor - */ - void rebuild(void* data, - uint32_t elementTotalCount, - uint32_t elementMemorySize); - - /** - * Destroys and frees the GPU resources which include the buffer and memory. - */ - void destroy(); - - /** - * Check whether tensor is initialized based on the created gpu resources. - * - * @returns Boolean stating whether tensor is initialized - */ - bool isInit(); - - /** - * Retrieve the tensor type of the Tensor - * - * @return Tensor type of tensor - */ - TensorTypes tensorType(); - - /** - * Records a copy from the memory of the tensor provided to the current - * thensor. This is intended to pass memory into a processing, to perform - * a staging buffer transfer, or to gather output (between others). - * - * @param commandBuffer Vulkan Command Buffer to record the commands into - * @param copyFromTensor Tensor to copy the data from - */ - void recordCopyFrom(const vk::CommandBuffer& commandBuffer, - std::shared_ptr copyFromTensor); - - /** - * Records a copy from the internal staging memory to the device memory - * using an optional barrier to wait for the operation. This function would - * only be relevant for kp::Tensors of type eDevice. - * - * @param commandBuffer Vulkan Command Buffer to record the commands into - */ - void recordCopyFromStagingToDevice(const vk::CommandBuffer& commandBuffer); - - /** - * Records a copy from the internal device memory to the staging memory - * using an optional barrier to wait for the operation. This function would - * only be relevant for kp::Tensors of type eDevice. - * - * @param commandBuffer Vulkan Command Buffer to record the commands into - */ - void recordCopyFromDeviceToStaging(const vk::CommandBuffer& commandBuffer); - - /** - * Records the buffer memory barrier into the primary buffer and command - * buffer which ensures that relevant data transfers are carried out - * correctly. - * - * @param commandBuffer Vulkan Command Buffer to record the commands into - * @param srcAccessMask Access flags for source access mask - * @param dstAccessMask Access flags for destination access mask - * @param scrStageMask Pipeline stage flags for source stage mask - * @param dstStageMask Pipeline stage flags for destination stage mask - */ - void recordPrimaryBufferMemoryBarrier( - const vk::CommandBuffer& commandBuffer, - vk::AccessFlagBits srcAccessMask, - vk::AccessFlagBits dstAccessMask, - vk::PipelineStageFlagBits srcStageMask, - vk::PipelineStageFlagBits dstStageMask); - /** - * Records the buffer memory barrier into the staging buffer and command - * buffer which ensures that relevant data transfers are carried out - * correctly. - * - * @param commandBuffer Vulkan Command Buffer to record the commands into - * @param srcAccessMask Access flags for source access mask - * @param dstAccessMask Access flags for destination access mask - * @param scrStageMask Pipeline stage flags for source stage mask - * @param dstStageMask Pipeline stage flags for destination stage mask - */ - void recordStagingBufferMemoryBarrier( - const vk::CommandBuffer& commandBuffer, - vk::AccessFlagBits srcAccessMask, - vk::AccessFlagBits dstAccessMask, - vk::PipelineStageFlagBits srcStageMask, - vk::PipelineStageFlagBits dstStageMask); - - /** - * Constructs a vulkan descriptor buffer info which can be used to specify - * and reference the underlying buffer component of the tensor without - * exposing it. - * - * @return Descriptor buffer info with own buffer - */ - vk::DescriptorBufferInfo constructDescriptorBufferInfo(); - - /** - * Returns the size/magnitude of the Tensor, which will be the total number - * of elements across all dimensions - * - * @return Unsigned integer representing the total number of elements - */ - uint32_t size(); - - /** - * Returns the total size of a single element of the respective data type - * that this tensor holds. - * - * @return Unsigned integer representing the memory of a single element of - * the respective data type. - */ - uint32_t dataTypeMemorySize(); - - /** - * Returns the total memory size of the data contained by the Tensor object - * which would equate to (this->size() * this->dataTypeMemorySize()) - * - * @return Unsigned integer representing the memory of a single element of - * the respective data type. - */ - uint32_t memorySize(); - - /** - * Retrieve the data type of the tensor (host, device, storage) - * - * @return Data type of tensor of type kp::Tensor::TensorDataTypes - */ - TensorDataTypes dataType(); - - /** - * Retrieve the raw data via the pointer to the memory that contains the raw - * memory of this current tensor. This tensor gets changed to a nullptr when - * the Tensor is removed. - * - * @return Pointer to raw memory containing raw bytes data of Tensor. - */ - void* rawData(); - - /** - * Sets / resets the data of the tensor which is directly done on the GPU - * host visible memory available by the tensor. - */ - void setRawData(const void* data); - - /** - * Template to return the pointer data converted by specific type, which - * would be any of the supported types including float, double, int32, - * uint32 and bool. - * - * @return Pointer to raw memory containing raw bytes data of Tensor. - */ - template - T* data() - { - return (T*)this->mRawData; - } - - /** - * Template to get the data of the current tensor as a vector of specific - * type, which would be any of the supported types including float, double, - * int32, uint32 and bool. - * - * @return Vector of type provided by template. - */ - template - std::vector vector() - { - return { (T*)this->mRawData, ((T*)this->mRawData) + this->size() }; - } - - protected: - // -------------- ALWAYS OWNED RESOURCES - TensorTypes mTensorType; - TensorDataTypes mDataType; - uint32_t mSize; - uint32_t mDataTypeMemorySize; - void* mRawData; - - private: - // -------------- NEVER OWNED RESOURCES - std::shared_ptr mPhysicalDevice; - std::shared_ptr mDevice; - - // -------------- OPTIONALLY OWNED RESOURCES - std::shared_ptr mPrimaryBuffer; - bool mFreePrimaryBuffer = false; - std::shared_ptr mStagingBuffer; - bool mFreeStagingBuffer = false; - std::shared_ptr mPrimaryMemory; - bool mFreePrimaryMemory = false; - std::shared_ptr mStagingMemory; - bool mFreeStagingMemory = false; - - void allocateMemoryCreateGPUResources(); // Creates the vulkan buffer - void createBuffer(std::shared_ptr buffer, - vk::BufferUsageFlags bufferUsageFlags); - void allocateBindMemory(std::shared_ptr buffer, - std::shared_ptr memory, - vk::MemoryPropertyFlags memoryPropertyFlags); - void recordCopyBuffer(const vk::CommandBuffer& commandBuffer, - std::shared_ptr bufferFrom, - std::shared_ptr bufferTo, - vk::DeviceSize bufferSize, - vk::BufferCopy copyRegion); - void recordBufferMemoryBarrier(const vk::CommandBuffer& commandBuffer, - const vk::Buffer& buffer, - vk::AccessFlagBits srcAccessMask, - vk::AccessFlagBits dstAccessMask, - vk::PipelineStageFlagBits srcStageMask, - vk::PipelineStageFlagBits dstStageMask); - - // Private util functions - vk::BufferUsageFlags getPrimaryBufferUsageFlags(); - vk::MemoryPropertyFlags getPrimaryMemoryPropertyFlags(); - vk::BufferUsageFlags getStagingBufferUsageFlags(); - vk::MemoryPropertyFlags getStagingMemoryPropertyFlags(); - - void mapRawData(); - void unmapRawData(); -}; - -template -class TensorT : public Tensor -{ - - public: - TensorT(std::shared_ptr physicalDevice, - std::shared_ptr device, - const std::vector& data, - const TensorTypes& tensorType = TensorTypes::eDevice) - : Tensor(physicalDevice, - device, - (void*)data.data(), - data.size(), - sizeof(T), - this->dataType(), - tensorType) - { - KP_LOG_DEBUG("Kompute TensorT constructor with data size {}", - data.size()); - } - - ~TensorT() { KP_LOG_DEBUG("Kompute TensorT destructor"); } - - T* data() { return (T*)this->mRawData; } - - std::vector vector() - { - return { (T*)this->mRawData, ((T*)this->mRawData) + this->size() }; - } - - T& operator[](int index) { return *(((T*)this->mRawData) + index); } - - void setData(const std::vector& data) - { - - KP_LOG_DEBUG("Kompute TensorT setting data with data size {}", - data.size()); - - if (data.size() != this->mSize) { - throw std::runtime_error( - "Kompute TensorT Cannot set data of different sizes"); - } - - Tensor::setRawData(data.data()); - } - - TensorDataTypes dataType(); -}; - -} // End namespace kp - -// SPDX-License-Identifier: Apache-2.0 - -namespace kp { - -/** - Abstraction for compute shaders that are run on top of tensors grouped via - ParameterGroups (which group descriptorsets) -*/ -class Algorithm -{ - public: - /** - * Main constructor for algorithm with configuration parameters to create - * the underlying resources. - * - * @param device The Vulkan device to use for creating resources - * @param tensors (optional) The tensors to use to create the descriptor - * resources - * @param spirv (optional) The spirv code to use to create the algorithm - * @param workgroup (optional) The kp::Workgroup to use for the dispatch - * which defaults to kp::Workgroup(tensor[0].size(), 1, 1) if not set. - * @param specializationConstants (optional) The templatable param is to be - * used to initialize the specialization constants which cannot be changed - * once set. - * @param pushConstants (optional) This templatable param is to be used - * when initializing the pipeline, which set the size of the push constants - * - these can be modified but all new values must have the same data type - * and length as otherwise it will result in errors. - */ - template - Algorithm(std::shared_ptr device, - const std::vector>& tensors = {}, - const std::vector& spirv = {}, - const Workgroup& workgroup = {}, - const std::vector& specializationConstants = {}, - const std::vector

& pushConstants = {}) - { - KP_LOG_DEBUG("Kompute Algorithm Constructor with device"); - - this->mDevice = device; - - if (tensors.size() && spirv.size()) { - KP_LOG_INFO( - "Kompute Algorithm initialising with tensor size: {} and " - "spirv size: {}", - tensors.size(), - spirv.size()); - this->rebuild(tensors, - spirv, - workgroup, - specializationConstants, - pushConstants); - } else { - KP_LOG_INFO( - "Kompute Algorithm constructor with empty tensors and or " - "spirv so not rebuilding vulkan components"); - } - } - - /** - * Rebuild function to reconstruct algorithm with configuration parameters - * to create the underlying resources. - * - * @param tensors The tensors to use to create the descriptor resources - * @param spirv The spirv code to use to create the algorithm - * @param workgroup (optional) The kp::Workgroup to use for the dispatch - * which defaults to kp::Workgroup(tensor[0].size(), 1, 1) if not set. - * @param specializationConstants (optional) The std::vector to use - * to initialize the specialization constants which cannot be changed once - * set. - * @param pushConstants (optional) The std::vector to use when - * initializing the pipeline, which set the size of the push constants - - * these can be modified but all new values must have the same vector size - * as this initial value. - */ - template - void rebuild(const std::vector>& tensors, - const std::vector& spirv, - const Workgroup& workgroup = {}, - const std::vector& specializationConstants = {}, - const std::vector

& pushConstants = {}) - { - KP_LOG_DEBUG("Kompute Algorithm rebuild started"); - - this->mTensors = tensors; - this->mSpirv = spirv; - - if (specializationConstants.size()) { - if (this->mSpecializationConstantsData) { - free(this->mSpecializationConstantsData); - } - uint32_t memorySize = - sizeof(decltype(specializationConstants.back())); - uint32_t size = specializationConstants.size(); - uint32_t totalSize = size * memorySize; - this->mSpecializationConstantsData = malloc(totalSize); - memcpy(this->mSpecializationConstantsData, - specializationConstants.data(), - totalSize); - this->mSpecializationConstantsDataTypeMemorySize = memorySize; - this->mSpecializationConstantsSize = size; - } - - if (pushConstants.size()) { - if (this->mPushConstantsData) { - free(this->mPushConstantsData); - } - uint32_t memorySize = sizeof(decltype(pushConstants.back())); - uint32_t size = pushConstants.size(); - uint32_t totalSize = size * memorySize; - this->mPushConstantsData = malloc(totalSize); - memcpy(this->mPushConstantsData, pushConstants.data(), totalSize); - this->mPushConstantsDataTypeMemorySize = memorySize; - this->mPushConstantsSize = size; - } - - this->setWorkgroup( - workgroup, this->mTensors.size() ? this->mTensors[0]->size() : 1); - - // Descriptor pool is created first so if available then destroy all - // before rebuild - if (this->isInit()) { - this->destroy(); - } - - this->createParameters(); - this->createShaderModule(); - this->createPipeline(); - } - - /** - * Destructor for Algorithm which is responsible for freeing and desroying - * respective pipelines and owned parameter groups. - */ - ~Algorithm(); - - /** - * Records the dispatch function with the provided template parameters or - * alternatively using the size of the tensor by default. - * - * @param commandBuffer Command buffer to record the algorithm resources to - */ - void recordDispatch(const vk::CommandBuffer& commandBuffer); - - /** - * Records command that binds the "core" algorithm components which consist - * of binding the pipeline and binding the descriptorsets. - * - * @param commandBuffer Command buffer to record the algorithm resources to - */ - void recordBindCore(const vk::CommandBuffer& commandBuffer); - - /** - * Records command that binds the push constants to the command buffer - * provided - * - it is required that the pushConstants provided are of the same size as - * the ones provided during initialization. - * - * @param commandBuffer Command buffer to record the algorithm resources to - */ - void recordBindPush(const vk::CommandBuffer& commandBuffer); - - /** - * function that checks all the gpu resource components to verify if these - * have been created and returns true if all are valid. - * - * @returns returns true if the algorithm is currently initialized. - */ - bool isInit(); - - /** - * Sets the work group to use in the recordDispatch - * - * @param workgroup The kp::Workgroup value to use to update the algorithm. - * It must have a value greater than 1 on the x value (index 1) otherwise it - * will be initialized on the size of the first tensor (ie. - * this->mTensor[0]->size()) - */ - void setWorkgroup(const Workgroup& workgroup, uint32_t minSize = 1); - /** - * Sets the push constants to the new value provided to use in the next - * bindPush() - * - * @param pushConstants The templatable vector is to be used to set the push - * constants to use in the next bindPush(...) calls. The constants provided - * must be of the same size as the ones created during initialization. - */ - template - void setPushConstants(const std::vector& pushConstants) - { - uint32_t memorySize = sizeof(decltype(pushConstants.back())); - uint32_t size = pushConstants.size(); - - this->setPushConstants(pushConstants.data(), size, memorySize); - } - - /** - * Sets the push constants to the new value provided to use in the next - * bindPush() with the raw memory block location and memory size to be used. - * - * @param data The raw data point to copy the data from, without modifying - * the pointer. - * @param size The number of data elements provided in the data - * @param memorySize The memory size of each of the data elements in bytes. - */ - void setPushConstants(void* data, uint32_t size, uint32_t memorySize) - { - - uint32_t totalSize = memorySize * size; - uint32_t previousTotalSize = - this->mPushConstantsDataTypeMemorySize * this->mPushConstantsSize; - - if (totalSize != previousTotalSize) { - throw std::runtime_error(fmt::format( - "Kompute Algorithm push " - "constant total memory size provided is {} but expected {} bytes", - totalSize, - previousTotalSize)); - } - if (this->mPushConstantsData) { - free(this->mPushConstantsData); - } - - this->mPushConstantsData = malloc(totalSize); - memcpy(this->mPushConstantsData, data, totalSize); - this->mPushConstantsDataTypeMemorySize = memorySize; - this->mPushConstantsSize = size; - } - - /** - * Gets the current workgroup from the algorithm. - * - * @param The kp::Constant to use to set the push constants to use in the - * next bindPush(...) calls. The constants provided must be of the same size - * as the ones created during initialization. - */ - const Workgroup& getWorkgroup(); - /** - * Gets the specialization constants of the current algorithm. - * - * @returns The std::vector currently set for specialization - * constants - */ - template - const std::vector getSpecializationConstants() - { - return { (T*)this->mSpecializationConstantsData, - ((T*)this->mSpecializationConstantsData) + - this->mSpecializationConstantsSize }; - } - /** - * Gets the specialization constants of the current algorithm. - * - * @returns The std::vector currently set for push constants - */ - template - const std::vector getPushConstants() - { - return { (T*)this->mPushConstantsData, - ((T*)this->mPushConstantsData) + this->mPushConstantsSize }; - } - /** - * Gets the current tensors that are used in the algorithm. - * - * @returns The list of tensors used in the algorithm. - */ - const std::vector>& getTensors(); - - void destroy(); - - private: - // -------------- NEVER OWNED RESOURCES - std::shared_ptr mDevice; - std::vector> mTensors; - - // -------------- OPTIONALLY OWNED RESOURCES - std::shared_ptr mDescriptorSetLayout; - bool mFreeDescriptorSetLayout = false; - std::shared_ptr mDescriptorPool; - bool mFreeDescriptorPool = false; - std::shared_ptr mDescriptorSet; - bool mFreeDescriptorSet = false; - std::shared_ptr mShaderModule; - bool mFreeShaderModule = false; - std::shared_ptr mPipelineLayout; - bool mFreePipelineLayout = false; - std::shared_ptr mPipelineCache; - bool mFreePipelineCache = false; - std::shared_ptr mPipeline; - bool mFreePipeline = false; - - // -------------- ALWAYS OWNED RESOURCES - std::vector mSpirv; - void* mSpecializationConstantsData = nullptr; - uint32_t mSpecializationConstantsDataTypeMemorySize = 0; - uint32_t mSpecializationConstantsSize = 0; - void* mPushConstantsData = nullptr; - uint32_t mPushConstantsDataTypeMemorySize = 0; - uint32_t mPushConstantsSize = 0; - Workgroup mWorkgroup; - - // Create util functions - void createShaderModule(); - void createPipeline(); - - // Parameters - void createParameters(); -}; - -} // End namespace kp - -// SPDX-License-Identifier: Apache-2.0 - -namespace kp { - -/** - * Base Operation which provides the high level interface that Kompute - * operations implement in order to perform a set of actions in the GPU. - * - * Operations can perform actions on tensors, and optionally can also own an - * Algorithm with respective parameters. kp::Operations with kp::Algorithms - * would inherit from kp::OpBaseAlgo. - */ -class OpBase -{ - public: - /** - * Default destructor for OpBase class. This OpBase destructor class should - * always be called to destroy and free owned resources unless it is - * intended to destroy the resources in the parent class. - */ - virtual ~OpBase() { KP_LOG_DEBUG("Kompute OpBase destructor started"); } - - /** - * The record function is intended to only send a record command or run - * commands that are expected to record operations that are to be submitted - * as a batch into the GPU. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void record(const vk::CommandBuffer& commandBuffer) = 0; - - /** - * Pre eval is called before the Sequence has called eval and submitted the - * commands to the GPU for processing, and can be used to perform any - * per-eval setup steps required as the computation iteration begins. It's - * worth noting that there are situations where eval can be called multiple - * times, so the resources that are created should be idempotent in case - * it's called multiple times in a row. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void preEval(const vk::CommandBuffer& commandBuffer) = 0; - - /** - * Post eval is called after the Sequence has called eval and submitted the - * commands to the GPU for processing, and can be used to perform any - * tear-down steps required as the computation iteration finishes. It's - * worth noting that there are situations where eval can be called multiple - * times, so the resources that are destroyed should not require a re-init - * unless explicitly provided by the user. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void postEval(const vk::CommandBuffer& commandBuffer) = 0; -}; - -} // End namespace kp - -// SPDX-License-Identifier: Apache-2.0 - -namespace kp { - -/** - * Operation that provides a general abstraction that simplifies the use of - * algorithm and parameter components which can be used with shaders. - * It exposes the pipeline barrier functionality specifically for memory - * barriers that can be configured through the respective source and destination - * masks - */ -class OpMemoryBarrier : public OpBase -{ - public: - /** - * Constructor that stores tensors as well as memory barrier parameters to - * be used to create a pipeline barrier on the respective primary or staging - * tensor. - * - * @param tensors The tensors to apply the memory barriers on - * @param srcAccessMask The kp::AccessFlagBits for the source access mask - * @param dstAccessMask The kp::AccessFlagBits for the destination access - * mask - * @param srcStageMask The kp::PipelineStageFlagBits for the source stage - * mask - * @param dstStageMask The kp::PipelineStageFlagBits for the destination - * stage mask - * @param barrierOnPrimary Boolean to select primary or secondary buffers on - * tensors - */ - OpMemoryBarrier(const std::vector>& tensors, - const vk::AccessFlagBits& srcAccessMask, - const vk::AccessFlagBits& dstAccessMask, - const vk::PipelineStageFlagBits& srcStageMask, - const vk::PipelineStageFlagBits& dstStageMask, - bool barrierOnPrimary = true); - - /** - * Default destructor, which is in charge of destroying the reference to the - * tensors and all the relevant access / stage masks created - */ - virtual ~OpMemoryBarrier() override; - - /** - * This records the memory barrier with the access and stage masks provided - * across all relevant tensors. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void record(const vk::CommandBuffer& commandBuffer) override; - - /** - * Does not perform any preEval commands. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void preEval(const vk::CommandBuffer& commandBuffer) override; - - /** - * Does not perform any postEval commands. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void postEval(const vk::CommandBuffer& commandBuffer) override; - - private: - const vk::AccessFlagBits mSrcAccessMask; - const vk::AccessFlagBits mDstAccessMask; - const vk::PipelineStageFlagBits mSrcStageMask; - const vk::PipelineStageFlagBits mDstStageMask; - const bool mBarrierOnPrimary; - const std::vector> mTensors; -}; - -} // End namespace kp - -// SPDX-License-Identifier: Apache-2.0 - -namespace kp { - -/** - * Operation that copies the data from the first tensor to the rest of the - * tensors provided, using a record command for all the vectors. This operation - * does not own/manage the memory of the tensors passed to it. The operation - * must only receive tensors of type - */ -class OpTensorCopy : public OpBase -{ - public: - /** - * Default constructor with parameters that provides the core vulkan - * resources and the tensors that will be used in the operation. - * - * @param tensors Tensors that will be used to create in operation. - */ - OpTensorCopy(const std::vector>& tensors); - - /** - * Default destructor. This class does not manage memory so it won't be - * expecting the parent to perform a release. - */ - ~OpTensorCopy() override; - - /** - * Records the copy commands from the first tensor into all the other - * tensors provided. Also optionally records a barrier. - * - * @param commandBuffer The command buffer to record the command into. - */ - void record(const vk::CommandBuffer& commandBuffer) override; - - /** - * Does not perform any preEval commands. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void preEval(const vk::CommandBuffer& commandBuffer) override; - - /** - * Copies the local vectors for all the tensors to sync the data with the - * gpu. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void postEval(const vk::CommandBuffer& commandBuffer) override; - - private: - // -------------- ALWAYS OWNED RESOURCES - std::vector> mTensors; -}; - -} // End namespace kp - -// SPDX-License-Identifier: Apache-2.0 - -namespace kp { - -/** - * Operation that syncs tensor's device by mapping local data into the device - * memory. For TensorTypes::eDevice it will use a record operation for the - * memory to be syncd into GPU memory which means that the operation will be - * done in sync with GPU commands. For TensorTypes::eHost it will only map the - * data into host memory which will happen during preEval before the recorded - * commands are dispatched. - */ -class OpTensorSyncDevice : public OpBase -{ - public: - /** - * Default constructor with parameters that provides the core vulkan - * resources and the tensors that will be used in the operation. The tensos - * provided cannot be of type TensorTypes::eStorage. - * - * @param tensors Tensors that will be used to create in operation. - */ - OpTensorSyncDevice(const std::vector>& tensors); - - /** - * Default destructor. This class does not manage memory so it won't be - * expecting the parent to perform a release. - */ - ~OpTensorSyncDevice() override; - - /** - * For device tensors, it records the copy command for the tensor to copy - * the data from its staging to device memory. - * - * @param commandBuffer The command buffer to record the command into. - */ - void record(const vk::CommandBuffer& commandBuffer) override; - - /** - * Does not perform any preEval commands. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void preEval(const vk::CommandBuffer& commandBuffer) override; - - /** - * Does not perform any postEval commands. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void postEval(const vk::CommandBuffer& commandBuffer) override; - - private: - // -------------- ALWAYS OWNED RESOURCES - std::vector> mTensors; -}; - -} // End namespace kp - -// SPDX-License-Identifier: Apache-2.0 - -namespace kp { - -/** - * Operation that syncs tensor's local memory by mapping device data into the - * local CPU memory. For TensorTypes::eDevice it will use a record operation - * for the memory to be syncd into GPU memory which means that the operation - * will be done in sync with GPU commands. For TensorTypes::eHost it will - * only map the data into host memory which will happen during preEval before - * the recorded commands are dispatched. - */ -class OpTensorSyncLocal : public OpBase -{ - public: - /** - * Default constructor with parameters that provides the core vulkan - * resources and the tensors that will be used in the operation. The tensors - * provided cannot be of type TensorTypes::eStorage. - * - * @param tensors Tensors that will be used to create in operation. - */ - OpTensorSyncLocal(const std::vector>& tensors); - - /** - * Default destructor. This class does not manage memory so it won't be - * expecting the parent to perform a release. - */ - ~OpTensorSyncLocal() override; - - /** - * For device tensors, it records the copy command for the tensor to copy - * the data from its device to staging memory. - * - * @param commandBuffer The command buffer to record the command into. - */ - void record(const vk::CommandBuffer& commandBuffer) override; - - /** - * Does not perform any preEval commands. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void preEval(const vk::CommandBuffer& commandBuffer) override; - - /** - * For host tensors it performs the map command from the host memory into - * local memory. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void postEval(const vk::CommandBuffer& commandBuffer) override; - - private: - // -------------- ALWAYS OWNED RESOURCES - std::vector> mTensors; -}; - -} // End namespace kp - -// SPDX-License-Identifier: Apache-2.0 - -namespace kp { - -/** - * Operation that provides a general abstraction that simplifies the use of - * algorithm and parameter components which can be used with shaders. - * By default it enables the user to provide a dynamic number of tensors - * which are then passed as inputs. - */ -class OpAlgoDispatch : public OpBase -{ - public: - /** - * Constructor that stores the algorithm to use as well as the relevant - * push constants to override when recording. - * - * @param algorithm The algorithm object to use for dispatch - * @param pushConstants The push constants to use for override - */ - template - OpAlgoDispatch(const std::shared_ptr& algorithm, - const std::vector& pushConstants = {}) - { - KP_LOG_DEBUG("Kompute OpAlgoDispatch constructor"); - - this->mAlgorithm = algorithm; - - if (pushConstants.size()) { - uint32_t memorySize = sizeof(decltype(pushConstants.back())); - uint32_t size = pushConstants.size(); - uint32_t totalSize = size * memorySize; - this->mPushConstantsData = malloc(totalSize); - memcpy(this->mPushConstantsData, pushConstants.data(), totalSize); - this->mPushConstantsDataTypeMemorySize = memorySize; - this->mPushConstantsSize = size; - } - } - - /** - * Default destructor, which is in charge of destroying the algorithm - * components but does not destroy the underlying tensors - */ - virtual ~OpAlgoDispatch() override; - - /** - * This records the commands that are to be sent to the GPU. This includes - * the barriers that ensure the memory has been copied before going in and - * out of the shader, as well as the dispatch operation that sends the - * shader processing to the gpu. This function also records the GPU memory - * copy of the output data for the staging buffer so it can be read by the - * host. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void record(const vk::CommandBuffer& commandBuffer) override; - - /** - * Does not perform any preEval commands. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void preEval(const vk::CommandBuffer& commandBuffer) override; - - /** - * Does not perform any postEval commands. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void postEval(const vk::CommandBuffer& commandBuffer) override; - - private: - // -------------- ALWAYS OWNED RESOURCES - std::shared_ptr mAlgorithm; - void* mPushConstantsData = nullptr; - uint32_t mPushConstantsDataTypeMemorySize = 0; - uint32_t mPushConstantsSize = 0; -}; - -} // End namespace kp - -// SPDX-License-Identifier: Apache-2.0 - -#include - -namespace kp { - -/** - * Operation that performs multiplication on two tensors and outpus on third - * tensor. - */ -class OpMult : public OpAlgoDispatch -{ - public: - /** - * Default constructor with parameters that provides the bare minimum - * requirements for the operations to be able to create and manage their - * sub-components. - * - * @param tensors Tensors that are to be used in this operation - * @param algorithm An algorithm that will be overridden with the OpMult - * shader data and the tensors provided which are expected to be 3 - */ - OpMult(std::vector> tensors, - std::shared_ptr algorithm) - : OpAlgoDispatch(algorithm) - { - KP_LOG_DEBUG("Kompute OpMult constructor with params"); - - if (tensors.size() != 3) { - throw std::runtime_error( - "Kompute OpMult expected 3 tensors but got " + tensors.size()); - } - - std::vector spirv( - (uint32_t*)shader_data::shaders_glsl_opmult_comp_spv, - (uint32_t*)(shader_data::shaders_glsl_opmult_comp_spv + - kp::shader_data::shaders_glsl_opmult_comp_spv_len)); - - algorithm->rebuild<>(tensors, spirv); - } - - /** - * Default destructor, which is in charge of destroying the algorithm - * components but does not destroy the underlying tensors - */ - virtual ~OpMult() override - { - KP_LOG_DEBUG("Kompute OpMult destructor started"); - } -}; - -} // End namespace kp - -// SPDX-License-Identifier: Apache-2.0 - -namespace kp { - -/** - * Container of operations that can be sent to GPU as batch - */ -class Sequence : public std::enable_shared_from_this -{ - public: - /** - * Main constructor for sequence which requires core vulkan components to - * generate all dependent resources. - * - * @param physicalDevice Vulkan physical device - * @param device Vulkan logical device - * @param computeQueue Vulkan compute queue - * @param queueIndex Vulkan compute queue index in device - * @param totalTimestamps Maximum number of timestamps to allocate - */ - Sequence(std::shared_ptr physicalDevice, - std::shared_ptr device, - std::shared_ptr computeQueue, - uint32_t queueIndex, - uint32_t totalTimestamps = 0); - /** - * Destructor for sequence which is responsible for cleaning all subsequent - * owned operations. - */ - ~Sequence(); - - /** - * Record function for operation to be added to the GPU queue in batch. This - * template requires classes to be derived from the OpBase class. This - * function also requires the Sequence to be recording, otherwise it will - * not be able to add the operation. - * - * @param op Object derived from kp::BaseOp that will be recoreded by the - * sequence which will be used when the operation is evaluated. - * @return shared_ptr of the Sequence class itself - */ - std::shared_ptr record(std::shared_ptr op); - - /** - * Record function for operation to be added to the GPU queue in batch. This - * template requires classes to be derived from the OpBase class. This - * function also requires the Sequence to be recording, otherwise it will - * not be able to add the operation. - * - * @param tensors Vector of tensors to use for the operation - * @param TArgs Template parameters that are used to initialise operation - * which allows for extensible configurations on initialisation. - * @return shared_ptr of the Sequence class itself - */ - template - std::shared_ptr record( - std::vector> tensors, - TArgs&&... params) - { - std::shared_ptr op{ new T(tensors, std::forward(params)...) }; - return this->record(op); - } - /** - * Record function for operation to be added to the GPU queue in batch. This - * template requires classes to be derived from the OpBase class. This - * function also requires the Sequence to be recording, otherwise it will - * not be able to add the operation. - * - * @param algorithm Algorithm to use for the record often used for OpAlgo - * operations - * @param TArgs Template parameters that are used to initialise operation - * which allows for extensible configurations on initialisation. - * @return shared_ptr of the Sequence class itself - */ - template - std::shared_ptr record(std::shared_ptr algorithm, - TArgs&&... params) - { - std::shared_ptr op{ new T(algorithm, - std::forward(params)...) }; - return this->record(op); - } - - /** - * Eval sends all the recorded and stored operations in the vector of - * operations into the gpu as a submit job synchronously (with a barrier). - * - * @return shared_ptr of the Sequence class itself - */ - std::shared_ptr eval(); - - /** - * Resets all the recorded and stored operations, records the operation - * provided and submits into the gpu as a submit job synchronously (with a - * barrier). - * - * @return shared_ptr of the Sequence class itself - */ - std::shared_ptr eval(std::shared_ptr op); - - /** - * Eval sends all the recorded and stored operations in the vector of - * operations into the gpu as a submit job with a barrier. - * - * @param tensors Vector of tensors to use for the operation - * @param TArgs Template parameters that are used to initialise operation - * which allows for extensible configurations on initialisation. - * @return shared_ptr of the Sequence class itself - */ - template - std::shared_ptr eval(std::vector> tensors, - TArgs&&... params) - { - std::shared_ptr op{ new T(tensors, std::forward(params)...) }; - return this->eval(op); - } - /** - * Eval sends all the recorded and stored operations in the vector of - * operations into the gpu as a submit job with a barrier. - * - * @param algorithm Algorithm to use for the record often used for OpAlgo - * operations - * @param TArgs Template parameters that are used to initialise operation - * which allows for extensible configurations on initialisation. - * @return shared_ptr of the Sequence class itself - */ - template - std::shared_ptr eval(std::shared_ptr algorithm, - TArgs&&... params) - { - std::shared_ptr op{ new T(algorithm, - std::forward(params)...) }; - return this->eval(op); - } - - /** - * Eval Async sends all the recorded and stored operations in the vector of - * operations into the gpu as a submit job without a barrier. EvalAwait() - * must ALWAYS be called after to ensure the sequence is terminated - * correctly. - * - * @return Boolean stating whether execution was successful. - */ - std::shared_ptr evalAsync(); - /** - * Clears currnet operations to record provided one in the vector of - * operations into the gpu as a submit job without a barrier. EvalAwait() - * must ALWAYS be called after to ensure the sequence is terminated - * correctly. - * - * @return Boolean stating whether execution was successful. - */ - std::shared_ptr evalAsync(std::shared_ptr op); - /** - * Eval sends all the recorded and stored operations in the vector of - * operations into the gpu as a submit job with a barrier. - * - * @param tensors Vector of tensors to use for the operation - * @param TArgs Template parameters that are used to initialise operation - * which allows for extensible configurations on initialisation. - * @return shared_ptr of the Sequence class itself - */ - template - std::shared_ptr evalAsync( - std::vector> tensors, - TArgs&&... params) - { - std::shared_ptr op{ new T(tensors, std::forward(params)...) }; - return this->evalAsync(op); - } - /** - * Eval sends all the recorded and stored operations in the vector of - * operations into the gpu as a submit job with a barrier. - * - * @param algorithm Algorithm to use for the record often used for OpAlgo - * operations - * @param TArgs Template parameters that are used to initialise operation - * which allows for extensible configurations on initialisation. - * @return shared_ptr of the Sequence class itself - */ - template - std::shared_ptr evalAsync(std::shared_ptr algorithm, - TArgs&&... params) - { - std::shared_ptr op{ new T(algorithm, - std::forward(params)...) }; - return this->evalAsync(op); - } - - /** - * Eval Await waits for the fence to finish processing and then once it - * finishes, it runs the postEval of all operations. - * - * @param waitFor Number of milliseconds to wait before timing out. - * @return shared_ptr of the Sequence class itself - */ - std::shared_ptr evalAwait(uint64_t waitFor = UINT64_MAX); - - /** - * Clear function clears all operations currently recorded and starts - * recording again. - */ - void clear(); - - /** - * Return the timestamps that were latched at the beginning and - * after each operation during the last eval() call. - */ - std::vector getTimestamps(); - - /** - * Begins recording commands for commands to be submitted into the command - * buffer. - * - * @return Boolean stating whether execution was successful. - */ - void begin(); - - /** - * Ends the recording and stops recording commands when the record command - * is sent. - * - * @return Boolean stating whether execution was successful. - */ - void end(); - - /** - * Returns true if the sequence is currently in recording activated. - * - * @return Boolean stating if recording ongoing. - */ - [[nodiscard]] bool isRecording() const; - - /** - * Returns true if the sequence has been initialised, and it's based on the - * GPU resources being referenced. - * - * @return Boolean stating if is initialized - */ - [[nodiscard]] bool isInit() const; - - /** - * Clears command buffer and triggers re-record of all the current - * operations saved, which is useful if the underlying kp::Tensors or - * kp::Algorithms are modified and need to be re-recorded. - */ - void rerecord(); - - /** - * Returns true if the sequence is currently running - mostly used for async - * workloads. - * - * @return Boolean stating if currently running. - */ - [[nodiscard]] bool isRunning() const; - - /** - * Destroys and frees the GPU resources which include the buffer and memory - * and sets the sequence as init=False. - */ - void destroy(); - - private: - // -------------- NEVER OWNED RESOURCES - std::shared_ptr mPhysicalDevice = nullptr; - std::shared_ptr mDevice = nullptr; - std::shared_ptr mComputeQueue = nullptr; - uint32_t mQueueIndex = -1; - - // -------------- OPTIONALLY OWNED RESOURCES - std::shared_ptr mCommandPool = nullptr; - bool mFreeCommandPool = false; - std::shared_ptr mCommandBuffer = nullptr; - bool mFreeCommandBuffer = false; - - // -------------- ALWAYS OWNED RESOURCES - vk::Fence mFence; - std::vector> mOperations; - std::shared_ptr timestampQueryPool = nullptr; - - // State - bool mRecording = false; - bool mIsRunning = false; - - // Create functions - void createCommandPool(); - void createCommandBuffer(); - void createTimestampQueryPool(uint32_t totalTimestamps); -}; - -} // End namespace kp - -// SPDX-License-Identifier: Apache-2.0 - -#include -#include - -#define KP_DEFAULT_SESSION "DEFAULT" - -namespace kp { - -/** - Base orchestrator which creates and manages device and child components -*/ -class Manager -{ - public: - /** - Base constructor and default used which creates the base resources - including choosing the device 0 by default. - */ - Manager(); - - /** - * Similar to base constructor but allows for further configuration to use - * when creating the Vulkan resources. - * - * @param physicalDeviceIndex The index of the physical device to use - * @param familyQueueIndices (Optional) List of queue indices to add for - * explicit allocation - * @param desiredExtensions The desired extensions to load from - * physicalDevice - */ - Manager(uint32_t physicalDeviceIndex, - const std::vector& familyQueueIndices = {}, - const std::vector& desiredExtensions = {}); - - /** - * Manager constructor which allows your own vulkan application to integrate - * with the kompute use. - * - * @param instance Vulkan compute instance to base this application - * @param physicalDevice Vulkan physical device to use for application - * @param device Vulkan logical device to use for all base resources - * @param physicalDeviceIndex Index for vulkan physical device used - */ - Manager(std::shared_ptr instance, - std::shared_ptr physicalDevice, - std::shared_ptr device); - - /** - * Manager destructor which would ensure all owned resources are destroyed - * unless explicitly stated that resources should not be destroyed or freed. - */ - ~Manager(); - - /** - * Create a managed sequence that will be destroyed by this manager - * if it hasn't been destroyed by its reference count going to zero. - * - * @param queueIndex The queue to use from the available queues - * @param nrOfTimestamps The maximum number of timestamps to allocate. - * If zero (default), disables latching of timestamps. - * @returns Shared pointer with initialised sequence - */ - std::shared_ptr sequence(uint32_t queueIndex = 0, - uint32_t totalTimestamps = 0); - - /** - * Create a managed tensor that will be destroyed by this manager - * if it hasn't been destroyed by its reference count going to zero. - * - * @param data The data to initialize the tensor with - * @param tensorType The type of tensor to initialize - * @returns Shared pointer with initialised tensor - */ - template - std::shared_ptr> tensorT( - const std::vector& data, - Tensor::TensorTypes tensorType = Tensor::TensorTypes::eDevice) - { - KP_LOG_DEBUG("Kompute Manager tensor creation triggered"); - - std::shared_ptr> tensor{ new kp::TensorT( - this->mPhysicalDevice, this->mDevice, data, tensorType) }; - - if (this->mManageResources) { - this->mManagedTensors.push_back(tensor); - } - - return tensor; - } - - std::shared_ptr> tensor( - const std::vector& data, - Tensor::TensorTypes tensorType = Tensor::TensorTypes::eDevice) - { - return this->tensorT(data, tensorType); - } - - std::shared_ptr tensor( - void* data, - uint32_t elementTotalCount, - uint32_t elementMemorySize, - const Tensor::TensorDataTypes& dataType, - Tensor::TensorTypes tensorType = Tensor::TensorTypes::eDevice) - { - std::shared_ptr tensor{ new kp::Tensor(this->mPhysicalDevice, - this->mDevice, - data, - elementTotalCount, - elementMemorySize, - dataType, - tensorType) }; - - if (this->mManageResources) { - this->mManagedTensors.push_back(tensor); - } - - return tensor; - } - - /** - * Default non-template function that can be used to create algorithm - * objects which provides default types to the push and spec constants as - * floats. - * - * @param tensors (optional) The tensors to initialise the algorithm with - * @param spirv (optional) The SPIRV bytes for the algorithm to dispatch - * @param workgroup (optional) kp::Workgroup for algorithm to use, and - * defaults to (tensor[0].size(), 1, 1) - * @param specializationConstants (optional) float vector to use for - * specialization constants, and defaults to an empty constant - * @param pushConstants (optional) float vector to use for push constants, - * and defaults to an empty constant - * @returns Shared pointer with initialised algorithm - */ - std::shared_ptr algorithm( - const std::vector>& tensors = {}, - const std::vector& spirv = {}, - const Workgroup& workgroup = {}, - const std::vector& specializationConstants = {}, - const std::vector& pushConstants = {}) - { - return this->algorithm<>( - tensors, spirv, workgroup, specializationConstants, pushConstants); - } - - /** - * Create a managed algorithm that will be destroyed by this manager - * if it hasn't been destroyed by its reference count going to zero. - * - * @param tensors (optional) The tensors to initialise the algorithm with - * @param spirv (optional) The SPIRV bytes for the algorithm to dispatch - * @param workgroup (optional) kp::Workgroup for algorithm to use, and - * defaults to (tensor[0].size(), 1, 1) - * @param specializationConstants (optional) templatable vector parameter to - * use for specialization constants, and defaults to an empty constant - * @param pushConstants (optional) templatable vector parameter to use for - * push constants, and defaults to an empty constant - * @returns Shared pointer with initialised algorithm - */ - template - std::shared_ptr algorithm( - const std::vector>& tensors, - const std::vector& spirv, - const Workgroup& workgroup, - const std::vector& specializationConstants, - const std::vector

& pushConstants) - { - - KP_LOG_DEBUG("Kompute Manager algorithm creation triggered"); - - std::shared_ptr algorithm{ new kp::Algorithm( - this->mDevice, - tensors, - spirv, - workgroup, - specializationConstants, - pushConstants) }; - - if (this->mManageResources) { - this->mManagedAlgorithms.push_back(algorithm); - } - - return algorithm; - } - - /** - * Destroy the GPU resources and all managed resources by manager. - **/ - void destroy(); - /** - * Run a pseudo-garbage collection to release all the managed resources - * that have been already freed due to these reaching to zero ref count. - **/ - void clear(); - - /** - * Information about the current device. - * - * @return vk::PhysicalDeviceProperties containing information about the - *device - **/ - vk::PhysicalDeviceProperties getDeviceProperties() const; - - /** - * List the devices available in the current vulkan instance. - * - * @return vector of physical devices containing their respective properties - **/ - std::vector listDevices() const; - - private: - // -------------- OPTIONALLY OWNED RESOURCES - std::shared_ptr mInstance = nullptr; - bool mFreeInstance = false; - std::shared_ptr mPhysicalDevice = nullptr; - std::shared_ptr mDevice = nullptr; - bool mFreeDevice = false; - - // -------------- ALWAYS OWNED RESOURCES - std::vector> mManagedTensors; - std::vector> mManagedSequences; - std::vector> mManagedAlgorithms; - - std::vector mComputeQueueFamilyIndices; - std::vector> mComputeQueues; - - bool mManageResources = false; - -#if DEBUG -#ifndef KOMPUTE_DISABLE_VK_DEBUG_LAYERS - vk::DebugReportCallbackEXT mDebugReportCallback; - vk::DispatchLoaderDynamic mDebugDispatcher; -#endif -#endif - - // Create functions - void createInstance(); - void createDevice(const std::vector& familyQueueIndices = {}, - uint32_t hysicalDeviceIndex = 0, - const std::vector& desiredExtensions = {}); -}; - -} // End namespace kp - -/** - * fmt fromater for kp::Tensor::TensorDataTypes. - */ -template<> -struct fmt::formatter : formatter -{ - template - auto format(kp::Tensor::TensorDataTypes dt, FormatContext& ctx) - { - std::string name = "unknown"; - switch (dt) { - case kp::Tensor::TensorDataTypes::eBool: - name = "eBool"; - break; - case kp::Tensor::TensorDataTypes::eDouble: - name = "eDouble"; - break; - case kp::Tensor::TensorDataTypes::eFloat: - name = "eFloat"; - break; - case kp::Tensor::TensorDataTypes::eInt: - name = "eInt"; - break; - case kp::Tensor::TensorDataTypes::eUnsignedInt: - name = "eUnsignedInt"; - break; - } - return formatter::format(name, ctx); - } -}; - -/** - * fmt fromater for kp::Tensor::TensorTypes. - */ -template<> -struct fmt::formatter : formatter -{ - template - auto format(kp::Tensor::TensorTypes dt, FormatContext& ctx) - { - std::string name = "unknown"; - switch (dt) { - case kp::Tensor::TensorTypes::eDevice: - name = "eDevice"; - break; - case kp::Tensor::TensorTypes::eHost: - name = "eHost"; - break; - case kp::Tensor::TensorTypes::eStorage: - name = "eStorage"; - break; - } - return formatter::format(name, ctx); - } -}; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9747694fe..dbb47dbe8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,169 +1,80 @@ # SPDX-License-Identifier: Apache-2.0 +cmake_minimum_required(VERSION 3.20) + if(KOMPUTE_OPT_ANDROID_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_ANDROID_BUILD) - find_package(Vulkan REQUIRED) -endif() - -if(KOMPUTE_OPT_BUILD_SHADERS) -# all shaders are compiled into cpp files - kompute_make(build_shaders - OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/include) -endif() - -if(KOMPUTE_OPT_BUILD_SINGLE_HEADER) -# all headers are compiled into a single header - kompute_make(build_single_header - OUTPUT ${PROJECT_SOURCE_DIR}/single_include) -endif() - -file(GLOB kompute_CPP - "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" -) - -if(KOMPUTE_OPT_ANDROID_BUILD) - set(VK_ANDROID_COMMON_DIR ${ANDROID_NDK}/sources/third_party/vulkan/src/common) - set(VK_ANDROID_PATCH_DIR ${PROJECT_SOURCE_DIR}/vk_ndk_wrapper_include/) - set(VK_ANDROID_INCLUDE_DIR ${ANDROID_NDK}/sources/third_party/vulkan/src/include) - - include_directories( - ${VK_ANDROID_COMMON_DIR} - ${VK_ANDROID_PATCH_DIR} - ${VK_ANDROID_INCLUDE_DIR}) - - add_library(kompute_vk_ndk_wrapper STATIC - ${PROJECT_SOURCE_DIR}/vk_ndk_wrapper_include/kompute_vk_ndk_wrapper.cpp) -endif() - -if(NOT KOMPUTE_OPT_BUILD_AS_SHARED_LIB) - add_library( - kompute STATIC - ${kompute_CPP}) -else() - add_library( - kompute SHARED - ${kompute_CPP}) -endif() - -target_include_directories( - kompute PUBLIC - $ - $ -) - -if(NOT KOMPUTE_OPT_ANDROID_BUILD) - target_link_libraries( - kompute - Vulkan::Vulkan - ) -else() - target_link_libraries( - kompute - ) -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 - $) -endif() - -##################################################### -#################### fmt ####################### -##################################################### - -if(KOMPUTE_OPT_REPO_SUBMODULE_BUILD) - add_subdirectory(${PROJECT_SOURCE_DIR}/external/fmt ${CMAKE_CURRENT_BINARY_DIR}/kompute_fmt) -else() - find_package(fmt REQUIRED) -endif() - -target_link_libraries( - kompute - fmt::fmt -) - -##################################################### -#################### SPDLOG ####################### -##################################################### - -if(KOMPUTE_OPT_ENABLE_SPDLOG) - if(KOMPUTE_OPT_REPO_SUBMODULE_BUILD) - add_subdirectory(${PROJECT_SOURCE_DIR}/external/spdlog ${CMAKE_CURRENT_BINARY_DIR}/kompute_spdlog) - else() - find_package(spdlog REQUIRED) - endif() - - target_link_libraries( - kompute - spdlog::spdlog - ) -endif() - -##################################################### -#################### Android ####################### -##################################################### - -if(KOMPUTE_OPT_ANDROID_BUILD) - target_link_libraries( - kompute - kompute_vk_ndk_wrapper - log - android - ) -endif() - -##################################################### -########## Built C++ Header SHADERS ################# -##################################################### - -if(KOMPUTE_OPT_BUILD_SHADERS) - add_dependencies(kompute - build_shaders) -endif() - -##################################################### -#################### Single Header ####################### -##################################################### - -if(KOMPUTE_OPT_BUILD_SINGLE_HEADER) - add_dependencies(kompute - build_single_header) -endif() +cmake_minimum_required(VERSION 3.20) +add_library(kompute Algorithm.cpp + Manager.cpp + OpAlgoDispatch.cpp + OpMemoryBarrier.cpp + OpTensorCopy.cpp + OpTensorSyncDevice.cpp + OpTensorSyncLocal.cpp + Sequence.cpp + Tensor.cpp + Core.cpp) add_library(kompute::kompute ALIAS kompute) -if(KOMPUTE_OPT_INSTALL) - install(TARGETS kompute EXPORT KomputeTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - INCLUDES DESTINATION include) +# Set version for shared libraries. +set_target_properties(kompute + PROPERTIES + VERSION ${${PROJECT_NAME}_VERSION} + SOVERSION ${${PROJECT_NAME}_VERSION_MAJOR}) - target_include_directories(kompute PUBLIC $) +# Import GNU common install directory variables +include(GNUInstallDirs) - install(DIRECTORY include/ DESTINATION include) +install(TARGETS kompute + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/single_include/ - DESTINATION include) +# Include CMake helpers for package config files +# Follow this installation guideline: https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html +include(CMakePackageConfigHelpers) - install(EXPORT KomputeTargets - FILE komputeConfig.cmake - NAMESPACE kompute:: - DESTINATION lib/cmake/kompute) +configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/komputeConfig.cmake.in + "${PROJECT_BINARY_DIR}/kompute/komputeConfig.cmake" + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kompute) + +install(FILES ${PROJECT_BINARY_DIR}/kompute/komputeConfig.cmake + ${PROJECT_BINARY_DIR}/kompute/komputeConfigVersion.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kompute) + +# #################################################### +# Linking +# #################################################### +if(KOMPUTE_OPT_ANDROID_BUILD) + target_link_libraries(kompute PUBLIC vulkanAndroid + android + kp_logger + kp_shader + fmt::fmt) +else() + target_link_libraries(kompute PUBLIC Vulkan::Vulkan + kp_logger + kp_shader + fmt::fmt) endif() if(KOMPUTE_OPT_BUILD_PYTHON) - include_directories(${PROJECT_SOURCE_DIR}/python/pybind11/include) - find_package(PythonLibs REQUIRED) include_directories(${PYTHON_INCLUDE_DIRS}) + + target_link_libraries(kompute PRIVATE pybind11::headers ${PYTHON_LIBRARIES}) endif() + +if(KOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER) + target_link_libraries(kompute PUBLIC Vulkan-Headers) +endif() + +# #################################################### +# Misc +# #################################################### +add_subdirectory(logger) +add_subdirectory(shaders) +add_subdirectory(include) diff --git a/src/Core.cpp b/src/Core.cpp new file mode 100644 index 000000000..01c19ff36 --- /dev/null +++ b/src/Core.cpp @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: Apache-2.0 + +#include "kompute/Core.hpp" + +#if VK_USE_PLATFORM_ANDROID_KHR +#ifndef KOMPUTE_VK_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE +#define KOMPUTE_VK_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE +/** + * Ensures support for dynamic loading of Vulkan functions on Android. + * Acts as a default store for loaded functions. + * More information: + * https://github.com/KhronosGroup/Vulkan-Hpp#vulkan_hpp_default_dispatcher + **/ +VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE +#endif // !KOMPUTE_VK_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE +#endif // VK_USE_PLATFORM_ANDROID_KHR + +namespace kp { +} // namespace kp diff --git a/src/Manager.cpp b/src/Manager.cpp index f3f66af91..3c3e11652 100644 --- a/src/Manager.cpp +++ b/src/Manager.cpp @@ -1,33 +1,36 @@ // SPDX-License-Identifier: Apache-2.0 +#include "kompute/Manager.hpp" +#include "fmt/format.h" +#include "kompute/logger/Logger.hpp" +#include #include #include #include #include -#include "kompute/Manager.hpp" - -#include "fmt/ranges.h" - namespace kp { -#if DEBUG #ifndef KOMPUTE_DISABLE_VK_DEBUG_LAYERS static VKAPI_ATTR VkBool32 VKAPI_CALL -debugMessageCallback(VkDebugReportFlagsEXT flags, - VkDebugReportObjectTypeEXT objectType, - uint64_t object, - size_t location, - int32_t messageCode, +debugMessageCallback(VkDebugReportFlagsEXT /*flags*/, + VkDebugReportObjectTypeEXT /*objectType*/, + uint64_t /*object*/, + size_t /*location*/, + int32_t /*messageCode*/, +#if KOMPUTE_OPT_ACTIVE_LOG_LEVEL <= KOMPUTE_LOG_LEVEL_DEBUG const char* pLayerPrefix, const char* pMessage, - void* pUserData) +#else + const char* /*pLayerPrefix*/, + const char* /*pMessage*/, +#endif + void* /*pUserData*/) { KP_LOG_DEBUG("[VALIDATION]: {} - {}", pLayerPrefix, pMessage); return VK_FALSE; } #endif -#endif Manager::Manager() : Manager(0) @@ -40,6 +43,11 @@ Manager::Manager(uint32_t physicalDeviceIndex, { this->mManageResources = true; +// Make sure the logger is setup +#if !KOMPUTE_OPT_LOG_LEVEL_DISABLED + logger::setupLogger(); +#endif + this->createInstance(); this->createDevice( familyQueueIndices, physicalDeviceIndex, desiredExtensions); @@ -54,6 +62,11 @@ Manager::Manager(std::shared_ptr instance, this->mInstance = instance; this->mPhysicalDevice = physicalDevice; this->mDevice = device; + +// Make sure the logger is setup +#if !KOMPUTE_OPT_LOG_LEVEL_DISABLED + logger::setupLogger(); +#endif } Manager::~Manager() @@ -120,14 +133,12 @@ Manager::destroy() return; } -#if DEBUG #ifndef KOMPUTE_DISABLE_VK_DEBUG_LAYERS if (this->mDebugReportCallback) { this->mInstance->destroyDebugReportCallbackEXT( this->mDebugReportCallback, nullptr, this->mDebugDispatcher); KP_LOG_DEBUG("Kompute Manager Destroyed Debug Report Callback"); } -#endif #endif if (this->mFreeInstance) { @@ -155,7 +166,7 @@ Manager::createInstance() std::vector applicationExtensions; -#if DEBUG +#ifndef KOMPUTE_DISABLE_VK_DEBUG_LAYERS applicationExtensions.push_back(VK_EXT_DEBUG_REPORT_EXTENSION_NAME); #endif @@ -168,7 +179,6 @@ Manager::createInstance() applicationExtensions.data(); } -#if DEBUG #ifndef KOMPUTE_DISABLE_VK_DEBUG_LAYERS KP_LOG_DEBUG("Kompute Manager adding debug validation layers"); // We'll identify the layers that are supported @@ -180,16 +190,17 @@ Manager::createInstance() }; std::vector envLayerNames; const char* envLayerNamesVal = std::getenv("KOMPUTE_ENV_DEBUG_LAYERS"); - if (envLayerNamesVal != NULL && *envLayerNamesVal != '\0') { + if (envLayerNamesVal != nullptr && *envLayerNamesVal != '\0') { KP_LOG_DEBUG("Kompute Manager adding environment layers: {}", envLayerNamesVal); std::istringstream iss(envLayerNamesVal); - std::istream_iterator beg(iss), end; + std::istream_iterator beg(iss); + std::istream_iterator end; envLayerNames = std::vector(beg, end); for (const std::string& layerName : envLayerNames) { desiredLayerNames.push_back(layerName.c_str()); } - KP_LOG_DEBUG("Desired layers: {}", desiredLayerNames); + KP_LOG_DEBUG("Desired layers: {}", fmt::join(desiredLayerNames, ", ")); } // Identify the valid layer names based on the desiredLayerNames @@ -201,7 +212,7 @@ Manager::createInstance() std::string layerName(layerProperties.layerName.data()); uniqueLayerNames.insert(layerName); } - KP_LOG_DEBUG("Available layers: {}", uniqueLayerNames); + KP_LOG_DEBUG("Available layers: {}", fmt::join(uniqueLayerNames, ", ")); for (const char* desiredLayerName : desiredLayerNames) { if (uniqueLayerNames.count(desiredLayerName) != 0) { validLayerNames.push_back(desiredLayerName); @@ -209,26 +220,36 @@ Manager::createInstance() } } - if (validLayerNames.size() > 0) { + if (!validLayerNames.empty()) { KP_LOG_DEBUG( "Kompute Manager Initializing instance with valid layers: {}", - validLayerNames); + fmt::join(validLayerNames, ", ")); computeInstanceCreateInfo.enabledLayerCount = - (uint32_t)validLayerNames.size(); + static_cast(validLayerNames.size()); computeInstanceCreateInfo.ppEnabledLayerNames = validLayerNames.data(); } else { KP_LOG_WARN("Kompute Manager no valid layer names found from desired " "layer names"); } #endif -#endif + +#if VK_USE_PLATFORM_ANDROID_KHR + vk::DynamicLoader dl; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + dl.getProcAddress("vkGetInstanceProcAddr"); + VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr); +#endif // VK_USE_PLATFORM_ANDROID_KHR this->mInstance = std::make_shared(); vk::createInstance( &computeInstanceCreateInfo, nullptr, this->mInstance.get()); + +#if VK_USE_PLATFORM_ANDROID_KHR + VULKAN_HPP_DEFAULT_DISPATCHER.init(*this->mInstance); +#endif // VK_USE_PLATFORM_ANDROID_KHR + KP_LOG_DEBUG("Kompute Manager Instance Created"); -#if DEBUG #ifndef KOMPUTE_DISABLE_VK_DEBUG_LAYERS KP_LOG_DEBUG("Kompute Manager adding debug callbacks"); if (validLayerNames.size() > 0) { @@ -246,7 +267,6 @@ Manager::createInstance() debugCreateInfo, nullptr, this->mDebugDispatcher); } #endif -#endif } void @@ -311,8 +331,10 @@ Manager::createDevice(const std::vector& familyQueueIndices, this->mPhysicalDevice = std::make_shared(physicalDevice); +#if KOMPUTE_OPT_ACTIVE_LOG_LEVEL <= KOMPUTE_LOG_LEVEL_INFO vk::PhysicalDeviceProperties physicalDeviceProperties = physicalDevice.getProperties(); +#endif KP_LOG_INFO("Using physical device index {} found {}", physicalDeviceIndex, @@ -369,7 +391,7 @@ Manager::createDevice(const std::vector& familyQueueIndices, } KP_LOG_DEBUG("Kompute Manager desired extension layers {}", - desiredExtensions); + fmt::join(desiredExtensions, ", ")); std::vector deviceExtensions = this->mPhysicalDevice->enumerateDeviceExtensionProperties(); @@ -379,7 +401,7 @@ Manager::createDevice(const std::vector& familyQueueIndices, uniqueExtensionNames.insert(ext.extensionName); } KP_LOG_DEBUG("Kompute Manager available extensions {}", - uniqueExtensionNames); + fmt::join(uniqueExtensionNames, ", ")); std::vector validExtensions; for (const std::string& ext : desiredExtensions) { if (uniqueExtensionNames.count(ext) != 0) { @@ -388,7 +410,7 @@ Manager::createDevice(const std::vector& familyQueueIndices, } if (desiredExtensions.size() != validExtensions.size()) { KP_LOG_ERROR("Kompute Manager not all extensions were added: {}", - validExtensions); + fmt::join(validExtensions, ", ")); } vk::DeviceCreateInfo deviceCreateInfo(vk::DeviceCreateFlags(), diff --git a/src/OpTensorCopy.cpp b/src/OpTensorCopy.cpp index 3180fa3cd..aae727533 100644 --- a/src/OpTensorCopy.cpp +++ b/src/OpTensorCopy.cpp @@ -1,6 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "kompute/operations/OpTensorCopy.hpp" +#include "kompute/Tensor.hpp" namespace kp { @@ -21,8 +22,8 @@ OpTensorCopy::OpTensorCopy(const std::vector>& tensors) if (tensor->dataType() != dataType) { throw std::runtime_error(fmt::format( "Attempting to copy tensors of different types from {} to {}", - dataType, - tensor->dataType())); + Tensor::toString(dataType), + Tensor::toString(tensor->dataType()))); } if (tensor->size() != size) { throw std::runtime_error(fmt::format( diff --git a/src/Tensor.cpp b/src/Tensor.cpp index 7a337503b..10e901485 100644 --- a/src/Tensor.cpp +++ b/src/Tensor.cpp @@ -4,6 +4,40 @@ namespace kp { +std::string +Tensor::toString(Tensor::TensorDataTypes dt) +{ + switch (dt) { + case TensorDataTypes::eBool: + return "eBool"; + case TensorDataTypes::eInt: + return "eInt"; + case TensorDataTypes::eUnsignedInt: + return "eUnsignedInt"; + case TensorDataTypes::eFloat: + return "eFloat"; + case TensorDataTypes::eDouble: + return "eDouble"; + default: + return "unknown"; + } +} + +std::string +Tensor::toString(Tensor::TensorTypes dt) +{ + switch (dt) { + case TensorTypes::eDevice: + return "eDevice"; + case TensorTypes::eHost: + return "eHost"; + case TensorTypes::eStorage: + return "eStorage"; + default: + return "unknown"; + } +} + Tensor::Tensor(std::shared_ptr physicalDevice, std::shared_ptr device, void* data, @@ -14,7 +48,7 @@ Tensor::Tensor(std::shared_ptr physicalDevice, { KP_LOG_DEBUG("Kompute Tensor constructor data length: {}, and type: {}", elementTotalCount, - tensorType); + Tensor::toString(tensorType)); this->mPhysicalDevice = physicalDevice; this->mDevice = device; @@ -27,7 +61,7 @@ Tensor::Tensor(std::shared_ptr physicalDevice, Tensor::~Tensor() { KP_LOG_DEBUG("Kompute Tensor destructor started. Type: {}", - this->tensorType()); + Tensor::toString(this->tensorType())); if (this->mDevice) { this->destroy(); diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt new file mode 100644 index 000000000..e1652fdda --- /dev/null +++ b/src/include/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.20) + +# #################################################### +# Kompute +# #################################################### +target_include_directories(kompute PUBLIC $ + $) + +target_sources(kompute PRIVATE + + # Header files (useful in IDEs) + kompute/Algorithm.hpp + kompute/Core.hpp + kompute/Kompute.hpp + kompute/Manager.hpp + kompute/Sequence.hpp + kompute/Tensor.hpp + + kompute/operations/OpAlgoDispatch.hpp + kompute/operations/OpBase.hpp + kompute/operations/OpMemoryBarrier.hpp + kompute/operations/OpMult.hpp + kompute/operations/OpTensorCopy.hpp + kompute/operations/OpTensorSyncDevice.hpp + kompute/operations/OpTensorSyncLocal.hpp + + kompute/logger/Logger.hpp +) + +install(DIRECTORY kompute DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + +# #################################################### +# Logger +# #################################################### +target_include_directories(kp_logger PUBLIC $ + $) + +target_sources(kp_logger PRIVATE + + # Header files (useful in IDEs) + kompute/logger/Logger.hpp +) + +install(DIRECTORY logger DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) \ No newline at end of file diff --git a/src/include/kompute/Algorithm.hpp b/src/include/kompute/Algorithm.hpp index bb6b9faa5..1917dd37a 100644 --- a/src/include/kompute/Algorithm.hpp +++ b/src/include/kompute/Algorithm.hpp @@ -3,7 +3,9 @@ #include "kompute/Core.hpp" +#include "fmt/format.h" #include "kompute/Tensor.hpp" +#include "logger/Logger.hpp" namespace kp { diff --git a/src/include/kompute/Core.hpp b/src/include/kompute/Core.hpp index 2c49f29ef..2384e47b2 100644 --- a/src/include/kompute/Core.hpp +++ b/src/include/kompute/Core.hpp @@ -1,16 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#if VK_USE_PLATFORM_ANDROID_KHR -#include -#include -// VK_NO_PROTOTYPES required before vulkan import but after wrapper.hpp -#undef VK_NO_PROTOTYPES -static const char* KOMPUTE_LOG_TAG = "KomputeLog"; -#endif - -#include - #include // Typedefs to simplify interaction with core types @@ -32,124 +22,9 @@ typedef std::vector Constants; KOMPUTE_VK_API_MAJOR_VERSION, KOMPUTE_VK_API_MINOR_VERSION, 0) #endif // KOMPUTE_VK_API_VERSION -// Defining kompute log levels analogous to spdlog log levels -#define KOMPUTE_LOG_LEVEL_TRACE 0 -#define KOMPUTE_LOG_LEVEL_DEBUG 1 -#define KOMPUTE_LOG_LEVEL_INFO 2 -#define KOMPUTE_LOG_LEVEL_WARN 3 -#define KOMPUTE_LOG_LEVEL_ERROR 4 -#define KOMPUTE_LOG_LEVEL_CRITICAL 5 -#define KOMPUTE_LOG_LEVEL_OFF 6 - -#ifndef KOMPUTE_LOG_LEVEL -#if DEBUG -#define KOMPUTE_LOG_LEVEL KOMPUTE_LOG_LEVEL_DEBUG -#else -#define KOMPUTE_LOG_LEVEL KOMPUTE_LOG_LEVEL_INFO -#endif -#endif // KOMPUTE_LOG_LEVEL - -// SPDLOG_ACTIVE_LEVEL must be defined before spdlog.h import -// It is recommended that it's set via KOMPUTE_LOG_LEVEL -// but if required it can be set directly as override -#ifndef SPDLOG_ACTIVE_LEVEL -#define SPDLOG_ACTIVE_LEVEL KOMPUTE_LOG_LEVEL -#endif - #if defined(KOMPUTE_BUILD_PYTHON) #include namespace py = pybind11; // from python/src/main.cpp -extern py::object kp_debug, kp_info, kp_warning, kp_error; +extern py::object kp_trace, kp_debug, kp_info, kp_warning, kp_error; #endif - -#ifndef KOMPUTE_LOG_OVERRIDE -#if KOMPUTE_ENABLE_SPDLOG -#include -#define KP_LOG_DEBUG(...) SPDLOG_DEBUG(__VA_ARGS__) -#define KP_LOG_INFO(...) SPDLOG_INFO(__VA_ARGS__) -#define KP_LOG_WARN(...) SPDLOG_WARN(__VA_ARGS__) -#define KP_LOG_ERROR(...) SPDLOG_ERROR(__VA_ARGS__) -#else -#include -#if KOMPUTE_LOG_LEVEL > 1 -#define KP_LOG_DEBUG(...) -#else -#if defined(VK_USE_PLATFORM_ANDROID_KHR) -#define KP_LOG_DEBUG(...) \ - ((void)__android_log_write( \ - ANDROID_LOG_DEBUG, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str())) -#elif defined(KOMPUTE_BUILD_PYTHON) -#define KP_LOG_DEBUG(...) kp_debug(fmt::format(__VA_ARGS__)) -#else -#define KP_LOG_DEBUG(...) \ - fmt::print("[{} {}] [debug] [{}:{}] {}\n", \ - __DATE__, \ - __TIME__, \ - __FILE__, \ - __LINE__, \ - fmt::format(__VA_ARGS__)) -#endif // VK_USE_PLATFORM_ANDROID_KHR -#endif // KOMPUTE_LOG_LEVEL > 1 - -#if KOMPUTE_LOG_LEVEL > 2 -#define KP_LOG_INFO(...) -#else -#if defined(VK_USE_PLATFORM_ANDROID_KHR) -#define KP_LOG_INFO(...) \ - ((void)__android_log_write( \ - ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str())) -#elif defined(KOMPUTE_BUILD_PYTHON) -#define KP_LOG_INFO(...) kp_info(fmt::format(__VA_ARGS__)) -#else -#define KP_LOG_INFO(...) \ - fmt::print("[{} {}] [debug] [{}:{}] {}\n", \ - __DATE__, \ - __TIME__, \ - __FILE__, \ - __LINE__, \ - fmt::format(__VA_ARGS__)) -#endif // VK_USE_PLATFORM_ANDROID_KHR -#endif // KOMPUTE_LOG_LEVEL > 2 - -#if KOMPUTE_LOG_LEVEL > 3 -#define KP_LOG_WARN(...) -#else -#if defined(VK_USE_PLATFORM_ANDROID_KHR) -#define KP_LOG_WARN(...) \ - ((void)__android_log_write( \ - ANDROID_LOG_WARN, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str())) -#elif defined(KOMPUTE_BUILD_PYTHON) -#define KP_LOG_WARN(...) kp_warning(fmt::format(__VA_ARGS__)) -#else -#define KP_LOG_WARN(...) \ - fmt::print("[{} {}] [debug] [{}:{}] {}\n", \ - __DATE__, \ - __TIME__, \ - __FILE__, \ - __LINE__, \ - fmt::format(__VA_ARGS__)) -#endif // VK_USE_PLATFORM_ANDROID_KHR -#endif // KOMPUTE_LOG_LEVEL > 3 - -#if KOMPUTE_LOG_LEVEL > 4 -#define KP_LOG_ERROR(...) -#else -#if defined(VK_USE_PLATFORM_ANDROID_KHR) -#define KP_LOG_ERROR(...) \ - ((void)__android_log_write( \ - ANDROID_LOG_ERROR, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str())) -#elif defined(KOMPUTE_BUILD_PYTHON) -#define KP_LOG_ERROR(...) kp_error(fmt::format(__VA_ARGS__)) -#else -#define KP_LOG_ERROR(...) \ - fmt::print("[{} {}] [debug] [{}:{}] {}\n", \ - __DATE__, \ - __TIME__, \ - __FILE__, \ - __LINE__, \ - fmt::format(__VA_ARGS__)) -#endif // VK_USE_PLATFORM_ANDROID_KHR -#endif // KOMPUTE_LOG_LEVEL > 4 -#endif // KOMPUTE_SPDLOG_ENABLED -#endif // KOMPUTE_LOG_OVERRIDE diff --git a/src/include/kompute/Kompute.hpp b/src/include/kompute/Kompute.hpp new file mode 100644 index 000000000..e54adc1b7 --- /dev/null +++ b/src/include/kompute/Kompute.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include "Algorithm.hpp" +#include "Core.hpp" +#include "Manager.hpp" +#include "Sequence.hpp" +#include "Tensor.hpp" + +#include "operations/OpAlgoDispatch.hpp" +#include "operations/OpBase.hpp" +#include "operations/OpMemoryBarrier.hpp" +#include "operations/OpMult.hpp" +#include "operations/OpTensorCopy.hpp" +#include "operations/OpTensorSyncDevice.hpp" +#include "operations/OpTensorSyncLocal.hpp" + +// Will be build by CMake and placed inside the build directory +#include "ShaderLogisticRegression.hpp" +#include "ShaderOpMult.hpp" diff --git a/src/include/kompute/Manager.hpp b/src/include/kompute/Manager.hpp index e154dc9c1..52f9ada73 100644 --- a/src/include/kompute/Manager.hpp +++ b/src/include/kompute/Manager.hpp @@ -7,6 +7,7 @@ #include "kompute/Core.hpp" #include "kompute/Sequence.hpp" +#include "logger/Logger.hpp" #define KP_DEFAULT_SESSION "DEFAULT" @@ -240,11 +241,9 @@ class Manager bool mManageResources = false; -#if DEBUG #ifndef KOMPUTE_DISABLE_VK_DEBUG_LAYERS vk::DebugReportCallbackEXT mDebugReportCallback; vk::DispatchLoaderDynamic mDebugDispatcher; -#endif #endif // Create functions diff --git a/src/include/kompute/Sequence.hpp b/src/include/kompute/Sequence.hpp index 56dbcd6bc..de9b9f69c 100644 --- a/src/include/kompute/Sequence.hpp +++ b/src/include/kompute/Sequence.hpp @@ -231,7 +231,7 @@ class Sequence : public std::enable_shared_from_this * * @return Boolean stating if recording ongoing. */ - [[nodiscard]] bool isRecording() const; + bool isRecording() const; /** * Returns true if the sequence has been initialised, and it's based on the @@ -239,7 +239,7 @@ class Sequence : public std::enable_shared_from_this * * @return Boolean stating if is initialized */ - [[nodiscard]] bool isInit() const; + bool isInit() const; /** * Clears command buffer and triggers re-record of all the current @@ -254,7 +254,7 @@ class Sequence : public std::enable_shared_from_this * * @return Boolean stating if currently running. */ - [[nodiscard]] bool isRunning() const; + bool isRunning() const; /** * Destroys and frees the GPU resources which include the buffer and memory diff --git a/src/include/kompute/Tensor.hpp b/src/include/kompute/Tensor.hpp index 05c402ac4..5d7524ee0 100644 --- a/src/include/kompute/Tensor.hpp +++ b/src/include/kompute/Tensor.hpp @@ -2,7 +2,7 @@ #pragma once #include "kompute/Core.hpp" -#include +#include "logger/Logger.hpp" #include namespace kp { @@ -39,6 +39,9 @@ class Tensor eDouble = 4, }; + static std::string toString(TensorDataTypes dt); + static std::string toString(TensorTypes dt); + /** * Constructor with data provided which would be used to create the * respective vulkan buffer and memory. @@ -341,59 +344,3 @@ class TensorT : public Tensor }; } // End namespace kp - -/** - * fmt fromater for kp::Tensor::TensorDataTypes. - */ -template<> -struct fmt::formatter : formatter -{ - template - auto format(kp::Tensor::TensorDataTypes dt, FormatContext& ctx) - { - std::string name = "unknown"; - switch (dt) { - case kp::Tensor::TensorDataTypes::eBool: - name = "eBool"; - break; - case kp::Tensor::TensorDataTypes::eDouble: - name = "eDouble"; - break; - case kp::Tensor::TensorDataTypes::eFloat: - name = "eFloat"; - break; - case kp::Tensor::TensorDataTypes::eInt: - name = "eInt"; - break; - case kp::Tensor::TensorDataTypes::eUnsignedInt: - name = "eUnsignedInt"; - break; - } - return formatter::format(name, ctx); - } -}; - -/** - * fmt fromater for kp::Tensor::TensorTypes. - */ -template<> -struct fmt::formatter : formatter -{ - template - auto format(kp::Tensor::TensorTypes dt, FormatContext& ctx) - { - std::string name = "unknown"; - switch (dt) { - case kp::Tensor::TensorTypes::eDevice: - name = "eDevice"; - break; - case kp::Tensor::TensorTypes::eHost: - name = "eHost"; - break; - case kp::Tensor::TensorTypes::eStorage: - name = "eStorage"; - break; - } - return formatter::format(name, ctx); - } -}; diff --git a/src/include/kompute/logger/Logger.hpp b/src/include/kompute/logger/Logger.hpp new file mode 100644 index 000000000..29dfc8696 --- /dev/null +++ b/src/include/kompute/logger/Logger.hpp @@ -0,0 +1,187 @@ +#pragma once + +#define KOMPUTE_LOG_LEVEL_TRACE 0 +#define KOMPUTE_LOG_LEVEL_DEBUG 1 +#define KOMPUTE_LOG_LEVEL_INFO 2 +#define KOMPUTE_LOG_LEVEL_WARN 3 +#define KOMPUTE_LOG_LEVEL_ERROR 4 +#define KOMPUTE_LOG_LEVEL_CRITICAL 5 +#define KOMPUTE_LOG_LEVEL_OFF 6 + +// Logging is disabled entirely. +#if KOMPUTE_OPT_LOG_LEVEL_DISABLED +#define KP_LOG_TRACE(...) +#define KP_LOG_DEBUG(...) +#define KP_LOG_INFO(...) +#define KP_LOG_WARN(...) +#define KP_LOG_ERROR(...) +#else + +#if !KOMPUTE_OPT_USE_SPDLOG +#if VK_USE_PLATFORM_ANDROID_KHR +#include +#include +static const char* KOMPUTE_LOG_TAG = "KomputeLog"; +#else +#if KOMPUTE_BUILD_PYTHON +#include +namespace py = pybind11; +// from python/src/main.cpp +extern py::object kp_trace, kp_debug, kp_info, kp_warning, kp_error; +#else +#include +#endif // KOMPUTE_BUILD_PYTHON +#endif // VK_USE_PLATFORM_ANDROID_KHR +#else +#include +#endif // !KOMPUTE_OPT_USE_SPDLOG +#include +#include +#include +namespace logger { +// Setup the logger, note the loglevel can not be set below the CMake log level +// (To change this use -DKOMPUTE_OPT_LOG_LEVEL=...) +void +setupLogger(); + +// Logging is enabled, but we do not use Spdlog. So we use fmt in case nothing +// else is defined, overriding logging. +#if !KOMPUTE_OPT_USE_SPDLOG + +#ifndef KP_LOG_TRACE +#if KOMPUTE_OPT_ACTIVE_LOG_LEVEL <= KOMPUTE_LOG_LEVEL_TRACE +#if VK_USE_PLATFORM_ANDROID_KHR +#define KP_LOG_TRACE(...) \ + ((void)__android_log_write( \ + ANDROID_LOG_VERBOSE, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str())) +#else +#if KOMPUTE_BUILD_PYTHON +#define KP_LOG_DEBUG(...) kp_trace(fmt::format(__VA_ARGS__)) +#else +#define KP_LOG_TRACE(...) \ + fmt::print("[{} {}] [trace] [{}:{}] {}\n", \ + __DATE__, \ + __TIME__, \ + __FILE__, \ + __LINE__, \ + fmt::format(__VA_ARGS__)) +#endif // KOMPUTE_BUILD_PYTHON +#endif // VK_USE_PLATFORM_ANDROID_KHR +#else +#define KP_LOG_TRACE(...) +#endif +#endif // !KP_LOG_TRACE + +#ifndef KP_LOG_DEBUG +#if KOMPUTE_OPT_ACTIVE_LOG_LEVEL <= KOMPUTE_LOG_LEVEL_DEBUG +#if VK_USE_PLATFORM_ANDROID_KHR +#define KP_LOG_DEBUG(...) \ + ((void)__android_log_write( \ + ANDROID_LOG_DEBUG, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str())) +#else +#if KOMPUTE_BUILD_PYTHON +#define KP_LOG_DEBUG(...) kp_debug(fmt::format(__VA_ARGS__)) +#else +#define KP_LOG_DEBUG(...) \ + fmt::print("[{} {}] [debug] [{}:{}] {}\n", \ + __DATE__, \ + __TIME__, \ + __FILE__, \ + __LINE__, \ + fmt::format(__VA_ARGS__)) +#endif // KOMPUTE_BUILD_PYTHON +#endif // VK_USE_PLATFORM_ANDROID_KHR +#else +#define KP_LOG_DEBUG(...) +#endif +#endif // !KP_LOG_DEBUG + +#ifndef KP_LOG_INFO +#if KOMPUTE_OPT_ACTIVE_LOG_LEVEL <= KOMPUTE_LOG_LEVEL_INFO +#if VK_USE_PLATFORM_ANDROID_KHR +#define KP_LOG_INFO(...) \ + ((void)__android_log_write( \ + ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str())) +#else +#if KOMPUTE_BUILD_PYTHON +#define KP_LOG_DEBUG(...) kp_info(fmt::format(__VA_ARGS__)) +#else +#define KP_LOG_INFO(...) \ + fmt::print("[{} {}] [info] [{}:{}] {}\n", \ + __DATE__, \ + __TIME__, \ + __FILE__, \ + __LINE__, \ + fmt::format(__VA_ARGS__)) +#endif // KOMPUTE_BUILD_PYTHON +#endif // VK_USE_PLATFORM_ANDROID_KHR +#else +#define KP_LOG_INFO(...) +#endif +#endif // !KP_LOG_INFO + +#ifndef KP_LOG_WARN +#if KOMPUTE_OPT_ACTIVE_LOG_LEVEL <= KOMPUTE_LOG_LEVEL_WARN +#if VK_USE_PLATFORM_ANDROID_KHR +#define KP_LOG_WARN(...) \ + ((void)__android_log_write( \ + ANDROID_LOG_WARN, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str())) +#else +#if KOMPUTE_BUILD_PYTHON +#define KP_LOG_DEBUG(...) kp_warning(fmt::format(__VA_ARGS__)) +#else +#define KP_LOG_WARN(...) \ + fmt::print("[{} {}] [warn] [{}:{}] {}\n", \ + __DATE__, \ + __TIME__, \ + __FILE__, \ + __LINE__, \ + fmt::format(__VA_ARGS__)) +#endif // KOMPUTE_BUILD_PYTHON +#endif // VK_USE_PLATFORM_ANDROID_KHR +#else +#define KP_LOG_WARN(...) +#endif +#endif // !KP_LOG_WARN + +#ifndef KP_LOG_ERROR +#if KOMPUTE_OPT_ACTIVE_LOG_LEVEL <= KOMPUTE_LOG_LEVEL_ERROR +#if VK_USE_PLATFORM_ANDROID_KHR +#define KP_LOG_ERROR(...) \ + ((void)__android_log_write( \ + ANDROID_LOG_ERROR, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str())) +#else +#if KOMPUTE_BUILD_PYTHON +#define KP_LOG_DEBUG(...) kp_error(fmt::format(__VA_ARGS__)) +#else +#define KP_LOG_ERROR(...) \ + fmt::print("[{} {}] [error] [{}:{}] {}\n", \ + __DATE__, \ + __TIME__, \ + __FILE__, \ + __LINE__, \ + fmt::format(__VA_ARGS__)) +#endif // KOMPUTE_BUILD_PYTHON +#endif // VK_USE_PLATFORM_ANDROID_KHR +#else +#define KP_LOG_ERROR(...) +#endif +#endif // !KP_LOG_ERROR +#else + +#define KP_LOG_TRACE(...) SPDLOG_TRACE(__VA_ARGS__) +#define KP_LOG_DEBUG(...) SPDLOG_DEBUG(__VA_ARGS__) +#define KP_LOG_INFO(...) SPDLOG_INFO(__VA_ARGS__) +#define KP_LOG_WARN(...) SPDLOG_WARN(__VA_ARGS__) +#define KP_LOG_ERROR(...) SPDLOG_ERROR(__VA_ARGS__) + +void +setLogLevel(spdlog::level::level_enum level); + +spdlog::level::level_enum +getLogLevel(); + +#endif // !KOMPUTE_OPT_USE_SPDLOG +} // namespace logger + +#endif // KOMPUTE_OPT_LOG_LEVEL_DISABLED \ No newline at end of file diff --git a/src/include/kompute/operations/OpMult.hpp b/src/include/kompute/operations/OpMult.hpp index d148087c7..f75ccc4fb 100644 --- a/src/include/kompute/operations/OpMult.hpp +++ b/src/include/kompute/operations/OpMult.hpp @@ -5,7 +5,7 @@ #include "kompute/Core.hpp" -#include "kompute/shaders/shaderopmult.hpp" +#include "ShaderOpMult.hpp" #include "kompute/Algorithm.hpp" #include "kompute/Tensor.hpp" @@ -38,13 +38,12 @@ class OpMult : public OpAlgoDispatch if (tensors.size() != 3) { throw std::runtime_error( - "Kompute OpMult expected 3 tensors but got " + tensors.size()); + "Kompute OpMult expected 3 tensors but got " + + std::to_string(tensors.size())); } - std::vector spirv( - (uint32_t*)shader_data::shaders_glsl_opmult_comp_spv, - (uint32_t*)(shader_data::shaders_glsl_opmult_comp_spv + - kp::shader_data::shaders_glsl_opmult_comp_spv_len)); + const std::vector spirv = std::vector( + SHADEROPMULT_COMP_SPV.begin(), SHADEROPMULT_COMP_SPV.end()); algorithm->rebuild<>(tensors, spirv); } @@ -53,10 +52,7 @@ class OpMult : public OpAlgoDispatch * Default destructor, which is in charge of destroying the algorithm * components but does not destroy the underlying tensors */ - virtual ~OpMult() override - { - KP_LOG_DEBUG("Kompute OpMult destructor started"); - } + ~OpMult() override { KP_LOG_DEBUG("Kompute OpMult destructor started"); } }; } // End namespace kp diff --git a/src/include/kompute/shaders/shaderlogisticregression.hpp b/src/include/kompute/shaders/shaderlogisticregression.hpp deleted file mode 100755 index f456ac1cf..000000000 --- a/src/include/kompute/shaders/shaderlogisticregression.hpp +++ /dev/null @@ -1,433 +0,0 @@ -/* - THIS FILE HAS BEEN AUTOMATICALLY GENERATED - DO NOT EDIT - - --- - - Copyright 2020 The Institute for Ethical AI & Machine Learning - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef SHADEROP_SHADERLOGISTICREGRESSION_HPP -#define SHADEROP_SHADERLOGISTICREGRESSION_HPP - -namespace kp { -namespace shader_data { -static const unsigned char shaders_glsl_logisticregression_comp_spv[] = { - 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x08, 0x00, - 0xae, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x06, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x00, 0x00, 0x10, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, - 0xc2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x73, 0x69, 0x67, 0x6d, 0x6f, 0x69, 0x64, 0x28, - 0x66, 0x31, 0x3b, 0x00, 0x05, 0x00, 0x03, 0x00, 0x09, 0x00, 0x00, 0x00, - 0x7a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x12, 0x00, 0x00, 0x00, - 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x28, 0x76, 0x66, - 0x32, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x11, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x08, 0x00, 0x17, 0x00, 0x00, 0x00, 0x63, 0x61, 0x6c, 0x63, - 0x75, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x73, 0x73, 0x28, 0x66, 0x31, - 0x3b, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, - 0x15, 0x00, 0x00, 0x00, 0x79, 0x48, 0x61, 0x74, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x16, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x21, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x79, 0x48, 0x61, 0x74, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, - 0x3e, 0x00, 0x00, 0x00, 0x69, 0x64, 0x78, 0x00, 0x05, 0x00, 0x08, 0x00, - 0x41, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x47, 0x6c, 0x6f, 0x62, 0x61, - 0x6c, 0x49, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, - 0x44, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, - 0x77, 0x43, 0x75, 0x72, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, - 0x48, 0x00, 0x00, 0x00, 0x62, 0x77, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x77, 0x69, 0x6e, 0x00, 0x05, 0x00, 0x03, 0x00, 0x4a, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x54, 0x00, 0x00, 0x00, - 0x62, 0x43, 0x75, 0x72, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, - 0x56, 0x00, 0x00, 0x00, 0x62, 0x62, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x04, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x62, 0x69, 0x6e, 0x00, 0x05, 0x00, 0x03, 0x00, 0x58, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x5b, 0x00, 0x00, 0x00, - 0x78, 0x43, 0x75, 0x72, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, - 0x5d, 0x00, 0x00, 0x00, 0x62, 0x78, 0x69, 0x00, 0x06, 0x00, 0x04, 0x00, - 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x69, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x64, 0x00, 0x00, 0x00, 0x62, 0x78, 0x6a, 0x00, - 0x06, 0x00, 0x04, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x78, 0x6a, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x66, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x6b, 0x00, 0x00, 0x00, - 0x79, 0x43, 0x75, 0x72, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, - 0x6d, 0x00, 0x00, 0x00, 0x62, 0x79, 0x00, 0x00, 0x06, 0x00, 0x04, 0x00, - 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x04, 0x00, 0x73, 0x00, 0x00, 0x00, 0x79, 0x48, 0x61, 0x74, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x74, 0x00, 0x00, 0x00, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, - 0x76, 0x00, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x04, 0x00, 0x78, 0x00, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7b, 0x00, 0x00, 0x00, - 0x64, 0x5a, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x00, 0x00, - 0x64, 0x57, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x86, 0x00, 0x00, 0x00, - 0x64, 0x42, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x8b, 0x00, 0x00, 0x00, - 0x62, 0x77, 0x6f, 0x75, 0x74, 0x69, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, - 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x6f, 0x75, 0x74, - 0x69, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x8d, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x93, 0x00, 0x00, 0x00, - 0x62, 0x77, 0x6f, 0x75, 0x74, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, - 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x6f, 0x75, 0x74, - 0x6a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x95, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9c, 0x00, 0x00, 0x00, - 0x62, 0x62, 0x6f, 0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, - 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x6f, 0x75, 0x74, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x9e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xa3, 0x00, 0x00, 0x00, - 0x62, 0x6c, 0x6f, 0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, - 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x6f, 0x75, 0x74, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xa5, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xa7, 0x00, 0x00, 0x00, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, - 0xa9, 0x00, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x41, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, - 0x1c, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x47, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, - 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x48, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4a, 0x00, 0x00, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x4a, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x55, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x56, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x03, 0x00, 0x56, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x5c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x48, 0x00, 0x05, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, - 0x5d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x5f, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x63, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, - 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x64, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x66, 0x00, 0x00, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x66, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x6d, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x03, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x6f, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8b, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x03, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x8d, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x92, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x48, 0x00, 0x05, 0x00, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, - 0x93, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x95, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x95, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x9b, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, - 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x9c, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x9e, 0x00, 0x00, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x9e, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa3, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x03, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0xa5, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa5, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0xad, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x05, 0x00, 0x14, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, - 0x15, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3d, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, - 0x3f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x3f, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x40, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, - 0x3c, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x43, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x3c, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, 0x47, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x48, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x49, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x49, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x15, 0x00, 0x04, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x4b, 0x00, 0x00, 0x00, - 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x4d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x2b, 0x00, 0x04, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, 0x55, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x56, 0x00, 0x00, 0x00, - 0x55, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x57, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x57, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x1d, 0x00, 0x03, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x03, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x5d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5e, 0x00, 0x00, 0x00, - 0x5f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, - 0x63, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, - 0x64, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, 0x6c, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x6d, 0x00, 0x00, 0x00, - 0x6c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x6e, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x6e, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x32, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, 0x8a, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x8b, 0x00, 0x00, 0x00, - 0x8a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8c, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x8c, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x1d, 0x00, 0x03, 0x00, 0x92, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x03, 0x00, 0x93, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x94, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x93, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x94, 0x00, 0x00, 0x00, - 0x95, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, - 0x3c, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1d, 0x00, 0x03, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x03, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x9c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9d, 0x00, 0x00, 0x00, - 0x9e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, - 0xa2, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, - 0xa3, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0xa4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xa5, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, 0x00, 0x3f, 0x00, 0x00, 0x00, - 0xad, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, - 0x97, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x3d, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x54, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x73, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x78, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x86, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x07, 0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x44, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, - 0x44, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x3e, 0x00, 0x00, 0x00, - 0x45, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, - 0x4e, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, - 0x4c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x4f, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, - 0x4d, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, - 0x4c, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, - 0x50, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, - 0x4f, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x46, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, - 0x4d, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, - 0x4c, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x54, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, - 0x61, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, - 0x60, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x62, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x3c, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, - 0x66, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, - 0x68, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x6a, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, - 0x71, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, - 0x70, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x72, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x6b, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x74, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, - 0x46, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x76, 0x00, 0x00, 0x00, - 0x77, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x79, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x78, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, - 0x74, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x73, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, - 0x73, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x7d, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, - 0x7d, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x7b, 0x00, 0x00, 0x00, - 0x7e, 0x00, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x81, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, - 0x5b, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x83, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, - 0x7b, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x85, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, - 0x88, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, - 0x85, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, - 0x87, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x86, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x3c, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, - 0x7f, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, - 0x8d, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x91, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x98, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, - 0x98, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, - 0x9a, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, - 0x96, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x00, 0x00, 0x00, - 0x99, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, - 0x9f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, - 0x9e, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0xa1, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0xa8, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0xa7, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0xa9, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, - 0x39, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, - 0xa5, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0xac, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, - 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x0b, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, - 0x1c, 0x00, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, - 0xfe, 0x00, 0x02, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, - 0x36, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, - 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x94, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x81, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, - 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x28, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, - 0x39, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x27, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, - 0xfe, 0x00, 0x02, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, - 0x36, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x2e, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, - 0x85, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, - 0x2e, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, - 0x83, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, - 0x83, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1c, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, - 0x36, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x38, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, - 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, - 0x38, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x39, 0x00, 0x00, 0x00, - 0x38, 0x00, 0x01, 0x00 -}; -static const unsigned int shaders_glsl_logisticregression_comp_spv_len = 4816; -} -} -#endif // define SHADEROP_SHADERLOGISTICREGRESSION_HPP diff --git a/src/include/kompute/shaders/shaderopmult.hpp b/src/include/kompute/shaders/shaderopmult.hpp deleted file mode 100755 index f4015a58f..000000000 --- a/src/include/kompute/shaders/shaderopmult.hpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - THIS FILE HAS BEEN AUTOMATICALLY GENERATED - DO NOT EDIT - - --- - - Copyright 2020 The Institute for Ethical AI & Machine Learning - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef SHADEROP_SHADEROPMULT_HPP -#define SHADEROP_SHADEROPMULT_HPP - -namespace kp { -namespace shader_data { -static const unsigned char shaders_glsl_opmult_comp_spv[] = { - 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x08, 0x00, - 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x06, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x10, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, - 0xc2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x47, - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x49, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x4f, 0x75, - 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x05, 0x00, 0x19, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6e, 0x73, - 0x6f, 0x72, 0x4c, 0x68, 0x73, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x4c, 0x68, 0x73, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x52, 0x68, - 0x73, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x52, 0x68, - 0x73, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, - 0x4c, 0x45, 0x4e, 0x5f, 0x4c, 0x48, 0x53, 0x00, 0x05, 0x00, 0x04, 0x00, - 0x2a, 0x00, 0x00, 0x00, 0x4c, 0x45, 0x4e, 0x5f, 0x52, 0x48, 0x53, 0x00, - 0x05, 0x00, 0x04, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x4c, 0x45, 0x4e, 0x5f, - 0x4f, 0x55, 0x54, 0x00, 0x47, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x48, 0x00, 0x05, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x19, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x03, 0x00, 0x21, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x29, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x2b, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x2d, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x16, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x1d, 0x00, 0x03, 0x00, 0x11, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x03, 0x00, 0x12, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, - 0x15, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x2b, 0x00, 0x04, 0x00, 0x15, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x19, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1a, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x1a, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x32, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, - 0x2d, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, - 0x2c, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, - 0x3e, 0x00, 0x03, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x1c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, - 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, - 0x16, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x1d, 0x00, 0x00, 0x00, - 0x25, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, - 0x24, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x26, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, - 0x26, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x1d, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x28, 0x00, 0x00, 0x00, - 0x27, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00 -}; -static const unsigned int shaders_glsl_opmult_comp_spv_len = 1464; -} -} -#endif // define SHADEROP_SHADEROPMULT_HPP diff --git a/src/logger/CMakeLists.txt b/src/logger/CMakeLists.txt new file mode 100644 index 000000000..026754c3c --- /dev/null +++ b/src/logger/CMakeLists.txt @@ -0,0 +1,63 @@ +cmake_minimum_required(VERSION 3.20) + +set(LOGGER_SOURCES Logger.cpp) + +add_library(kp_logger ${LOGGER_SOURCES}) + +# Define log levels in code +add_compile_definitions(KOMPUTE_LOG_LEVEL_TRACE=0) +add_compile_definitions(KOMPUTE_LOG_LEVEL_DEBUG=1) +add_compile_definitions(KOMPUTE_LOG_LEVEL_INFO=2) +add_compile_definitions(KOMPUTE_LOG_LEVEL_WARN=3) +add_compile_definitions(KOMPUTE_LOG_LEVEL_ERROR=4) +add_compile_definitions(KOMPUTE_LOG_LEVEL_CRITICAL=5) +add_compile_definitions(KOMPUTE_LOG_LEVEL_OFF=6) + +if(KOMPUTE_OPT_BUILD_PYTHON AND KOMPUTE_OPT_USE_SPDLOG) + message(FATAL_ERROR "'KOMPUTE_OPT_BUILD_PYTHON' is incompatible with 'KOMPUTE_OPT_USE_SPDLOG'. To continue set either one option to 'OFF'.") +endif() + +if(KOMPUTE_OPT_ANDROID_BUILD AND KOMPUTE_OPT_USE_SPDLOG) + message(FATAL_ERROR "'KOMPUTE_OPT_ANDROID_BUILD' is incompatible with 'KOMPUTE_OPT_USE_SPDLOG'. To continue set either one option to 'OFF'.") +endif() + +if(${KOMPUTE_OPT_LOG_LEVEL} STREQUAL "Trace") + set(KOMPUTE_OPT_LOG_LEVEL TRACE) + message(STATUS "Using log level Trace") +elseif(${KOMPUTE_OPT_LOG_LEVEL} STREQUAL "Debug") + set(KOMPUTE_OPT_LOG_LEVEL DEBUG) + message(STATUS "Using log level Debug") +elseif(${KOMPUTE_OPT_LOG_LEVEL} STREQUAL "Info") + set(KOMPUTE_OPT_LOG_LEVEL INFO) + message(STATUS "Using log level Info") +elseif(${KOMPUTE_OPT_LOG_LEVEL} STREQUAL "Warn") + set(KOMPUTE_OPT_LOG_LEVEL WARN) + message(STATUS "Using log level Warn") +elseif(${KOMPUTE_OPT_LOG_LEVEL} STREQUAL "Error") + set(KOMPUTE_OPT_LOG_LEVEL ERROR) + message(STATUS "Using log level Error") +elseif(${KOMPUTE_OPT_LOG_LEVEL} STREQUAL "Critical") + set(KOMPUTE_OPT_LOG_LEVEL CRITICAL) + message(STATUS "Using log level Critical") +elseif(${KOMPUTE_OPT_LOG_LEVEL} STREQUAL "Off") + set(KOMPUTE_OPT_LOG_LEVEL OFF) + message(STATUS "Using log level Off") +elseif(${KOMPUTE_OPT_LOG_LEVEL} STREQUAL "Default") + set(KOMPUTE_OPT_LOG_LEVEL $,DEBUG,INFO>) + message(STATUS "Setting KOMPUTE_OPT_LOG_LEVEL to according to the build type") +else() + message(FATAL_ERROR "Log level '${KOMPUTE_OPT_LOG_LEVEL}' unknown, use -DKOMPUTE_OPT_LOG_LEVEL={Trace, Debug, Info, Warn, Error, Critical, Off, Default} to set it to a correct value.") +endif() + +# Always make sure we define the Kompute log level independent of the Spdlog log level +target_compile_definitions(kp_logger INTERFACE KOMPUTE_OPT_ACTIVE_LOG_LEVEL=KOMPUTE_LOG_LEVEL_${KOMPUTE_OPT_LOG_LEVEL}) + +# Link depending on how the logger should be setup +if(NOT KOMPUTE_OPT_LOG_LEVEL_DISABLED) + if(KOMPUTE_OPT_USE_SPDLOG) + target_link_libraries(kp_logger PUBLIC spdlog::spdlog) + target_compile_definitions(kp_logger INTERFACE SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${KOMPUTE_OPT_LOG_LEVEL}) + else() + target_link_libraries(kp_logger PUBLIC fmt::fmt) + endif() +endif() diff --git a/src/logger/Logger.cpp b/src/logger/Logger.cpp new file mode 100644 index 000000000..b8628788c --- /dev/null +++ b/src/logger/Logger.cpp @@ -0,0 +1,98 @@ +#include "kompute/logger/Logger.hpp" + +#if !KOMPUTE_OPT_LOG_LEVEL_DISABLED +#if !KOMPUTE_OPT_USE_SPDLOG +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif // !KOMPUTE_OPT_USE_SPDLOG + +namespace logger { +#if !KOMPUTE_OPT_USE_SPDLOG + +void +setupLogger() +{ +} + +#else +constexpr int THREAD_QUEUE_LENGTH = 8192; + +void +setupLogger() +{ + // Ensure we setup the logger only once + static bool setup = false; + static std::mutex setupMutex{}; + setupMutex.lock(); + if (setup) { + setupMutex.unlock(); + return; + } + setup = true; + setupMutex.unlock(); + + spdlog::init_thread_pool(THREAD_QUEUE_LENGTH, 1); + spdlog::sink_ptr console_sink = + std::make_shared(); + console_sink->set_pattern("[%H:%M:%S %z] [%=8l] [thread %t] [%@]\t%v"); + std::vector sinks{ console_sink }; + std::shared_ptr logger = + std::make_shared( + "", + sinks.begin(), + sinks.end(), + spdlog::thread_pool(), + spdlog::async_overflow_policy::block); + + logger->set_level(getLogLevel()); + spdlog::set_default_logger(logger); +} + +spdlog::level::level_enum +getLogLevel() +{ +#if SPDLOG_ACTIVE_LEVEL == SPDLOG_LEVEL_TRACE + return spdlog::level::trace; +#endif + +#if SPDLOG_ACTIVE_LEVEL == SPDLOG_LEVEL_DEBUG + return spdlog::level::debug; +#endif + +#if SPDLOG_ACTIVE_LEVEL == SPDLOG_LEVEL_INFO + return spdlog::level::info; +#endif + +#if SPDLOG_ACTIVE_LEVEL == SPDLOG_LEVEL_WARN + return spdlog::level::warn; +#endif + +#if SPDLOG_ACTIVE_LEVEL == SPDLOG_LEVEL_ERROR + return spdlog::level::error; +#endif + +#if SPDLOG_ACTIVE_LEVEL == SPDLOG_LEVEL_CRITICAL + return spdlog::level::critical; +#endif + + return spdlog::level::off; +} + +void +setLogLevel(const spdlog::level::level_enum level) +{ + spdlog::default_logger()->set_level(level); +} +#endif // !KOMPUTE_OPT_USE_SPDLOG +} // namespace logger + +#endif diff --git a/src/shaders/CMakeLists.txt b/src/shaders/CMakeLists.txt new file mode 100644 index 000000000..901bf3e8a --- /dev/null +++ b/src/shaders/CMakeLists.txt @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 +# ###################### +cmake_minimum_required(VERSION 3.20) + +add_subdirectory(glsl) \ No newline at end of file diff --git a/src/shaders/glsl/CMakeLists.txt b/src/shaders/glsl/CMakeLists.txt new file mode 100644 index 000000000..3101a2b17 --- /dev/null +++ b/src/shaders/glsl/CMakeLists.txt @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: Apache-2.0 +# ###################### +cmake_minimum_required(VERSION 3.20) + +# Check if build shaders from source is enabled +if(KOMPUTE_OPT_BUILD_SHADERS) + vulkan_compile_shader(INFILE ShaderOpMult.comp + OUTFILE ShaderOpMult.hpp + NAMESPACE "kp") + + vulkan_compile_shader(INFILE ShaderLogisticRegression.comp + OUTFILE ShaderLogisticRegression.hpp + NAMESPACE "kp") +else() # Else we will use our precompiled versions + add_custom_command(OUTPUT $/ShaderOpMult.hpp COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/ShaderOpMult.hpp.in $/ShaderOpMult.hpp) + add_custom_command(OUTPUT $/ShaderLogisticRegression.hpp COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/ShaderLogisticRegression.hpp.in $/ShaderLogisticRegression.hpp) +endif() + +add_library(kp_shader INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/ShaderOpMult.hpp" + "${CMAKE_CURRENT_BINARY_DIR}/ShaderLogisticRegression.hpp") + +target_include_directories(kp_shader INTERFACE $) + +# Make sure we install shaders: +install(FILES $/ShaderOpMult.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(FILES $/ShaderLogisticRegression.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/shaders/glsl/logisticregression.comp b/src/shaders/glsl/ShaderLogisticRegression.comp similarity index 100% rename from shaders/glsl/logisticregression.comp rename to src/shaders/glsl/ShaderLogisticRegression.comp diff --git a/src/shaders/glsl/ShaderLogisticRegression.hpp.in b/src/shaders/glsl/ShaderLogisticRegression.hpp.in new file mode 100644 index 000000000..bfe7792c6 --- /dev/null +++ b/src/shaders/glsl/ShaderLogisticRegression.hpp.in @@ -0,0 +1,310 @@ +#pragma once +#include +#include + +namespace kp { +const std::array SHADERLOGISTICREGRESSION_COMP_SPV = { +0x07230203, 0x00010000, 0x0008000a, 0x000000ae, +0x00000000, 0x00020011, 0x00000001, 0x0006000b, +0x00000001, 0x4c534c47, 0x6474732e, 0x3035342e, +0x00000000, 0x0003000e, 0x00000000, 0x00000001, +0x0006000f, 0x00000005, 0x00000004, 0x6e69616d, +0x00000000, 0x00000041, 0x00060010, 0x00000004, +0x00000011, 0x00000001, 0x00000001, 0x00000001, +0x00030003, 0x00000002, 0x000001c2, 0x00040005, +0x00000004, 0x6e69616d, 0x00000000, 0x00050005, +0x0000000a, 0x6d676973, 0x2864696f, 0x003b3166, +0x00030005, 0x00000009, 0x0000007a, 0x00080005, +0x00000012, 0x65666e69, 0x636e6572, 0x66762865, +0x66763b32, 0x31663b32, 0x0000003b, 0x00030005, +0x0000000f, 0x00000078, 0x00030005, 0x00000010, +0x00000077, 0x00030005, 0x00000011, 0x00000062, +0x00080005, 0x00000017, 0x636c6163, 0x74616c75, +0x736f4c65, 0x31662873, 0x3b31663b, 0x00000000, +0x00040005, 0x00000015, 0x74614879, 0x00000000, +0x00030005, 0x00000016, 0x00000079, 0x00030005, +0x00000021, 0x0000007a, 0x00040005, 0x00000027, +0x74614879, 0x00000000, 0x00040005, 0x00000028, +0x61726170, 0x0000006d, 0x00030005, 0x0000003e, +0x00786469, 0x00080005, 0x00000041, 0x475f6c67, +0x61626f6c, 0x766e496c, 0x7461636f, 0x496e6f69, +0x00000044, 0x00040005, 0x00000046, 0x72754377, +0x00000072, 0x00040005, 0x00000048, 0x6e697762, +0x00000000, 0x00040006, 0x00000048, 0x00000000, +0x006e6977, 0x00030005, 0x0000004a, 0x00000000, +0x00040005, 0x00000054, 0x72754362, 0x00000072, +0x00040005, 0x00000056, 0x6e696262, 0x00000000, +0x00040006, 0x00000056, 0x00000000, 0x006e6962, +0x00030005, 0x00000058, 0x00000000, 0x00040005, +0x0000005b, 0x72754378, 0x00000072, 0x00030005, +0x0000005d, 0x00697862, 0x00040006, 0x0000005d, +0x00000000, 0x00006978, 0x00030005, 0x0000005f, +0x00000000, 0x00030005, 0x00000064, 0x006a7862, +0x00040006, 0x00000064, 0x00000000, 0x00006a78, +0x00030005, 0x00000066, 0x00000000, 0x00040005, +0x0000006b, 0x72754379, 0x00000072, 0x00030005, +0x0000006d, 0x00007962, 0x00040006, 0x0000006d, +0x00000000, 0x00000079, 0x00030005, 0x0000006f, +0x00000000, 0x00040005, 0x00000073, 0x74614879, +0x00000000, 0x00040005, 0x00000074, 0x61726170, +0x0000006d, 0x00040005, 0x00000076, 0x61726170, +0x0000006d, 0x00040005, 0x00000078, 0x61726170, +0x0000006d, 0x00030005, 0x0000007b, 0x00005a64, +0x00030005, 0x0000007f, 0x00005764, 0x00030005, +0x00000080, 0x0000006d, 0x00030005, 0x00000086, +0x00004264, 0x00040005, 0x0000008b, 0x756f7762, +0x00006974, 0x00050006, 0x0000008b, 0x00000000, +0x74756f77, 0x00000069, 0x00030005, 0x0000008d, +0x00000000, 0x00040005, 0x00000093, 0x756f7762, +0x00006a74, 0x00050006, 0x00000093, 0x00000000, +0x74756f77, 0x0000006a, 0x00030005, 0x00000095, +0x00000000, 0x00040005, 0x0000009c, 0x756f6262, +0x00000074, 0x00050006, 0x0000009c, 0x00000000, +0x74756f62, 0x00000000, 0x00030005, 0x0000009e, +0x00000000, 0x00040005, 0x000000a3, 0x756f6c62, +0x00000074, 0x00050006, 0x000000a3, 0x00000000, +0x74756f6c, 0x00000000, 0x00030005, 0x000000a5, +0x00000000, 0x00040005, 0x000000a7, 0x61726170, +0x0000006d, 0x00040005, 0x000000a9, 0x61726170, +0x0000006d, 0x00040047, 0x00000041, 0x0000000b, +0x0000001c, 0x00040047, 0x00000047, 0x00000006, +0x00000004, 0x00050048, 0x00000048, 0x00000000, +0x00000023, 0x00000000, 0x00030047, 0x00000048, +0x00000003, 0x00040047, 0x0000004a, 0x00000022, +0x00000000, 0x00040047, 0x0000004a, 0x00000021, +0x00000003, 0x00040047, 0x00000055, 0x00000006, +0x00000004, 0x00050048, 0x00000056, 0x00000000, +0x00000023, 0x00000000, 0x00030047, 0x00000056, +0x00000003, 0x00040047, 0x00000058, 0x00000022, +0x00000000, 0x00040047, 0x00000058, 0x00000021, +0x00000006, 0x00040047, 0x0000005c, 0x00000006, +0x00000004, 0x00050048, 0x0000005d, 0x00000000, +0x00000023, 0x00000000, 0x00030047, 0x0000005d, +0x00000003, 0x00040047, 0x0000005f, 0x00000022, +0x00000000, 0x00040047, 0x0000005f, 0x00000021, +0x00000000, 0x00040047, 0x00000063, 0x00000006, +0x00000004, 0x00050048, 0x00000064, 0x00000000, +0x00000023, 0x00000000, 0x00030047, 0x00000064, +0x00000003, 0x00040047, 0x00000066, 0x00000022, +0x00000000, 0x00040047, 0x00000066, 0x00000021, +0x00000001, 0x00040047, 0x0000006c, 0x00000006, +0x00000004, 0x00050048, 0x0000006d, 0x00000000, +0x00000023, 0x00000000, 0x00030047, 0x0000006d, +0x00000003, 0x00040047, 0x0000006f, 0x00000022, +0x00000000, 0x00040047, 0x0000006f, 0x00000021, +0x00000002, 0x00040047, 0x00000080, 0x00000001, +0x00000000, 0x00040047, 0x0000008a, 0x00000006, +0x00000004, 0x00050048, 0x0000008b, 0x00000000, +0x00000023, 0x00000000, 0x00030047, 0x0000008b, +0x00000003, 0x00040047, 0x0000008d, 0x00000022, +0x00000000, 0x00040047, 0x0000008d, 0x00000021, +0x00000004, 0x00040047, 0x00000092, 0x00000006, +0x00000004, 0x00050048, 0x00000093, 0x00000000, +0x00000023, 0x00000000, 0x00030047, 0x00000093, +0x00000003, 0x00040047, 0x00000095, 0x00000022, +0x00000000, 0x00040047, 0x00000095, 0x00000021, +0x00000005, 0x00040047, 0x0000009b, 0x00000006, +0x00000004, 0x00050048, 0x0000009c, 0x00000000, +0x00000023, 0x00000000, 0x00030047, 0x0000009c, +0x00000003, 0x00040047, 0x0000009e, 0x00000022, +0x00000000, 0x00040047, 0x0000009e, 0x00000021, +0x00000007, 0x00040047, 0x000000a2, 0x00000006, +0x00000004, 0x00050048, 0x000000a3, 0x00000000, +0x00000023, 0x00000000, 0x00030047, 0x000000a3, +0x00000003, 0x00040047, 0x000000a5, 0x00000022, +0x00000000, 0x00040047, 0x000000a5, 0x00000021, +0x00000008, 0x00040047, 0x000000ad, 0x0000000b, +0x00000019, 0x00020013, 0x00000002, 0x00030021, +0x00000003, 0x00000002, 0x00030016, 0x00000006, +0x00000020, 0x00040020, 0x00000007, 0x00000007, +0x00000006, 0x00040021, 0x00000008, 0x00000006, +0x00000007, 0x00040017, 0x0000000c, 0x00000006, +0x00000002, 0x00040020, 0x0000000d, 0x00000007, +0x0000000c, 0x00060021, 0x0000000e, 0x00000006, +0x0000000d, 0x0000000d, 0x00000007, 0x00050021, +0x00000014, 0x00000006, 0x00000007, 0x00000007, +0x0004002b, 0x00000006, 0x00000019, 0x3f800000, +0x00040015, 0x0000003c, 0x00000020, 0x00000000, +0x00040020, 0x0000003d, 0x00000007, 0x0000003c, +0x00040017, 0x0000003f, 0x0000003c, 0x00000003, +0x00040020, 0x00000040, 0x00000001, 0x0000003f, +0x0004003b, 0x00000040, 0x00000041, 0x00000001, +0x0004002b, 0x0000003c, 0x00000042, 0x00000000, +0x00040020, 0x00000043, 0x00000001, 0x0000003c, +0x0003001d, 0x00000047, 0x00000006, 0x0003001e, +0x00000048, 0x00000047, 0x00040020, 0x00000049, +0x00000002, 0x00000048, 0x0004003b, 0x00000049, +0x0000004a, 0x00000002, 0x00040015, 0x0000004b, +0x00000020, 0x00000001, 0x0004002b, 0x0000004b, +0x0000004c, 0x00000000, 0x00040020, 0x0000004d, +0x00000002, 0x00000006, 0x0004002b, 0x0000004b, +0x00000050, 0x00000001, 0x0003001d, 0x00000055, +0x00000006, 0x0003001e, 0x00000056, 0x00000055, +0x00040020, 0x00000057, 0x00000002, 0x00000056, +0x0004003b, 0x00000057, 0x00000058, 0x00000002, +0x0003001d, 0x0000005c, 0x00000006, 0x0003001e, +0x0000005d, 0x0000005c, 0x00040020, 0x0000005e, +0x00000002, 0x0000005d, 0x0004003b, 0x0000005e, +0x0000005f, 0x00000002, 0x0003001d, 0x00000063, +0x00000006, 0x0003001e, 0x00000064, 0x00000063, +0x00040020, 0x00000065, 0x00000002, 0x00000064, +0x0004003b, 0x00000065, 0x00000066, 0x00000002, +0x0003001d, 0x0000006c, 0x00000006, 0x0003001e, +0x0000006d, 0x0000006c, 0x00040020, 0x0000006e, +0x00000002, 0x0000006d, 0x0004003b, 0x0000006e, +0x0000006f, 0x00000002, 0x00040032, 0x00000006, +0x00000080, 0x00000000, 0x0003001d, 0x0000008a, +0x00000006, 0x0003001e, 0x0000008b, 0x0000008a, +0x00040020, 0x0000008c, 0x00000002, 0x0000008b, +0x0004003b, 0x0000008c, 0x0000008d, 0x00000002, +0x0003001d, 0x00000092, 0x00000006, 0x0003001e, +0x00000093, 0x00000092, 0x00040020, 0x00000094, +0x00000002, 0x00000093, 0x0004003b, 0x00000094, +0x00000095, 0x00000002, 0x0004002b, 0x0000003c, +0x00000097, 0x00000001, 0x0003001d, 0x0000009b, +0x00000006, 0x0003001e, 0x0000009c, 0x0000009b, +0x00040020, 0x0000009d, 0x00000002, 0x0000009c, +0x0004003b, 0x0000009d, 0x0000009e, 0x00000002, +0x0003001d, 0x000000a2, 0x00000006, 0x0003001e, +0x000000a3, 0x000000a2, 0x00040020, 0x000000a4, +0x00000002, 0x000000a3, 0x0004003b, 0x000000a4, +0x000000a5, 0x00000002, 0x0006002c, 0x0000003f, +0x000000ad, 0x00000097, 0x00000097, 0x00000097, +0x00050036, 0x00000002, 0x00000004, 0x00000000, +0x00000003, 0x000200f8, 0x00000005, 0x0004003b, +0x0000003d, 0x0000003e, 0x00000007, 0x0004003b, +0x0000000d, 0x00000046, 0x00000007, 0x0004003b, +0x00000007, 0x00000054, 0x00000007, 0x0004003b, +0x0000000d, 0x0000005b, 0x00000007, 0x0004003b, +0x00000007, 0x0000006b, 0x00000007, 0x0004003b, +0x00000007, 0x00000073, 0x00000007, 0x0004003b, +0x0000000d, 0x00000074, 0x00000007, 0x0004003b, +0x0000000d, 0x00000076, 0x00000007, 0x0004003b, +0x00000007, 0x00000078, 0x00000007, 0x0004003b, +0x00000007, 0x0000007b, 0x00000007, 0x0004003b, +0x0000000d, 0x0000007f, 0x00000007, 0x0004003b, +0x00000007, 0x00000086, 0x00000007, 0x0004003b, +0x00000007, 0x000000a7, 0x00000007, 0x0004003b, +0x00000007, 0x000000a9, 0x00000007, 0x00050041, +0x00000043, 0x00000044, 0x00000041, 0x00000042, +0x0004003d, 0x0000003c, 0x00000045, 0x00000044, +0x0003003e, 0x0000003e, 0x00000045, 0x00060041, +0x0000004d, 0x0000004e, 0x0000004a, 0x0000004c, +0x0000004c, 0x0004003d, 0x00000006, 0x0000004f, +0x0000004e, 0x00060041, 0x0000004d, 0x00000051, +0x0000004a, 0x0000004c, 0x00000050, 0x0004003d, +0x00000006, 0x00000052, 0x00000051, 0x00050050, +0x0000000c, 0x00000053, 0x0000004f, 0x00000052, +0x0003003e, 0x00000046, 0x00000053, 0x00060041, +0x0000004d, 0x00000059, 0x00000058, 0x0000004c, +0x0000004c, 0x0004003d, 0x00000006, 0x0000005a, +0x00000059, 0x0003003e, 0x00000054, 0x0000005a, +0x0004003d, 0x0000003c, 0x00000060, 0x0000003e, +0x00060041, 0x0000004d, 0x00000061, 0x0000005f, +0x0000004c, 0x00000060, 0x0004003d, 0x00000006, +0x00000062, 0x00000061, 0x0004003d, 0x0000003c, +0x00000067, 0x0000003e, 0x00060041, 0x0000004d, +0x00000068, 0x00000066, 0x0000004c, 0x00000067, +0x0004003d, 0x00000006, 0x00000069, 0x00000068, +0x00050050, 0x0000000c, 0x0000006a, 0x00000062, +0x00000069, 0x0003003e, 0x0000005b, 0x0000006a, +0x0004003d, 0x0000003c, 0x00000070, 0x0000003e, +0x00060041, 0x0000004d, 0x00000071, 0x0000006f, +0x0000004c, 0x00000070, 0x0004003d, 0x00000006, +0x00000072, 0x00000071, 0x0003003e, 0x0000006b, +0x00000072, 0x0004003d, 0x0000000c, 0x00000075, +0x0000005b, 0x0003003e, 0x00000074, 0x00000075, +0x0004003d, 0x0000000c, 0x00000077, 0x00000046, +0x0003003e, 0x00000076, 0x00000077, 0x0004003d, +0x00000006, 0x00000079, 0x00000054, 0x0003003e, +0x00000078, 0x00000079, 0x00070039, 0x00000006, +0x0000007a, 0x00000012, 0x00000074, 0x00000076, +0x00000078, 0x0003003e, 0x00000073, 0x0000007a, +0x0004003d, 0x00000006, 0x0000007c, 0x00000073, +0x0004003d, 0x00000006, 0x0000007d, 0x0000006b, +0x00050083, 0x00000006, 0x0000007e, 0x0000007c, +0x0000007d, 0x0003003e, 0x0000007b, 0x0000007e, +0x00050088, 0x00000006, 0x00000081, 0x00000019, +0x00000080, 0x0004003d, 0x0000000c, 0x00000082, +0x0000005b, 0x0005008e, 0x0000000c, 0x00000083, +0x00000082, 0x00000081, 0x0004003d, 0x00000006, +0x00000084, 0x0000007b, 0x0005008e, 0x0000000c, +0x00000085, 0x00000083, 0x00000084, 0x0003003e, +0x0000007f, 0x00000085, 0x00050088, 0x00000006, +0x00000087, 0x00000019, 0x00000080, 0x0004003d, +0x00000006, 0x00000088, 0x0000007b, 0x00050085, +0x00000006, 0x00000089, 0x00000087, 0x00000088, +0x0003003e, 0x00000086, 0x00000089, 0x0004003d, +0x0000003c, 0x0000008e, 0x0000003e, 0x00050041, +0x00000007, 0x0000008f, 0x0000007f, 0x00000042, +0x0004003d, 0x00000006, 0x00000090, 0x0000008f, +0x00060041, 0x0000004d, 0x00000091, 0x0000008d, +0x0000004c, 0x0000008e, 0x0003003e, 0x00000091, +0x00000090, 0x0004003d, 0x0000003c, 0x00000096, +0x0000003e, 0x00050041, 0x00000007, 0x00000098, +0x0000007f, 0x00000097, 0x0004003d, 0x00000006, +0x00000099, 0x00000098, 0x00060041, 0x0000004d, +0x0000009a, 0x00000095, 0x0000004c, 0x00000096, +0x0003003e, 0x0000009a, 0x00000099, 0x0004003d, +0x0000003c, 0x0000009f, 0x0000003e, 0x0004003d, +0x00000006, 0x000000a0, 0x00000086, 0x00060041, +0x0000004d, 0x000000a1, 0x0000009e, 0x0000004c, +0x0000009f, 0x0003003e, 0x000000a1, 0x000000a0, +0x0004003d, 0x0000003c, 0x000000a6, 0x0000003e, +0x0004003d, 0x00000006, 0x000000a8, 0x00000073, +0x0003003e, 0x000000a7, 0x000000a8, 0x0004003d, +0x00000006, 0x000000aa, 0x0000006b, 0x0003003e, +0x000000a9, 0x000000aa, 0x00060039, 0x00000006, +0x000000ab, 0x00000017, 0x000000a7, 0x000000a9, +0x00060041, 0x0000004d, 0x000000ac, 0x000000a5, +0x0000004c, 0x000000a6, 0x0003003e, 0x000000ac, +0x000000ab, 0x000100fd, 0x00010038, 0x00050036, +0x00000006, 0x0000000a, 0x00000000, 0x00000008, +0x00030037, 0x00000007, 0x00000009, 0x000200f8, +0x0000000b, 0x0004003d, 0x00000006, 0x0000001a, +0x00000009, 0x0004007f, 0x00000006, 0x0000001b, +0x0000001a, 0x0006000c, 0x00000006, 0x0000001c, +0x00000001, 0x0000001b, 0x0000001b, 0x00050081, +0x00000006, 0x0000001d, 0x00000019, 0x0000001c, +0x00050088, 0x00000006, 0x0000001e, 0x00000019, +0x0000001d, 0x000200fe, 0x0000001e, 0x00010038, +0x00050036, 0x00000006, 0x00000012, 0x00000000, +0x0000000e, 0x00030037, 0x0000000d, 0x0000000f, +0x00030037, 0x0000000d, 0x00000010, 0x00030037, +0x00000007, 0x00000011, 0x000200f8, 0x00000013, +0x0004003b, 0x00000007, 0x00000021, 0x00000007, +0x0004003b, 0x00000007, 0x00000027, 0x00000007, +0x0004003b, 0x00000007, 0x00000028, 0x00000007, +0x0004003d, 0x0000000c, 0x00000022, 0x00000010, +0x0004003d, 0x0000000c, 0x00000023, 0x0000000f, +0x00050094, 0x00000006, 0x00000024, 0x00000022, +0x00000023, 0x0004003d, 0x00000006, 0x00000025, +0x00000011, 0x00050081, 0x00000006, 0x00000026, +0x00000024, 0x00000025, 0x0003003e, 0x00000021, +0x00000026, 0x0004003d, 0x00000006, 0x00000029, +0x00000021, 0x0003003e, 0x00000028, 0x00000029, +0x00050039, 0x00000006, 0x0000002a, 0x0000000a, +0x00000028, 0x0003003e, 0x00000027, 0x0000002a, +0x0004003d, 0x00000006, 0x0000002b, 0x00000027, +0x000200fe, 0x0000002b, 0x00010038, 0x00050036, +0x00000006, 0x00000017, 0x00000000, 0x00000014, +0x00030037, 0x00000007, 0x00000015, 0x00030037, +0x00000007, 0x00000016, 0x000200f8, 0x00000018, +0x0004003d, 0x00000006, 0x0000002e, 0x00000016, +0x0004003d, 0x00000006, 0x0000002f, 0x00000015, +0x0006000c, 0x00000006, 0x00000030, 0x00000001, +0x0000001c, 0x0000002f, 0x00050085, 0x00000006, +0x00000031, 0x0000002e, 0x00000030, 0x0004003d, +0x00000006, 0x00000032, 0x00000016, 0x00050083, +0x00000006, 0x00000033, 0x00000019, 0x00000032, +0x0004003d, 0x00000006, 0x00000034, 0x00000015, +0x00050083, 0x00000006, 0x00000035, 0x00000019, +0x00000034, 0x0006000c, 0x00000006, 0x00000036, +0x00000001, 0x0000001c, 0x00000035, 0x00050085, +0x00000006, 0x00000037, 0x00000033, 0x00000036, +0x00050081, 0x00000006, 0x00000038, 0x00000031, +0x00000037, 0x0004007f, 0x00000006, 0x00000039, +0x00000038, 0x000200fe, 0x00000039, 0x00010038 }; +} // namespace kp + + diff --git a/shaders/glsl/opmult.comp b/src/shaders/glsl/ShaderOpMult.comp similarity index 100% rename from shaders/glsl/opmult.comp rename to src/shaders/glsl/ShaderOpMult.comp diff --git a/src/shaders/glsl/ShaderOpMult.hpp.in b/src/shaders/glsl/ShaderOpMult.hpp.in new file mode 100644 index 000000000..5af29c66d --- /dev/null +++ b/src/shaders/glsl/ShaderOpMult.hpp.in @@ -0,0 +1,101 @@ +#pragma once +#include +#include + +namespace kp { +const std::array SHADEROPMULT_COMP_SPV = { +0x07230203, 0x00010000, 0x0008000a, 0x0000002e, +0x00000000, 0x00020011, 0x00000001, 0x0006000b, +0x00000001, 0x4c534c47, 0x6474732e, 0x3035342e, +0x00000000, 0x0003000e, 0x00000000, 0x00000001, +0x0006000f, 0x00000005, 0x00000004, 0x6e69616d, +0x00000000, 0x0000000b, 0x00060010, 0x00000004, +0x00000011, 0x00000001, 0x00000001, 0x00000001, +0x00030003, 0x00000002, 0x000001c2, 0x00040005, +0x00000004, 0x6e69616d, 0x00000000, 0x00040005, +0x00000008, 0x65646e69, 0x00000078, 0x00080005, +0x0000000b, 0x475f6c67, 0x61626f6c, 0x766e496c, +0x7461636f, 0x496e6f69, 0x00000044, 0x00060005, +0x00000012, 0x736e6574, 0x754f726f, 0x74757074, +0x00000000, 0x00070006, 0x00000012, 0x00000000, +0x756c6176, 0x754f7365, 0x74757074, 0x00000000, +0x00030005, 0x00000014, 0x00000000, 0x00050005, +0x00000019, 0x736e6574, 0x684c726f, 0x00000073, +0x00060006, 0x00000019, 0x00000000, 0x756c6176, +0x684c7365, 0x00000073, 0x00030005, 0x0000001b, +0x00000000, 0x00050005, 0x00000021, 0x736e6574, +0x6852726f, 0x00000073, 0x00060006, 0x00000021, +0x00000000, 0x756c6176, 0x68527365, 0x00000073, +0x00030005, 0x00000023, 0x00000000, 0x00040005, +0x00000029, 0x5f4e454c, 0x0053484c, 0x00040005, +0x0000002a, 0x5f4e454c, 0x00534852, 0x00040005, +0x0000002b, 0x5f4e454c, 0x0054554f, 0x00040047, +0x0000000b, 0x0000000b, 0x0000001c, 0x00040047, +0x00000011, 0x00000006, 0x00000004, 0x00050048, +0x00000012, 0x00000000, 0x00000023, 0x00000000, +0x00030047, 0x00000012, 0x00000003, 0x00040047, +0x00000014, 0x00000022, 0x00000000, 0x00040047, +0x00000014, 0x00000021, 0x00000002, 0x00040047, +0x00000018, 0x00000006, 0x00000004, 0x00050048, +0x00000019, 0x00000000, 0x00000023, 0x00000000, +0x00030047, 0x00000019, 0x00000003, 0x00040047, +0x0000001b, 0x00000022, 0x00000000, 0x00040047, +0x0000001b, 0x00000021, 0x00000000, 0x00040047, +0x00000020, 0x00000006, 0x00000004, 0x00050048, +0x00000021, 0x00000000, 0x00000023, 0x00000000, +0x00030047, 0x00000021, 0x00000003, 0x00040047, +0x00000023, 0x00000022, 0x00000000, 0x00040047, +0x00000023, 0x00000021, 0x00000001, 0x00040047, +0x00000029, 0x00000001, 0x00000000, 0x00040047, +0x0000002a, 0x00000001, 0x00000001, 0x00040047, +0x0000002b, 0x00000001, 0x00000002, 0x00040047, +0x0000002d, 0x0000000b, 0x00000019, 0x00020013, +0x00000002, 0x00030021, 0x00000003, 0x00000002, +0x00040015, 0x00000006, 0x00000020, 0x00000000, +0x00040020, 0x00000007, 0x00000007, 0x00000006, +0x00040017, 0x00000009, 0x00000006, 0x00000003, +0x00040020, 0x0000000a, 0x00000001, 0x00000009, +0x0004003b, 0x0000000a, 0x0000000b, 0x00000001, +0x0004002b, 0x00000006, 0x0000000c, 0x00000000, +0x00040020, 0x0000000d, 0x00000001, 0x00000006, +0x00030016, 0x00000010, 0x00000020, 0x0003001d, +0x00000011, 0x00000010, 0x0003001e, 0x00000012, +0x00000011, 0x00040020, 0x00000013, 0x00000002, +0x00000012, 0x0004003b, 0x00000013, 0x00000014, +0x00000002, 0x00040015, 0x00000015, 0x00000020, +0x00000001, 0x0004002b, 0x00000015, 0x00000016, +0x00000000, 0x0003001d, 0x00000018, 0x00000010, +0x0003001e, 0x00000019, 0x00000018, 0x00040020, +0x0000001a, 0x00000002, 0x00000019, 0x0004003b, +0x0000001a, 0x0000001b, 0x00000002, 0x00040020, +0x0000001d, 0x00000002, 0x00000010, 0x0003001d, +0x00000020, 0x00000010, 0x0003001e, 0x00000021, +0x00000020, 0x00040020, 0x00000022, 0x00000002, +0x00000021, 0x0004003b, 0x00000022, 0x00000023, +0x00000002, 0x00040032, 0x00000006, 0x00000029, +0x00000000, 0x00040032, 0x00000006, 0x0000002a, +0x00000000, 0x00040032, 0x00000006, 0x0000002b, +0x00000000, 0x0004002b, 0x00000006, 0x0000002c, +0x00000001, 0x0006002c, 0x00000009, 0x0000002d, +0x0000002c, 0x0000002c, 0x0000002c, 0x00050036, +0x00000002, 0x00000004, 0x00000000, 0x00000003, +0x000200f8, 0x00000005, 0x0004003b, 0x00000007, +0x00000008, 0x00000007, 0x00050041, 0x0000000d, +0x0000000e, 0x0000000b, 0x0000000c, 0x0004003d, +0x00000006, 0x0000000f, 0x0000000e, 0x0003003e, +0x00000008, 0x0000000f, 0x0004003d, 0x00000006, +0x00000017, 0x00000008, 0x0004003d, 0x00000006, +0x0000001c, 0x00000008, 0x00060041, 0x0000001d, +0x0000001e, 0x0000001b, 0x00000016, 0x0000001c, +0x0004003d, 0x00000010, 0x0000001f, 0x0000001e, +0x0004003d, 0x00000006, 0x00000024, 0x00000008, +0x00060041, 0x0000001d, 0x00000025, 0x00000023, +0x00000016, 0x00000024, 0x0004003d, 0x00000010, +0x00000026, 0x00000025, 0x00050085, 0x00000010, +0x00000027, 0x0000001f, 0x00000026, 0x00060041, +0x0000001d, 0x00000028, 0x00000014, 0x00000016, +0x00000017, 0x0003003e, 0x00000028, 0x00000027, +0x000100fd, 0x00010038 }; +} // namespace kp + + diff --git a/shaders/hlsl/computeheadless.comp b/src/shaders/hlsl/computeheadless.comp similarity index 100% rename from shaders/hlsl/computeheadless.comp rename to src/shaders/hlsl/computeheadless.comp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 562f1890e..0564458c6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,100 +1,41 @@ # SPDX-License-Identifier: Apache-2.0 +# ###################### +cmake_minimum_required(VERSION 3.20) -##################################################### -#################### GETEST ####################### -##################################################### -enable_testing() -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) +# #################################################### +# Shaders +# #################################################### +add_subdirectory(shaders) + +# #################################################### +# Tests +# #################################################### +add_executable(kompute_tests TestAsyncOperations.cpp + TestDestroy.cpp + TestLogisticRegression.cpp + TestManager.cpp + TestMultipleAlgoExecutions.cpp + TestOpShadersFromStringAndFile.cpp + TestOpTensorCopy.cpp + TestOpTensorCreate.cpp + TestPushConstant.cpp + TestSequence.cpp + TestSpecializationConstant.cpp + TestWorkgroup.cpp) + +target_link_libraries(kompute_tests PRIVATE GTest::gtest_main + kompute::kompute + kp_logger + test_shaders + test_shaders_glsl) +add_test(NAME kompute_tests COMMAND kompute_tests) + +# Group under the "tests" project folder in IDEs such as Visual Studio. +set_property(TARGET kompute_tests PROPERTY FOLDER "tests") + +if(WIN32 AND BUILD_SHARED_LIBS) # Install dlls in the same directory as the executable on Windows so one can simply double click them + add_custom_command(TARGET kompute_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ $) + add_custom_command(TARGET kompute_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ $) + add_custom_command(TARGET kompute_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ $) + add_custom_command(TARGET kompute_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ $) endif() - -file(GLOB test_kompute_CPP - "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" -) - -add_executable(test_kompute ${test_kompute_CPP}) - -target_include_directories( - test_kompute PUBLIC - $ - $ - $ -) - -if(KOMPUTE_OPT_REPO_SUBMODULE_BUILD) - target_include_directories( - test_kompute PRIVATE - ${gtest_SOURCE_DIR}/include) - - target_link_libraries(test_kompute - gtest_main) -else() - target_link_libraries(test_kompute - GTest::gtest) -endif() - -target_link_libraries(test_kompute kompute) - -add_test(NAME test_kompute COMMAND test_kompute) - - -##################################################### -#################### CODECOV ####################### -##################################################### - -if (KOMPUTE_OPT_CODE_COVERAGE) - if(NOT UNIX) - message( - FATAL_ERROR - "KOMPUTE_OPT_CODE_COVERAGE can only be enabled in unix based systems due to limitation on gcov") - endif() - - add_custom_target(codecov_run_tests - COMMAND make -C ${PROJECT_SOURCE_DIR} mk_run_tests - DEPENDS test_kompute) - - add_custom_target(codecov_copy_files - COMMAND ${CMAKE_COMMAND} - -E copy_directory - ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/test_kompute.dir/ - ${CODECOV_DIR} - COMMAND ${CMAKE_COMMAND} - -E copy_directory - ${CMAKE_CURRENT_BINARY_DIR}/../src/CMakeFiles/kompute.dir/ - ${CODECOV_DIR} - DEPENDS test_kompute codecov_run_tests) - - add_custom_target(codecov_gcov - COMMAND gcov - -b -c "*.gcno" - WORKING_DIRECTORY ${CODECOV_DIR} - DEPENDS codecov_copy_files) - - add_custom_target(codecov_lcov_capture - COMMAND lcov - --capture - -o ${CODECOV_FILENAME_LCOV_INFO_FULL} - -d . - WORKING_DIRECTORY ${CODECOV_DIR} - DEPENDS codecov_gcov) - add_custom_target(codecov_lcov_extract - COMMAND lcov - --extract - ${CODECOV_FILENAME_LCOV_INFO_FULL} - -o ${CODECOV_FILENAME_LCOV_INFO} - -d . - "*/src/*" - WORKING_DIRECTORY ${CODECOV_DIR} - DEPENDS codecov_lcov_capture) - - add_custom_target(codecov_genhtml - COMMAND genhtml - ${CODECOV_FILENAME_LCOV_INFO} - --output-directory ${CODECOV_DIR_HTML} - WORKING_DIRECTORY ${CODECOV_DIR} - DEPENDS codecov_lcov_extract) -endif() - diff --git a/test/TestAsyncOperations.cpp b/test/TestAsyncOperations.cpp index cacc41da4..d549dda41 100644 --- a/test/TestAsyncOperations.cpp +++ b/test/TestAsyncOperations.cpp @@ -5,8 +5,8 @@ #include #include "kompute/Kompute.hpp" - -#include "kompute_test/Shader.hpp" +#include "kompute/logger/Logger.hpp" +#include "shaders/Utils.hpp" TEST(TestAsyncOperations, TestManagerParallelExecution) { diff --git a/test/TestDestroy.cpp b/test/TestDestroy.cpp index 8ae824756..f6b92cd90 100644 --- a/test/TestDestroy.cpp +++ b/test/TestDestroy.cpp @@ -3,8 +3,9 @@ #include "gtest/gtest.h" #include "kompute/Kompute.hpp" +#include "kompute/logger/Logger.hpp" -#include "kompute_test/Shader.hpp" +#include "shaders/Utils.hpp" TEST(TestDestroy, TestDestroyTensorSingle) { diff --git a/test/TestLogisticRegression.cpp b/test/TestLogisticRegression.cpp index b1ffaef84..6b417a94c 100644 --- a/test/TestLogisticRegression.cpp +++ b/test/TestLogisticRegression.cpp @@ -3,8 +3,9 @@ #include "gtest/gtest.h" #include "kompute/Kompute.hpp" +#include "kompute/logger/Logger.hpp" -#include "kompute_test/shaders/shadertest_logistic_regression.hpp" +#include "test_logistic_regression_shader.hpp" TEST(TestLogisticRegression, TestMainLogisticRegression) { @@ -39,13 +40,11 @@ TEST(TestLogisticRegression, TestMainLogisticRegression) mgr.sequence()->eval(params); - std::vector spirv = std::vector( - (uint32_t*)kp::shader_data:: - test_shaders_glsl_test_logistic_regression_comp_spv, - (uint32_t*)(kp::shader_data:: - test_shaders_glsl_test_logistic_regression_comp_spv + - kp::shader_data:: - test_shaders_glsl_test_logistic_regression_comp_spv_len)); + std::vector spirv2{ 0x1, 0x2 }; + + std::vector spirv( + kp::TEST_LOGISTIC_REGRESSION_SHADER_COMP_SPV.begin(), + kp::TEST_LOGISTIC_REGRESSION_SHADER_COMP_SPV.end()); std::shared_ptr algorithm = mgr.algorithm( params, spirv, kp::Workgroup({ 5 }), std::vector({ 5.0 })); @@ -58,7 +57,6 @@ TEST(TestLogisticRegression, TestMainLogisticRegression) // Iterate across all expected iterations for (size_t i = 0; i < ITERATIONS; i++) { - sq->eval(); for (size_t j = 0; j < bOut->size(); j++) { @@ -119,12 +117,9 @@ TEST(TestLogisticRegression, TestMainLogisticRegressionManualCopy) mgr.sequence()->record(params)->eval(); - std::vector spirv = std::vector( - (uint32_t*)kp::shader_data::shaders_glsl_logisticregression_comp_spv, - (uint32_t*)(kp::shader_data:: - shaders_glsl_logisticregression_comp_spv + - kp::shader_data:: - shaders_glsl_logisticregression_comp_spv_len)); + std::vector spirv( + kp::TEST_LOGISTIC_REGRESSION_SHADER_COMP_SPV.begin(), + kp::TEST_LOGISTIC_REGRESSION_SHADER_COMP_SPV.end()); std::shared_ptr algorithm = mgr.algorithm( params, spirv, kp::Workgroup(), std::vector({ 5.0 })); diff --git a/test/TestMain.cpp b/test/TestMain.cpp deleted file mode 100644 index 4f777f0b2..000000000 --- a/test/TestMain.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 - -#include - -#include - -int -main(int argc, char* argv[]) -{ - testing::InitGoogleTest(&argc, argv); - -#if KOMPUTE_ENABLE_SPDLOG - spdlog::set_level( - static_cast(KOMPUTE_LOG_LEVEL)); -#endif - - return RUN_ALL_TESTS(); -} diff --git a/test/TestManager.cpp b/test/TestManager.cpp index e882421fc..a7e488d11 100644 --- a/test/TestManager.cpp +++ b/test/TestManager.cpp @@ -3,6 +3,7 @@ #include "gtest/gtest.h" #include "kompute/Kompute.hpp" +#include "kompute/logger/Logger.hpp" TEST(TestManager, EndToEndOpMultEvalFlow) { diff --git a/test/TestMultipleAlgoExecutions.cpp b/test/TestMultipleAlgoExecutions.cpp index f554f54fe..f3d7315ba 100644 --- a/test/TestMultipleAlgoExecutions.cpp +++ b/test/TestMultipleAlgoExecutions.cpp @@ -3,8 +3,9 @@ #include "gtest/gtest.h" #include "kompute/Kompute.hpp" +#include "kompute/logger/Logger.hpp" -#include "kompute_test/Shader.hpp" +#include "shaders/Utils.hpp" TEST(TestMultipleAlgoExecutions, TestEndToEndFunctionality) { diff --git a/test/TestOpShadersFromStringAndFile.cpp b/test/TestOpShadersFromStringAndFile.cpp index 7033816e1..c95f2f516 100644 --- a/test/TestOpShadersFromStringAndFile.cpp +++ b/test/TestOpShadersFromStringAndFile.cpp @@ -3,10 +3,37 @@ #include "gtest/gtest.h" #include "kompute/Kompute.hpp" +#include "kompute/logger/Logger.hpp" -#include "kompute_test/shaders/shadertest_op_custom_shader.hpp" +#include "shaders/Utils.hpp" +#include "test_op_custom_shader.hpp" +#include "test_shader.hpp" -#include "kompute_test/Shader.hpp" +TEST(TestShaderEndianness, ShaderRawDataFromConstructor) +{ + std::string shader(R"( + #version 450 + + layout (local_size_x = 1) in; + + layout(set = 0, binding = 0) buffer a { float pa[]; }; + layout(set = 0, binding = 1) buffer b { float pb[]; }; + + void main() { + uint index = gl_GlobalInvocationID.x; + pb[index] = pa[index]; + pa[index] = index; + } + )"); + + std::vector spirv = compileSource(shader); + std::vector spirv2(kp::TEST_SHADER_COMP_SPV.begin(), + kp::TEST_SHADER_COMP_SPV.end()); + EXPECT_EQ(spirv.size(), spirv2.size()); + for (size_t i = 0; i < spirv.size(); i++) { + EXPECT_EQ(spirv[i], spirv2[i]); + } +} TEST(TestOpAlgoCreate, ShaderRawDataFromConstructor) { @@ -50,14 +77,8 @@ TEST(TestOpAlgoCreate, ShaderCompiledDataFromConstructor) std::shared_ptr> tensorA = mgr.tensor({ 3, 4, 5 }); std::shared_ptr> tensorB = mgr.tensor({ 0, 0, 0 }); - std::vector spirv = std::vector( - (uint32_t*) - kp::shader_data::test_shaders_glsl_test_op_custom_shader_comp_spv, - (uint32_t*)(kp::shader_data:: - test_shaders_glsl_test_op_custom_shader_comp_spv + - kp::shader_data:: - test_shaders_glsl_test_op_custom_shader_comp_spv_len)); - + std::vector spirv(kp::TEST_OP_CUSTOM_SHADER_COMP_SPV.begin(), + kp::TEST_OP_CUSTOM_SHADER_COMP_SPV.end()); std::vector> params = { tensorA, tensorB }; mgr.sequence() diff --git a/test/TestOpTensorCopy.cpp b/test/TestOpTensorCopy.cpp index c76db8979..22e8130c7 100644 --- a/test/TestOpTensorCopy.cpp +++ b/test/TestOpTensorCopy.cpp @@ -3,8 +3,9 @@ #include "gtest/gtest.h" #include "kompute/Kompute.hpp" +#include "kompute/logger/Logger.hpp" -#include "kompute_test/Shader.hpp" +#include "shaders/Utils.hpp" TEST(TestOpTensorCopy, CopyDeviceToDeviceTensor) { diff --git a/test/TestOpTensorCreate.cpp b/test/TestOpTensorCreate.cpp index 8ad552e6c..c3508ff89 100644 --- a/test/TestOpTensorCreate.cpp +++ b/test/TestOpTensorCreate.cpp @@ -3,6 +3,7 @@ #include "gtest/gtest.h" #include "kompute/Kompute.hpp" +#include "kompute/logger/Logger.hpp" TEST(TestOpTensorCreate, CreateSingleTensorSingleOp) { diff --git a/test/TestOpTensorSync.cpp b/test/TestOpTensorSync.cpp index 9fecb85f9..b59ee1481 100644 --- a/test/TestOpTensorSync.cpp +++ b/test/TestOpTensorSync.cpp @@ -3,6 +3,7 @@ #include "gtest/gtest.h" #include "kompute/Kompute.hpp" +#include "kompute/logger/Logger.hpp" TEST(TestOpTensorSync, SyncToDeviceMemorySingleTensor) { diff --git a/test/TestPushConstant.cpp b/test/TestPushConstant.cpp index c305f089c..1356425cf 100644 --- a/test/TestPushConstant.cpp +++ b/test/TestPushConstant.cpp @@ -3,10 +3,9 @@ #include "gtest/gtest.h" #include "kompute/Kompute.hpp" +#include "kompute/logger/Logger.hpp" -#include "kompute_test/Shader.hpp" - -#include "fmt/ranges.h" +#include "shaders/Utils.hpp" TEST(TestPushConstants, TestConstantsAlgoDispatchOverride) { diff --git a/test/TestSequence.cpp b/test/TestSequence.cpp index 6e9687562..d99107a96 100644 --- a/test/TestSequence.cpp +++ b/test/TestSequence.cpp @@ -3,8 +3,9 @@ #include "gtest/gtest.h" #include "kompute/Kompute.hpp" +#include "kompute/logger/Logger.hpp" -#include "kompute_test/Shader.hpp" +#include "shaders/Utils.hpp" TEST(TestSequence, SequenceDestructorViaManager) { diff --git a/test/TestSpecializationConstant.cpp b/test/TestSpecializationConstant.cpp index e7bb39266..7f15f8443 100644 --- a/test/TestSpecializationConstant.cpp +++ b/test/TestSpecializationConstant.cpp @@ -3,8 +3,9 @@ #include "gtest/gtest.h" #include "kompute/Kompute.hpp" +#include "kompute/logger/Logger.hpp" -#include "kompute_test/Shader.hpp" +#include "shaders/Utils.hpp" TEST(TestSpecializationConstants, TestTwoConstants) { diff --git a/test/TestTensor.cpp b/test/TestTensor.cpp index e6af04f25..7eeff4af3 100644 --- a/test/TestTensor.cpp +++ b/test/TestTensor.cpp @@ -3,6 +3,7 @@ #include "gtest/gtest.h" #include "kompute/Kompute.hpp" +#include "kompute/logger/Logger.hpp" TEST(TestTensor, ConstructorData) { diff --git a/test/TestWorkgroup.cpp b/test/TestWorkgroup.cpp index 164166ee3..914ee721e 100644 --- a/test/TestWorkgroup.cpp +++ b/test/TestWorkgroup.cpp @@ -3,8 +3,9 @@ #include "gtest/gtest.h" #include "kompute/Kompute.hpp" +#include "kompute/logger/Logger.hpp" -#include "kompute_test/shaders/shadertest_workgroup.hpp" +#include "test_workgroup_shader.hpp" TEST(TestWorkgroup, TestSimpleWorkgroup) { @@ -21,14 +22,9 @@ TEST(TestWorkgroup, TestSimpleWorkgroup) std::vector> params = { tensorA, tensorB }; - std::vector spirv( - (uint32_t*) - kp::shader_data::test_shaders_glsl_test_workgroup_comp_spv, - (uint32_t*)(kp::shader_data:: - test_shaders_glsl_test_workgroup_comp_spv + - kp::shader_data:: - test_shaders_glsl_test_workgroup_comp_spv_len)); + kp::TEST_WORKGROUP_SHADER_COMP_SPV.begin(), + kp::TEST_WORKGROUP_SHADER_COMP_SPV.end()); kp::Workgroup workgroup = { 16, 8, 1 }; diff --git a/test/shaders/CMakeLists.txt b/test/shaders/CMakeLists.txt new file mode 100644 index 000000000..9b134bac9 --- /dev/null +++ b/test/shaders/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 +# ###################### +cmake_minimum_required(VERSION 3.20) + +add_library(test_shaders "Utils.cpp" + "Utils.hpp") + +add_subdirectory(glsl) \ No newline at end of file diff --git a/test/utils/kompute_test/Shader.hpp b/test/shaders/Utils.cpp similarity index 51% rename from test/utils/kompute_test/Shader.hpp rename to test/shaders/Utils.cpp index 33f81f122..85a38b568 100644 --- a/test/utils/kompute_test/Shader.hpp +++ b/test/shaders/Utils.cpp @@ -1,21 +1,13 @@ // SPDX-License-Identifier: Apache-2.0 -#pragma once - +#include "Utils.hpp" +#include #include #include +#include #include -/** - * Compile a single glslang source from string value. This is only meant - * to be used for testing as it's non threadsafe, and it had to be removed - * from the glslang dependency and now can only run the CLI directly due to - * license issues: see https://github.com/KomputeProject/kompute/pull/235 - * - * @param source An individual raw glsl shader in string format - * @return The compiled SPIR-V binary in unsigned int32 format - */ -static std::vector +std::vector compileSource(const std::string& source) { std::ofstream fileOut("tmp_kp_shader.comp"); @@ -24,12 +16,13 @@ compileSource(const std::string& source) if (system( std::string( "glslangValidator -V tmp_kp_shader.comp -o tmp_kp_shader.comp.spv") - .c_str())) + .c_str())) { throw std::runtime_error("Error running glslangValidator command"); + } std::ifstream fileStream("tmp_kp_shader.comp.spv", std::ios::binary); std::vector buffer; buffer.insert( buffer.begin(), std::istreambuf_iterator(fileStream), {}); - return { (uint32_t*)buffer.data(), - (uint32_t*)(buffer.data() + buffer.size()) }; + return { reinterpret_cast(buffer.data()), + reinterpret_cast(buffer.data() + buffer.size()) }; } diff --git a/test/shaders/Utils.hpp b/test/shaders/Utils.hpp new file mode 100644 index 000000000..fa8aa9729 --- /dev/null +++ b/test/shaders/Utils.hpp @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include +#include +#include + +/** + * Compile a single glslang source from string value. This is only meant + * to be used for testing as it's non threadsafe, and it had to be removed + * from the glslang dependency and now can only run the CLI directly due to + * license issues: see https://github.com/KomputeProject/kompute/pull/235 + * + * @param source An individual raw glsl shader in string format + * @return The compiled SPIR-V binary in unsigned int32 format + */ +std::vector +compileSource(const std::string& source); diff --git a/test/shaders/glsl/CMakeLists.txt b/test/shaders/glsl/CMakeLists.txt new file mode 100644 index 000000000..c8c3cba9a --- /dev/null +++ b/test/shaders/glsl/CMakeLists.txt @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: Apache-2.0 +# ###################### +cmake_minimum_required(VERSION 3.20) + +vulkan_compile_shader(INFILE test_logistic_regression_shader.comp + OUTFILE test_logistic_regression_shader.hpp + NAMESPACE "kp") + +vulkan_compile_shader(INFILE test_op_custom_shader.comp + OUTFILE test_op_custom_shader.hpp + NAMESPACE "kp") + +vulkan_compile_shader(INFILE test_workgroup_shader.comp + OUTFILE test_workgroup_shader.hpp + NAMESPACE "kp") + +vulkan_compile_shader(INFILE test_shader.comp + OUTFILE test_shader.hpp + NAMESPACE "kp") + +add_library(test_shaders_glsl INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/test_logistic_regression_shader.hpp" + "${CMAKE_CURRENT_BINARY_DIR}/test_op_custom_shader.hpp" + "${CMAKE_CURRENT_BINARY_DIR}/test_workgroup_shader.hpp" + "${CMAKE_CURRENT_BINARY_DIR}/test_shader.hpp") + +target_include_directories(test_shaders_glsl INTERFACE $) diff --git a/test/shaders/glsl/test_logistic_regression.comp.spv b/test/shaders/glsl/test_logistic_regression.comp.spv deleted file mode 100755 index 2f6883dac..000000000 Binary files a/test/shaders/glsl/test_logistic_regression.comp.spv and /dev/null differ diff --git a/test/shaders/glsl/test_logistic_regression.comp b/test/shaders/glsl/test_logistic_regression_shader.comp similarity index 100% rename from test/shaders/glsl/test_logistic_regression.comp rename to test/shaders/glsl/test_logistic_regression_shader.comp diff --git a/test/shaders/glsl/test_op_custom_shader.comp.spv b/test/shaders/glsl/test_op_custom_shader.comp.spv deleted file mode 100755 index 1c1a83c30..000000000 Binary files a/test/shaders/glsl/test_op_custom_shader.comp.spv and /dev/null differ diff --git a/test/shaders/glsl/test_shader.comp b/test/shaders/glsl/test_shader.comp new file mode 100644 index 000000000..fb4a7ab62 --- /dev/null +++ b/test/shaders/glsl/test_shader.comp @@ -0,0 +1,12 @@ +#version 450 + +layout (local_size_x = 1) in; + +layout(set = 0, binding = 0) buffer a { float pa[]; }; +layout(set = 0, binding = 1) buffer b { float pb[]; }; + +void main() { + uint index = gl_GlobalInvocationID.x; + pb[index] = pa[index]; + pa[index] = index; +} \ No newline at end of file diff --git a/test/shaders/glsl/test_workgroup.comp.spv b/test/shaders/glsl/test_workgroup.comp.spv deleted file mode 100755 index 533d994fe..000000000 Binary files a/test/shaders/glsl/test_workgroup.comp.spv and /dev/null differ diff --git a/test/shaders/glsl/test_workgroup.comp b/test/shaders/glsl/test_workgroup_shader.comp similarity index 100% rename from test/shaders/glsl/test_workgroup.comp rename to test/shaders/glsl/test_workgroup_shader.comp diff --git a/vk_ndk_wrapper_include/kompute_vk_ndk_wrapper.cpp b/vk_ndk_wrapper_include/kompute_vk_ndk_wrapper.cpp deleted file mode 100755 index e5a71e5dd..000000000 --- a/vk_ndk_wrapper_include/kompute_vk_ndk_wrapper.cpp +++ /dev/null @@ -1,798 +0,0 @@ -/* - * Copyright 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// This file is generated. -#ifdef __cplusplus -extern "C" { -#endif - -#include "kompute_vk_ndk_wrapper.hpp" -#include - -PFN_vkCmdBuildAccelerationStructureNV vkCmdBuildAccelerationStructureNV; -PFN_vkCmdCopyAccelerationStructureNV vkCmdCopyAccelerationStructureNV; -PFN_vkCmdTraceRaysNV vkCmdTraceRaysNV; -PFN_vkCmdWriteAccelerationStructuresPropertiesNV vkCmdWriteAccelerationStructuresPropertiesNV; -PFN_vkBindAccelerationStructureMemoryNV vkBindAccelerationStructureMemoryNV; -PFN_vkCompileDeferredNV vkCompileDeferredNV; -PFN_vkCreateRayTracingPipelinesNV vkCreateRayTracingPipelinesNV; -PFN_vkDestroyAccelerationStructureNV vkDestroyAccelerationStructureNV; -PFN_vkGetAccelerationStructureHandleNV vkGetAccelerationStructureHandleNV; -PFN_vkGetAccelerationStructureMemoryRequirementsNV vkGetAccelerationStructureMemoryRequirementsNV; -PFN_vkGetRayTracingShaderGroupHandlesNV vkGetRayTracingShaderGroupHandlesNV; - -#ifdef VK_USE_PLATFORM_ANDROID_KHR -PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR; -#endif - -#ifdef VK_USE_PLATFORM_ANDROID_KHR -PFN_vkGetAndroidHardwareBufferPropertiesANDROID vkGetAndroidHardwareBufferPropertiesANDROID; -PFN_vkGetMemoryAndroidHardwareBufferANDROID vkGetMemoryAndroidHardwareBufferANDROID; -#endif - - -int InitVulkan(void) { - void* libvulkan = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL); - if (!libvulkan) return 0; - - // Vulkan supported, set function addresses - vkCreateInstance = reinterpret_cast(dlsym(libvulkan, "vkCreateInstance")); - vkDestroyInstance = reinterpret_cast(dlsym(libvulkan, "vkDestroyInstance")); - vkEnumeratePhysicalDevices = reinterpret_cast(dlsym(libvulkan, "vkEnumeratePhysicalDevices")); - vkGetPhysicalDeviceFeatures = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceFeatures")); - vkGetPhysicalDeviceFormatProperties = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceFormatProperties")); - vkGetPhysicalDeviceImageFormatProperties = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceImageFormatProperties")); - vkGetPhysicalDeviceProperties = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceProperties")); - vkGetPhysicalDeviceQueueFamilyProperties = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceQueueFamilyProperties")); - vkGetPhysicalDeviceMemoryProperties = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceMemoryProperties")); - vkGetInstanceProcAddr = reinterpret_cast(dlsym(libvulkan, "vkGetInstanceProcAddr")); - vkGetDeviceProcAddr = reinterpret_cast(dlsym(libvulkan, "vkGetDeviceProcAddr")); - vkCreateDevice = reinterpret_cast(dlsym(libvulkan, "vkCreateDevice")); - vkDestroyDevice = reinterpret_cast(dlsym(libvulkan, "vkDestroyDevice")); - vkEnumerateInstanceExtensionProperties = - reinterpret_cast(dlsym(libvulkan, "vkEnumerateInstanceExtensionProperties")); - vkEnumerateDeviceExtensionProperties = - reinterpret_cast(dlsym(libvulkan, "vkEnumerateDeviceExtensionProperties")); - vkEnumerateInstanceLayerProperties = - reinterpret_cast(dlsym(libvulkan, "vkEnumerateInstanceLayerProperties")); - vkEnumerateDeviceLayerProperties = - reinterpret_cast(dlsym(libvulkan, "vkEnumerateDeviceLayerProperties")); - vkGetDeviceQueue = reinterpret_cast(dlsym(libvulkan, "vkGetDeviceQueue")); - vkQueueSubmit = reinterpret_cast(dlsym(libvulkan, "vkQueueSubmit")); - vkQueueWaitIdle = reinterpret_cast(dlsym(libvulkan, "vkQueueWaitIdle")); - vkDeviceWaitIdle = reinterpret_cast(dlsym(libvulkan, "vkDeviceWaitIdle")); - vkAllocateMemory = reinterpret_cast(dlsym(libvulkan, "vkAllocateMemory")); - vkFreeMemory = reinterpret_cast(dlsym(libvulkan, "vkFreeMemory")); - vkMapMemory = reinterpret_cast(dlsym(libvulkan, "vkMapMemory")); - vkUnmapMemory = reinterpret_cast(dlsym(libvulkan, "vkUnmapMemory")); - vkFlushMappedMemoryRanges = reinterpret_cast(dlsym(libvulkan, "vkFlushMappedMemoryRanges")); - vkInvalidateMappedMemoryRanges = - reinterpret_cast(dlsym(libvulkan, "vkInvalidateMappedMemoryRanges")); - vkGetDeviceMemoryCommitment = - reinterpret_cast(dlsym(libvulkan, "vkGetDeviceMemoryCommitment")); - vkBindBufferMemory = reinterpret_cast(dlsym(libvulkan, "vkBindBufferMemory")); - vkBindImageMemory = reinterpret_cast(dlsym(libvulkan, "vkBindImageMemory")); - vkGetBufferMemoryRequirements = - reinterpret_cast(dlsym(libvulkan, "vkGetBufferMemoryRequirements")); - vkGetImageMemoryRequirements = - reinterpret_cast(dlsym(libvulkan, "vkGetImageMemoryRequirements")); - vkGetImageSparseMemoryRequirements = - reinterpret_cast(dlsym(libvulkan, "vkGetImageSparseMemoryRequirements")); - vkGetPhysicalDeviceSparseImageFormatProperties = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceSparseImageFormatProperties")); - vkQueueBindSparse = reinterpret_cast(dlsym(libvulkan, "vkQueueBindSparse")); - vkCreateFence = reinterpret_cast(dlsym(libvulkan, "vkCreateFence")); - vkDestroyFence = reinterpret_cast(dlsym(libvulkan, "vkDestroyFence")); - vkResetFences = reinterpret_cast(dlsym(libvulkan, "vkResetFences")); - vkGetFenceStatus = reinterpret_cast(dlsym(libvulkan, "vkGetFenceStatus")); - vkWaitForFences = reinterpret_cast(dlsym(libvulkan, "vkWaitForFences")); - vkCreateSemaphore = reinterpret_cast(dlsym(libvulkan, "vkCreateSemaphore")); - vkDestroySemaphore = reinterpret_cast(dlsym(libvulkan, "vkDestroySemaphore")); - vkCreateEvent = reinterpret_cast(dlsym(libvulkan, "vkCreateEvent")); - vkDestroyEvent = reinterpret_cast(dlsym(libvulkan, "vkDestroyEvent")); - vkGetEventStatus = reinterpret_cast(dlsym(libvulkan, "vkGetEventStatus")); - vkSetEvent = reinterpret_cast(dlsym(libvulkan, "vkSetEvent")); - vkResetEvent = reinterpret_cast(dlsym(libvulkan, "vkResetEvent")); - vkCreateQueryPool = reinterpret_cast(dlsym(libvulkan, "vkCreateQueryPool")); - vkDestroyQueryPool = reinterpret_cast(dlsym(libvulkan, "vkDestroyQueryPool")); - vkGetQueryPoolResults = reinterpret_cast(dlsym(libvulkan, "vkGetQueryPoolResults")); - vkCreateBuffer = reinterpret_cast(dlsym(libvulkan, "vkCreateBuffer")); - vkDestroyBuffer = reinterpret_cast(dlsym(libvulkan, "vkDestroyBuffer")); - vkCreateBufferView = reinterpret_cast(dlsym(libvulkan, "vkCreateBufferView")); - vkDestroyBufferView = reinterpret_cast(dlsym(libvulkan, "vkDestroyBufferView")); - vkCreateImage = reinterpret_cast(dlsym(libvulkan, "vkCreateImage")); - vkDestroyImage = reinterpret_cast(dlsym(libvulkan, "vkDestroyImage")); - vkGetImageSubresourceLayout = - reinterpret_cast(dlsym(libvulkan, "vkGetImageSubresourceLayout")); - vkCreateImageView = reinterpret_cast(dlsym(libvulkan, "vkCreateImageView")); - vkDestroyImageView = reinterpret_cast(dlsym(libvulkan, "vkDestroyImageView")); - vkCreateShaderModule = reinterpret_cast(dlsym(libvulkan, "vkCreateShaderModule")); - vkDestroyShaderModule = reinterpret_cast(dlsym(libvulkan, "vkDestroyShaderModule")); - vkCreatePipelineCache = reinterpret_cast(dlsym(libvulkan, "vkCreatePipelineCache")); - vkDestroyPipelineCache = reinterpret_cast(dlsym(libvulkan, "vkDestroyPipelineCache")); - vkGetPipelineCacheData = reinterpret_cast(dlsym(libvulkan, "vkGetPipelineCacheData")); - vkMergePipelineCaches = reinterpret_cast(dlsym(libvulkan, "vkMergePipelineCaches")); - vkCreateGraphicsPipelines = reinterpret_cast(dlsym(libvulkan, "vkCreateGraphicsPipelines")); - vkCreateComputePipelines = reinterpret_cast(dlsym(libvulkan, "vkCreateComputePipelines")); - vkDestroyPipeline = reinterpret_cast(dlsym(libvulkan, "vkDestroyPipeline")); - vkCreatePipelineLayout = reinterpret_cast(dlsym(libvulkan, "vkCreatePipelineLayout")); - vkDestroyPipelineLayout = reinterpret_cast(dlsym(libvulkan, "vkDestroyPipelineLayout")); - vkCreateSampler = reinterpret_cast(dlsym(libvulkan, "vkCreateSampler")); - vkDestroySampler = reinterpret_cast(dlsym(libvulkan, "vkDestroySampler")); - vkCreateDescriptorSetLayout = - reinterpret_cast(dlsym(libvulkan, "vkCreateDescriptorSetLayout")); - vkDestroyDescriptorSetLayout = - reinterpret_cast(dlsym(libvulkan, "vkDestroyDescriptorSetLayout")); - vkCreateDescriptorPool = reinterpret_cast(dlsym(libvulkan, "vkCreateDescriptorPool")); - vkDestroyDescriptorPool = reinterpret_cast(dlsym(libvulkan, "vkDestroyDescriptorPool")); - vkResetDescriptorPool = reinterpret_cast(dlsym(libvulkan, "vkResetDescriptorPool")); - vkAllocateDescriptorSets = reinterpret_cast(dlsym(libvulkan, "vkAllocateDescriptorSets")); - vkFreeDescriptorSets = reinterpret_cast(dlsym(libvulkan, "vkFreeDescriptorSets")); - vkUpdateDescriptorSets = reinterpret_cast(dlsym(libvulkan, "vkUpdateDescriptorSets")); - vkCreateFramebuffer = reinterpret_cast(dlsym(libvulkan, "vkCreateFramebuffer")); - vkDestroyFramebuffer = reinterpret_cast(dlsym(libvulkan, "vkDestroyFramebuffer")); - vkCreateRenderPass = reinterpret_cast(dlsym(libvulkan, "vkCreateRenderPass")); - vkDestroyRenderPass = reinterpret_cast(dlsym(libvulkan, "vkDestroyRenderPass")); - vkGetRenderAreaGranularity = reinterpret_cast(dlsym(libvulkan, "vkGetRenderAreaGranularity")); - vkCreateCommandPool = reinterpret_cast(dlsym(libvulkan, "vkCreateCommandPool")); - vkDestroyCommandPool = reinterpret_cast(dlsym(libvulkan, "vkDestroyCommandPool")); - vkResetCommandPool = reinterpret_cast(dlsym(libvulkan, "vkResetCommandPool")); - vkAllocateCommandBuffers = reinterpret_cast(dlsym(libvulkan, "vkAllocateCommandBuffers")); - vkFreeCommandBuffers = reinterpret_cast(dlsym(libvulkan, "vkFreeCommandBuffers")); - vkBeginCommandBuffer = reinterpret_cast(dlsym(libvulkan, "vkBeginCommandBuffer")); - vkEndCommandBuffer = reinterpret_cast(dlsym(libvulkan, "vkEndCommandBuffer")); - vkResetCommandBuffer = reinterpret_cast(dlsym(libvulkan, "vkResetCommandBuffer")); - vkCmdBindPipeline = reinterpret_cast(dlsym(libvulkan, "vkCmdBindPipeline")); - vkCmdSetViewport = reinterpret_cast(dlsym(libvulkan, "vkCmdSetViewport")); - vkCmdSetScissor = reinterpret_cast(dlsym(libvulkan, "vkCmdSetScissor")); - vkCmdSetLineWidth = reinterpret_cast(dlsym(libvulkan, "vkCmdSetLineWidth")); - vkCmdSetDepthBias = reinterpret_cast(dlsym(libvulkan, "vkCmdSetDepthBias")); - vkCmdSetBlendConstants = reinterpret_cast(dlsym(libvulkan, "vkCmdSetBlendConstants")); - vkCmdSetDepthBounds = reinterpret_cast(dlsym(libvulkan, "vkCmdSetDepthBounds")); - vkCmdSetStencilCompareMask = reinterpret_cast(dlsym(libvulkan, "vkCmdSetStencilCompareMask")); - vkCmdSetStencilWriteMask = reinterpret_cast(dlsym(libvulkan, "vkCmdSetStencilWriteMask")); - vkCmdSetStencilReference = reinterpret_cast(dlsym(libvulkan, "vkCmdSetStencilReference")); - vkCmdBindDescriptorSets = reinterpret_cast(dlsym(libvulkan, "vkCmdBindDescriptorSets")); - vkCmdBindIndexBuffer = reinterpret_cast(dlsym(libvulkan, "vkCmdBindIndexBuffer")); - vkCmdBindVertexBuffers = reinterpret_cast(dlsym(libvulkan, "vkCmdBindVertexBuffers")); - vkCmdDraw = reinterpret_cast(dlsym(libvulkan, "vkCmdDraw")); - vkCmdDrawIndexed = reinterpret_cast(dlsym(libvulkan, "vkCmdDrawIndexed")); - vkCmdDrawIndirect = reinterpret_cast(dlsym(libvulkan, "vkCmdDrawIndirect")); - vkCmdDrawIndexedIndirect = reinterpret_cast(dlsym(libvulkan, "vkCmdDrawIndexedIndirect")); - vkCmdDispatch = reinterpret_cast(dlsym(libvulkan, "vkCmdDispatch")); - vkCmdDispatchIndirect = reinterpret_cast(dlsym(libvulkan, "vkCmdDispatchIndirect")); - vkCmdCopyBuffer = reinterpret_cast(dlsym(libvulkan, "vkCmdCopyBuffer")); - vkCmdCopyImage = reinterpret_cast(dlsym(libvulkan, "vkCmdCopyImage")); - vkCmdBlitImage = reinterpret_cast(dlsym(libvulkan, "vkCmdBlitImage")); - vkCmdCopyBufferToImage = reinterpret_cast(dlsym(libvulkan, "vkCmdCopyBufferToImage")); - vkCmdCopyImageToBuffer = reinterpret_cast(dlsym(libvulkan, "vkCmdCopyImageToBuffer")); - vkCmdUpdateBuffer = reinterpret_cast(dlsym(libvulkan, "vkCmdUpdateBuffer")); - vkCmdFillBuffer = reinterpret_cast(dlsym(libvulkan, "vkCmdFillBuffer")); - vkCmdClearColorImage = reinterpret_cast(dlsym(libvulkan, "vkCmdClearColorImage")); - vkCmdClearDepthStencilImage = - reinterpret_cast(dlsym(libvulkan, "vkCmdClearDepthStencilImage")); - vkCmdClearAttachments = reinterpret_cast(dlsym(libvulkan, "vkCmdClearAttachments")); - vkCmdResolveImage = reinterpret_cast(dlsym(libvulkan, "vkCmdResolveImage")); - vkCmdSetEvent = reinterpret_cast(dlsym(libvulkan, "vkCmdSetEvent")); - vkCmdResetEvent = reinterpret_cast(dlsym(libvulkan, "vkCmdResetEvent")); - vkCmdWaitEvents = reinterpret_cast(dlsym(libvulkan, "vkCmdWaitEvents")); - vkCmdPipelineBarrier = reinterpret_cast(dlsym(libvulkan, "vkCmdPipelineBarrier")); - vkCmdBeginQuery = reinterpret_cast(dlsym(libvulkan, "vkCmdBeginQuery")); - vkCmdEndQuery = reinterpret_cast(dlsym(libvulkan, "vkCmdEndQuery")); - vkCmdResetQueryPool = reinterpret_cast(dlsym(libvulkan, "vkCmdResetQueryPool")); - vkCmdWriteTimestamp = reinterpret_cast(dlsym(libvulkan, "vkCmdWriteTimestamp")); - vkCmdCopyQueryPoolResults = reinterpret_cast(dlsym(libvulkan, "vkCmdCopyQueryPoolResults")); - vkCmdPushConstants = reinterpret_cast(dlsym(libvulkan, "vkCmdPushConstants")); - vkCmdBeginRenderPass = reinterpret_cast(dlsym(libvulkan, "vkCmdBeginRenderPass")); - vkCmdNextSubpass = reinterpret_cast(dlsym(libvulkan, "vkCmdNextSubpass")); - vkCmdEndRenderPass = reinterpret_cast(dlsym(libvulkan, "vkCmdEndRenderPass")); - vkCmdExecuteCommands = reinterpret_cast(dlsym(libvulkan, "vkCmdExecuteCommands")); - vkEnumerateInstanceVersion = reinterpret_cast(dlsym(libvulkan, "vkEnumerateInstanceVersion")); - vkBindBufferMemory2 = reinterpret_cast(dlsym(libvulkan, "vkBindBufferMemory2")); - vkBindImageMemory2 = reinterpret_cast(dlsym(libvulkan, "vkBindImageMemory2")); - vkGetDeviceGroupPeerMemoryFeatures = - reinterpret_cast(dlsym(libvulkan, "vkGetDeviceGroupPeerMemoryFeatures")); - vkCmdSetDeviceMask = reinterpret_cast(dlsym(libvulkan, "vkCmdSetDeviceMask")); - vkCmdDispatchBase = reinterpret_cast(dlsym(libvulkan, "vkCmdDispatchBase")); - vkEnumeratePhysicalDeviceGroups = - reinterpret_cast(dlsym(libvulkan, "vkEnumeratePhysicalDeviceGroups")); - vkGetImageMemoryRequirements2 = - reinterpret_cast(dlsym(libvulkan, "vkGetImageMemoryRequirements2")); - vkGetBufferMemoryRequirements2 = - reinterpret_cast(dlsym(libvulkan, "vkGetBufferMemoryRequirements2")); - vkGetImageSparseMemoryRequirements2 = - reinterpret_cast(dlsym(libvulkan, "vkGetImageSparseMemoryRequirements2")); - vkGetPhysicalDeviceFeatures2 = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceFeatures2")); - vkGetPhysicalDeviceProperties2 = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceProperties2")); - vkGetPhysicalDeviceFormatProperties2 = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceFormatProperties2")); - vkGetPhysicalDeviceImageFormatProperties2 = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceImageFormatProperties2")); - vkGetPhysicalDeviceQueueFamilyProperties2 = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceQueueFamilyProperties2")); - vkGetPhysicalDeviceMemoryProperties2 = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceMemoryProperties2")); - vkGetPhysicalDeviceSparseImageFormatProperties2 = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceSparseImageFormatProperties2")); - vkTrimCommandPool = reinterpret_cast(dlsym(libvulkan, "vkTrimCommandPool")); - vkGetDeviceQueue2 = reinterpret_cast(dlsym(libvulkan, "vkGetDeviceQueue2")); - vkCreateSamplerYcbcrConversion = - reinterpret_cast(dlsym(libvulkan, "vkCreateSamplerYcbcrConversion")); - vkDestroySamplerYcbcrConversion = - reinterpret_cast(dlsym(libvulkan, "vkDestroySamplerYcbcrConversion")); - vkCreateDescriptorUpdateTemplate = - reinterpret_cast(dlsym(libvulkan, "vkCreateDescriptorUpdateTemplate")); - vkDestroyDescriptorUpdateTemplate = - reinterpret_cast(dlsym(libvulkan, "vkDestroyDescriptorUpdateTemplate")); - vkUpdateDescriptorSetWithTemplate = - reinterpret_cast(dlsym(libvulkan, "vkUpdateDescriptorSetWithTemplate")); - vkGetPhysicalDeviceExternalBufferProperties = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceExternalBufferProperties")); - vkGetPhysicalDeviceExternalFenceProperties = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceExternalFenceProperties")); - vkGetPhysicalDeviceExternalSemaphoreProperties = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceExternalSemaphoreProperties")); - vkGetDescriptorSetLayoutSupport = - reinterpret_cast(dlsym(libvulkan, "vkGetDescriptorSetLayoutSupport")); - vkDestroySurfaceKHR = reinterpret_cast(dlsym(libvulkan, "vkDestroySurfaceKHR")); - vkGetPhysicalDeviceSurfaceSupportKHR = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceSurfaceSupportKHR")); - vkGetPhysicalDeviceSurfaceCapabilitiesKHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR")); - vkGetPhysicalDeviceSurfaceFormatsKHR = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceSurfaceFormatsKHR")); - vkGetPhysicalDeviceSurfacePresentModesKHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceSurfacePresentModesKHR")); - vkCreateSwapchainKHR = reinterpret_cast(dlsym(libvulkan, "vkCreateSwapchainKHR")); - vkDestroySwapchainKHR = reinterpret_cast(dlsym(libvulkan, "vkDestroySwapchainKHR")); - vkGetSwapchainImagesKHR = reinterpret_cast(dlsym(libvulkan, "vkGetSwapchainImagesKHR")); - vkAcquireNextImageKHR = reinterpret_cast(dlsym(libvulkan, "vkAcquireNextImageKHR")); - vkQueuePresentKHR = reinterpret_cast(dlsym(libvulkan, "vkQueuePresentKHR")); - vkGetDeviceGroupPresentCapabilitiesKHR = - reinterpret_cast(dlsym(libvulkan, "vkGetDeviceGroupPresentCapabilitiesKHR")); - vkGetDeviceGroupSurfacePresentModesKHR = - reinterpret_cast(dlsym(libvulkan, "vkGetDeviceGroupSurfacePresentModesKHR")); - vkGetPhysicalDevicePresentRectanglesKHR = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDevicePresentRectanglesKHR")); - vkAcquireNextImage2KHR = reinterpret_cast(dlsym(libvulkan, "vkAcquireNextImage2KHR")); - vkGetPhysicalDeviceDisplayPropertiesKHR = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceDisplayPropertiesKHR")); - vkGetPhysicalDeviceDisplayPlanePropertiesKHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR")); - vkGetDisplayPlaneSupportedDisplaysKHR = - reinterpret_cast(dlsym(libvulkan, "vkGetDisplayPlaneSupportedDisplaysKHR")); - vkGetDisplayModePropertiesKHR = - reinterpret_cast(dlsym(libvulkan, "vkGetDisplayModePropertiesKHR")); - vkCreateDisplayModeKHR = reinterpret_cast(dlsym(libvulkan, "vkCreateDisplayModeKHR")); - vkGetDisplayPlaneCapabilitiesKHR = - reinterpret_cast(dlsym(libvulkan, "vkGetDisplayPlaneCapabilitiesKHR")); - vkCreateDisplayPlaneSurfaceKHR = - reinterpret_cast(dlsym(libvulkan, "vkCreateDisplayPlaneSurfaceKHR")); - vkCreateSharedSwapchainsKHR = - reinterpret_cast(dlsym(libvulkan, "vkCreateSharedSwapchainsKHR")); - vkGetPhysicalDeviceFeatures2KHR = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceFeatures2KHR")); - vkGetPhysicalDeviceProperties2KHR = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceProperties2KHR")); - vkGetPhysicalDeviceFormatProperties2KHR = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceFormatProperties2KHR")); - vkGetPhysicalDeviceImageFormatProperties2KHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceImageFormatProperties2KHR")); - vkGetPhysicalDeviceQueueFamilyProperties2KHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceQueueFamilyProperties2KHR")); - vkGetPhysicalDeviceMemoryProperties2KHR = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceMemoryProperties2KHR")); - vkGetPhysicalDeviceSparseImageFormatProperties2KHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceSparseImageFormatProperties2KHR")); - vkGetDeviceGroupPeerMemoryFeaturesKHR = - reinterpret_cast(dlsym(libvulkan, "vkGetDeviceGroupPeerMemoryFeaturesKHR")); - vkCmdSetDeviceMaskKHR = reinterpret_cast(dlsym(libvulkan, "vkCmdSetDeviceMaskKHR")); - vkCmdDispatchBaseKHR = reinterpret_cast(dlsym(libvulkan, "vkCmdDispatchBaseKHR")); - vkTrimCommandPoolKHR = reinterpret_cast(dlsym(libvulkan, "vkTrimCommandPoolKHR")); - vkEnumeratePhysicalDeviceGroupsKHR = - reinterpret_cast(dlsym(libvulkan, "vkEnumeratePhysicalDeviceGroupsKHR")); - vkGetPhysicalDeviceExternalBufferPropertiesKHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceExternalBufferPropertiesKHR")); - vkGetMemoryFdKHR = reinterpret_cast(dlsym(libvulkan, "vkGetMemoryFdKHR")); - vkGetMemoryFdPropertiesKHR = reinterpret_cast(dlsym(libvulkan, "vkGetMemoryFdPropertiesKHR")); - vkGetPhysicalDeviceExternalSemaphorePropertiesKHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR")); - vkImportSemaphoreFdKHR = reinterpret_cast(dlsym(libvulkan, "vkImportSemaphoreFdKHR")); - vkGetSemaphoreFdKHR = reinterpret_cast(dlsym(libvulkan, "vkGetSemaphoreFdKHR")); - vkCmdPushDescriptorSetKHR = reinterpret_cast(dlsym(libvulkan, "vkCmdPushDescriptorSetKHR")); - vkCmdPushDescriptorSetWithTemplateKHR = - reinterpret_cast(dlsym(libvulkan, "vkCmdPushDescriptorSetWithTemplateKHR")); - vkCreateDescriptorUpdateTemplateKHR = - reinterpret_cast(dlsym(libvulkan, "vkCreateDescriptorUpdateTemplateKHR")); - vkDestroyDescriptorUpdateTemplateKHR = - reinterpret_cast(dlsym(libvulkan, "vkDestroyDescriptorUpdateTemplateKHR")); - vkUpdateDescriptorSetWithTemplateKHR = - reinterpret_cast(dlsym(libvulkan, "vkUpdateDescriptorSetWithTemplateKHR")); - vkCreateRenderPass2KHR = reinterpret_cast(dlsym(libvulkan, "vkCreateRenderPass2KHR")); - vkCmdBeginRenderPass2KHR = reinterpret_cast(dlsym(libvulkan, "vkCmdBeginRenderPass2KHR")); - vkCmdNextSubpass2KHR = reinterpret_cast(dlsym(libvulkan, "vkCmdNextSubpass2KHR")); - vkCmdEndRenderPass2KHR = reinterpret_cast(dlsym(libvulkan, "vkCmdEndRenderPass2KHR")); - vkGetSwapchainStatusKHR = reinterpret_cast(dlsym(libvulkan, "vkGetSwapchainStatusKHR")); - vkGetPhysicalDeviceExternalFencePropertiesKHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceExternalFencePropertiesKHR")); - vkImportFenceFdKHR = reinterpret_cast(dlsym(libvulkan, "vkImportFenceFdKHR")); - vkGetFenceFdKHR = reinterpret_cast(dlsym(libvulkan, "vkGetFenceFdKHR")); - vkGetPhysicalDeviceSurfaceCapabilities2KHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceSurfaceCapabilities2KHR")); - vkGetPhysicalDeviceSurfaceFormats2KHR = - reinterpret_cast(dlsym(libvulkan, "vkGetPhysicalDeviceSurfaceFormats2KHR")); - vkGetPhysicalDeviceDisplayProperties2KHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceDisplayProperties2KHR")); - vkGetPhysicalDeviceDisplayPlaneProperties2KHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceDisplayPlaneProperties2KHR")); - vkGetDisplayModeProperties2KHR = - reinterpret_cast(dlsym(libvulkan, "vkGetDisplayModeProperties2KHR")); - vkGetDisplayPlaneCapabilities2KHR = - reinterpret_cast(dlsym(libvulkan, "vkGetDisplayPlaneCapabilities2KHR")); - vkGetImageMemoryRequirements2KHR = - reinterpret_cast(dlsym(libvulkan, "vkGetImageMemoryRequirements2KHR")); - vkGetBufferMemoryRequirements2KHR = - reinterpret_cast(dlsym(libvulkan, "vkGetBufferMemoryRequirements2KHR")); - vkGetImageSparseMemoryRequirements2KHR = - reinterpret_cast(dlsym(libvulkan, "vkGetImageSparseMemoryRequirements2KHR")); - vkCreateSamplerYcbcrConversionKHR = - reinterpret_cast(dlsym(libvulkan, "vkCreateSamplerYcbcrConversionKHR")); - vkDestroySamplerYcbcrConversionKHR = - reinterpret_cast(dlsym(libvulkan, "vkDestroySamplerYcbcrConversionKHR")); - vkBindBufferMemory2KHR = reinterpret_cast(dlsym(libvulkan, "vkBindBufferMemory2KHR")); - vkBindImageMemory2KHR = reinterpret_cast(dlsym(libvulkan, "vkBindImageMemory2KHR")); - vkGetDescriptorSetLayoutSupportKHR = - reinterpret_cast(dlsym(libvulkan, "vkGetDescriptorSetLayoutSupportKHR")); - vkCmdDrawIndirectCountKHR = reinterpret_cast(dlsym(libvulkan, "vkCmdDrawIndirectCountKHR")); - vkCmdDrawIndexedIndirectCountKHR = - reinterpret_cast(dlsym(libvulkan, "vkCmdDrawIndexedIndirectCountKHR")); - -#ifdef VK_USE_PLATFORM_ANDROID_KHR - vkCreateAndroidSurfaceKHR = reinterpret_cast(dlsym(libvulkan, "vkCreateAndroidSurfaceKHR")); -#endif - -#ifdef VK_USE_PLATFORM_WAYLAND_KHR - vkCreateWaylandSurfaceKHR = reinterpret_cast(dlsym(libvulkan, "vkCreateWaylandSurfaceKHR")); - vkGetPhysicalDeviceWaylandPresentationSupportKHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceWaylandPresentationSupportKHR")); -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR - vkCreateWin32SurfaceKHR = reinterpret_cast(dlsym(libvulkan, "vkCreateWin32SurfaceKHR")); - vkGetPhysicalDeviceWin32PresentationSupportKHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceWin32PresentationSupportKHR")); -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR - vkGetMemoryWin32HandleKHR = reinterpret_cast(dlsym(libvulkan, "vkGetMemoryWin32HandleKHR")); - vkGetMemoryWin32HandlePropertiesKHR = - reinterpret_cast(dlsym(libvulkan, "vkGetMemoryWin32HandlePropertiesKHR")); -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR - vkImportSemaphoreWin32HandleKHR = - reinterpret_cast(dlsym(libvulkan, "vkImportSemaphoreWin32HandleKHR")); - vkGetSemaphoreWin32HandleKHR = - reinterpret_cast(dlsym(libvulkan, "vkGetSemaphoreWin32HandleKHR")); -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR - vkImportFenceWin32HandleKHR = - reinterpret_cast(dlsym(libvulkan, "vkImportFenceWin32HandleKHR")); - vkGetFenceWin32HandleKHR = reinterpret_cast(dlsym(libvulkan, "vkGetFenceWin32HandleKHR")); -#endif - -#ifdef VK_USE_PLATFORM_XCB_KHR - vkCreateXcbSurfaceKHR = reinterpret_cast(dlsym(libvulkan, "vkCreateXcbSurfaceKHR")); - vkGetPhysicalDeviceXcbPresentationSupportKHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceXcbPresentationSupportKHR")); -#endif - -#ifdef VK_USE_PLATFORM_XLIB_KHR - vkCreateXlibSurfaceKHR = reinterpret_cast(dlsym(libvulkan, "vkCreateXlibSurfaceKHR")); - vkGetPhysicalDeviceXlibPresentationSupportKHR = reinterpret_cast( - dlsym(libvulkan, "vkGetPhysicalDeviceXlibPresentationSupportKHR")); -#endif - return 1; -} - -// No Vulkan support, do not set function addresses -PFN_vkCreateInstance vkCreateInstance; -PFN_vkDestroyInstance vkDestroyInstance; -PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices; -PFN_vkGetPhysicalDeviceFeatures vkGetPhysicalDeviceFeatures; -PFN_vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceFormatProperties; -PFN_vkGetPhysicalDeviceImageFormatProperties vkGetPhysicalDeviceImageFormatProperties; -PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties; -PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties; -PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties; -PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr; -PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr; -PFN_vkCreateDevice vkCreateDevice; -PFN_vkDestroyDevice vkDestroyDevice; -PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties; -PFN_vkEnumerateDeviceExtensionProperties vkEnumerateDeviceExtensionProperties; -PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties; -PFN_vkEnumerateDeviceLayerProperties vkEnumerateDeviceLayerProperties; -PFN_vkGetDeviceQueue vkGetDeviceQueue; -PFN_vkQueueSubmit vkQueueSubmit; -PFN_vkQueueWaitIdle vkQueueWaitIdle; -PFN_vkDeviceWaitIdle vkDeviceWaitIdle; -PFN_vkAllocateMemory vkAllocateMemory; -PFN_vkFreeMemory vkFreeMemory; -PFN_vkMapMemory vkMapMemory; -PFN_vkUnmapMemory vkUnmapMemory; -PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges; -PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges; -PFN_vkGetDeviceMemoryCommitment vkGetDeviceMemoryCommitment; -PFN_vkBindBufferMemory vkBindBufferMemory; -PFN_vkBindImageMemory vkBindImageMemory; -PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements; -PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements; -PFN_vkGetImageSparseMemoryRequirements vkGetImageSparseMemoryRequirements; -PFN_vkGetPhysicalDeviceSparseImageFormatProperties vkGetPhysicalDeviceSparseImageFormatProperties; -PFN_vkQueueBindSparse vkQueueBindSparse; -PFN_vkCreateFence vkCreateFence; -PFN_vkDestroyFence vkDestroyFence; -PFN_vkResetFences vkResetFences; -PFN_vkGetFenceStatus vkGetFenceStatus; -PFN_vkWaitForFences vkWaitForFences; -PFN_vkCreateSemaphore vkCreateSemaphore; -PFN_vkDestroySemaphore vkDestroySemaphore; -PFN_vkCreateEvent vkCreateEvent; -PFN_vkDestroyEvent vkDestroyEvent; -PFN_vkGetEventStatus vkGetEventStatus; -PFN_vkSetEvent vkSetEvent; -PFN_vkResetEvent vkResetEvent; -PFN_vkCreateQueryPool vkCreateQueryPool; -PFN_vkDestroyQueryPool vkDestroyQueryPool; -PFN_vkGetQueryPoolResults vkGetQueryPoolResults; -PFN_vkCreateBuffer vkCreateBuffer; -PFN_vkDestroyBuffer vkDestroyBuffer; -PFN_vkCreateBufferView vkCreateBufferView; -PFN_vkDestroyBufferView vkDestroyBufferView; -PFN_vkCreateImage vkCreateImage; -PFN_vkDestroyImage vkDestroyImage; -PFN_vkGetImageSubresourceLayout vkGetImageSubresourceLayout; -PFN_vkCreateImageView vkCreateImageView; -PFN_vkDestroyImageView vkDestroyImageView; -PFN_vkCreateShaderModule vkCreateShaderModule; -PFN_vkDestroyShaderModule vkDestroyShaderModule; -PFN_vkCreatePipelineCache vkCreatePipelineCache; -PFN_vkDestroyPipelineCache vkDestroyPipelineCache; -PFN_vkGetPipelineCacheData vkGetPipelineCacheData; -PFN_vkMergePipelineCaches vkMergePipelineCaches; -PFN_vkCreateGraphicsPipelines vkCreateGraphicsPipelines; -PFN_vkCreateComputePipelines vkCreateComputePipelines; -PFN_vkDestroyPipeline vkDestroyPipeline; -PFN_vkCreatePipelineLayout vkCreatePipelineLayout; -PFN_vkDestroyPipelineLayout vkDestroyPipelineLayout; -PFN_vkCreateSampler vkCreateSampler; -PFN_vkDestroySampler vkDestroySampler; -PFN_vkCreateDescriptorSetLayout vkCreateDescriptorSetLayout; -PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout; -PFN_vkCreateDescriptorPool vkCreateDescriptorPool; -PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool; -PFN_vkResetDescriptorPool vkResetDescriptorPool; -PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets; -PFN_vkFreeDescriptorSets vkFreeDescriptorSets; -PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets; -PFN_vkCreateFramebuffer vkCreateFramebuffer; -PFN_vkDestroyFramebuffer vkDestroyFramebuffer; -PFN_vkCreateRenderPass vkCreateRenderPass; -PFN_vkDestroyRenderPass vkDestroyRenderPass; -PFN_vkGetRenderAreaGranularity vkGetRenderAreaGranularity; -PFN_vkCreateCommandPool vkCreateCommandPool; -PFN_vkDestroyCommandPool vkDestroyCommandPool; -PFN_vkResetCommandPool vkResetCommandPool; -PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers; -PFN_vkFreeCommandBuffers vkFreeCommandBuffers; -PFN_vkBeginCommandBuffer vkBeginCommandBuffer; -PFN_vkEndCommandBuffer vkEndCommandBuffer; -PFN_vkResetCommandBuffer vkResetCommandBuffer; -PFN_vkCmdBindPipeline vkCmdBindPipeline; -PFN_vkCmdSetViewport vkCmdSetViewport; -PFN_vkCmdSetScissor vkCmdSetScissor; -PFN_vkCmdSetLineWidth vkCmdSetLineWidth; -PFN_vkCmdSetDepthBias vkCmdSetDepthBias; -PFN_vkCmdSetBlendConstants vkCmdSetBlendConstants; -PFN_vkCmdSetDepthBounds vkCmdSetDepthBounds; -PFN_vkCmdSetStencilCompareMask vkCmdSetStencilCompareMask; -PFN_vkCmdSetStencilWriteMask vkCmdSetStencilWriteMask; -PFN_vkCmdSetStencilReference vkCmdSetStencilReference; -PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets; -PFN_vkCmdBindIndexBuffer vkCmdBindIndexBuffer; -PFN_vkCmdBindVertexBuffers vkCmdBindVertexBuffers; -PFN_vkCmdDraw vkCmdDraw; -PFN_vkCmdDrawIndexed vkCmdDrawIndexed; -PFN_vkCmdDrawIndirect vkCmdDrawIndirect; -PFN_vkCmdDrawIndexedIndirect vkCmdDrawIndexedIndirect; -PFN_vkCmdDispatch vkCmdDispatch; -PFN_vkCmdDispatchIndirect vkCmdDispatchIndirect; -PFN_vkCmdCopyBuffer vkCmdCopyBuffer; -PFN_vkCmdCopyImage vkCmdCopyImage; -PFN_vkCmdBlitImage vkCmdBlitImage; -PFN_vkCmdCopyBufferToImage vkCmdCopyBufferToImage; -PFN_vkCmdCopyImageToBuffer vkCmdCopyImageToBuffer; -PFN_vkCmdUpdateBuffer vkCmdUpdateBuffer; -PFN_vkCmdFillBuffer vkCmdFillBuffer; -PFN_vkCmdClearColorImage vkCmdClearColorImage; -PFN_vkCmdClearDepthStencilImage vkCmdClearDepthStencilImage; -PFN_vkCmdClearAttachments vkCmdClearAttachments; -PFN_vkCmdResolveImage vkCmdResolveImage; -PFN_vkCmdSetEvent vkCmdSetEvent; -PFN_vkCmdResetEvent vkCmdResetEvent; -PFN_vkCmdWaitEvents vkCmdWaitEvents; -PFN_vkCmdPipelineBarrier vkCmdPipelineBarrier; -PFN_vkCmdBeginQuery vkCmdBeginQuery; -PFN_vkCmdEndQuery vkCmdEndQuery; -PFN_vkCmdResetQueryPool vkCmdResetQueryPool; -PFN_vkCmdWriteTimestamp vkCmdWriteTimestamp; -PFN_vkCmdCopyQueryPoolResults vkCmdCopyQueryPoolResults; -PFN_vkCmdPushConstants vkCmdPushConstants; -PFN_vkCmdBeginRenderPass vkCmdBeginRenderPass; -PFN_vkCmdNextSubpass vkCmdNextSubpass; -PFN_vkCmdEndRenderPass vkCmdEndRenderPass; -PFN_vkCmdExecuteCommands vkCmdExecuteCommands; -PFN_vkEnumerateInstanceVersion vkEnumerateInstanceVersion; -PFN_vkBindBufferMemory2 vkBindBufferMemory2; -PFN_vkBindImageMemory2 vkBindImageMemory2; -PFN_vkGetDeviceGroupPeerMemoryFeatures vkGetDeviceGroupPeerMemoryFeatures; -PFN_vkCmdSetDeviceMask vkCmdSetDeviceMask; -PFN_vkCmdDispatchBase vkCmdDispatchBase; -PFN_vkEnumeratePhysicalDeviceGroups vkEnumeratePhysicalDeviceGroups; -PFN_vkGetImageMemoryRequirements2 vkGetImageMemoryRequirements2; -PFN_vkGetBufferMemoryRequirements2 vkGetBufferMemoryRequirements2; -PFN_vkGetImageSparseMemoryRequirements2 vkGetImageSparseMemoryRequirements2; -PFN_vkGetPhysicalDeviceFeatures2 vkGetPhysicalDeviceFeatures2; -PFN_vkGetPhysicalDeviceProperties2 vkGetPhysicalDeviceProperties2; -PFN_vkGetPhysicalDeviceFormatProperties2 vkGetPhysicalDeviceFormatProperties2; -PFN_vkGetPhysicalDeviceImageFormatProperties2 vkGetPhysicalDeviceImageFormatProperties2; -PFN_vkGetPhysicalDeviceQueueFamilyProperties2 vkGetPhysicalDeviceQueueFamilyProperties2; -PFN_vkGetPhysicalDeviceMemoryProperties2 vkGetPhysicalDeviceMemoryProperties2; -PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 vkGetPhysicalDeviceSparseImageFormatProperties2; -PFN_vkTrimCommandPool vkTrimCommandPool; -PFN_vkGetDeviceQueue2 vkGetDeviceQueue2; -PFN_vkCreateSamplerYcbcrConversion vkCreateSamplerYcbcrConversion; -PFN_vkDestroySamplerYcbcrConversion vkDestroySamplerYcbcrConversion; -PFN_vkCreateDescriptorUpdateTemplate vkCreateDescriptorUpdateTemplate; -PFN_vkDestroyDescriptorUpdateTemplate vkDestroyDescriptorUpdateTemplate; -PFN_vkUpdateDescriptorSetWithTemplate vkUpdateDescriptorSetWithTemplate; -PFN_vkGetPhysicalDeviceExternalBufferProperties vkGetPhysicalDeviceExternalBufferProperties; -PFN_vkGetPhysicalDeviceExternalFenceProperties vkGetPhysicalDeviceExternalFenceProperties; -PFN_vkGetPhysicalDeviceExternalSemaphoreProperties vkGetPhysicalDeviceExternalSemaphoreProperties; -PFN_vkGetDescriptorSetLayoutSupport vkGetDescriptorSetLayoutSupport; -PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR; -PFN_vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceSupportKHR; -PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR; -PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR; -PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR; -PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR; -PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR; -PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR; -PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR; -PFN_vkQueuePresentKHR vkQueuePresentKHR; -PFN_vkGetDeviceGroupPresentCapabilitiesKHR vkGetDeviceGroupPresentCapabilitiesKHR; -PFN_vkGetDeviceGroupSurfacePresentModesKHR vkGetDeviceGroupSurfacePresentModesKHR; -PFN_vkGetPhysicalDevicePresentRectanglesKHR vkGetPhysicalDevicePresentRectanglesKHR; -PFN_vkAcquireNextImage2KHR vkAcquireNextImage2KHR; -PFN_vkGetPhysicalDeviceDisplayPropertiesKHR vkGetPhysicalDeviceDisplayPropertiesKHR; -PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR vkGetPhysicalDeviceDisplayPlanePropertiesKHR; -PFN_vkGetDisplayPlaneSupportedDisplaysKHR vkGetDisplayPlaneSupportedDisplaysKHR; -PFN_vkGetDisplayModePropertiesKHR vkGetDisplayModePropertiesKHR; -PFN_vkCreateDisplayModeKHR vkCreateDisplayModeKHR; -PFN_vkGetDisplayPlaneCapabilitiesKHR vkGetDisplayPlaneCapabilitiesKHR; -PFN_vkCreateDisplayPlaneSurfaceKHR vkCreateDisplayPlaneSurfaceKHR; -PFN_vkCreateSharedSwapchainsKHR vkCreateSharedSwapchainsKHR; -PFN_vkGetPhysicalDeviceFeatures2KHR vkGetPhysicalDeviceFeatures2KHR; -PFN_vkGetPhysicalDeviceProperties2KHR vkGetPhysicalDeviceProperties2KHR; -PFN_vkGetPhysicalDeviceFormatProperties2KHR vkGetPhysicalDeviceFormatProperties2KHR; -PFN_vkGetPhysicalDeviceImageFormatProperties2KHR vkGetPhysicalDeviceImageFormatProperties2KHR; -PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR vkGetPhysicalDeviceQueueFamilyProperties2KHR; -PFN_vkGetPhysicalDeviceMemoryProperties2KHR vkGetPhysicalDeviceMemoryProperties2KHR; -PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR vkGetPhysicalDeviceSparseImageFormatProperties2KHR; -PFN_vkGetDeviceGroupPeerMemoryFeaturesKHR vkGetDeviceGroupPeerMemoryFeaturesKHR; -PFN_vkCmdSetDeviceMaskKHR vkCmdSetDeviceMaskKHR; -PFN_vkCmdDispatchBaseKHR vkCmdDispatchBaseKHR; -PFN_vkTrimCommandPoolKHR vkTrimCommandPoolKHR; -PFN_vkEnumeratePhysicalDeviceGroupsKHR vkEnumeratePhysicalDeviceGroupsKHR; -PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR vkGetPhysicalDeviceExternalBufferPropertiesKHR; -PFN_vkGetMemoryFdKHR vkGetMemoryFdKHR; -PFN_vkGetMemoryFdPropertiesKHR vkGetMemoryFdPropertiesKHR; -PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR vkGetPhysicalDeviceExternalSemaphorePropertiesKHR; -PFN_vkImportSemaphoreFdKHR vkImportSemaphoreFdKHR; -PFN_vkGetSemaphoreFdKHR vkGetSemaphoreFdKHR; -PFN_vkCmdPushDescriptorSetKHR vkCmdPushDescriptorSetKHR; -PFN_vkCmdPushDescriptorSetWithTemplateKHR vkCmdPushDescriptorSetWithTemplateKHR; -PFN_vkCreateDescriptorUpdateTemplateKHR vkCreateDescriptorUpdateTemplateKHR; -PFN_vkDestroyDescriptorUpdateTemplateKHR vkDestroyDescriptorUpdateTemplateKHR; -PFN_vkUpdateDescriptorSetWithTemplateKHR vkUpdateDescriptorSetWithTemplateKHR; -PFN_vkCreateRenderPass2KHR vkCreateRenderPass2KHR; -PFN_vkCmdBeginRenderPass2KHR vkCmdBeginRenderPass2KHR; -PFN_vkCmdNextSubpass2KHR vkCmdNextSubpass2KHR; -PFN_vkCmdEndRenderPass2KHR vkCmdEndRenderPass2KHR; -PFN_vkGetSwapchainStatusKHR vkGetSwapchainStatusKHR; -PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR vkGetPhysicalDeviceExternalFencePropertiesKHR; -PFN_vkImportFenceFdKHR vkImportFenceFdKHR; -PFN_vkGetFenceFdKHR vkGetFenceFdKHR; -PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR vkGetPhysicalDeviceSurfaceCapabilities2KHR; -PFN_vkGetPhysicalDeviceSurfaceFormats2KHR vkGetPhysicalDeviceSurfaceFormats2KHR; -PFN_vkGetPhysicalDeviceDisplayProperties2KHR vkGetPhysicalDeviceDisplayProperties2KHR; -PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR vkGetPhysicalDeviceDisplayPlaneProperties2KHR; -PFN_vkGetDisplayModeProperties2KHR vkGetDisplayModeProperties2KHR; -PFN_vkGetDisplayPlaneCapabilities2KHR vkGetDisplayPlaneCapabilities2KHR; -PFN_vkGetImageMemoryRequirements2KHR vkGetImageMemoryRequirements2KHR; -PFN_vkGetBufferMemoryRequirements2KHR vkGetBufferMemoryRequirements2KHR; -PFN_vkGetImageSparseMemoryRequirements2KHR vkGetImageSparseMemoryRequirements2KHR; -PFN_vkCreateSamplerYcbcrConversionKHR vkCreateSamplerYcbcrConversionKHR; -PFN_vkDestroySamplerYcbcrConversionKHR vkDestroySamplerYcbcrConversionKHR; -PFN_vkBindBufferMemory2KHR vkBindBufferMemory2KHR; -PFN_vkBindImageMemory2KHR vkBindImageMemory2KHR; -PFN_vkGetDescriptorSetLayoutSupportKHR vkGetDescriptorSetLayoutSupportKHR; -PFN_vkCmdDrawIndirectCountKHR vkCmdDrawIndirectCountKHR; -PFN_vkCmdDrawIndexedIndirectCountKHR vkCmdDrawIndexedIndirectCountKHR; -PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT; -PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT; -PFN_vkDebugReportMessageEXT vkDebugReportMessageEXT; -PFN_vkDebugMarkerSetObjectTagEXT vkDebugMarkerSetObjectTagEXT; -PFN_vkDebugMarkerSetObjectNameEXT vkDebugMarkerSetObjectNameEXT; -PFN_vkCmdDebugMarkerBeginEXT vkCmdDebugMarkerBeginEXT; -PFN_vkCmdDebugMarkerEndEXT vkCmdDebugMarkerEndEXT; -PFN_vkCmdDebugMarkerInsertEXT vkCmdDebugMarkerInsertEXT; -PFN_vkCmdBindTransformFeedbackBuffersEXT vkCmdBindTransformFeedbackBuffersEXT; -PFN_vkCmdBeginTransformFeedbackEXT vkCmdBeginTransformFeedbackEXT; -PFN_vkCmdEndTransformFeedbackEXT vkCmdEndTransformFeedbackEXT; -PFN_vkCmdBeginQueryIndexedEXT vkCmdBeginQueryIndexedEXT; -PFN_vkCmdEndQueryIndexedEXT vkCmdEndQueryIndexedEXT; -PFN_vkCmdDrawIndirectByteCountEXT vkCmdDrawIndirectByteCountEXT; -PFN_vkCmdDrawIndirectCountAMD vkCmdDrawIndirectCountAMD; -PFN_vkCmdDrawIndexedIndirectCountAMD vkCmdDrawIndexedIndirectCountAMD; -PFN_vkGetShaderInfoAMD vkGetShaderInfoAMD; -PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV vkGetPhysicalDeviceExternalImageFormatPropertiesNV; -PFN_vkCmdBeginConditionalRenderingEXT vkCmdBeginConditionalRenderingEXT; -PFN_vkCmdEndConditionalRenderingEXT vkCmdEndConditionalRenderingEXT; -PFN_vkCmdProcessCommandsNVX vkCmdProcessCommandsNVX; -PFN_vkCmdReserveSpaceForCommandsNVX vkCmdReserveSpaceForCommandsNVX; -PFN_vkCreateIndirectCommandsLayoutNVX vkCreateIndirectCommandsLayoutNVX; -PFN_vkDestroyIndirectCommandsLayoutNVX vkDestroyIndirectCommandsLayoutNVX; -PFN_vkCreateObjectTableNVX vkCreateObjectTableNVX; -PFN_vkDestroyObjectTableNVX vkDestroyObjectTableNVX; -PFN_vkRegisterObjectsNVX vkRegisterObjectsNVX; -PFN_vkUnregisterObjectsNVX vkUnregisterObjectsNVX; -PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX; -PFN_vkCmdSetViewportWScalingNV vkCmdSetViewportWScalingNV; -PFN_vkReleaseDisplayEXT vkReleaseDisplayEXT; -PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT vkGetPhysicalDeviceSurfaceCapabilities2EXT; -PFN_vkDisplayPowerControlEXT vkDisplayPowerControlEXT; -PFN_vkRegisterDeviceEventEXT vkRegisterDeviceEventEXT; -PFN_vkRegisterDisplayEventEXT vkRegisterDisplayEventEXT; -PFN_vkGetSwapchainCounterEXT vkGetSwapchainCounterEXT; -PFN_vkGetRefreshCycleDurationGOOGLE vkGetRefreshCycleDurationGOOGLE; -PFN_vkGetPastPresentationTimingGOOGLE vkGetPastPresentationTimingGOOGLE; -PFN_vkCmdSetDiscardRectangleEXT vkCmdSetDiscardRectangleEXT; -PFN_vkSetHdrMetadataEXT vkSetHdrMetadataEXT; -PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectNameEXT; -PFN_vkSetDebugUtilsObjectTagEXT vkSetDebugUtilsObjectTagEXT; -PFN_vkQueueBeginDebugUtilsLabelEXT vkQueueBeginDebugUtilsLabelEXT; -PFN_vkQueueEndDebugUtilsLabelEXT vkQueueEndDebugUtilsLabelEXT; -PFN_vkQueueInsertDebugUtilsLabelEXT vkQueueInsertDebugUtilsLabelEXT; -PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT; -PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabelEXT; -PFN_vkCmdInsertDebugUtilsLabelEXT vkCmdInsertDebugUtilsLabelEXT; -PFN_vkCreateDebugUtilsMessengerEXT vkCreateDebugUtilsMessengerEXT; -PFN_vkDestroyDebugUtilsMessengerEXT vkDestroyDebugUtilsMessengerEXT; -PFN_vkSubmitDebugUtilsMessageEXT vkSubmitDebugUtilsMessageEXT; -PFN_vkCmdSetSampleLocationsEXT vkCmdSetSampleLocationsEXT; -PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT vkGetPhysicalDeviceMultisamplePropertiesEXT; -PFN_vkGetImageDrmFormatModifierPropertiesEXT vkGetImageDrmFormatModifierPropertiesEXT; -PFN_vkCreateValidationCacheEXT vkCreateValidationCacheEXT; -PFN_vkDestroyValidationCacheEXT vkDestroyValidationCacheEXT; -PFN_vkMergeValidationCachesEXT vkMergeValidationCachesEXT; -PFN_vkGetValidationCacheDataEXT vkGetValidationCacheDataEXT; -PFN_vkCmdBindShadingRateImageNV vkCmdBindShadingRateImageNV; -PFN_vkCmdSetViewportShadingRatePaletteNV vkCmdSetViewportShadingRatePaletteNV; -PFN_vkCmdSetCoarseSampleOrderNV vkCmdSetCoarseSampleOrderNV; -PFN_vkCreateAccelerationStructureNV vkCreateAccelerationStructureNV; -PFN_vkGetMemoryHostPointerPropertiesEXT vkGetMemoryHostPointerPropertiesEXT; -PFN_vkCmdWriteBufferMarkerAMD vkCmdWriteBufferMarkerAMD; -PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT vkGetPhysicalDeviceCalibrateableTimeDomainsEXT; -PFN_vkGetCalibratedTimestampsEXT vkGetCalibratedTimestampsEXT; -PFN_vkCmdDrawMeshTasksNV vkCmdDrawMeshTasksNV; -PFN_vkCmdDrawMeshTasksIndirectNV vkCmdDrawMeshTasksIndirectNV; -PFN_vkCmdDrawMeshTasksIndirectCountNV vkCmdDrawMeshTasksIndirectCountNV; -PFN_vkCmdSetExclusiveScissorNV vkCmdSetExclusiveScissorNV; -PFN_vkCmdSetCheckpointNV vkCmdSetCheckpointNV; -PFN_vkGetQueueCheckpointDataNV vkGetQueueCheckpointDataNV; - -#ifdef VK_USE_PLATFORM_FUCHSIA -PFN_vkCreateImagePipeSurfaceFUCHSIA vkCreateImagePipeSurfaceFUCHSIA; -#endif - -#ifdef VK_USE_PLATFORM_IOS_MVK -PFN_vkCreateIOSSurfaceMVK vkCreateIOSSurfaceMVK; -#endif - -#ifdef VK_USE_PLATFORM_MACOS_MVK -PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK; -#endif - -#ifdef VK_USE_PLATFORM_VI_NN -PFN_vkCreateViSurfaceNN vkCreateViSurfaceNN; -#endif - -#ifdef VK_USE_PLATFORM_WAYLAND_KHR -PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR; -PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR vkGetPhysicalDeviceWaylandPresentationSupportKHR; -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR -PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR; -PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR vkGetPhysicalDeviceWin32PresentationSupportKHR; -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR -PFN_vkGetMemoryWin32HandleKHR vkGetMemoryWin32HandleKHR; -PFN_vkGetMemoryWin32HandlePropertiesKHR vkGetMemoryWin32HandlePropertiesKHR; -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR -PFN_vkImportSemaphoreWin32HandleKHR vkImportSemaphoreWin32HandleKHR; -PFN_vkGetSemaphoreWin32HandleKHR vkGetSemaphoreWin32HandleKHR; -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR -PFN_vkImportFenceWin32HandleKHR vkImportFenceWin32HandleKHR; -PFN_vkGetFenceWin32HandleKHR vkGetFenceWin32HandleKHR; -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR -PFN_vkGetMemoryWin32HandleNV vkGetMemoryWin32HandleNV; -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR -#endif - -#ifdef VK_USE_PLATFORM_XCB_KHR -PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR; -PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR vkGetPhysicalDeviceXcbPresentationSupportKHR; -#endif - -#ifdef VK_USE_PLATFORM_XLIB_KHR -PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR; -PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR vkGetPhysicalDeviceXlibPresentationSupportKHR; -#endif - -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT -PFN_vkAcquireXlibDisplayEXT vkAcquireXlibDisplayEXT; -PFN_vkGetRandROutputDisplayEXT vkGetRandROutputDisplayEXT; -#endif - -#ifdef __cplusplus -} -#endif diff --git a/vk_ndk_wrapper_include/kompute_vk_ndk_wrapper.hpp b/vk_ndk_wrapper_include/kompute_vk_ndk_wrapper.hpp deleted file mode 100755 index b387bade3..000000000 --- a/vk_ndk_wrapper_include/kompute_vk_ndk_wrapper.hpp +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// This file is generated. -#ifndef VULKAN_WRAPPER_H -#define VULKAN_WRAPPER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define VK_NO_PROTOTYPES 1 -#include -#include - -/* Initialize the Vulkan function pointer variables declared in this header. - * Returns 0 if vulkan is not available, non-zero if it is available. - */ -int InitVulkan(void); - -// VK_core_0 -extern PFN_vkCreateInstance vkCreateInstance; -extern PFN_vkDestroyInstance vkDestroyInstance; -extern PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices; -extern PFN_vkGetPhysicalDeviceFeatures vkGetPhysicalDeviceFeatures; -extern PFN_vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceFormatProperties; -extern PFN_vkGetPhysicalDeviceImageFormatProperties vkGetPhysicalDeviceImageFormatProperties; -extern PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties; -extern PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties; -extern PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties; -extern PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr; -extern PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr; -extern PFN_vkCreateDevice vkCreateDevice; -extern PFN_vkDestroyDevice vkDestroyDevice; -extern PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties; -extern PFN_vkEnumerateDeviceExtensionProperties vkEnumerateDeviceExtensionProperties; -extern PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties; -extern PFN_vkEnumerateDeviceLayerProperties vkEnumerateDeviceLayerProperties; -extern PFN_vkGetDeviceQueue vkGetDeviceQueue; -extern PFN_vkQueueSubmit vkQueueSubmit; -extern PFN_vkQueueWaitIdle vkQueueWaitIdle; -extern PFN_vkDeviceWaitIdle vkDeviceWaitIdle; -extern PFN_vkAllocateMemory vkAllocateMemory; -extern PFN_vkFreeMemory vkFreeMemory; -extern PFN_vkMapMemory vkMapMemory; -extern PFN_vkUnmapMemory vkUnmapMemory; -extern PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges; -extern PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges; -extern PFN_vkGetDeviceMemoryCommitment vkGetDeviceMemoryCommitment; -extern PFN_vkBindBufferMemory vkBindBufferMemory; -extern PFN_vkBindImageMemory vkBindImageMemory; -extern PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements; -extern PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements; -extern PFN_vkGetImageSparseMemoryRequirements vkGetImageSparseMemoryRequirements; -extern PFN_vkGetPhysicalDeviceSparseImageFormatProperties vkGetPhysicalDeviceSparseImageFormatProperties; -extern PFN_vkQueueBindSparse vkQueueBindSparse; -extern PFN_vkCreateFence vkCreateFence; -extern PFN_vkDestroyFence vkDestroyFence; -extern PFN_vkResetFences vkResetFences; -extern PFN_vkGetFenceStatus vkGetFenceStatus; -extern PFN_vkWaitForFences vkWaitForFences; -extern PFN_vkCreateSemaphore vkCreateSemaphore; -extern PFN_vkDestroySemaphore vkDestroySemaphore; -extern PFN_vkCreateEvent vkCreateEvent; -extern PFN_vkDestroyEvent vkDestroyEvent; -extern PFN_vkGetEventStatus vkGetEventStatus; -extern PFN_vkSetEvent vkSetEvent; -extern PFN_vkResetEvent vkResetEvent; -extern PFN_vkCreateQueryPool vkCreateQueryPool; -extern PFN_vkDestroyQueryPool vkDestroyQueryPool; -extern PFN_vkGetQueryPoolResults vkGetQueryPoolResults; -extern PFN_vkCreateBuffer vkCreateBuffer; -extern PFN_vkDestroyBuffer vkDestroyBuffer; -extern PFN_vkCreateBufferView vkCreateBufferView; -extern PFN_vkDestroyBufferView vkDestroyBufferView; -extern PFN_vkCreateImage vkCreateImage; -extern PFN_vkDestroyImage vkDestroyImage; -extern PFN_vkGetImageSubresourceLayout vkGetImageSubresourceLayout; -extern PFN_vkCreateImageView vkCreateImageView; -extern PFN_vkDestroyImageView vkDestroyImageView; -extern PFN_vkCreateShaderModule vkCreateShaderModule; -extern PFN_vkDestroyShaderModule vkDestroyShaderModule; -extern PFN_vkCreatePipelineCache vkCreatePipelineCache; -extern PFN_vkDestroyPipelineCache vkDestroyPipelineCache; -extern PFN_vkGetPipelineCacheData vkGetPipelineCacheData; -extern PFN_vkMergePipelineCaches vkMergePipelineCaches; -extern PFN_vkCreateGraphicsPipelines vkCreateGraphicsPipelines; -extern PFN_vkCreateComputePipelines vkCreateComputePipelines; -extern PFN_vkDestroyPipeline vkDestroyPipeline; -extern PFN_vkCreatePipelineLayout vkCreatePipelineLayout; -extern PFN_vkDestroyPipelineLayout vkDestroyPipelineLayout; -extern PFN_vkCreateSampler vkCreateSampler; -extern PFN_vkDestroySampler vkDestroySampler; -extern PFN_vkCreateDescriptorSetLayout vkCreateDescriptorSetLayout; -extern PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout; -extern PFN_vkCreateDescriptorPool vkCreateDescriptorPool; -extern PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool; -extern PFN_vkResetDescriptorPool vkResetDescriptorPool; -extern PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets; -extern PFN_vkFreeDescriptorSets vkFreeDescriptorSets; -extern PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets; -extern PFN_vkCreateFramebuffer vkCreateFramebuffer; -extern PFN_vkDestroyFramebuffer vkDestroyFramebuffer; -extern PFN_vkCreateRenderPass vkCreateRenderPass; -extern PFN_vkDestroyRenderPass vkDestroyRenderPass; -extern PFN_vkGetRenderAreaGranularity vkGetRenderAreaGranularity; -extern PFN_vkCreateCommandPool vkCreateCommandPool; -extern PFN_vkDestroyCommandPool vkDestroyCommandPool; -extern PFN_vkResetCommandPool vkResetCommandPool; -extern PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers; -extern PFN_vkFreeCommandBuffers vkFreeCommandBuffers; -extern PFN_vkBeginCommandBuffer vkBeginCommandBuffer; -extern PFN_vkEndCommandBuffer vkEndCommandBuffer; -extern PFN_vkResetCommandBuffer vkResetCommandBuffer; -extern PFN_vkCmdBindPipeline vkCmdBindPipeline; -extern PFN_vkCmdSetViewport vkCmdSetViewport; -extern PFN_vkCmdSetScissor vkCmdSetScissor; -extern PFN_vkCmdSetLineWidth vkCmdSetLineWidth; -extern PFN_vkCmdSetDepthBias vkCmdSetDepthBias; -extern PFN_vkCmdSetBlendConstants vkCmdSetBlendConstants; -extern PFN_vkCmdSetDepthBounds vkCmdSetDepthBounds; -extern PFN_vkCmdSetStencilCompareMask vkCmdSetStencilCompareMask; -extern PFN_vkCmdSetStencilWriteMask vkCmdSetStencilWriteMask; -extern PFN_vkCmdSetStencilReference vkCmdSetStencilReference; -extern PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets; -extern PFN_vkCmdBindIndexBuffer vkCmdBindIndexBuffer; -extern PFN_vkCmdBindVertexBuffers vkCmdBindVertexBuffers; -extern PFN_vkCmdDraw vkCmdDraw; -extern PFN_vkCmdDrawIndexed vkCmdDrawIndexed; -extern PFN_vkCmdDrawIndirect vkCmdDrawIndirect; -extern PFN_vkCmdDrawIndexedIndirect vkCmdDrawIndexedIndirect; -extern PFN_vkCmdDispatch vkCmdDispatch; -extern PFN_vkCmdDispatchIndirect vkCmdDispatchIndirect; -extern PFN_vkCmdCopyBuffer vkCmdCopyBuffer; -extern PFN_vkCmdCopyImage vkCmdCopyImage; -extern PFN_vkCmdBlitImage vkCmdBlitImage; -extern PFN_vkCmdCopyBufferToImage vkCmdCopyBufferToImage; -extern PFN_vkCmdCopyImageToBuffer vkCmdCopyImageToBuffer; -extern PFN_vkCmdUpdateBuffer vkCmdUpdateBuffer; -extern PFN_vkCmdFillBuffer vkCmdFillBuffer; -extern PFN_vkCmdClearColorImage vkCmdClearColorImage; -extern PFN_vkCmdClearDepthStencilImage vkCmdClearDepthStencilImage; -extern PFN_vkCmdClearAttachments vkCmdClearAttachments; -extern PFN_vkCmdResolveImage vkCmdResolveImage; -extern PFN_vkCmdSetEvent vkCmdSetEvent; -extern PFN_vkCmdResetEvent vkCmdResetEvent; -extern PFN_vkCmdWaitEvents vkCmdWaitEvents; -extern PFN_vkCmdPipelineBarrier vkCmdPipelineBarrier; -extern PFN_vkCmdBeginQuery vkCmdBeginQuery; -extern PFN_vkCmdEndQuery vkCmdEndQuery; -extern PFN_vkCmdResetQueryPool vkCmdResetQueryPool; -extern PFN_vkCmdWriteTimestamp vkCmdWriteTimestamp; -extern PFN_vkCmdCopyQueryPoolResults vkCmdCopyQueryPoolResults; -extern PFN_vkCmdPushConstants vkCmdPushConstants; -extern PFN_vkCmdBeginRenderPass vkCmdBeginRenderPass; -extern PFN_vkCmdNextSubpass vkCmdNextSubpass; -extern PFN_vkCmdEndRenderPass vkCmdEndRenderPass; -extern PFN_vkCmdExecuteCommands vkCmdExecuteCommands; - -// VK_core_1 -extern PFN_vkEnumerateInstanceVersion vkEnumerateInstanceVersion; -extern PFN_vkBindBufferMemory2 vkBindBufferMemory2; -extern PFN_vkBindImageMemory2 vkBindImageMemory2; -extern PFN_vkGetDeviceGroupPeerMemoryFeatures vkGetDeviceGroupPeerMemoryFeatures; -extern PFN_vkCmdSetDeviceMask vkCmdSetDeviceMask; -extern PFN_vkCmdDispatchBase vkCmdDispatchBase; -extern PFN_vkEnumeratePhysicalDeviceGroups vkEnumeratePhysicalDeviceGroups; -extern PFN_vkGetImageMemoryRequirements2 vkGetImageMemoryRequirements2; -extern PFN_vkGetBufferMemoryRequirements2 vkGetBufferMemoryRequirements2; -extern PFN_vkGetImageSparseMemoryRequirements2 vkGetImageSparseMemoryRequirements2; -extern PFN_vkGetPhysicalDeviceFeatures2 vkGetPhysicalDeviceFeatures2; -extern PFN_vkGetPhysicalDeviceProperties2 vkGetPhysicalDeviceProperties2; -extern PFN_vkGetPhysicalDeviceFormatProperties2 vkGetPhysicalDeviceFormatProperties2; -extern PFN_vkGetPhysicalDeviceImageFormatProperties2 vkGetPhysicalDeviceImageFormatProperties2; -extern PFN_vkGetPhysicalDeviceQueueFamilyProperties2 vkGetPhysicalDeviceQueueFamilyProperties2; -extern PFN_vkGetPhysicalDeviceMemoryProperties2 vkGetPhysicalDeviceMemoryProperties2; -extern PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 vkGetPhysicalDeviceSparseImageFormatProperties2; -extern PFN_vkTrimCommandPool vkTrimCommandPool; -extern PFN_vkGetDeviceQueue2 vkGetDeviceQueue2; -extern PFN_vkCreateSamplerYcbcrConversion vkCreateSamplerYcbcrConversion; -extern PFN_vkDestroySamplerYcbcrConversion vkDestroySamplerYcbcrConversion; -extern PFN_vkCreateDescriptorUpdateTemplate vkCreateDescriptorUpdateTemplate; -extern PFN_vkDestroyDescriptorUpdateTemplate vkDestroyDescriptorUpdateTemplate; -extern PFN_vkUpdateDescriptorSetWithTemplate vkUpdateDescriptorSetWithTemplate; -extern PFN_vkGetPhysicalDeviceExternalBufferProperties vkGetPhysicalDeviceExternalBufferProperties; -extern PFN_vkGetPhysicalDeviceExternalFenceProperties vkGetPhysicalDeviceExternalFenceProperties; -extern PFN_vkGetPhysicalDeviceExternalSemaphoreProperties vkGetPhysicalDeviceExternalSemaphoreProperties; -extern PFN_vkGetDescriptorSetLayoutSupport vkGetDescriptorSetLayoutSupport; - -// VK_KHR_surface -extern PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR; -extern PFN_vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceSupportKHR; -extern PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR; -extern PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR; -extern PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR; - -// VK_KHR_swapchain -extern PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR; -extern PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR; -extern PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR; -extern PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR; -extern PFN_vkQueuePresentKHR vkQueuePresentKHR; -extern PFN_vkGetDeviceGroupPresentCapabilitiesKHR vkGetDeviceGroupPresentCapabilitiesKHR; -extern PFN_vkGetDeviceGroupSurfacePresentModesKHR vkGetDeviceGroupSurfacePresentModesKHR; -extern PFN_vkGetPhysicalDevicePresentRectanglesKHR vkGetPhysicalDevicePresentRectanglesKHR; -extern PFN_vkAcquireNextImage2KHR vkAcquireNextImage2KHR; - -// VK_KHR_display -extern PFN_vkGetPhysicalDeviceDisplayPropertiesKHR vkGetPhysicalDeviceDisplayPropertiesKHR; -extern PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR vkGetPhysicalDeviceDisplayPlanePropertiesKHR; -extern PFN_vkGetDisplayPlaneSupportedDisplaysKHR vkGetDisplayPlaneSupportedDisplaysKHR; -extern PFN_vkGetDisplayModePropertiesKHR vkGetDisplayModePropertiesKHR; -extern PFN_vkCreateDisplayModeKHR vkCreateDisplayModeKHR; -extern PFN_vkGetDisplayPlaneCapabilitiesKHR vkGetDisplayPlaneCapabilitiesKHR; -extern PFN_vkCreateDisplayPlaneSurfaceKHR vkCreateDisplayPlaneSurfaceKHR; - -// VK_KHR_display_swapchain -extern PFN_vkCreateSharedSwapchainsKHR vkCreateSharedSwapchainsKHR; - -// VK_KHR_sampler_mirror_clamp_to_edge - -// VK_KHR_multiview - -// VK_KHR_get_physical_device_properties2 -extern PFN_vkGetPhysicalDeviceFeatures2KHR vkGetPhysicalDeviceFeatures2KHR; -extern PFN_vkGetPhysicalDeviceProperties2KHR vkGetPhysicalDeviceProperties2KHR; -extern PFN_vkGetPhysicalDeviceFormatProperties2KHR vkGetPhysicalDeviceFormatProperties2KHR; -extern PFN_vkGetPhysicalDeviceImageFormatProperties2KHR vkGetPhysicalDeviceImageFormatProperties2KHR; -extern PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR vkGetPhysicalDeviceQueueFamilyProperties2KHR; -extern PFN_vkGetPhysicalDeviceMemoryProperties2KHR vkGetPhysicalDeviceMemoryProperties2KHR; -extern PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR vkGetPhysicalDeviceSparseImageFormatProperties2KHR; - -// VK_KHR_device_group -extern PFN_vkGetDeviceGroupPeerMemoryFeaturesKHR vkGetDeviceGroupPeerMemoryFeaturesKHR; -extern PFN_vkCmdSetDeviceMaskKHR vkCmdSetDeviceMaskKHR; -extern PFN_vkCmdDispatchBaseKHR vkCmdDispatchBaseKHR; - -// VK_KHR_shader_draw_parameters - -// VK_KHR_maintenance1 -extern PFN_vkTrimCommandPoolKHR vkTrimCommandPoolKHR; - -// VK_KHR_device_group_creation -extern PFN_vkEnumeratePhysicalDeviceGroupsKHR vkEnumeratePhysicalDeviceGroupsKHR; - -// VK_KHR_external_memory_capabilities -extern PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR vkGetPhysicalDeviceExternalBufferPropertiesKHR; - -// VK_KHR_external_memory - -// VK_KHR_external_memory_fd -extern PFN_vkGetMemoryFdKHR vkGetMemoryFdKHR; -extern PFN_vkGetMemoryFdPropertiesKHR vkGetMemoryFdPropertiesKHR; - -// VK_KHR_external_semaphore_capabilities -extern PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR vkGetPhysicalDeviceExternalSemaphorePropertiesKHR; - -// VK_KHR_external_semaphore - -// VK_KHR_external_semaphore_fd -extern PFN_vkImportSemaphoreFdKHR vkImportSemaphoreFdKHR; -extern PFN_vkGetSemaphoreFdKHR vkGetSemaphoreFdKHR; - -// VK_KHR_push_descriptor -extern PFN_vkCmdPushDescriptorSetKHR vkCmdPushDescriptorSetKHR; -extern PFN_vkCmdPushDescriptorSetWithTemplateKHR vkCmdPushDescriptorSetWithTemplateKHR; - -// VK_KHR_16bit_storage - -// VK_KHR_incremental_present - -// VK_KHR_descriptor_update_template -extern PFN_vkCreateDescriptorUpdateTemplateKHR vkCreateDescriptorUpdateTemplateKHR; -extern PFN_vkDestroyDescriptorUpdateTemplateKHR vkDestroyDescriptorUpdateTemplateKHR; -extern PFN_vkUpdateDescriptorSetWithTemplateKHR vkUpdateDescriptorSetWithTemplateKHR; - -// VK_KHR_create_renderpass2 -extern PFN_vkCreateRenderPass2KHR vkCreateRenderPass2KHR; -extern PFN_vkCmdBeginRenderPass2KHR vkCmdBeginRenderPass2KHR; -extern PFN_vkCmdNextSubpass2KHR vkCmdNextSubpass2KHR; -extern PFN_vkCmdEndRenderPass2KHR vkCmdEndRenderPass2KHR; - -// VK_KHR_shared_presentable_image -extern PFN_vkGetSwapchainStatusKHR vkGetSwapchainStatusKHR; - -// VK_KHR_external_fence_capabilities -extern PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR vkGetPhysicalDeviceExternalFencePropertiesKHR; - -// VK_KHR_external_fence - -// VK_KHR_external_fence_fd -extern PFN_vkImportFenceFdKHR vkImportFenceFdKHR; -extern PFN_vkGetFenceFdKHR vkGetFenceFdKHR; - -// VK_KHR_maintenance2 - -// VK_KHR_get_surface_capabilities2 -extern PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR vkGetPhysicalDeviceSurfaceCapabilities2KHR; -extern PFN_vkGetPhysicalDeviceSurfaceFormats2KHR vkGetPhysicalDeviceSurfaceFormats2KHR; - -// VK_KHR_variable_pointers - -// VK_KHR_get_display_properties2 -extern PFN_vkGetPhysicalDeviceDisplayProperties2KHR vkGetPhysicalDeviceDisplayProperties2KHR; -extern PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR vkGetPhysicalDeviceDisplayPlaneProperties2KHR; -extern PFN_vkGetDisplayModeProperties2KHR vkGetDisplayModeProperties2KHR; -extern PFN_vkGetDisplayPlaneCapabilities2KHR vkGetDisplayPlaneCapabilities2KHR; - -// VK_KHR_dedicated_allocation - -// VK_KHR_storage_buffer_storage_class - -// VK_KHR_relaxed_block_layout - -// VK_KHR_get_memory_requirements2 -extern PFN_vkGetImageMemoryRequirements2KHR vkGetImageMemoryRequirements2KHR; -extern PFN_vkGetBufferMemoryRequirements2KHR vkGetBufferMemoryRequirements2KHR; -extern PFN_vkGetImageSparseMemoryRequirements2KHR vkGetImageSparseMemoryRequirements2KHR; - -// VK_KHR_image_format_list - -// VK_KHR_sampler_ycbcr_conversion -extern PFN_vkCreateSamplerYcbcrConversionKHR vkCreateSamplerYcbcrConversionKHR; -extern PFN_vkDestroySamplerYcbcrConversionKHR vkDestroySamplerYcbcrConversionKHR; - -// VK_KHR_bind_memory2 -extern PFN_vkBindBufferMemory2KHR vkBindBufferMemory2KHR; -extern PFN_vkBindImageMemory2KHR vkBindImageMemory2KHR; - -// VK_KHR_maintenance3 -extern PFN_vkGetDescriptorSetLayoutSupportKHR vkGetDescriptorSetLayoutSupportKHR; - -// VK_KHR_draw_indirect_count -extern PFN_vkCmdDrawIndirectCountKHR vkCmdDrawIndirectCountKHR; -extern PFN_vkCmdDrawIndexedIndirectCountKHR vkCmdDrawIndexedIndirectCountKHR; - -// VK_KHR_8bit_storage - -// VK_KHR_shader_atomic_int64 - -// VK_KHR_driver_properties - -// VK_KHR_vulkan_memory_model - -#ifdef VK_USE_PLATFORM_ANDROID_KHR -// VK_KHR_android_surface -extern PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR; -#endif - -#ifdef VK_USE_PLATFORM_WAYLAND_KHR -// VK_KHR_wayland_surface -extern PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR; -extern PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR vkGetPhysicalDeviceWaylandPresentationSupportKHR; -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR -// VK_KHR_win32_surface -extern PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR; -extern PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR vkGetPhysicalDeviceWin32PresentationSupportKHR; -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR -// VK_KHR_external_memory_win32 -extern PFN_vkGetMemoryWin32HandleKHR vkGetMemoryWin32HandleKHR; -extern PFN_vkGetMemoryWin32HandlePropertiesKHR vkGetMemoryWin32HandlePropertiesKHR; -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR -// VK_KHR_win32_keyed_mutex -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR -// VK_KHR_external_semaphore_win32 -extern PFN_vkImportSemaphoreWin32HandleKHR vkImportSemaphoreWin32HandleKHR; -extern PFN_vkGetSemaphoreWin32HandleKHR vkGetSemaphoreWin32HandleKHR; -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR -// VK_KHR_external_fence_win32 -extern PFN_vkImportFenceWin32HandleKHR vkImportFenceWin32HandleKHR; -extern PFN_vkGetFenceWin32HandleKHR vkGetFenceWin32HandleKHR; -#endif - -#ifdef VK_USE_PLATFORM_XCB_KHR -// VK_KHR_xcb_surface -extern PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR; -extern PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR vkGetPhysicalDeviceXcbPresentationSupportKHR; -#endif - -#ifdef VK_USE_PLATFORM_XLIB_KHR -// VK_KHR_xlib_surface -extern PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR; -extern PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR vkGetPhysicalDeviceXlibPresentationSupportKHR; -#endif - -#ifdef __cplusplus -} -#endif - - -#endif // VULKAN_WRAPPER_H - diff --git a/vk_ndk_wrapper_include/kompute_vk_ndk_wrapper_patch.hpp b/vk_ndk_wrapper_include/kompute_vk_ndk_wrapper_patch.hpp deleted file mode 100644 index f25f44c2b..000000000 --- a/vk_ndk_wrapper_include/kompute_vk_ndk_wrapper_patch.hpp +++ /dev/null @@ -1,185 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -#pragma once - -/* - * Vulkan API definitions to assist with issues in the `vulkan_wrapper.h/vulkan_wrapper.cpp` - * which ships with the Android NDK 20 when using the `vulkan.hpp` header. - */ - -#define VK_NO_PROTOTYPES 1 -#include - -// Adding references previously in vulkan_wrapper.cpp into here instead for vulkan.hpp -extern PFN_vkCmdBuildAccelerationStructureNV vkCmdBuildAccelerationStructureNV; -extern PFN_vkCmdCopyAccelerationStructureNV vkCmdCopyAccelerationStructureNV; -extern PFN_vkCmdTraceRaysNV vkCmdTraceRaysNV; -extern PFN_vkCmdWriteAccelerationStructuresPropertiesNV vkCmdWriteAccelerationStructuresPropertiesNV; -extern PFN_vkBindAccelerationStructureMemoryNV vkBindAccelerationStructureMemoryNV; -extern PFN_vkCompileDeferredNV vkCompileDeferredNV; -extern PFN_vkCreateRayTracingPipelinesNV vkCreateRayTracingPipelinesNV; -extern PFN_vkDestroyAccelerationStructureNV vkDestroyAccelerationStructureNV; -extern PFN_vkGetAccelerationStructureHandleNV vkGetAccelerationStructureHandleNV; -extern PFN_vkGetAccelerationStructureMemoryRequirementsNV vkGetAccelerationStructureMemoryRequirementsNV; -extern PFN_vkGetRayTracingShaderGroupHandlesNV vkGetRayTracingShaderGroupHandlesNV; - -#ifdef VK_USE_PLATFORM_ANDROID_KHR -extern PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR; -#endif - -#ifdef VK_USE_PLATFORM_ANDROID_KHR -extern PFN_vkGetAndroidHardwareBufferPropertiesANDROID vkGetAndroidHardwareBufferPropertiesANDROID; -extern PFN_vkGetMemoryAndroidHardwareBufferANDROID vkGetMemoryAndroidHardwareBufferANDROID; -#endif - -extern PFN_vkCmdSetLineStippleEXT vkCmdSetLineStippleEXT; -extern PFN_vkCmdSetPerformanceMarkerINTEL vkCmdSetPerformanceMarkerINTEL; -extern PFN_vkCmdSetPerformanceOverrideINTEL vkCmdSetPerformanceOverrideINTEL; -extern PFN_vkCmdSetPerformanceStreamMarkerINTEL vkCmdSetPerformanceStreamMarkerINTEL; -extern PFN_vkAcquirePerformanceConfigurationINTEL vkAcquirePerformanceConfigurationINTEL; -extern PFN_vkGetBufferDeviceAddressEXT vkGetBufferDeviceAddressEXT; -extern PFN_vkGetImageViewHandleNVX vkGetImageViewHandleNVX; -extern PFN_vkGetPerformanceParameterINTEL vkGetPerformanceParameterINTEL; -extern PFN_vkGetPipelineExecutableInternalRepresentationsKHR vkGetPipelineExecutableInternalRepresentationsKHR; -extern PFN_vkGetPipelineExecutablePropertiesKHR vkGetPipelineExecutablePropertiesKHR; -extern PFN_vkGetPipelineExecutableStatisticsKHR vkGetPipelineExecutableStatisticsKHR; -extern PFN_vkInitializePerformanceApiINTEL vkInitializePerformanceApiINTEL; -extern PFN_vkReleasePerformanceConfigurationINTEL vkReleasePerformanceConfigurationINTEL; -extern PFN_vkResetQueryPoolEXT vkResetQueryPoolEXT; -extern PFN_vkSetLocalDimmingAMD vkSetLocalDimmingAMD; -extern PFN_vkUninitializePerformanceApiINTEL vkUninitializePerformanceApiINTEL; -extern PFN_vkCreateHeadlessSurfaceEXT vkCreateHeadlessSurfaceEXT; -extern PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV vkGetPhysicalDeviceCooperativeMatrixPropertiesNV; -extern PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV; -extern PFN_vkQueueSetPerformanceConfigurationINTEL vkQueueSetPerformanceConfigurationINTEL; - -typedef void *PFN_vkBindAccelerationStructureMemoryNVX; -typedef void *PFN_vkCmdBuildAccelerationStructureNVX; -typedef void *PFN_vkCmdCopyAccelerationStructureNVX; -typedef void *PFN_vkBindAccelerationStructureMemoryNVX; -typedef void *PFN_vkCmdBuildAccelerationStructureNVX; -typedef void *PFN_vkCmdCopyAccelerationStructureNVX; -typedef void *PFN_vkBindAccelerationStructureMemoryNVX; -typedef void *PFN_vkCmdTraceRaysNVX; -typedef void *PFN_vkCmdWriteAccelerationStructurePropertiesNVX; -typedef void *PFN_vkCompileDeferredNVX; -typedef void *PFN_vkCreateAccelerationStructureNVX; -typedef void *PFN_vkCreateRaytracingPipelinesNVX; -typedef void *PFN_vkDestroyAccelerationStructureNVX; -typedef void *PFN_vkGetAccelerationStructureHandleNVX; -typedef void *PFN_vkGetAccelerationStructureMemoryRequirementsNVX; -typedef void *PFN_vkGetAccelerationStructureScratchMemoryRequirementsNVX; -typedef void *PFN_vkGetRaytracingShaderHandlesNVX; -typedef void *PFN_vkBindAccelerationStructureMemoryNVX; -typedef void *PFN_vkCmdBuildAccelerationStructureNVX; -typedef void *PFN_vkCmdCopyAccelerationStructureNVX; - - -extern PFN_vkBindAccelerationStructureMemoryNVX vkBindAccelerationStructureMemoryNVX; -extern PFN_vkCmdBeginConditionalRenderingEXT vkCmdBeginConditionalRenderingEXT; -extern PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT; -extern PFN_vkCmdBeginQueryIndexedEXT vkCmdBeginQueryIndexedEXT; -extern PFN_vkCmdBeginTransformFeedbackEXT vkCmdBeginTransformFeedbackEXT; -extern PFN_vkCmdBindShadingRateImageNV vkCmdBindShadingRateImageNV; -extern PFN_vkCmdBindTransformFeedbackBuffersEXT vkCmdBindTransformFeedbackBuffersEXT; -extern PFN_vkCmdBuildAccelerationStructureNVX vkCmdBuildAccelerationStructureNVX; -extern PFN_vkCmdCopyAccelerationStructureNVX vkCmdCopyAccelerationStructureNVX; -extern PFN_vkCmdDebugMarkerBeginEXT vkCmdDebugMarkerBeginEXT; -extern PFN_vkCmdDebugMarkerEndEXT vkCmdDebugMarkerEndEXT; -extern PFN_vkCmdDebugMarkerInsertEXT vkCmdDebugMarkerInsertEXT; -extern PFN_vkCmdDrawIndexedIndirectCountAMD vkCmdDrawIndexedIndirectCountAMD; -extern PFN_vkCmdDrawIndirectByteCountEXT vkCmdDrawIndirectByteCountEXT; -extern PFN_vkCmdDrawIndirectCountAMD vkCmdDrawIndirectCountAMD; -extern PFN_vkCmdDrawMeshTasksIndirectCountNV vkCmdDrawMeshTasksIndirectCountNV; -extern PFN_vkCmdDrawMeshTasksIndirectNV vkCmdDrawMeshTasksIndirectNV; -extern PFN_vkCmdDrawMeshTasksNV vkCmdDrawMeshTasksNV; -extern PFN_vkCmdEndConditionalRenderingEXT vkCmdEndConditionalRenderingEXT; -extern PFN_vkBindAccelerationStructureMemoryNVX vkBindAccelerationStructureMemoryNVX; -extern PFN_vkCmdBeginConditionalRenderingEXT vkCmdBeginConditionalRenderingEXT; -extern PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT; -extern PFN_vkCmdBeginQueryIndexedEXT vkCmdBeginQueryIndexedEXT; -extern PFN_vkCmdBeginTransformFeedbackEXT vkCmdBeginTransformFeedbackEXT; -extern PFN_vkCmdBindShadingRateImageNV vkCmdBindShadingRateImageNV; -extern PFN_vkCmdBindTransformFeedbackBuffersEXT vkCmdBindTransformFeedbackBuffersEXT; -extern PFN_vkCmdBuildAccelerationStructureNVX vkCmdBuildAccelerationStructureNVX; -extern PFN_vkCmdCopyAccelerationStructureNVX vkCmdCopyAccelerationStructureNVX; -extern PFN_vkCmdDebugMarkerBeginEXT vkCmdDebugMarkerBeginEXT; -extern PFN_vkCmdDebugMarkerEndEXT vkCmdDebugMarkerEndEXT; -extern PFN_vkCmdDebugMarkerInsertEXT vkCmdDebugMarkerInsertEXT; -extern PFN_vkCmdDrawIndexedIndirectCountAMD vkCmdDrawIndexedIndirectCountAMD; -extern PFN_vkCmdDrawIndirectByteCountEXT vkCmdDrawIndirectByteCountEXT; -extern PFN_vkCmdDrawIndirectCountAMD vkCmdDrawIndirectCountAMD; -extern PFN_vkCmdDrawMeshTasksIndirectCountNV vkCmdDrawMeshTasksIndirectCountNV; -extern PFN_vkCmdDrawMeshTasksIndirectNV vkCmdDrawMeshTasksIndirectNV; -extern PFN_vkCmdDrawMeshTasksNV vkCmdDrawMeshTasksNV; -extern PFN_vkCmdEndConditionalRenderingEXT vkCmdEndConditionalRenderingEXT; -extern PFN_vkBindAccelerationStructureMemoryNVX vkBindAccelerationStructureMemoryNVX; -extern PFN_vkCmdBeginConditionalRenderingEXT vkCmdBeginConditionalRenderingEXT; -extern PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT; -extern PFN_vkCmdBeginQueryIndexedEXT vkCmdBeginQueryIndexedEXT; -extern PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabelEXT; -extern PFN_vkCmdEndQueryIndexedEXT vkCmdEndQueryIndexedEXT; -extern PFN_vkCmdEndTransformFeedbackEXT vkCmdEndTransformFeedbackEXT; -extern PFN_vkCmdInsertDebugUtilsLabelEXT vkCmdInsertDebugUtilsLabelEXT; -extern PFN_vkCmdProcessCommandsNVX vkCmdProcessCommandsNVX; -extern PFN_vkCmdReserveSpaceForCommandsNVX vkCmdReserveSpaceForCommandsNVX; -extern PFN_vkCmdSetCheckpointNV vkCmdSetCheckpointNV; -extern PFN_vkCmdSetCoarseSampleOrderNV vkCmdSetCoarseSampleOrderNV; -extern PFN_vkCmdSetDiscardRectangleEXT vkCmdSetDiscardRectangleEXT; -extern PFN_vkCmdSetExclusiveScissorNV vkCmdSetExclusiveScissorNV; -extern PFN_vkCmdSetSampleLocationsEXT vkCmdSetSampleLocationsEXT; -extern PFN_vkCmdSetViewportShadingRatePaletteNV vkCmdSetViewportShadingRatePaletteNV; -extern PFN_vkCmdSetViewportWScalingNV vkCmdSetViewportWScalingNV; -extern PFN_vkCmdTraceRaysNVX vkCmdTraceRaysNVX; -extern PFN_vkCmdWriteAccelerationStructurePropertiesNVX vkCmdWriteAccelerationStructurePropertiesNVX; -extern PFN_vkCmdWriteBufferMarkerAMD vkCmdWriteBufferMarkerAMD; -extern PFN_vkCompileDeferredNVX vkCompileDeferredNVX; -extern PFN_vkCreateAccelerationStructureNVX vkCreateAccelerationStructureNVX; -extern PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT; -extern PFN_vkCreateDebugUtilsMessengerEXT vkCreateDebugUtilsMessengerEXT; -extern PFN_vkCreateIndirectCommandsLayoutNVX vkCreateIndirectCommandsLayoutNVX; -extern PFN_vkCreateObjectTableNVX vkCreateObjectTableNVX; -extern PFN_vkCreateRaytracingPipelinesNVX vkCreateRaytracingPipelinesNVX; -extern PFN_vkCreateValidationCacheEXT vkCreateValidationCacheEXT; -extern PFN_vkDebugMarkerSetObjectNameEXT vkDebugMarkerSetObjectNameEXT; -extern PFN_vkDebugMarkerSetObjectTagEXT vkDebugMarkerSetObjectTagEXT; -extern PFN_vkDebugReportMessageEXT vkDebugReportMessageEXT; -extern PFN_vkDestroyAccelerationStructureNVX vkDestroyAccelerationStructureNVX; -extern PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT; -extern PFN_vkDestroyDebugUtilsMessengerEXT vkDestroyDebugUtilsMessengerEXT; -extern PFN_vkDestroyIndirectCommandsLayoutNVX vkDestroyIndirectCommandsLayoutNVX; -extern PFN_vkDestroyObjectTableNVX vkDestroyObjectTableNVX; -extern PFN_vkDestroyValidationCacheEXT vkDestroyValidationCacheEXT; -extern PFN_vkDisplayPowerControlEXT vkDisplayPowerControlEXT; -extern PFN_vkGetAccelerationStructureHandleNVX vkGetAccelerationStructureHandleNVX; -extern PFN_vkGetAccelerationStructureMemoryRequirementsNVX vkGetAccelerationStructureMemoryRequirementsNVX; -extern PFN_vkGetAccelerationStructureScratchMemoryRequirementsNVX vkGetAccelerationStructureScratchMemoryRequirementsNVX; -extern PFN_vkGetCalibratedTimestampsEXT vkGetCalibratedTimestampsEXT; -extern PFN_vkGetImageDrmFormatModifierPropertiesEXT vkGetImageDrmFormatModifierPropertiesEXT; -extern PFN_vkGetMemoryHostPointerPropertiesEXT vkGetMemoryHostPointerPropertiesEXT; -extern PFN_vkGetPastPresentationTimingGOOGLE vkGetPastPresentationTimingGOOGLE; -extern PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT vkGetPhysicalDeviceCalibrateableTimeDomainsEXT; -extern PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV vkGetPhysicalDeviceExternalImageFormatPropertiesNV; -extern PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX; -extern PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT vkGetPhysicalDeviceMultisamplePropertiesEXT; -extern PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT vkGetPhysicalDeviceSurfaceCapabilities2EXT; -extern PFN_vkGetQueueCheckpointDataNV vkGetQueueCheckpointDataNV; -extern PFN_vkGetRaytracingShaderHandlesNVX vkGetRaytracingShaderHandlesNVX; -extern PFN_vkGetRefreshCycleDurationGOOGLE vkGetRefreshCycleDurationGOOGLE; -extern PFN_vkGetShaderInfoAMD vkGetShaderInfoAMD; -extern PFN_vkGetSwapchainCounterEXT vkGetSwapchainCounterEXT; -extern PFN_vkGetValidationCacheDataEXT vkGetValidationCacheDataEXT; -extern PFN_vkMergeValidationCachesEXT vkMergeValidationCachesEXT; -extern PFN_vkQueueBeginDebugUtilsLabelEXT vkQueueBeginDebugUtilsLabelEXT; -extern PFN_vkQueueEndDebugUtilsLabelEXT vkQueueEndDebugUtilsLabelEXT; -extern PFN_vkQueueInsertDebugUtilsLabelEXT vkQueueInsertDebugUtilsLabelEXT; -extern PFN_vkRegisterDeviceEventEXT vkRegisterDeviceEventEXT; -extern PFN_vkRegisterDisplayEventEXT vkRegisterDisplayEventEXT; -extern PFN_vkRegisterObjectsNVX vkRegisterObjectsNVX; -extern PFN_vkReleaseDisplayEXT vkReleaseDisplayEXT; -extern PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectNameEXT; -extern PFN_vkSetDebugUtilsObjectTagEXT vkSetDebugUtilsObjectTagEXT; -extern PFN_vkSetHdrMetadataEXT vkSetHdrMetadataEXT; -extern PFN_vkSubmitDebugUtilsMessageEXT vkSubmitDebugUtilsMessageEXT; -extern PFN_vkUnregisterObjectsNVX vkUnregisterObjectsNVX; -extern PFN_vkCreateAccelerationStructureNV vkCreateAccelerationStructureNV; -