From 1a6dc19cc7547c723ac08d510ae9a46b6877ffd3 Mon Sep 17 00:00:00 2001 From: Yuval Shekel Date: Tue, 24 Dec 2024 14:54:57 +0200 Subject: [PATCH 1/5] add script to pull vulkan backend --- scripts/pull_metal_backend.sh | 2 -- scripts/pull_vulkan_backend.sh | 42 ++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100755 scripts/pull_vulkan_backend.sh diff --git a/scripts/pull_metal_backend.sh b/scripts/pull_metal_backend.sh index 7c5bb69f9..7e6c26aa0 100755 --- a/scripts/pull_metal_backend.sh +++ b/scripts/pull_metal_backend.sh @@ -14,8 +14,6 @@ ABS_METAL_DIR=$(realpath ${BACKEND_DIR})/metal echo "Trying to pull Metal backend commit '${METAL_BACKEND}' to '${ABS_METAL_DIR}'" -exit 1 - if [ -d "${ABS_METAL_DIR}" ] && [ "$(ls -A ${ABS_METAL_DIR})" ]; then echo "Directory ${ABS_METAL_DIR} is not empty." read -p "Do you want to proceed with fetching and resetting? (y/n): " response diff --git a/scripts/pull_vulkan_backend.sh b/scripts/pull_vulkan_backend.sh new file mode 100755 index 000000000..45ba5efc6 --- /dev/null +++ b/scripts/pull_vulkan_backend.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +VULKAN_BACKEND=${1:-main} +BACKEND_DIR=${2:-./icicle/backend} + +# Check if BACKEND_DIR exists +if [ ! -d "${BACKEND_DIR}" ]; then + echo "Error: Directory '${BACKEND_DIR}' does not exist." + exit 1 +fi + +# Get the absolute path of the backend directory +ABS_VULKAN_DIR=$(realpath ${BACKEND_DIR})/vulkan + +echo "Trying to pull vulkan backend commit '${VULKAN_BACKEND}' to '${ABS_VULKAN_DIR}'" + +if [ -d "${ABS_VULKAN_DIR}" ] && [ "$(ls -A ${ABS_VULKAN_DIR})" ]; then + echo "Directory ${ABS_VULKAN_DIR} is not empty." + read -p "Do you want to proceed with fetching and resetting? (y/n): " response + case "$response" in + [Yy]* ) + echo "Proceeding with fetch and reset..." + cd ${ABS_VULKAN_DIR} + git fetch origin + git reset --hard origin/${VULKAN_BACKEND} + ;; + [Nn]* ) + echo "Aborting." + exit 1 + ;; + * ) + echo "Invalid input. Aborting." + exit 1 + ;; + esac +else + echo "Directory ${ABS_VULKAN_DIR} is empty or does not exist. Cloning..." + mkdir -p ${ABS_VULKAN_DIR} + cd ${ABS_VULKAN_DIR} + git clone git@github.com:ingonyama-zk/icicle-vulkan-backend.git ${ABS_VULKAN_DIR} + git checkout ${VULKAN_BACKEND} +fi \ No newline at end of file From 2876461e39587c89f6c0c6dedadf1c0cd27883d1 Mon Sep 17 00:00:00 2001 From: Yuval Shekel Date: Tue, 24 Dec 2024 16:02:04 +0200 Subject: [PATCH 2/5] cmake for vulkan build --- icicle/CMakeLists.txt | 57 +++-------------------- icicle/cmake/backend_include.cmake | 74 ++++++++++++++++++++++++++++++ icicle/tests/test_device_api.cpp | 21 ++++----- 3 files changed, 90 insertions(+), 62 deletions(-) create mode 100644 icicle/cmake/backend_include.cmake diff --git a/icicle/CMakeLists.txt b/icicle/CMakeLists.txt index 64f2479a9..2a5a3716d 100644 --- a/icicle/CMakeLists.txt +++ b/icicle/CMakeLists.txt @@ -55,11 +55,13 @@ endif() set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Build options -option(BUILD_TESTS "Build unit tests. Default=OFF" OFF) +option(BUILD_TESTS "Build unit test2s. Default=OFF" OFF) +# Backends: typically CPU is built into the frontend, the rest are DSOs loaded at runtime from installation option(CPU_BACKEND "Build CPU backend. Default=ON" ON) -# TODO Yuval: consider decoupling backends from frontend build. Is that worth the effort? +# To enable building backends, use the following options: (note they are in private repos) option(CUDA_BACKEND "Branch/commit to pull for CUDA backend or `local` if under icicle/backend/cuda. Default=OFF" OFF) option(METAL_BACKEND "Branch/commit to pull for METAL backend or `local` if under icicle/backend/metal. Default=OFF" OFF) +option(VULKAN_BACKEND "Branch/commit to pull for VULKAN backend or `local` if under icicle/backend/vulkan. Default=OFF" OFF) # features that some fields/curves have and some don't. option(NTT "Build NTT" ON) @@ -129,55 +131,8 @@ if (CPU_BACKEND) add_subdirectory(backend/cpu) endif() -if (CUDA_BACKEND) - string(TOLOWER "${CUDA_BACKEND}" CUDA_BACKEND_LOWER) - if (CUDA_BACKEND_LOWER STREQUAL "local") - # CUDA backend is local, no need to pull - message(STATUS "Adding CUDA backend from local path: icicle/backend/cuda") - add_subdirectory(backend/cuda) - - # Set the compile definition for the backend build directory - add_compile_definitions(BACKEND_BUILD_DIR="${CMAKE_BINARY_DIR}/backend") - else() - set(CUDA_BACKEND_URL "git@github.com:ingonyama-zk/icicle-cuda-backend.git") - - include(FetchContent) - message(STATUS "Fetching cuda backend from ${CUDA_BACKEND_URL}:${CUDA_BACKEND}") - FetchContent_Declare( - cuda_backend - GIT_REPOSITORY ${CUDA_BACKEND_URL} - GIT_TAG ${CUDA_BACKEND} - ) - FetchContent_MakeAvailable(cuda_backend) - # Set the compile definition for the backend build directory - add_compile_definitions(BACKEND_BUILD_DIR="${CMAKE_BINARY_DIR}/_deps/cuda_backend-build") - endif() -endif() - -if (METAL_BACKEND) - string(TOLOWER "${METAL_BACKEND}" METAL_BACKEND_LOWER) - if (METAL_BACKEND_LOWER STREQUAL "local") - # METAL backend is local, no need to pull - message(STATUS "Adding Metal backend from local path: icicle/backend/metal") - add_subdirectory(backend/metal) - - # Set the compile definition for the backend build directory - add_compile_definitions(BACKEND_BUILD_DIR="${CMAKE_BINARY_DIR}/backend") - else() - set(METAL_BACKEND_URL "git@github.com:ingonyama-zk/icicle-metal-backend.git") - - include(FetchContent) - message(STATUS "Fetching cuda backend from ${METAL_BACKEND_URL}:${METAL_BACKEND}") - FetchContent_Declare( - metal_backend - GIT_REPOSITORY ${METAL_BACKEND_URL} - GIT_TAG ${METAL_BACKEND} - ) - FetchContent_MakeAvailable(metal_backend) - # Set the compile definition for the backend build directory - add_compile_definitions(BACKEND_BUILD_DIR="${CMAKE_BINARY_DIR}/_deps/metal_backend-build") - endif() -endif() +# Include and configure (for build) backends based on the backend options +include(cmake/backend_include.cmake) if (BUILD_TESTS) add_subdirectory(tests) diff --git a/icicle/cmake/backend_include.cmake b/icicle/cmake/backend_include.cmake new file mode 100644 index 000000000..565c07282 --- /dev/null +++ b/icicle/cmake/backend_include.cmake @@ -0,0 +1,74 @@ +if (CUDA_BACKEND) + string(TOLOWER "${CUDA_BACKEND}" CUDA_BACKEND_LOWER) + if (CUDA_BACKEND_LOWER STREQUAL "local") + # CUDA backend is local, no need to pull + message(STATUS "Adding CUDA backend from local path: icicle/backend/cuda") + add_subdirectory(backend/cuda) + + # Set the compile definition for the backend build directory + add_compile_definitions(BACKEND_BUILD_DIR="${CMAKE_BINARY_DIR}/backend") + else() + set(CUDA_BACKEND_URL "git@github.com:ingonyama-zk/icicle-cuda-backend.git") + + include(FetchContent) + message(STATUS "Fetching cuda backend from ${CUDA_BACKEND_URL}:${CUDA_BACKEND}") + FetchContent_Declare( + cuda_backend + GIT_REPOSITORY ${CUDA_BACKEND_URL} + GIT_TAG ${CUDA_BACKEND} + ) + FetchContent_MakeAvailable(cuda_backend) + # Set the compile definition for the backend build directory + add_compile_definitions(BACKEND_BUILD_DIR="${CMAKE_BINARY_DIR}/_deps/cuda_backend-build") + endif() +endif() + +if (METAL_BACKEND) + string(TOLOWER "${METAL_BACKEND}" METAL_BACKEND_LOWER) + if (METAL_BACKEND_LOWER STREQUAL "local") + # METAL backend is local, no need to pull + message(STATUS "Adding Metal backend from local path: icicle/backend/metal") + add_subdirectory(backend/metal) + + # Set the compile definition for the backend build directory + add_compile_definitions(BACKEND_BUILD_DIR="${CMAKE_BINARY_DIR}/backend") + else() + set(METAL_BACKEND_URL "git@github.com:ingonyama-zk/icicle-metal-backend.git") + + include(FetchContent) + message(STATUS "Fetching cuda backend from ${METAL_BACKEND_URL}:${METAL_BACKEND}") + FetchContent_Declare( + metal_backend + GIT_REPOSITORY ${METAL_BACKEND_URL} + GIT_TAG ${METAL_BACKEND} + ) + FetchContent_MakeAvailable(metal_backend) + # Set the compile definition for the backend build directory + add_compile_definitions(BACKEND_BUILD_DIR="${CMAKE_BINARY_DIR}/_deps/metal_backend-build") + endif() +endif() + +if (VULKAN_BACKEND) + string(TOLOWER "${VULKAN_BACKEND}" VULKAN_BACKEND_LOWER) + if (VULKAN_BACKEND_LOWER STREQUAL "local") + # VULKAN backend is local, no need to pull + message(STATUS "Adding Vulkan backend from local path: icicle/backend/vulkan") + add_subdirectory(backend/vulkan) + + # Set the compile definition for the backend build directory + add_compile_definitions(BACKEND_BUILD_DIR="${CMAKE_BINARY_DIR}/backend") + else() + set(VULKAN_BACKEND_URL "git@github.com:ingonyama-zk/icicle-vulkan-backend.git") + + include(FetchContent) + message(STATUS "Fetching cuda backend from ${VULKAN_BACKEND_URL}:${VULKAN_BACKEND}") + FetchContent_Declare( + vulkan_backend + GIT_REPOSITORY ${VULKAN_BACKEND_URL} + GIT_TAG ${VULKAN_BACKEND} + ) + FetchContent_MakeAvailable(vulkan_backend) + # Set the compile definition for the backend build directory + add_compile_definitions(BACKEND_BUILD_DIR="${CMAKE_BINARY_DIR}/_deps/vulkan-backend-build") + endif() +endif() \ No newline at end of file diff --git a/icicle/tests/test_device_api.cpp b/icicle/tests/test_device_api.cpp index f63d3c987..b2206caed 100644 --- a/icicle/tests/test_device_api.cpp +++ b/icicle/tests/test_device_api.cpp @@ -27,7 +27,7 @@ TEST_F(DeviceApiTest, MemoryCopySync) int output[2] = {0, 0}; icicle::Device dev = {device_type, 0}; - icicle_set_device(dev); + ICICLE_CHECK(icicle_set_device(dev)); void* dev_mem = nullptr; ICICLE_CHECK(icicle_malloc(&dev_mem, sizeof(input))); @@ -47,7 +47,7 @@ TEST_F(DeviceApiTest, MemoryCopySyncWithOffset) int output[2] = {0, 0}; icicle::Device dev = {device_type, 0}; - icicle_set_device(dev); + ICICLE_CHECK(icicle_set_device(dev)); int* dev_mem = nullptr; ICICLE_CHECK( @@ -68,7 +68,7 @@ TEST_F(DeviceApiTest, MemoryCopyAsync) int output[2] = {0, 0}; icicle::Device dev = {device_type, 0}; - icicle_set_device(dev); + ICICLE_CHECK(icicle_set_device(dev)); void* dev_mem = nullptr; icicleStreamHandle stream; @@ -90,7 +90,7 @@ TEST_F(DeviceApiTest, CopyDeviceInference) int output[2] = {0, 0}; icicle::Device dev = {device_type, 0}; - icicle_set_device(dev); + ICICLE_CHECK(icicle_set_device(dev)); void* dev_mem = nullptr; ICICLE_CHECK(icicle_malloc(&dev_mem, sizeof(input))); @@ -107,9 +107,8 @@ TEST_F(DeviceApiTest, Memest) for (const auto& device_type : s_registered_devices) { char host_mem[2] = {0, 0}; - // icicle::Device dev = {device_type, 0}; - icicle::Device dev = {"CPU", 0}; - icicle_set_device(dev); + icicle::Device dev = {device_type, 0}; + ICICLE_CHECK(icicle_set_device(dev)); char* dev_mem = nullptr; ICICLE_CHECK(icicle_malloc((void**)&dev_mem, sizeof(host_mem))); @@ -125,7 +124,7 @@ TEST_F(DeviceApiTest, ApiError) { for (const auto& device_type : s_registered_devices) { icicle::Device dev = {device_type, 0}; - icicle_set_device(dev); + ICICLE_CHECK(icicle_set_device(dev)); void* dev_mem = nullptr; EXPECT_ANY_THROW(ICICLE_CHECK(icicle_malloc(&dev_mem, -1))); } @@ -137,7 +136,7 @@ TEST_F(DeviceApiTest, AvailableMemory) const bool is_cuda_registered = eIcicleError::SUCCESS == icicle_is_device_available(dev); if (!is_cuda_registered) { GTEST_SKIP(); } // most devices do not support this - icicle_set_device(dev); + ICICLE_CHECK(icicle_set_device(dev)); size_t total, free; ASSERT_EQ(eIcicleError::SUCCESS, icicle_get_available_memory(total, free)); @@ -165,7 +164,7 @@ TEST_F(DeviceApiTest, memoryTracker) MemoryTracker tracker{}; ICICLE_ASSERT(s_main_device != UNKOWN_DEVICE) << "memoryTracker test assumes more than one device"; Device main_device = {s_main_device, 0}; - icicle_set_device(main_device); + ICICLE_CHECK(icicle_set_device(main_device)); std::vector allocated_addresses(NOF_ALLOCS, nullptr); @@ -195,7 +194,7 @@ TEST_F(DeviceApiTest, memoryTracker) ASSERT_EQ(eIcicleError::INVALID_POINTER, icicle_is_active_device_memory(host_mem.get())); // test that we still identify correctly after switching device - icicle_set_device({"CPU", 0}); + ICICLE_CHECK(icicle_set_device({"CPU", 0})); const void* addr = (void*)((size_t)*allocated_addresses.begin() + rand_uint_32b(0, RAND_MAX) % ALLOC_SIZE); ASSERT_EQ(eIcicleError::INVALID_POINTER, icicle_is_active_device_memory(addr)); ASSERT_EQ(eIcicleError::INVALID_POINTER, icicle_is_active_device_memory(host_mem.get())); From 98f1c3526580e722e4d1bc8f4e4927554511fde9 Mon Sep 17 00:00:00 2001 From: Yuval Shekel Date: Tue, 24 Dec 2024 16:27:23 +0200 Subject: [PATCH 3/5] rust tests should execute in phases --- .github/workflows/cpp-golang-rust.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cpp-golang-rust.yml b/.github/workflows/cpp-golang-rust.yml index a4fdc9414..4a14f8a25 100644 --- a/.github/workflows/cpp-golang-rust.yml +++ b/.github/workflows/cpp-golang-rust.yml @@ -132,7 +132,9 @@ jobs: CURVE_DIR=icicle-${CURVE//_/-} export ICICLE_BACKEND_INSTALL_DIR=${{ steps.cuda-flag.outputs.INSTALL_PATH }} cd ./$CURVE_DIR - cargo test --release --verbose + cargo test --release --verbose -- --skip phase + cargo test phase2 --release + cargo test phase3 --release - name: Run C++ curve Tests working-directory: ./icicle/build/tests if: needs.check-changed-files.outputs.cpp == 'true' @@ -260,7 +262,9 @@ jobs: FIELD_DIR=icicle-${FIELD//_/-} export ICICLE_BACKEND_INSTALL_DIR=${{ steps.cuda-flag.outputs.INSTALL_PATH }} cd ./$FIELD_DIR - cargo test --release --verbose + cargo test --release --verbose -- --skip phase + cargo test phase2 --release + cargo test phase3 --release - name: Run C++ field Tests working-directory: ./icicle/build/tests if: needs.check-changed-files.outputs.cpp == 'true' From a0c705681780edd0ccc22b790dfe25a9c50aca97 Mon Sep 17 00:00:00 2001 From: Yuval Shekel Date: Wed, 25 Dec 2024 19:07:21 +0200 Subject: [PATCH 4/5] update device api test --- icicle/tests/test_device_api.cpp | 50 ++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/icicle/tests/test_device_api.cpp b/icicle/tests/test_device_api.cpp index b2206caed..4e5a83233 100644 --- a/icicle/tests/test_device_api.cpp +++ b/icicle/tests/test_device_api.cpp @@ -29,12 +29,15 @@ TEST_F(DeviceApiTest, MemoryCopySync) icicle::Device dev = {device_type, 0}; ICICLE_CHECK(icicle_set_device(dev)); - void* dev_mem = nullptr; - ICICLE_CHECK(icicle_malloc(&dev_mem, sizeof(input))); - ICICLE_CHECK(icicle_copy_to_device(dev_mem, input, sizeof(input))); - ICICLE_CHECK(icicle_copy_to_host(output, dev_mem, sizeof(input))); - ICICLE_CHECK(icicle_free(dev_mem)); - + void* dev_memA = nullptr; + void* dev_memB = nullptr; + // test copy host->device->device->host + ICICLE_CHECK(icicle_malloc(&dev_memA, sizeof(input))); + ICICLE_CHECK(icicle_malloc(&dev_memB, sizeof(input))); + ICICLE_CHECK(icicle_copy_to_device(dev_memA, input, sizeof(input))); + ICICLE_CHECK(icicle_copy(dev_memB, dev_memA, sizeof(input))); + ICICLE_CHECK(icicle_copy_to_host(output, dev_memB, sizeof(input))); + ICICLE_CHECK(icicle_free(dev_memB)); ASSERT_EQ(0, memcmp(input, output, sizeof(input))); } } @@ -42,22 +45,22 @@ TEST_F(DeviceApiTest, MemoryCopySync) TEST_F(DeviceApiTest, MemoryCopySyncWithOffset) { int input[4] = {1, 2, 3, 4}; + int expected[4] = {3, 4, 1, 2}; for (const auto& device_type : s_registered_devices) { - int output[2] = {0, 0}; + int output[4] = {0, 0, 0, 0}; icicle::Device dev = {device_type, 0}; ICICLE_CHECK(icicle_set_device(dev)); int* dev_mem = nullptr; - ICICLE_CHECK( - icicle_malloc((void**)&dev_mem, sizeof(input))); // allocating larger memory to have offset on this buffer to copy - // 2 values from offset (that is copy {2,3} only) - ICICLE_CHECK(icicle_copy_to_device(dev_mem + 1, input + 1, sizeof(output))); - ICICLE_CHECK(icicle_copy_to_host(output, dev_mem + 1, sizeof(output))); + ICICLE_CHECK(icicle_malloc((void**)&dev_mem, 4 * sizeof(int))); + ICICLE_CHECK(icicle_copy_to_device(dev_mem, input + 2, 2 * sizeof(int))); + ICICLE_CHECK(icicle_copy_to_device(dev_mem + 2, input, 2 * sizeof(int))); + ICICLE_CHECK(icicle_copy_to_host(output, dev_mem, 4 * sizeof(int))); ICICLE_CHECK(icicle_free(dev_mem)); - ASSERT_EQ(0, memcmp(input + 1, output, sizeof(output))); + ASSERT_EQ(0, memcmp(expected, output, 4 * sizeof(int))); } } @@ -101,7 +104,7 @@ TEST_F(DeviceApiTest, CopyDeviceInference) } } -TEST_F(DeviceApiTest, Memest) +TEST_F(DeviceApiTest, Memset) { char expected[2] = {1, 2}; for (const auto& device_type : s_registered_devices) { @@ -158,7 +161,7 @@ TEST_F(DeviceApiTest, memoryTracker) { // need two devices for this test if (s_registered_devices.size() == 1) { return; } - const int NOF_ALLOCS = 1000; + const int NOF_ALLOCS = 200; // Note that some backends have a bound (typically 256) on allocations const int ALLOC_SIZE = 1 << 20; MemoryTracker tracker{}; @@ -200,6 +203,23 @@ TEST_F(DeviceApiTest, memoryTracker) ASSERT_EQ(eIcicleError::INVALID_POINTER, icicle_is_active_device_memory(host_mem.get())); auto it = tracker.identify(addr); ASSERT_EQ(*it->first, main_device); + + ICICLE_CHECK(icicle_set_device(main_device)); + START_TIMER(remove); + for (auto& it : allocated_addresses) { + tracker.remove_allocation(it); + } + END_TIMER_AVERAGE(remove, "memory-tracker: remove average", true, NOF_ALLOCS); + + START_TIMER(free); + for (auto& it : allocated_addresses) { + icicle_free(it); + } + END_TIMER_AVERAGE(free, "memory-tracker: free average", true, NOF_ALLOCS); + + void* mem; + ICICLE_CHECK(icicle_malloc(&mem, ALLOC_SIZE)); + ICICLE_CHECK(icicle_free(mem)); } int main(int argc, char** argv) From 95fb15e4790e951469ae01deb10b384e7f2f4538 Mon Sep 17 00:00:00 2001 From: Yuval Shekel Date: Mon, 6 Jan 2025 17:34:34 +0200 Subject: [PATCH 5/5] add vulkan feature to rust crates --- examples/c++/examples_utils.h | 2 +- .../arkworks-icicle-conversions/Cargo.toml | 23 ++++++++++----- examples/rust/hash-and-merkle/Cargo.toml | 28 ++++++++++++------- examples/rust/msm/Cargo.toml | 18 +++++++++--- examples/rust/ntt/Cargo.toml | 16 +++++++++-- examples/rust/polynomials/Cargo.toml | 22 +++++++++++---- examples/rust/poseidon2/Cargo.toml | 26 +++++++++++++---- .../icicle-curves/icicle-bls12-377/Cargo.toml | 3 +- .../icicle-curves/icicle-bls12-377/build.rs | 5 ++++ .../icicle-curves/icicle-bls12-381/Cargo.toml | 2 ++ .../icicle-curves/icicle-bls12-381/build.rs | 5 ++++ .../icicle-curves/icicle-bn254/Cargo.toml | 2 ++ .../rust/icicle-curves/icicle-bn254/build.rs | 5 ++++ .../icicle-curves/icicle-bw6-761/build.rs | 5 ++++ .../icicle-curves/icicle-grumpkin/Cargo.toml | 2 ++ .../icicle-curves/icicle-grumpkin/build.rs | 5 ++++ .../icicle-fields/icicle-babybear/Cargo.toml | 4 ++- .../icicle-fields/icicle-babybear/build.rs | 5 ++++ .../icicle-fields/icicle-koalabear/Cargo.toml | 4 ++- .../icicle-fields/icicle-koalabear/build.rs | 5 ++++ .../rust/icicle-fields/icicle-m31/Cargo.toml | 2 ++ .../rust/icicle-fields/icicle-m31/build.rs | 5 ++++ .../icicle-fields/icicle-stark252/Cargo.toml | 4 ++- wrappers/rust/icicle-hash/Cargo.toml | 4 ++- wrappers/rust/icicle-hash/build.rs | 5 ++++ wrappers/rust/icicle-runtime/Cargo.toml | 2 ++ wrappers/rust/icicle-runtime/build.rs | 5 ++++ 27 files changed, 173 insertions(+), 41 deletions(-) diff --git a/examples/c++/examples_utils.h b/examples/c++/examples_utils.h index 65abf3beb..59142ddf1 100644 --- a/examples/c++/examples_utils.h +++ b/examples/c++/examples_utils.h @@ -29,5 +29,5 @@ void try_load_and_set_backend_device(int argc = 0, char** argv = nullptr) return; } - ICICLE_LOG_INFO << "Device " << selected_device << " is not available, falling back to CPU"; + ICICLE_LOG_ERROR << "Device " << selected_device << " is not available, falling back to CPU"; } \ No newline at end of file diff --git a/examples/rust/arkworks-icicle-conversions/Cargo.toml b/examples/rust/arkworks-icicle-conversions/Cargo.toml index f054855c4..84fa7ffdc 100644 --- a/examples/rust/arkworks-icicle-conversions/Cargo.toml +++ b/examples/rust/arkworks-icicle-conversions/Cargo.toml @@ -5,24 +5,33 @@ edition = "2018" [dependencies] icicle-runtime = { path = "../../../wrappers/rust/icicle-runtime" } -icicle-core = { path = "../../../wrappers/rust/icicle-core"} +icicle-core = { path = "../../../wrappers/rust/icicle-core" } icicle-bn254 = { path = "../../../wrappers/rust/icicle-curves/icicle-bn254" } -ark-bn254 = { version = "0.4.0"} -ark-ff = { version = "0.4.0" , features=["parallel"]} -ark-ec = { version = "0.4.0" , features=["parallel"]} +ark-bn254 = { version = "0.4.0" } +ark-ff = { version = "0.4.0", features = ["parallel"] } +ark-ec = { version = "0.4.0", features = ["parallel"] } rand = "0.8" rayon = "1.5" clap = { version = "<=4.4.12", features = ["derive"] } [features] -cuda = ["icicle-runtime/cuda_backend", +cuda = [ + "icicle-runtime/cuda_backend", "icicle-bn254/cuda_backend", "icicle-bn254/no_ecntt", "icicle-bn254/no_g2", ] -metal = ["icicle-runtime/metal_backend", +metal = [ + "icicle-runtime/metal_backend", "icicle-bn254/metal_backend", "icicle-bn254/no_ecntt", "icicle-bn254/no_g2", -] \ No newline at end of file +] + +vulkan = [ + "icicle-runtime/vulkan_backend", + "icicle-bn254/vulkan_backend", + "icicle-bn254/no_ecntt", + "icicle-bn254/no_g2", +] diff --git a/examples/rust/hash-and-merkle/Cargo.toml b/examples/rust/hash-and-merkle/Cargo.toml index 95045b11d..3e0e9f0dd 100644 --- a/examples/rust/hash-and-merkle/Cargo.toml +++ b/examples/rust/hash-and-merkle/Cargo.toml @@ -4,20 +4,28 @@ version = "0.1.0" edition = "2018" [dependencies] -hex = "0.4" +hex = "0.4" clap = { version = "<=4.4.12", features = ["derive"] } -icicle-core = {path = "../../../wrappers/rust/icicle-core" } -icicle-runtime = {path = "../../../wrappers/rust/icicle-runtime" } -icicle-hash = {path = "../../../wrappers/rust/icicle-hash" } -icicle-babybear = {path = "../../../wrappers/rust/icicle-fields/icicle-babybear" } +icicle-core = { path = "../../../wrappers/rust/icicle-core" } +icicle-runtime = { path = "../../../wrappers/rust/icicle-runtime" } +icicle-hash = { path = "../../../wrappers/rust/icicle-hash" } +icicle-babybear = { path = "../../../wrappers/rust/icicle-fields/icicle-babybear" } [features] -cuda = ["icicle-runtime/cuda_backend", +cuda = [ + "icicle-runtime/cuda_backend", "icicle-babybear/cuda_backend", - "icicle-hash/cuda_backend", + "icicle-hash/cuda_backend", ] -metal = ["icicle-runtime/metal_backend", +metal = [ + "icicle-runtime/metal_backend", "icicle-babybear/metal_backend", - "icicle-hash/metal_backend", -] \ No newline at end of file + "icicle-hash/metal_backend", +] + +vulkan = [ + "icicle-runtime/vulkan_backend", + "icicle-babybear/vulkan_backend", + "icicle-hash/vulkan_backend", +] diff --git a/examples/rust/msm/Cargo.toml b/examples/rust/msm/Cargo.toml index 29e1cf1ad..22a6be4ab 100644 --- a/examples/rust/msm/Cargo.toml +++ b/examples/rust/msm/Cargo.toml @@ -11,16 +11,26 @@ icicle-bls12-377 = { path = "../../../wrappers/rust/icicle-curves/icicle-bls12-3 clap = { version = "<=4.4.12", features = ["derive"] } [features] -cuda = ["icicle-runtime/cuda_backend", +cuda = [ + "icicle-runtime/cuda_backend", "icicle-bn254/cuda_backend", "icicle-bn254/no_ecntt", "icicle-bls12-377/cuda_backend", - "icicle-bls12-377/no_ecntt" + "icicle-bls12-377/no_ecntt", ] -metal = ["icicle-runtime/metal_backend", +metal = [ + "icicle-runtime/metal_backend", "icicle-bn254/metal_backend", "icicle-bn254/no_ecntt", "icicle-bls12-377/metal_backend", - "icicle-bls12-377/no_ecntt" + "icicle-bls12-377/no_ecntt", +] + +vulkan = [ + "icicle-runtime/vulkan_backend", + "icicle-bn254/vulkan_backend", + "icicle-bn254/no_ecntt", + "icicle-bls12-377/vulkan_backend", + "icicle-bls12-377/no_ecntt", ] diff --git a/examples/rust/ntt/Cargo.toml b/examples/rust/ntt/Cargo.toml index 616610f70..97cf3818d 100644 --- a/examples/rust/ntt/Cargo.toml +++ b/examples/rust/ntt/Cargo.toml @@ -12,7 +12,8 @@ icicle-bls12-377 = { path = "../../../wrappers/rust/icicle-curves/icicle-bls12-3 clap = { version = "<=4.4.12", features = ["derive"] } [features] -cuda = ["icicle-runtime/cuda_backend", +cuda = [ + "icicle-runtime/cuda_backend", "icicle-bn254/cuda_backend", "icicle-bn254/no_ecntt", "icicle-bn254/no_g2", @@ -21,7 +22,8 @@ cuda = ["icicle-runtime/cuda_backend", "icicle-bls12-377/no_g2", ] -metal = ["icicle-runtime/metal_backend", +metal = [ + "icicle-runtime/metal_backend", "icicle-bn254/metal_backend", "icicle-bn254/no_ecntt", "icicle-bn254/no_g2", @@ -29,3 +31,13 @@ metal = ["icicle-runtime/metal_backend", "icicle-bls12-377/no_ecntt", "icicle-bls12-377/no_g2", ] + +vulkan = [ + "icicle-runtime/vulkan_backend", + "icicle-bn254/vulkan_backend", + "icicle-bn254/no_ecntt", + "icicle-bn254/no_g2", + "icicle-bls12-377/vulkan_backend", + "icicle-bls12-377/no_ecntt", + "icicle-bls12-377/no_g2", +] diff --git a/examples/rust/polynomials/Cargo.toml b/examples/rust/polynomials/Cargo.toml index 527b0bd26..742dbffac 100644 --- a/examples/rust/polynomials/Cargo.toml +++ b/examples/rust/polynomials/Cargo.toml @@ -12,16 +12,26 @@ icicle-babybear = { path = "../../../wrappers/rust/icicle-fields/icicle-babybear clap = { version = "<=4.4.12", features = ["derive"] } [features] -cuda = ["icicle-runtime/cuda_backend", +cuda = [ + "icicle-runtime/cuda_backend", "icicle-bn254/cuda_backend", - "icicle-bn254/no_ecntt", - "icicle-bn254/no_g2", + "icicle-bn254/no_ecntt", + "icicle-bn254/no_g2", "icicle-babybear/cuda_backend", ] -metal = ["icicle-runtime/metal_backend", + +metal = [ + "icicle-runtime/metal_backend", "icicle-bn254/metal_backend", - "icicle-bn254/no_ecntt", - "icicle-bn254/no_g2", + "icicle-bn254/no_ecntt", + "icicle-bn254/no_g2", "icicle-babybear/metal_backend", ] +vulkan = [ + "icicle-runtime/vulkan_backend", + "icicle-bn254/vulkan_backend", + "icicle-bn254/no_ecntt", + "icicle-bn254/no_g2", + "icicle-babybear/vulkan_backend", +] diff --git a/examples/rust/poseidon2/Cargo.toml b/examples/rust/poseidon2/Cargo.toml index 9416d34f8..5f07f8df0 100644 --- a/examples/rust/poseidon2/Cargo.toml +++ b/examples/rust/poseidon2/Cargo.toml @@ -4,12 +4,12 @@ version = "0.1.0" edition = "2018" [dependencies] -icicle-core = {path = "../../../wrappers/rust/icicle-core" } -icicle-runtime = {path = "../../../wrappers/rust/icicle-runtime" } -icicle-hash = {path = "../../../wrappers/rust/icicle-hash" } -icicle-babybear = {path = "../../../wrappers/rust/icicle-fields/icicle-babybear" } -icicle-m31 = {path = "../../../wrappers/rust/icicle-fields/icicle-m31" } -hex = "0.4" +icicle-core = { path = "../../../wrappers/rust/icicle-core" } +icicle-runtime = { path = "../../../wrappers/rust/icicle-runtime" } +icicle-hash = { path = "../../../wrappers/rust/icicle-hash" } +icicle-babybear = { path = "../../../wrappers/rust/icicle-fields/icicle-babybear" } +icicle-m31 = { path = "../../../wrappers/rust/icicle-fields/icicle-m31" } +hex = "0.4" rand = "0.8" clap = { version = "<=4.4.12", features = ["derive"] } @@ -20,3 +20,17 @@ cuda = [ "icicle-babybear/cuda_backend", "icicle-m31/cuda_backend", ] + +metal = [ + "icicle-runtime/metal_backend", + "icicle-hash/metal_backend", + "icicle-babybear/metal_backend", + "icicle-m31/metal_backend", +] + +vulkan = [ + "icicle-runtime/vulkan_backend", + "icicle-hash/vulkan_backend", + "icicle-babybear/vulkan_backend", + "icicle-m31/vulkan_backend", +] diff --git a/wrappers/rust/icicle-curves/icicle-bls12-377/Cargo.toml b/wrappers/rust/icicle-curves/icicle-bls12-377/Cargo.toml index bf9c07bcb..544d2bf0b 100644 --- a/wrappers/rust/icicle-curves/icicle-bls12-377/Cargo.toml +++ b/wrappers/rust/icicle-curves/icicle-bls12-377/Cargo.toml @@ -29,6 +29,8 @@ cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] metal_backend = ["icicle-runtime/metal_backend"] pull_metal_backend = ["icicle-runtime/pull_metal_backend"] +vulkan_backend = ["icicle-runtime/vulkan_backend"] +pull_vulkan_backend = ["icicle-runtime/pull_vulkan_backend"] [[bench]] @@ -42,4 +44,3 @@ harness = false [[bench]] name = "ecntt" harness = false - diff --git a/wrappers/rust/icicle-curves/icicle-bls12-377/build.rs b/wrappers/rust/icicle-curves/icicle-bls12-377/build.rs index d881fa7ca..19f8257fe 100644 --- a/wrappers/rust/icicle-curves/icicle-bls12-377/build.rs +++ b/wrappers/rust/icicle-curves/icicle-bls12-377/build.rs @@ -41,6 +41,11 @@ fn main() { } else if cfg!(feature = "pull_metal_backend") { config.define("METAL_BACKEND", "main"); } + if cfg!(feature = "vulkan_backend") { + config.define("VULKAN_BACKEND", "local"); + } else if cfg!(feature = "pull_vulkan_backend") { + config.define("VULKAN_BACKEND", "main"); + } // Optional Features that are default ON (so that default matches any backend) if cfg!(feature = "no_g2") { config.define("G2", "OFF"); diff --git a/wrappers/rust/icicle-curves/icicle-bls12-381/Cargo.toml b/wrappers/rust/icicle-curves/icicle-bls12-381/Cargo.toml index 30d9089a3..c539209ca 100644 --- a/wrappers/rust/icicle-curves/icicle-bls12-381/Cargo.toml +++ b/wrappers/rust/icicle-curves/icicle-bls12-381/Cargo.toml @@ -27,6 +27,8 @@ cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] metal_backend = ["icicle-runtime/metal_backend"] pull_metal_backend = ["icicle-runtime/pull_metal_backend"] +vulkan_backend = ["icicle-runtime/vulkan_backend"] +pull_vulkan_backend = ["icicle-runtime/pull_vulkan_backend"] [[bench]] name = "ntt" diff --git a/wrappers/rust/icicle-curves/icicle-bls12-381/build.rs b/wrappers/rust/icicle-curves/icicle-bls12-381/build.rs index 87ace38e0..ddec7268c 100644 --- a/wrappers/rust/icicle-curves/icicle-bls12-381/build.rs +++ b/wrappers/rust/icicle-curves/icicle-bls12-381/build.rs @@ -41,6 +41,11 @@ fn main() { } else if cfg!(feature = "pull_metal_backend") { config.define("METAL_BACKEND", "main"); } + if cfg!(feature = "vulkan_backend") { + config.define("VULKAN_BACKEND", "local"); + } else if cfg!(feature = "pull_vulkan_backend") { + config.define("VULKAN_BACKEND", "main"); + } // Optional Features that are default ON (so that default matches any backend) if cfg!(feature = "no_g2") { config.define("G2", "OFF"); diff --git a/wrappers/rust/icicle-curves/icicle-bn254/Cargo.toml b/wrappers/rust/icicle-curves/icicle-bn254/Cargo.toml index 74b6d9843..257570af1 100644 --- a/wrappers/rust/icicle-curves/icicle-bn254/Cargo.toml +++ b/wrappers/rust/icicle-curves/icicle-bn254/Cargo.toml @@ -27,6 +27,8 @@ cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] metal_backend = ["icicle-runtime/metal_backend"] pull_metal_backend = ["icicle-runtime/pull_metal_backend"] +vulkan_backend = ["icicle-runtime/vulkan_backend"] +pull_vulkan_backend = ["icicle-runtime/pull_vulkan_backend"] [[bench]] name = "ntt" diff --git a/wrappers/rust/icicle-curves/icicle-bn254/build.rs b/wrappers/rust/icicle-curves/icicle-bn254/build.rs index 1d1d98b2e..00bf3aafb 100644 --- a/wrappers/rust/icicle-curves/icicle-bn254/build.rs +++ b/wrappers/rust/icicle-curves/icicle-bn254/build.rs @@ -40,6 +40,11 @@ fn main() { } else if cfg!(feature = "pull_metal_backend") { config.define("METAL_BACKEND", "main"); } + if cfg!(feature = "vulkan_backend") { + config.define("VULKAN_BACKEND", "local"); + } else if cfg!(feature = "pull_vulkan_backend") { + config.define("VULKAN_BACKEND", "main"); + } // Optional Features that are default ON (so that default matches any backend) if cfg!(feature = "no_g2") { config.define("G2", "OFF"); diff --git a/wrappers/rust/icicle-curves/icicle-bw6-761/build.rs b/wrappers/rust/icicle-curves/icicle-bw6-761/build.rs index 319ea57e3..fdebc5cc6 100644 --- a/wrappers/rust/icicle-curves/icicle-bw6-761/build.rs +++ b/wrappers/rust/icicle-curves/icicle-bw6-761/build.rs @@ -40,6 +40,11 @@ fn main() { } else if cfg!(feature = "pull_metal_backend") { config.define("METAL_BACKEND", "main"); } + if cfg!(feature = "vulkan_backend") { + config.define("VULKAN_BACKEND", "local"); + } else if cfg!(feature = "pull_vulkan_backend") { + config.define("VULKAN_BACKEND", "main"); + } // Build let _ = config diff --git a/wrappers/rust/icicle-curves/icicle-grumpkin/Cargo.toml b/wrappers/rust/icicle-curves/icicle-grumpkin/Cargo.toml index 590e1ac75..f2ee067da 100644 --- a/wrappers/rust/icicle-curves/icicle-grumpkin/Cargo.toml +++ b/wrappers/rust/icicle-curves/icicle-grumpkin/Cargo.toml @@ -25,6 +25,8 @@ cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] metal_backend = ["icicle-runtime/metal_backend"] pull_metal_backend = ["icicle-runtime/pull_metal_backend"] +vulkan_backend = ["icicle-runtime/vulkan_backend"] +pull_vulkan_backend = ["icicle-runtime/pull_vulkan_backend"] [[bench]] diff --git a/wrappers/rust/icicle-curves/icicle-grumpkin/build.rs b/wrappers/rust/icicle-curves/icicle-grumpkin/build.rs index d52afa259..9ec47ecc6 100644 --- a/wrappers/rust/icicle-curves/icicle-grumpkin/build.rs +++ b/wrappers/rust/icicle-curves/icicle-grumpkin/build.rs @@ -40,6 +40,11 @@ fn main() { } else if cfg!(feature = "pull_metal_backend") { config.define("METAL_BACKEND", "main"); } + if cfg!(feature = "vulkan_backend") { + config.define("VULKAN_BACKEND", "local"); + } else if cfg!(feature = "pull_vulkan_backend") { + config.define("VULKAN_BACKEND", "main"); + } // Build let _ = config diff --git a/wrappers/rust/icicle-fields/icicle-babybear/Cargo.toml b/wrappers/rust/icicle-fields/icicle-babybear/Cargo.toml index e9d222324..02a668955 100644 --- a/wrappers/rust/icicle-fields/icicle-babybear/Cargo.toml +++ b/wrappers/rust/icicle-fields/icicle-babybear/Cargo.toml @@ -9,7 +9,7 @@ repository.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -icicle-core = {workspace = true } +icicle-core = { workspace = true } icicle-runtime = { workspace = true } icicle-hash = { workspace = true } @@ -27,6 +27,8 @@ cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] metal_backend = ["icicle-runtime/metal_backend"] pull_metal_backend = ["icicle-runtime/pull_metal_backend"] +vulkan_backend = ["icicle-runtime/vulkan_backend"] +pull_vulkan_backend = ["icicle-runtime/pull_vulkan_backend"] [[bench]] name = "ntt" diff --git a/wrappers/rust/icicle-fields/icicle-babybear/build.rs b/wrappers/rust/icicle-fields/icicle-babybear/build.rs index 763ad0269..f1412b4d3 100644 --- a/wrappers/rust/icicle-fields/icicle-babybear/build.rs +++ b/wrappers/rust/icicle-fields/icicle-babybear/build.rs @@ -40,6 +40,11 @@ fn main() { } else if cfg!(feature = "pull_metal_backend") { config.define("METAL_BACKEND", "main"); } + if cfg!(feature = "vulkan_backend") { + config.define("VULKAN_BACKEND", "local"); + } else if cfg!(feature = "pull_vulkan_backend") { + config.define("VULKAN_BACKEND", "main"); + } // Build let _ = config diff --git a/wrappers/rust/icicle-fields/icicle-koalabear/Cargo.toml b/wrappers/rust/icicle-fields/icicle-koalabear/Cargo.toml index 585031b61..bff263ded 100644 --- a/wrappers/rust/icicle-fields/icicle-koalabear/Cargo.toml +++ b/wrappers/rust/icicle-fields/icicle-koalabear/Cargo.toml @@ -9,7 +9,7 @@ repository.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -icicle-core = {workspace = true } +icicle-core = { workspace = true } icicle-runtime = { workspace = true } icicle-hash = { workspace = true } @@ -27,6 +27,8 @@ cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] metal_backend = ["icicle-runtime/metal_backend"] pull_metal_backend = ["icicle-runtime/pull_metal_backend"] +vulkan_backend = ["icicle-runtime/vulkan_backend"] +pull_vulkan_backend = ["icicle-runtime/pull_vulkan_backend"] [[bench]] name = "ntt" diff --git a/wrappers/rust/icicle-fields/icicle-koalabear/build.rs b/wrappers/rust/icicle-fields/icicle-koalabear/build.rs index 59d0e9982..2a0611ade 100644 --- a/wrappers/rust/icicle-fields/icicle-koalabear/build.rs +++ b/wrappers/rust/icicle-fields/icicle-koalabear/build.rs @@ -40,6 +40,11 @@ fn main() { } else if cfg!(feature = "pull_metal_backend") { config.define("METAL_BACKEND", "main"); } + if cfg!(feature = "vulkan_backend") { + config.define("VULKAN_BACKEND", "local"); + } else if cfg!(feature = "pull_vulkan_backend") { + config.define("VULKAN_BACKEND", "main"); + } // Build let _ = config diff --git a/wrappers/rust/icicle-fields/icicle-m31/Cargo.toml b/wrappers/rust/icicle-fields/icicle-m31/Cargo.toml index 35011a498..2c3f80416 100644 --- a/wrappers/rust/icicle-fields/icicle-m31/Cargo.toml +++ b/wrappers/rust/icicle-fields/icicle-m31/Cargo.toml @@ -20,3 +20,5 @@ cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] metal_backend = ["icicle-runtime/metal_backend"] pull_metal_backend = ["icicle-runtime/pull_metal_backend"] +vulkan_backend = ["icicle-runtime/vulkan_backend"] +pull_vulkan_backend = ["icicle-runtime/pull_vulkan_backend"] diff --git a/wrappers/rust/icicle-fields/icicle-m31/build.rs b/wrappers/rust/icicle-fields/icicle-m31/build.rs index c25209b29..dfd0f58e0 100644 --- a/wrappers/rust/icicle-fields/icicle-m31/build.rs +++ b/wrappers/rust/icicle-fields/icicle-m31/build.rs @@ -40,6 +40,11 @@ fn main() { } else if cfg!(feature = "pull_metal_backend") { config.define("METAL_BACKEND", "main"); } + if cfg!(feature = "vulkan_backend") { + config.define("VULKAN_BACKEND", "local"); + } else if cfg!(feature = "pull_vulkan_backend") { + config.define("VULKAN_BACKEND", "main"); + } // Build let _ = config diff --git a/wrappers/rust/icicle-fields/icicle-stark252/Cargo.toml b/wrappers/rust/icicle-fields/icicle-stark252/Cargo.toml index 8346d7e93..f57c8037e 100644 --- a/wrappers/rust/icicle-fields/icicle-stark252/Cargo.toml +++ b/wrappers/rust/icicle-fields/icicle-stark252/Cargo.toml @@ -9,7 +9,7 @@ repository.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -icicle-core = {workspace = true } +icicle-core = { workspace = true } icicle-runtime = { workspace = true } icicle-hash = { workspace = true } @@ -26,6 +26,8 @@ cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] metal_backend = ["icicle-runtime/metal_backend"] pull_metal_backend = ["icicle-runtime/pull_metal_backend"] +vulkan_backend = ["icicle-runtime/vulkan_backend"] +pull_vulkan_backend = ["icicle-runtime/pull_vulkan_backend"] [[bench]] name = "ntt" diff --git a/wrappers/rust/icicle-hash/Cargo.toml b/wrappers/rust/icicle-hash/Cargo.toml index 7cc89ba80..fad2cd3aa 100644 --- a/wrappers/rust/icicle-hash/Cargo.toml +++ b/wrappers/rust/icicle-hash/Cargo.toml @@ -7,7 +7,7 @@ homepage.workspace = true repository.workspace = true [dependencies] -icicle-core = {workspace = true } +icicle-core = { workspace = true } icicle-runtime = { workspace = true } rand = "0.8" @@ -19,3 +19,5 @@ cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] metal_backend = ["icicle-runtime/metal_backend"] pull_metal_backend = ["icicle-runtime/pull_metal_backend"] +vulkan_backend = ["icicle-runtime/vulkan_backend"] +pull_vulkan_backend = ["icicle-runtime/pull_vulkan_backend"] diff --git a/wrappers/rust/icicle-hash/build.rs b/wrappers/rust/icicle-hash/build.rs index 5658fe3c1..2c997e76b 100644 --- a/wrappers/rust/icicle-hash/build.rs +++ b/wrappers/rust/icicle-hash/build.rs @@ -38,6 +38,11 @@ fn main() { } else if cfg!(feature = "pull_metal_backend") { config.define("METAL_BACKEND", "main"); } + if cfg!(feature = "vulkan_backend") { + config.define("VULKAN_BACKEND", "local"); + } else if cfg!(feature = "pull_vulkan_backend") { + config.define("VULKAN_BACKEND", "main"); + } // Build let _ = config diff --git a/wrappers/rust/icicle-runtime/Cargo.toml b/wrappers/rust/icicle-runtime/Cargo.toml index 1ae0f72c7..e5c9b568c 100644 --- a/wrappers/rust/icicle-runtime/Cargo.toml +++ b/wrappers/rust/icicle-runtime/Cargo.toml @@ -22,3 +22,5 @@ cuda_backend = [] pull_cuda_backend = [] metal_backend = [] pull_metal_backend = [] +vulkan_backend = [] +pull_vulkan_backend = [] diff --git a/wrappers/rust/icicle-runtime/build.rs b/wrappers/rust/icicle-runtime/build.rs index c93c9ed94..6c7613001 100644 --- a/wrappers/rust/icicle-runtime/build.rs +++ b/wrappers/rust/icicle-runtime/build.rs @@ -38,6 +38,11 @@ fn main() { } else if cfg!(feature = "pull_metal_backend") { config.define("METAL_BACKEND", "main"); } + if cfg!(feature = "vulkan_backend") { + config.define("VULKAN_BACKEND", "local"); + } else if cfg!(feature = "pull_vulkan_backend") { + config.define("VULKAN_BACKEND", "main"); + } // Build let _ = config