diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b38603..8ba0cd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ string(REPLACE "i686" "ia32" ARCH ${ARCH}) string(REPLACE "i386" "ia32" ARCH ${ARCH}) string(REPLACE "armv7l" "arm" ARCH ${ARCH}) string(REPLACE "arm" "arm" ARCH ${ARCH}) -string(REPLACE "arm64ex" "arm64" ARCH ${ARCH}) +string(REPLACE "arm64x" "arm64" ARCH ${ARCH}) string(REPLACE "aarch64" "arm64" ARCH ${ARCH}) if(DEFINED VARIANT) @@ -58,6 +58,21 @@ include_directories(${CMAKE_JS_INC}) # flags: -fPIC set(CMAKE_POSITION_INDEPENDENT_CODE ON) +# VULKAN_SDK +if (VULKAN_SDK) + set(ENV{VULKAN_SDK} ${VULKAN_SDK}) + find_package(Vulkan REQUIRED) +endif() + +find_program(PATCH patch REQUIRED) + +add_custom_target( + patch ALL + COMMAND ${PATCH} -p1 -n -i ${CMAKE_SOURCE_DIR}/patches/llama.patch + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/llama.cpp + COMMENT "Applying patches" +) + set(LLAMA_STATIC ON CACHE BOOL "Build llama as static library") add_subdirectory("src/llama.cpp") diff --git a/README.md b/README.md index 1599652..9972e2e 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,7 @@ console.log('Result:', text) ## Lib Variants -- [x] `default`: General usage, Supported GPU: Metal (macOS) and Vulkan (Linux-x86_64) -- [x] `opencl`: OpenCL (build with CLBlast), support Windows and Linux-aarch64 +- [x] `default`: General usage, Supported GPU: Metal (macOS) and Vulkan (Linux / Windows) ## License diff --git a/patches/llama.patch b/patches/llama.patch new file mode 100644 index 0000000..1ac4bdd --- /dev/null +++ b/patches/llama.patch @@ -0,0 +1,59 @@ +diff --git a/ggml-vulkan.cpp b/ggml-vulkan.cpp +index 1736ab73..55831936 100644 +--- a/ggml-vulkan.cpp ++++ b/ggml-vulkan.cpp +@@ -25,6 +25,7 @@ + + #define CEIL_DIV(M, N) (((M) + (N)-1) / (N)) + ++#define VK_VENDOR_ID_QUALCOMM 0x5143 + #define VK_VENDOR_ID_AMD 0x1002 + #define VK_VENDOR_ID_APPLE 0x106b + #define VK_VENDOR_ID_INTEL 0x8086 +@@ -1074,19 +1075,21 @@ static void ggml_vk_load_shaders(ggml_backend_vk_context * ctx) { + ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q3_K]->a_m, "matmul_q3_k_f32_aligned_m", matmul_q3_k_f32_aligned_len, matmul_q3_k_f32_aligned_data, "main", 3, 14 * sizeof(uint32_t), m_wg_denoms, warptile_mmq_m, m_align); + ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q3_K]->a_s, "matmul_q3_k_f32_aligned_s", matmul_q3_k_f32_aligned_len, matmul_q3_k_f32_aligned_data, "main", 3, 14 * sizeof(uint32_t), s_wg_denoms, warptile_mmq_s, s_align); + +- ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q4_K]->l, "matmul_q4_k_f32_l", matmul_q4_k_f32_len, matmul_q4_k_f32_data, "main", 3, 14 * sizeof(uint32_t), l_wg_denoms, warptile_mmq_l, l_align); +- ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q4_K]->m, "matmul_q4_k_f32_m", matmul_q4_k_f32_len, matmul_q4_k_f32_data, "main", 3, 14 * sizeof(uint32_t), m_wg_denoms, warptile_mmq_m, m_align); +- ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q4_K]->s, "matmul_q4_k_f32_s", matmul_q4_k_f32_len, matmul_q4_k_f32_data, "main", 3, 14 * sizeof(uint32_t), s_wg_denoms, warptile_mmq_s, s_align); +- ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q4_K]->a_l, "matmul_q4_k_f32_aligned_l", matmul_q4_k_f32_aligned_len, matmul_q4_k_f32_aligned_data, "main", 3, 14 * sizeof(uint32_t), l_wg_denoms, warptile_mmq_l, l_align); +- ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q4_K]->a_m, "matmul_q4_k_f32_aligned_m", matmul_q4_k_f32_aligned_len, matmul_q4_k_f32_aligned_data, "main", 3, 14 * sizeof(uint32_t), m_wg_denoms, warptile_mmq_m, m_align); +- ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q4_K]->a_s, "matmul_q4_k_f32_aligned_s", matmul_q4_k_f32_aligned_len, matmul_q4_k_f32_aligned_data, "main", 3, 14 * sizeof(uint32_t), s_wg_denoms, warptile_mmq_s, s_align); ++ if (device->vendor_id != VK_VENDOR_ID_QUALCOMM) { ++ ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q4_K]->l, "matmul_q4_k_f32_l", matmul_q4_k_f32_len, matmul_q4_k_f32_data, "main", 3, 14 * sizeof(uint32_t), l_wg_denoms, warptile_mmq_l, l_align); ++ ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q4_K]->m, "matmul_q4_k_f32_m", matmul_q4_k_f32_len, matmul_q4_k_f32_data, "main", 3, 14 * sizeof(uint32_t), m_wg_denoms, warptile_mmq_m, m_align); ++ ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q4_K]->s, "matmul_q4_k_f32_s", matmul_q4_k_f32_len, matmul_q4_k_f32_data, "main", 3, 14 * sizeof(uint32_t), s_wg_denoms, warptile_mmq_s, s_align); ++ ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q4_K]->a_l, "matmul_q4_k_f32_aligned_l", matmul_q4_k_f32_aligned_len, matmul_q4_k_f32_aligned_data, "main", 3, 14 * sizeof(uint32_t), l_wg_denoms, warptile_mmq_l, l_align); ++ ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q4_K]->a_m, "matmul_q4_k_f32_aligned_m", matmul_q4_k_f32_aligned_len, matmul_q4_k_f32_aligned_data, "main", 3, 14 * sizeof(uint32_t), m_wg_denoms, warptile_mmq_m, m_align); ++ ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q4_K]->a_s, "matmul_q4_k_f32_aligned_s", matmul_q4_k_f32_aligned_len, matmul_q4_k_f32_aligned_data, "main", 3, 14 * sizeof(uint32_t), s_wg_denoms, warptile_mmq_s, s_align); + +- ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q5_K]->l, "matmul_q5_k_f32_l", matmul_q5_k_f32_len, matmul_q5_k_f32_data, "main", 3, 14 * sizeof(uint32_t), l_wg_denoms, warptile_mmq_l, l_align); +- ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q5_K]->m, "matmul_q5_k_f32_m", matmul_q5_k_f32_len, matmul_q5_k_f32_data, "main", 3, 14 * sizeof(uint32_t), m_wg_denoms, warptile_mmq_m, m_align); +- ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q5_K]->s, "matmul_q5_k_f32_s", matmul_q5_k_f32_len, matmul_q5_k_f32_data, "main", 3, 14 * sizeof(uint32_t), s_wg_denoms, warptile_mmq_s, s_align); +- ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q5_K]->a_l, "matmul_q5_k_f32_aligned_l", matmul_q5_k_f32_aligned_len, matmul_q5_k_f32_aligned_data, "main", 3, 14 * sizeof(uint32_t), l_wg_denoms, warptile_mmq_l, l_align); +- ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q5_K]->a_m, "matmul_q5_k_f32_aligned_m", matmul_q5_k_f32_aligned_len, matmul_q5_k_f32_aligned_data, "main", 3, 14 * sizeof(uint32_t), m_wg_denoms, warptile_mmq_m, m_align); +- ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q5_K]->a_s, "matmul_q5_k_f32_aligned_s", matmul_q5_k_f32_aligned_len, matmul_q5_k_f32_aligned_data, "main", 3, 14 * sizeof(uint32_t), s_wg_denoms, warptile_mmq_s, s_align); ++ ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q5_K]->l, "matmul_q5_k_f32_l", matmul_q5_k_f32_len, matmul_q5_k_f32_data, "main", 3, 14 * sizeof(uint32_t), l_wg_denoms, warptile_mmq_l, l_align); ++ ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q5_K]->m, "matmul_q5_k_f32_m", matmul_q5_k_f32_len, matmul_q5_k_f32_data, "main", 3, 14 * sizeof(uint32_t), m_wg_denoms, warptile_mmq_m, m_align); ++ ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q5_K]->s, "matmul_q5_k_f32_s", matmul_q5_k_f32_len, matmul_q5_k_f32_data, "main", 3, 14 * sizeof(uint32_t), s_wg_denoms, warptile_mmq_s, s_align); ++ ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q5_K]->a_l, "matmul_q5_k_f32_aligned_l", matmul_q5_k_f32_aligned_len, matmul_q5_k_f32_aligned_data, "main", 3, 14 * sizeof(uint32_t), l_wg_denoms, warptile_mmq_l, l_align); ++ ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q5_K]->a_m, "matmul_q5_k_f32_aligned_m", matmul_q5_k_f32_aligned_len, matmul_q5_k_f32_aligned_data, "main", 3, 14 * sizeof(uint32_t), m_wg_denoms, warptile_mmq_m, m_align); ++ ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q5_K]->a_s, "matmul_q5_k_f32_aligned_s", matmul_q5_k_f32_aligned_len, matmul_q5_k_f32_aligned_data, "main", 3, 14 * sizeof(uint32_t), s_wg_denoms, warptile_mmq_s, s_align); ++ } + + ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q6_K]->l, "matmul_q6_k_f32_l", matmul_q6_k_f32_len, matmul_q6_k_f32_data, "main", 3, 14 * sizeof(uint32_t), l_wg_denoms, warptile_mmq_l, l_align); + ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant_mul_mat_mat[GGML_TYPE_Q6_K]->m, "matmul_q6_k_f32_m", matmul_q6_k_f32_len, matmul_q6_k_f32_data, "main", 3, 14 * sizeof(uint32_t), m_wg_denoms, warptile_mmq_m, m_align); +@@ -1208,8 +1211,10 @@ static void ggml_vk_load_shaders(ggml_backend_vk_context * ctx) { + ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant[GGML_TYPE_Q8_0], "dequant_q8_0", dequant_q8_0_len, dequant_q8_0_data, "main", 2, 5 * sizeof(uint32_t), {256 * 16, 1, 1}, {}, 1); + ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant[GGML_TYPE_Q2_K], "dequant_q2_K", dequant_q2_K_len, dequant_q2_K_data, "main", 2, 5 * sizeof(uint32_t), {256 * 64, 1, 1}, {}, 1); + ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant[GGML_TYPE_Q3_K], "dequant_q3_K", dequant_q3_K_len, dequant_q3_K_data, "main", 2, 5 * sizeof(uint32_t), {256 * 64, 1, 1}, {}, 1); +- ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant[GGML_TYPE_Q4_K], "dequant_q4_K", dequant_q4_K_len, dequant_q4_K_data, "main", 2, 5 * sizeof(uint32_t), {256 * 32, 1, 1}, {}, 1); +- ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant[GGML_TYPE_Q5_K], "dequant_q5_K", dequant_q5_K_len, dequant_q5_K_data, "main", 2, 5 * sizeof(uint32_t), {256 * 64, 1, 1}, {}, 1); ++ if (device->vendor_id != VK_VENDOR_ID_QUALCOMM) { ++ ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant[GGML_TYPE_Q4_K], "dequant_q4_K", dequant_q4_K_len, dequant_q4_K_data, "main", 2, 5 * sizeof(uint32_t), {256 * 32, 1, 1}, {}, 1); ++ ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant[GGML_TYPE_Q5_K], "dequant_q5_K", dequant_q5_K_len, dequant_q5_K_data, "main", 2, 5 * sizeof(uint32_t), {256 * 64, 1, 1}, {}, 1); ++ } + ggml_vk_create_pipeline(ctx, ctx->device->pipeline_dequant[GGML_TYPE_Q6_K], "dequant_q6_K", dequant_q6_K_len, dequant_q6_K_data, "main", 2, 5 * sizeof(uint32_t), {256 * 64, 1, 1}, {}, 1); + + // get_rows diff --git a/scripts/build-linux.sh b/scripts/build-linux.sh index 0fe45b1..cbf8f58 100755 --- a/scripts/build-linux.sh +++ b/scripts/build-linux.sh @@ -5,8 +5,5 @@ set -e # General yarn clean && yarn build-native -a x86_64 --CDLLAMA_VULKAN=1 -yarn clean && yarn build-native -a aarch64 --cc aarch64-linux-gnu-gcc --cxx aarch64-linux-gnu-g++ - -# build with CLBlast yarn clean && yarn build-native -a aarch64 --cc aarch64-linux-gnu-gcc --cxx aarch64-linux-gnu-g++ \ - --CDVARIANT=opencl --CDLLAMA_CLBLAST=ON --CDCMAKE_PREFIX_PATH="$(realpath 'externals/SDK/lib/cmake/CLBlast')" + --CDLLAMA_VULKAN=1 --CDVULKAN_SDK="$(realpath 'externals/arm64-Vulkan-SDK')" diff --git a/scripts/build-windows.ps1 b/scripts/build-windows.ps1 index c68d858..ecd13f1 100644 --- a/scripts/build-windows.ps1 +++ b/scripts/build-windows.ps1 @@ -2,12 +2,5 @@ $ErrorActionPreference='Stop' # General -yarn clean ; yarn build-native -a x86_64 -yarn clean ; yarn build-native -a arm64 - -# build with CLBlast -$X64_CLBlast=Resolve-Path 'externals/win32-x64/SDK/lib/cmake/CLBlast' -$ARM64_CLBlast=Resolve-Path 'externals/win32-arm64/SDK/lib/cmake/CLBlast' - -yarn clean ; yarn build-native -a x86_64 --CDVARIANT=opencl --CDLLAMA_CLBLAST=ON --CDCMAKE_PREFIX_PATH=$X64_CLBlast -yarn clean ; yarn build-native -a arm64 --CDVARIANT=opencl --CDLLAMA_CLBLAST=ON --CDCMAKE_PREFIX_PATH=$ARM64_CLBlast +yarn clean ; yarn build-native -a x86_64 --CDCMAKE_PREFIX_PATH=(Resolve-Path 'externals/win32-x64/Vulkan-SDK') +yarn clean ; yarn build-native -a arm64 --CDCMAKE_PREFIX_PATH=(Resolve-Path 'externals/win32-arm64/Vulkan-SDK') diff --git a/scripts/prepare-linux.sh b/scripts/prepare-linux.sh index fb122ee..cb7d2d5 100755 --- a/scripts/prepare-linux.sh +++ b/scripts/prepare-linux.sh @@ -33,20 +33,36 @@ if [ ! -d CLBlast-source ]; then cd .. fi -SDK_ROOT=$(realpath ./SDK) +# build Vulkan SDK from source for arm64 -if [ ! -d SDK ]; then - # build from source - export CC=aarch64-linux-gnu-gcc - export CXX=aarch64-linux-gnu-g++ - cd OpenCL-SDK-source - rm -rf build - cmake -B build -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DOPENCL_SDK_BUILD_SAMPLES=OFF -DOPENCL_SDK_TEST_SAMPLES=OFF -DCMAKE_INSTALL_PREFIX=$SDK_ROOT - cmake --build build --config Release - cmake --install build - cd ../CLBlast-source - rm -rf build - cmake -B build -DBUILD_SHARED_LIBS=ON -DOVERRIDE_MSVC_FLAGS_TO_MT=OFF -DTUNERS=OFF -DOPENCL_ROOT="$SDK_ROOT" -DCMAKE_INSTALL_PREFIX=$SDK_ROOT - cmake --build build --config Release - cmake --install build +if [ ! -d arm64-Vulkan-SDK ]; then + VULKAN_ROOT=$(realpath ./arm64-Vulkan-SDK) + if [ ! -d Vulkan-Headers-source ]; then + git clone "https://github.com/KhronosGroup/Vulkan-Headers.git" "Vulkan-Headers-source" + cd "Vulkan-Headers-source" + git checkout "sdk-1.3.261" + CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ cmake -B build + cmake --build build --config Release + cmake --install build --prefix $VULKAN_ROOT + cd .. + fi + if [ ! -d Vulkan-Loader-source ]; then + git clone "https://github.com/KhronosGroup/Vulkan-Loader.git" "Vulkan-Loader-source" + cd "Vulkan-Loader-source" + git checkout "sdk-1.3.261" + CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ cmake -B build -DVULKAN_HEADERS_INSTALL_DIR="$VULKAN_ROOT" -DUSE_MASM=OFF + cmake --build build --config Release + cmake --install build --prefix $VULKAN_ROOT + cd ".." + fi + if [ ! -d Vulkan-Hpp-source ]; then + git clone "https://github.com/KhronosGroup/Vulkan-Hpp.git" "Vulkan-Hpp-source" + cd "Vulkan-Hpp-source" + git checkout "v1.3.261" + git submodule update --init --recursive + cmake -B build -DVULKAN_HPP_INSTALL=ON -DVULKAN_HPP_RUN_GENERATOR=ON + cmake --build build --config Release + cmake --install build --prefix $VULKAN_ROOT + cd ".." + fi fi diff --git a/scripts/prepare-windows.ps1 b/scripts/prepare-windows.ps1 index 5f6356e..d4dddeb 100644 --- a/scripts/prepare-windows.ps1 +++ b/scripts/prepare-windows.ps1 @@ -11,54 +11,72 @@ New-Item -ItemType Directory -Force -Path "externals" | Out-Null cd "externals" -if (-not (Test-Path "OpenCL-SDK-source")) { - git clone "https://github.com/KhronosGroup/OpenCL-SDK.git" "OpenCL-SDK-source" --recursive - cd "OpenCL-SDK-source" - git checkout v2023.12.14 - cd ".." -} - -if (-not (Test-Path "CLBlast-source")) { - git clone "https://github.com/CNugteren/CLBlast.git" "CLBlast-source" --recursive - cd "CLBlast-source" - git checkout 1.6.2 - cd ".." +if (-not (Test-Path "win32-x64/Vulkan-SDK") -or -not (Test-Path "win32-arm64/Vulkan-SDK")) { + if (-not (Test-Path "Vulkan-Headers-source")) { + git clone "https://github.com/KhronosGroup/Vulkan-Headers.git" "Vulkan-Headers-source" + cd "Vulkan-Headers-source" + git checkout sdk-1.3.261 + cd ".." + } + if (-not (Test-Path "Vulkan-Loader-source")) { + git clone "https://github.com/KhronosGroup/Vulkan-Loader.git" "Vulkan-Loader-source" + cd "Vulkan-Loader-source" + git checkout sdk-1.3.261 + cd ".." + } + if (-not (Test-Path "Vulkan-Hpp-source")) { + git clone "https://github.com/KhronosGroup/Vulkan-Hpp.git" "Vulkan-Hpp-source" + cd "Vulkan-Hpp-source" + git checkout v1.3.261 + git submodule update --init --recursive + cd ".." + } } # x64 -if (-not (Test-Path "win32-x64/SDK")) { - New-Item -ItemType Directory -Force -Path "win32-x64/SDK" | Out-Null - $SDK_ROOT = (Resolve-Path "win32-x64/SDK").Path +if (-not (Test-Path "win32-x64/Vulkan-SDK") { + New-Item -ItemType Directory -Force -Path "win32-x64/Vulkan-SDK" | Out-Null + $VULKAN_ROOT = (Resolve-Path "win32-x64/Vulkan-SDK").Path # build from source - cd "OpenCL-SDK-source" + cd "Vulkan-Headers-source" + DelIfExist "build" + cmake -B build -G "Visual Studio 17 2022" -A x64 + cmake --build build --config Release + cmake --install build --prefix $VULKAN_ROOT + cd "../Vulkan-Loader-source" DelIfExist "build" - cmake -B build -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DOPENCL_SDK_BUILD_SAMPLES=OFF -DOPENCL_SDK_TEST_SAMPLES=OFF -G "Visual Studio 17 2022" + cmake -B build -G "Visual Studio 17 2022" -DVULKAN_HEADERS_INSTALL_DIR="$VULKAN_ROOT" -DUSE_MASM=OFF -A x64 cmake --build build --config Release - cmake --install build --prefix $SDK_ROOT - cd "../CLBlast-source" + cmake --install build --prefix $VULKAN_ROOT + cd "../Vulkan-Hpp-source" DelIfExist "build" - cmake -B build -DBUILD_SHARED_LIBS=ON -DOVERRIDE_MSVC_FLAGS_TO_MT=OFF -DTUNERS=OFF -DOPENCL_ROOT="$SDK_ROOT" -G "Visual Studio 17 2022" + cmake -B build -G "Visual Studio 17 2022" -DVULKAN_HPP_INSTALL=ON -DVULKAN_HPP_RUN_GENERATOR=ON cmake --build build --config Release - cmake --install build --prefix $SDK_ROOT + cmake --install build --prefix $VULKAN_ROOT cd ".." } # ARM64 -if (-not (Test-Path "win32-arm64/SDK")) { - New-Item -ItemType Directory -Force -Path "win32-arm64/SDK" | Out-Null - $SDK_ROOT = (Resolve-Path "win32-arm64/SDK").Path +if (-not (Test-Path "win32-arm64/Vulkan-SDK")) { + New-Item -ItemType Directory -Force -Path "win32-arm64/Vulkan-SDK" | Out-Null + $VULKAN_ROOT = (Resolve-Path "win32-arm64/Vulkan-SDK").Path # build from source - cd "OpenCL-SDK-source" + cd "Vulkan-Headers-source" + DelIfExist "build" + cmake -B build -G "Visual Studio 17 2022" -A arm64 + cmake --build build --config Release + cmake --install build --prefix $VULKAN_ROOT + cd "../Vulkan-Loader-source" DelIfExist "build" - cmake -B build -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DOPENCL_SDK_BUILD_SAMPLES=OFF -DOPENCL_SDK_TEST_SAMPLES=OFF -G "Visual Studio 17 2022" -A arm64 + cmake -B build -G "Visual Studio 17 2022" -DVULKAN_HEADERS_INSTALL_DIR="$VULKAN_ROOT" -DUSE_MASM=OFF -A arm64 cmake --build build --config Release - cmake --install build --prefix $SDK_ROOT - cd "../CLBlast-source" + cmake --install build --prefix $VULKAN_ROOT + cd "../Vulkan-Hpp-source" DelIfExist "build" - cmake -B build -DBUILD_SHARED_LIBS=ON -DOVERRIDE_MSVC_FLAGS_TO_MT=OFF -DTUNERS=OFF -DOPENCL_ROOT="$SDK_ROOT" -G "Visual Studio 17 2022" -A arm64 + cmake -B build -G "Visual Studio 17 2022" -DVULKAN_HPP_INSTALL=ON -DVULKAN_HPP_RUN_GENERATOR=ON cmake --build build --config Release - cmake --install build --prefix $SDK_ROOT + cmake --install build --prefix $VULKAN_ROOT cd ".." }