From 1158b04e4cafc899b35df730bba1f3f617aa1e8a Mon Sep 17 00:00:00 2001 From: Yuval Shekel Date: Wed, 21 Aug 2024 13:53:11 +0300 Subject: [PATCH] make rust features disable instead of enable and use in examples --- docs/docs/icicle/getting_started.md | 27 ++++++------ examples/c++/best-practice-ntt/run.sh | 4 +- examples/c++/msm/run.sh | 4 +- examples/c++/ntt/run.sh | 4 +- examples/c++/pedersen-commitment/run.sh | 2 +- examples/c++/polynomial-api/example.cpp | 2 +- examples/c++/polynomial-api/run.sh | 2 +- examples/c++/polynomial_multiplication/run.sh | 4 +- examples/c++/risc0/run.sh | 2 +- examples/rust/msm/Cargo.toml | 9 +++- examples/rust/ntt/Cargo.toml | 11 ++++- examples/rust/polynomials/Cargo.toml | 9 +++- examples/rust/polynomials/run.sh | 4 +- icicle_v3/cmake/curve.cmake | 2 +- icicle_v3/cmake/field.cmake | 2 +- icicle_v3/cmake/target_editor.cmake | 11 +++-- icicle_v3/src/runtime.cpp | 2 +- wrappers/rust_v3/icicle-core/Cargo.toml | 4 +- .../icicle-curves/icicle-bls12-377/Cargo.toml | 7 ++- .../icicle-bls12-377/benches/ecntt.rs | 6 +-- .../icicle-curves/icicle-bls12-377/build.rs | 44 ++++++++++--------- .../icicle-bls12-377/src/curve.rs | 10 ++--- .../icicle-bls12-377/src/msm/mod.rs | 8 ++-- .../icicle-curves/icicle-bls12-381/Cargo.toml | 6 +-- .../icicle-bls12-381/benches/ecntt.rs | 6 +-- .../icicle-curves/icicle-bls12-381/build.rs | 17 +++---- .../icicle-bls12-381/src/curve.rs | 10 ++--- .../icicle-bls12-381/src/msm/mod.rs | 8 ++-- .../icicle-curves/icicle-bn254/Cargo.toml | 6 +-- .../icicle-bn254/benches/ecntt.rs | 6 +-- .../icicle-curves/icicle-bn254/build.rs | 19 ++++---- .../icicle-curves/icicle-bn254/src/curve.rs | 10 ++--- .../icicle-curves/icicle-bn254/src/msm/mod.rs | 8 ++-- .../icicle-curves/icicle-bw6-761/Cargo.toml | 6 +-- .../icicle-curves/icicle-bw6-761/src/curve.rs | 6 +-- .../icicle-bw6-761/src/msm/mod.rs | 8 ++-- .../icicle-curves/icicle-grumpkin/Cargo.toml | 1 - .../icicle-grumpkin/src/msm/mod.rs | 2 +- 38 files changed, 159 insertions(+), 140 deletions(-) diff --git a/docs/docs/icicle/getting_started.md b/docs/docs/icicle/getting_started.md index c29deacb00..6f3b475556 100644 --- a/docs/docs/icicle/getting_started.md +++ b/docs/docs/icicle/getting_started.md @@ -90,11 +90,8 @@ You can customize your ICICLE build with the following flags: #### Features -By default, all [features](./libraries.md#supported-curves-and-operations) are enabled. - -:::note -Installed backends may implement and register all APIs, therefore by default we include them in the frontend part too. -::: +By default, all [features](./libraries.md#supported-curves-and-operations) are enabled. +This is since installed backends may implement and register all APIs. Missing APIs in the frontend would cause linkage to fail due to missing symbols. Therefore by default we include them in the frontend part too. To disable features, add the following to the cmake command. - ntt: `-DNTT=OFF` @@ -103,6 +100,10 @@ To disable features, add the following to the cmake command. - ecntt: `-DECNTT=OFF` - extension field: `-DEXT_FIELD=OFF` +:::tip +Disabling features is useful when developing with a backend that is slow to compile (e.g. CUDA backend); +::: + ### Rust: Build, Test, and Install To build and test ICICLE in Rust, follow these steps: @@ -116,19 +117,17 @@ cd wrappers/rust # or go to a specific field/curve 'cd wrappers/rust/icicle-fiel ```bash cargo build --release ``` -By default, all [features](./libraries.md#supported-curves-and-operations) are enabled. -In rust we have the following features: -- `g2` for G2 MSM -- `ec_ntt` for ECNTT +By default, all [supported features](./libraries.md#supported-curves-and-operations) are enabled. [See here for more details.](#features) +To disable, use the following cargo features: +- `no_g2` to disable G2 MSM +- `no_ecntt` to disable ECNTT -They can be disabled by +They can be disabled as follows: ```bash -cargo build --release --no-default-features # disable all features -cargo build --release --no-default-features --features "ec_ntt" # disable all except ec_ntt -cargo build --release --no-default-features --features "g2" # disable all except g2 +cargo build --release --no-default-features --features=no_ecntt,no_g2 ``` -:::tip +:::note If you have access to cuda backend repo, it can be built along ICICLE frontend by using the following cargo features: - `cuda_backend` : if the cuda backend resides in `icicle/backend/cuda` - `pull_cuda_backend` : to pull main branch and build it diff --git a/examples/c++/best-practice-ntt/run.sh b/examples/c++/best-practice-ntt/run.sh index d8062fe530..a064a57e6c 100755 --- a/examples/c++/best-practice-ntt/run.sh +++ b/examples/c++/best-practice-ntt/run.sh @@ -51,11 +51,11 @@ ICICLE_CUDA_SOURCE_DIR="${ICILE_DIR}/backend/cuda" # Build Icicle and the example app that links to it if [ "$DEVICE_TYPE" == "CUDA" ] && [ ! -d "${ICICLE_BACKEND_INSTALL_DIR}" ] && [ -d "${ICICLE_CUDA_SOURCE_DIR}" ]; then echo "Building icicle with CUDA backend" - cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DMSM=OFF -DCUDA_BACKEND=local -S "${ICILE_DIR}" -B build/icicle + cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DMSM=OFF -DG2=OFF -DECNTT=OFF -DCUDA_BACKEND=local -S "${ICILE_DIR}" -B build/icicle export ICICLE_BACKEND_INSTALL_DIR=$(realpath "build/icicle/backend") else echo "Building icicle without CUDA backend, ICICLE_BACKEND_INSTALL_DIR=${ICICLE_BACKEND_INSTALL_DIR}" - cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DMSM=OFF -S "${ICILE_DIR}" -B build/icicle + cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -S "${ICILE_DIR}" -B build/icicle fi cmake -DCMAKE_BUILD_TYPE=Release -S . -B build/example diff --git a/examples/c++/msm/run.sh b/examples/c++/msm/run.sh index db4529b87c..975c87f939 100755 --- a/examples/c++/msm/run.sh +++ b/examples/c++/msm/run.sh @@ -51,11 +51,11 @@ ICICLE_CUDA_SOURCE_DIR="${ICILE_DIR}/backend/cuda" # Build Icicle and the example app that links to it if [ "$DEVICE_TYPE" == "CUDA" ] && [ ! -d "${ICICLE_BACKEND_INSTALL_DIR}" ] && [ -d "${ICICLE_CUDA_SOURCE_DIR}" ]; then echo "Building icicle with CUDA backend" - cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DG2=ON -DCUDA_BACKEND=local -S "${ICILE_DIR}" -B build/icicle + cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DECNTT=OFF -DCUDA_BACKEND=local -S "${ICILE_DIR}" -B build/icicle export ICICLE_BACKEND_INSTALL_DIR=$(realpath "build/icicle/backend") else echo "Building icicle without CUDA backend, ICICLE_BACKEND_INSTALL_DIR=${ICICLE_BACKEND_INSTALL_DIR}" - cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DG2=ON -S "${ICILE_DIR}" -B build/icicle + cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -S "${ICILE_DIR}" -B build/icicle fi cmake -DCMAKE_BUILD_TYPE=Release -S . -B build/example diff --git a/examples/c++/ntt/run.sh b/examples/c++/ntt/run.sh index dbf7cceda2..44496b66c5 100755 --- a/examples/c++/ntt/run.sh +++ b/examples/c++/ntt/run.sh @@ -51,11 +51,11 @@ ICICLE_CUDA_SOURCE_DIR="${ICILE_DIR}/backend/cuda" # Build Icicle and the example app that links to it if [ "$DEVICE_TYPE" == "CUDA" ] && [ ! -d "${ICICLE_BACKEND_INSTALL_DIR}" ] && [ -d "${ICICLE_CUDA_SOURCE_DIR}" ]; then echo "Building icicle with CUDA backend" - cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DMSM=OFF -DCUDA_BACKEND=local -S "${ICILE_DIR}" -B build/icicle + cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DMSM=OFF -DG2=OFF -DECNTT=OFF -DCUDA_BACKEND=local -S "${ICILE_DIR}" -B build/icicle export ICICLE_BACKEND_INSTALL_DIR=$(realpath "build/icicle/backend") else echo "Building icicle without CUDA backend, ICICLE_BACKEND_INSTALL_DIR=${ICICLE_BACKEND_INSTALL_DIR}" - cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DMSM=OFF -S "${ICILE_DIR}" -B build/icicle + cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -S "${ICILE_DIR}" -B build/icicle fi cmake -DCMAKE_BUILD_TYPE=Release -S . -B build/example diff --git a/examples/c++/pedersen-commitment/run.sh b/examples/c++/pedersen-commitment/run.sh index 0f2729f0d5..6e4da3bad9 100755 --- a/examples/c++/pedersen-commitment/run.sh +++ b/examples/c++/pedersen-commitment/run.sh @@ -51,7 +51,7 @@ ICICLE_CUDA_SOURCE_DIR="${ICILE_DIR}/backend/cuda" # Build Icicle and the example app that links to it if [ "$DEVICE_TYPE" == "CUDA" ] && [ ! -d "${ICICLE_BACKEND_INSTALL_DIR}" ] && [ -d "${ICICLE_CUDA_SOURCE_DIR}" ]; then echo "Building icicle with CUDA backend" - cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DCUDA_BACKEND=local -S "${ICILE_DIR}" -B build/icicle + cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DG2=OFF -DECNTT=OFF -DCUDA_BACKEND=local -S "${ICILE_DIR}" -B build/icicle export ICICLE_BACKEND_INSTALL_DIR=$(realpath "build/icicle/backend") else echo "Building icicle without CUDA backend, ICICLE_BACKEND_INSTALL_DIR=${ICICLE_BACKEND_INSTALL_DIR}" diff --git a/examples/c++/polynomial-api/example.cpp b/examples/c++/polynomial-api/example.cpp index 79aa3caa66..06e33fa5ce 100644 --- a/examples/c++/polynomial-api/example.cpp +++ b/examples/c++/polynomial-api/example.cpp @@ -316,7 +316,7 @@ void example_device_memory_view() auto coset_evals = std::make_unique(size); auto ntt_config = default_ntt_config(); ntt_config.are_inputs_on_device = true; // using the device data directly as a view - ntt_config.coset_gen = get_root_of_unity(size * 2); + ICICLE_CHECK(get_root_of_unity(size * 2, &ntt_config.coset_gen)); ntt(d_coeffs.get(), size, NTTDir::kForward, ntt_config, coset_evals.get()); } diff --git a/examples/c++/polynomial-api/run.sh b/examples/c++/polynomial-api/run.sh index 0f2729f0d5..6e4da3bad9 100755 --- a/examples/c++/polynomial-api/run.sh +++ b/examples/c++/polynomial-api/run.sh @@ -51,7 +51,7 @@ ICICLE_CUDA_SOURCE_DIR="${ICILE_DIR}/backend/cuda" # Build Icicle and the example app that links to it if [ "$DEVICE_TYPE" == "CUDA" ] && [ ! -d "${ICICLE_BACKEND_INSTALL_DIR}" ] && [ -d "${ICICLE_CUDA_SOURCE_DIR}" ]; then echo "Building icicle with CUDA backend" - cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DCUDA_BACKEND=local -S "${ICILE_DIR}" -B build/icicle + cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DG2=OFF -DECNTT=OFF -DCUDA_BACKEND=local -S "${ICILE_DIR}" -B build/icicle export ICICLE_BACKEND_INSTALL_DIR=$(realpath "build/icicle/backend") else echo "Building icicle without CUDA backend, ICICLE_BACKEND_INSTALL_DIR=${ICICLE_BACKEND_INSTALL_DIR}" diff --git a/examples/c++/polynomial_multiplication/run.sh b/examples/c++/polynomial_multiplication/run.sh index d8062fe530..a064a57e6c 100755 --- a/examples/c++/polynomial_multiplication/run.sh +++ b/examples/c++/polynomial_multiplication/run.sh @@ -51,11 +51,11 @@ ICICLE_CUDA_SOURCE_DIR="${ICILE_DIR}/backend/cuda" # Build Icicle and the example app that links to it if [ "$DEVICE_TYPE" == "CUDA" ] && [ ! -d "${ICICLE_BACKEND_INSTALL_DIR}" ] && [ -d "${ICICLE_CUDA_SOURCE_DIR}" ]; then echo "Building icicle with CUDA backend" - cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DMSM=OFF -DCUDA_BACKEND=local -S "${ICILE_DIR}" -B build/icicle + cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DMSM=OFF -DG2=OFF -DECNTT=OFF -DCUDA_BACKEND=local -S "${ICILE_DIR}" -B build/icicle export ICICLE_BACKEND_INSTALL_DIR=$(realpath "build/icicle/backend") else echo "Building icicle without CUDA backend, ICICLE_BACKEND_INSTALL_DIR=${ICICLE_BACKEND_INSTALL_DIR}" - cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -DMSM=OFF -S "${ICILE_DIR}" -B build/icicle + cmake -DCMAKE_BUILD_TYPE=Release -DCURVE=bn254 -S "${ICILE_DIR}" -B build/icicle fi cmake -DCMAKE_BUILD_TYPE=Release -S . -B build/example diff --git a/examples/c++/risc0/run.sh b/examples/c++/risc0/run.sh index de75fff935..d9b26b6805 100755 --- a/examples/c++/risc0/run.sh +++ b/examples/c++/risc0/run.sh @@ -51,7 +51,7 @@ ICICLE_CUDA_SOURCE_DIR="${ICILE_DIR}/backend/cuda" # Build Icicle and the example app that links to it if [ "$DEVICE_TYPE" == "CUDA" ] && [ ! -d "${ICICLE_BACKEND_INSTALL_DIR}" ] && [ -d "${ICICLE_CUDA_SOURCE_DIR}" ]; then echo "Building icicle with CUDA backend" - cmake -DCMAKE_BUILD_TYPE=Release -DFIELD=babybear -DCUDA_BACKEND=local -S "${ICILE_DIR}" -B build/icicle + cmake -DCMAKE_BUILD_TYPE=Release -DFIELD=babybear -DMSM=OFF -DG2=OFF -DECNTT=OFF -DCUDA_BACKEND=local -S "${ICILE_DIR}" -B build/icicle export ICICLE_BACKEND_INSTALL_DIR=$(realpath "build/icicle/backend") else echo "Building icicle without CUDA backend, ICICLE_BACKEND_INSTALL_DIR=${ICICLE_BACKEND_INSTALL_DIR}" diff --git a/examples/rust/msm/Cargo.toml b/examples/rust/msm/Cargo.toml index 7e4489ea30..9d80f56dd1 100644 --- a/examples/rust/msm/Cargo.toml +++ b/examples/rust/msm/Cargo.toml @@ -6,9 +6,14 @@ edition = "2018" [dependencies] icicle-runtime = { path = "../../../wrappers/rust_v3/icicle-runtime" } icicle-core = { path = "../../../wrappers/rust_v3/icicle-core" } -icicle-bn254 = { path = "../../../wrappers/rust_v3/icicle-curves/icicle-bn254", features = ["g2"] } +icicle-bn254 = { path = "../../../wrappers/rust_v3/icicle-curves/icicle-bn254" } icicle-bls12-377 = { path = "../../../wrappers/rust_v3/icicle-curves/icicle-bls12-377" } clap = { version = "<=4.4.12", features = ["derive"] } [features] -cuda = ["icicle-runtime/cuda_backend", "icicle-bn254/cuda_backend", "icicle-bls12-377/cuda_backend"] +cuda = ["icicle-runtime/cuda_backend", + "icicle-bn254/cuda_backend", + "icicle-bls12-377/cuda_backend", + "icicle-bn254/no_ecntt", + "icicle-bls12-377/no_ecntt" +] diff --git a/examples/rust/ntt/Cargo.toml b/examples/rust/ntt/Cargo.toml index 0e6dd3241a..b8d9117aca 100644 --- a/examples/rust/ntt/Cargo.toml +++ b/examples/rust/ntt/Cargo.toml @@ -6,10 +6,17 @@ edition = "2018" [dependencies] icicle-runtime = { path = "../../../wrappers/rust_v3/icicle-runtime" } icicle-core = { path = "../../../wrappers/rust_v3/icicle-core" } -icicle-bn254 = { path = "../../../wrappers/rust_v3/icicle-curves/icicle-bn254", features = ["g2"] } +icicle-bn254 = { path = "../../../wrappers/rust_v3/icicle-curves/icicle-bn254" } icicle-bls12-377 = { path = "../../../wrappers/rust_v3/icicle-curves/icicle-bls12-377" } clap = { version = "<=4.4.12", features = ["derive"] } [features] -cuda = ["icicle-runtime/cuda_backend", "icicle-bn254/cuda_backend", "icicle-bls12-377/cuda_backend"] +cuda = ["icicle-runtime/cuda_backend", + "icicle-bn254/cuda_backend", + "icicle-bn254/no_ecntt", + "icicle-bn254/no_g2", + "icicle-bls12-377/cuda_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 0553e95945..ad038cb73a 100644 --- a/examples/rust/polynomials/Cargo.toml +++ b/examples/rust/polynomials/Cargo.toml @@ -6,11 +6,16 @@ edition = "2018" [dependencies] icicle-runtime = { path = "../../../wrappers/rust_v3/icicle-runtime" } icicle-core = { path = "../../../wrappers/rust_v3/icicle-core" } -icicle-bn254 = { path = "../../../wrappers/rust_v3/icicle-curves/icicle-bn254", features = ["g2"] } +icicle-bn254 = { path = "../../../wrappers/rust_v3/icicle-curves/icicle-bn254" } icicle-babybear = { path = "../../../wrappers/rust_v3/icicle-fields/icicle-babybear" } clap = { version = "<=4.4.12", features = ["derive"] } [features] -cuda = ["icicle-runtime/cuda_backend", "icicle-bn254/cuda_backend", "icicle-babybear/cuda_backend"] +cuda = ["icicle-runtime/cuda_backend", + "icicle-bn254/cuda_backend", + "icicle-babybear/cuda_backend", + "icicle-bn254/no_ecntt", + "icicle-bn254/no_g2", +] diff --git a/examples/rust/polynomials/run.sh b/examples/rust/polynomials/run.sh index f8feb43069..2b1638b32d 100755 --- a/examples/rust/polynomials/run.sh +++ b/examples/rust/polynomials/run.sh @@ -51,9 +51,9 @@ ICICLE_CUDA_SOURCE_DIR="${ICILE_DIR}/backend/cuda" # Build Icicle and the example app that links to it if [ "$DEVICE_TYPE" == "CUDA" ] && [ ! -d "${ICICLE_BACKEND_INSTALL_DIR}" ] && [ -d "${ICICLE_CUDA_SOURCE_DIR}" ]; then echo "Building icicle with CUDA backend" - cargo build --release --features=cuda + cargo build --release --no-default-features --features=cuda export ICICLE_BACKEND_INSTALL_DIR=$(realpath "./target/release/deps/icicle/lib/backend") - cargo run --release --features=cuda -- --device-type "${DEVICE_TYPE}" + cargo run --release --no-default-features --features=cuda -- --device-type "${DEVICE_TYPE}" else echo "Building icicle without CUDA backend, ICICLE_BACKEND_INSTALL_DIR=${ICICLE_BACKEND_INSTALL_DIR}" export ICICLE_BACKEND_INSTALL_DIR="$ICICLE_BACKEND_INSTALL_DIR"; diff --git a/icicle_v3/cmake/curve.cmake b/icicle_v3/cmake/curve.cmake index d804adf6f5..c82d1b90b0 100644 --- a/icicle_v3/cmake/curve.cmake +++ b/icicle_v3/cmake/curve.cmake @@ -24,7 +24,7 @@ function(check_curve CURVE CURVE_INDEX_OUT FEATURES_STRING_OUT) if (CURVE STREQUAL CURVE_NAME) set(IS_CURVE_SUPPORTED TRUE) - message(STATUS "building CURVE_NAME=${CURVE_NAME} ; CURVE_INDEX=${CURVE_INDEX} ; FEATURES=${FEATURES_STRING}") + message(STATUS "building CURVE_NAME=${CURVE_NAME} ; CURVE_INDEX=${CURVE_INDEX} ; SUPPORTED_FEATURES=${FEATURES_STRING}") # Output the CURVE_INDEX and FEATURES_STRING set(${CURVE_INDEX_OUT} "${CURVE_INDEX}" PARENT_SCOPE) set(${FEATURES_STRING_OUT} "${FEATURES_STRING}" PARENT_SCOPE) diff --git a/icicle_v3/cmake/field.cmake b/icicle_v3/cmake/field.cmake index 99ccd6a5ab..92f6685396 100644 --- a/icicle_v3/cmake/field.cmake +++ b/icicle_v3/cmake/field.cmake @@ -24,7 +24,7 @@ function(check_field FIELD FIELD_INDEX_OUT FEATURES_STRING_OUT) if (FIELD STREQUAL FIELD_NAME) set(IS_FIELD_SUPPORTED TRUE) - message(STATUS "building FIELD_NAME=${FIELD_NAME} ; FIELD_INDEX=${FIELD_INDEX} ; FEATURES=${FEATURES_STRING}") + message(STATUS "building FIELD_NAME=${FIELD_NAME} ; FIELD_INDEX=${FIELD_INDEX} ; SUPPORTED_FEATURES=${FEATURES_STRING}") # Output the FIELD_INDEX and FEATURES_STRING set(${FIELD_INDEX_OUT} "${FIELD_INDEX}" PARENT_SCOPE) set(${FEATURES_STRING_OUT} "${FEATURES_STRING}" PARENT_SCOPE) diff --git a/icicle_v3/cmake/target_editor.cmake b/icicle_v3/cmake/target_editor.cmake index 4e8e433a5a..33b9e3f191 100644 --- a/icicle_v3/cmake/target_editor.cmake +++ b/icicle_v3/cmake/target_editor.cmake @@ -19,18 +19,17 @@ endfunction() function(handle_ntt TARGET FEATURE_LIST) if(NTT AND "NTT" IN_LIST FEATURE_LIST) - target_compile_definitions(${TARGET} PUBLIC NTT=${NTT}) + target_compile_definitions(${TARGET} PUBLIC NTT=${NTT}) target_sources(${TARGET} PRIVATE src/ntt.cpp src/polynomials/polynomials.cpp src/polynomials/polynomials_c_api.cpp src/polynomials/polynomials_abstract_factory.cpp ) - set(NTT ON CACHE BOOL "Enable NTT feature" FORCE) - else() - set(NTT OFF CACHE BOOL "NTT not available for this field" FORCE) - message(STATUS "NTT not available for this field") - endif() + set(NTT ON CACHE BOOL "Enable NTT feature" FORCE) + else() + set(NTT OFF CACHE BOOL "NTT not available for this field" FORCE) + endif() endfunction() function(handle_ext_field TARGET FEATURE_LIST) diff --git a/icicle_v3/src/runtime.cpp b/icicle_v3/src/runtime.cpp index 4871c6b451..0180467f52 100644 --- a/icicle_v3/src/runtime.cpp +++ b/icicle_v3/src/runtime.cpp @@ -275,7 +275,7 @@ extern "C" eIcicleError icicle_load_backend(const char* path, bool is_recursive) auto load_library = [](const char* filePath) { ICICLE_LOG_DEBUG << "Attempting load: " << filePath; - void* handle = dlopen(filePath, RTLD_LAZY | RTLD_GLOBAL); + void* handle = dlopen(filePath, RTLD_LAZY); if (!handle) { ICICLE_LOG_ERROR << "Failed to load " << filePath << ": " << dlerror(); } }; diff --git a/wrappers/rust_v3/icicle-core/Cargo.toml b/wrappers/rust_v3/icicle-core/Cargo.toml index 19d11e3caf..48c869ccfe 100644 --- a/wrappers/rust_v3/icicle-core/Cargo.toml +++ b/wrappers/rust_v3/icicle-core/Cargo.toml @@ -19,5 +19,5 @@ serial_test = "3.0.0" once_cell = "1.10.0" [features] -g2 = [] -ec_ntt = [] +no_g2 = [] +no_ecntt = [] diff --git a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/Cargo.toml b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/Cargo.toml index bc8293f48d..6f410540fe 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/Cargo.toml +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/Cargo.toml @@ -20,11 +20,10 @@ serial_test = "3.0.0" cmake = "0.1.50" [features] -default = ["g2", "ec_ntt"] +default = [] bw6-761 = [] -bw6-761-g2 = ["bw6-761"] -g2 = ["icicle-core/g2"] -ec_ntt = ["icicle-core/ec_ntt"] +no_g2 = ["icicle-core/no_g2"] +no_ecntt = ["icicle-core/no_ecntt"] cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] diff --git a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/benches/ecntt.rs b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/benches/ecntt.rs index 0fd2c027cb..48a79a9b7e 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/benches/ecntt.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/benches/ecntt.rs @@ -1,9 +1,9 @@ -#[cfg(feature = "ec_ntt")] +#[cfg(not(feature = "no_ecntt"))] use icicle_bls12_377::curve::{CurveCfg, ScalarField}; -#[cfg(feature = "ec_ntt")] +#[cfg(not(feature = "no_ecntt"))] use icicle_core::impl_ecntt_bench; -#[cfg(feature = "ec_ntt")] +#[cfg(not(feature = "no_ecntt"))] impl_ecntt_bench!("bls12_377", ScalarField, CurveCfg); #[cfg(not(feature = "ec_ntt"))] diff --git a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/build.rs b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/build.rs index 81af152bf0..a4e68994a6 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/build.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/build.rs @@ -29,17 +29,18 @@ fn main() { .define("CMAKE_BUILD_TYPE", "Release") .define("CMAKE_INSTALL_PREFIX", &icicle_install_dir); - #[cfg(feature = "cuda_backend")] - config.define("CUDA_BACKEND", "local"); - - #[cfg(feature = "pull_cuda_backend")] - config.define("CUDA_BACKEND", "main"); - + // build (or pull and build) cuda backend if feature enabled. + // Note: this requires access to the repo + if cfg!(feature = "cuda_backend") { + config.define("CUDA_BACKEND", "local"); + } else if cfg!(feature = "pull_cuda_backend") { + config.define("CUDA_BACKEND", "main"); + } // Optional Features that are default ON (so that default matches any backend) - if !cfg!(feature = "g2") { + if cfg!(feature = "no_g2") { config.define("G2", "OFF"); } - if !cfg!(feature = "ec_ntt") { + if cfg!(feature = "no_ecntt") { config.define("ECNTT", "OFF"); } @@ -61,18 +62,21 @@ fn main() { .define("CMAKE_BUILD_TYPE", "Release") .define("CMAKE_INSTALL_PREFIX", &icicle_install_dir); - #[cfg(feature = "cuda_backend")] - config_bw.define("CUDA_BACKEND", "local"); - - #[cfg(feature = "pull_cuda_backend")] - config_bw.define("CUDA_BACKEND", "main"); - - // Optional Features - #[cfg(feature = "bw6-761-g2")] - config_bw.define("G2", "ON"); - - #[cfg(feature = "ec_ntt")] - config_bw.define("ECNTT", "OFF"); + // build (or pull and build) cuda backend if feature enabled. + // Note: this requires access to the repo + if cfg!(feature = "cuda_backend") { + config.define("CUDA_BACKEND", "local"); + } else if cfg!(feature = "pull_cuda_backend") { + config.define("CUDA_BACKEND", "main"); + } + + // Optional Features that are default ON (so that default matches any backend) + if cfg!(feature = "no_g2") { + config.define("G2", "OFF"); + } + if cfg!(feature = "no_ecntt") { + config.define("ECNTT", "OFF"); + } // Build let _ = config_bw diff --git a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/src/curve.rs b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/src/curve.rs index 6fcf6717c6..16ae42b152 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/src/curve.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/src/curve.rs @@ -13,7 +13,7 @@ use icicle_runtime::{ pub(crate) const SCALAR_LIMBS: usize = 8; pub(crate) const BASE_LIMBS: usize = 12; -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] pub(crate) const G2_BASE_LIMBS: usize = 24; impl_scalar_field!("bls12_377", bls12_377_sf, SCALAR_LIMBS, ScalarField, ScalarCfg); @@ -34,9 +34,9 @@ impl_curve!( G1Projective ); -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] impl_field!(G2_BASE_LIMBS, G2BaseField, G2BaseCfg); -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] impl_curve!( "bls12_377_g2", bls12_377_g2, @@ -50,7 +50,7 @@ impl_curve!( #[cfg(test)] mod tests { use super::{CurveCfg, ScalarField, BASE_LIMBS}; - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] use super::{G2CurveCfg, G2_BASE_LIMBS}; use icicle_core::curve::Curve; use icicle_core::test_utilities; @@ -60,7 +60,7 @@ mod tests { impl_field_tests!(ScalarField); impl_curve_tests!(BASE_LIMBS, CurveCfg); - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] mod g2 { use super::*; impl_curve_tests!(G2_BASE_LIMBS, G2CurveCfg); diff --git a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/src/msm/mod.rs b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/src/msm/mod.rs index 54424afbc0..9155fa3af5 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/src/msm/mod.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/src/msm/mod.rs @@ -1,5 +1,5 @@ use crate::curve::CurveCfg; -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] use crate::curve::G2CurveCfg; use icicle_core::{ curve::{Affine, Curve, Projective}, @@ -12,19 +12,19 @@ use icicle_runtime::{ }; impl_msm!("bls12_377", bls12_377, CurveCfg); -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] impl_msm!("bls12_377_g2", bls12_377_g2, G2CurveCfg); #[cfg(test)] pub(crate) mod tests { use crate::curve::CurveCfg; - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] use crate::curve::G2CurveCfg; use icicle_core::impl_msm_tests; use icicle_core::msm::tests::*; impl_msm_tests!(CurveCfg); - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] mod g2 { use super::*; impl_msm_tests!(G2CurveCfg); diff --git a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/Cargo.toml b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/Cargo.toml index 8f8ca29790..33fa839d34 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/Cargo.toml +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/Cargo.toml @@ -20,9 +20,9 @@ serial_test = "3.0.0" cmake = "0.1.50" [features] -default = ["g2", "ec_ntt"] -g2 = ["icicle-core/g2"] -ec_ntt = ["icicle-core/ec_ntt"] +default = [] +no_g2 = ["icicle-core/no_g2"] +no_ecntt = ["icicle-core/no_ecntt"] cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] diff --git a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/benches/ecntt.rs b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/benches/ecntt.rs index 28371a5c10..c103e4c7d2 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/benches/ecntt.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/benches/ecntt.rs @@ -1,9 +1,9 @@ -#[cfg(feature = "ec_ntt")] +#[cfg(not(feature = "no_ecntt"))] use icicle_bls12_381::curve::{CurveCfg, ScalarField}; -#[cfg(feature = "ec_ntt")] +#[cfg(not(feature = "no_ecntt"))] use icicle_core::impl_ecntt_bench; -#[cfg(feature = "ec_ntt")] +#[cfg(not(feature = "no_ecntt"))] impl_ecntt_bench!("bls12_381", ScalarField, CurveCfg); #[cfg(not(feature = "ec_ntt"))] diff --git a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/build.rs b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/build.rs index b610a3c501..74d32d0c7f 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/build.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/build.rs @@ -28,17 +28,18 @@ fn main() { .define("CMAKE_BUILD_TYPE", "Release") .define("CMAKE_INSTALL_PREFIX", &icicle_install_dir); - #[cfg(feature = "cuda_backend")] - config.define("CUDA_BACKEND", "local"); - - #[cfg(feature = "pull_cuda_backend")] - config.define("CUDA_BACKEND", "main"); - + // build (or pull and build) cuda backend if feature enabled. + // Note: this requires access to the repo + if cfg!(feature = "cuda_backend") { + config.define("CUDA_BACKEND", "local"); + } else if cfg!(feature = "pull_cuda_backend") + config.define("CUDA_BACKEND", "main"); + } // Optional Features that are default ON (so that default matches any backend) - if !cfg!(feature = "g2") { + if cfg!(feature = "no_g2") { config.define("G2", "OFF"); } - if !cfg!(feature = "ec_ntt") { + if cfg!(feature = "no_ecntt") { config.define("ECNTT", "OFF"); } diff --git a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/src/curve.rs b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/src/curve.rs index 911ce7150a..3822669178 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/src/curve.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/src/curve.rs @@ -13,7 +13,7 @@ use icicle_runtime::{ pub(crate) const SCALAR_LIMBS: usize = 8; pub(crate) const BASE_LIMBS: usize = 12; -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] pub(crate) const G2_BASE_LIMBS: usize = 24; impl_scalar_field!("bls12_381", bls12_381_sf, SCALAR_LIMBS, ScalarField, ScalarCfg); @@ -29,9 +29,9 @@ impl_curve!( G1Projective ); -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] impl_field!(G2_BASE_LIMBS, G2BaseField, G2BaseCfg); -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] impl_curve!( "bls12_381_g2", bls12_381_g2, @@ -45,7 +45,7 @@ impl_curve!( #[cfg(test)] mod tests { use super::{CurveCfg, ScalarField, BASE_LIMBS}; - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] use super::{G2CurveCfg, G2_BASE_LIMBS}; use icicle_core::curve::Curve; use icicle_core::test_utilities; @@ -55,7 +55,7 @@ mod tests { impl_field_tests!(ScalarField); impl_curve_tests!(BASE_LIMBS, CurveCfg); - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] mod g2 { use super::*; impl_curve_tests!(G2_BASE_LIMBS, G2CurveCfg); diff --git a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/src/msm/mod.rs b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/src/msm/mod.rs index 1d732923bc..f4b4bd17ef 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/src/msm/mod.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/src/msm/mod.rs @@ -1,5 +1,5 @@ use crate::curve::CurveCfg; -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] use crate::curve::G2CurveCfg; use icicle_core::{ curve::{Affine, Curve, Projective}, @@ -12,19 +12,19 @@ use icicle_runtime::{ }; impl_msm!("bls12_381", bls12_381, CurveCfg); -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] impl_msm!("bls12_381_g2", bls12_381_g2, G2CurveCfg); #[cfg(test)] pub(crate) mod tests { use crate::curve::CurveCfg; - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] use crate::curve::G2CurveCfg; use icicle_core::impl_msm_tests; use icicle_core::msm::tests::*; impl_msm_tests!(CurveCfg); - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] mod g2 { use super::*; impl_msm_tests!(G2CurveCfg); diff --git a/wrappers/rust_v3/icicle-curves/icicle-bn254/Cargo.toml b/wrappers/rust_v3/icicle-curves/icicle-bn254/Cargo.toml index ddd935c8c1..be6529fe60 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bn254/Cargo.toml +++ b/wrappers/rust_v3/icicle-curves/icicle-bn254/Cargo.toml @@ -20,9 +20,9 @@ serial_test = "3.0.0" cmake = "0.1.50" [features] -default = ["g2", "ec_ntt"] -g2 = ["icicle-core/g2"] -ec_ntt = ["icicle-core/ec_ntt"] +default = [] +no_g2 = ["icicle-core/no_g2"] +no_ecntt = ["icicle-core/no_ecntt"] cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] diff --git a/wrappers/rust_v3/icicle-curves/icicle-bn254/benches/ecntt.rs b/wrappers/rust_v3/icicle-curves/icicle-bn254/benches/ecntt.rs index 37b5b80e6d..223909f9e9 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bn254/benches/ecntt.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bn254/benches/ecntt.rs @@ -1,9 +1,9 @@ -#[cfg(feature = "ec_ntt")] +#[cfg(not(feature = "no_ecntt"))] use icicle_bn254::curve::{CurveCfg, ScalarField}; -#[cfg(feature = "ec_ntt")] +#[cfg(not(feature = "no_ecntt"))] use icicle_core::impl_ecntt_bench; -#[cfg(feature = "ec_ntt")] +#[cfg(not(feature = "no_ecntt"))] impl_ecntt_bench!("bn254", ScalarField, CurveCfg); #[cfg(not(feature = "ec_ntt"))] diff --git a/wrappers/rust_v3/icicle-curves/icicle-bn254/build.rs b/wrappers/rust_v3/icicle-curves/icicle-bn254/build.rs index b371dbbd6e..c4fbf6ba46 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bn254/build.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bn254/build.rs @@ -25,20 +25,21 @@ fn main() { }; config .define("CURVE", "bn254") - .define("CMAKE_BUILD_TYPE", "Release") + .define("CMAKE_BUILD_TYPE", "Debug") .define("CMAKE_INSTALL_PREFIX", &icicle_install_dir); - #[cfg(feature = "cuda_backend")] - config.define("CUDA_BACKEND", "local"); - - #[cfg(feature = "pull_cuda_backend")] - config.define("CUDA_BACKEND", "main"); - + // build (or pull and build) cuda backend if feature enabled. + // Note: this requires access to the repo + if cfg!(feature = "cuda_backend") { + config.define("CUDA_BACKEND", "local"); + } else if cfg!(feature = "pull_cuda_backend") { + config.define("CUDA_BACKEND", "main"); + } // Optional Features that are default ON (so that default matches any backend) - if !cfg!(feature = "g2") { + if cfg!(feature = "no_g2") { config.define("G2", "OFF"); } - if !cfg!(feature = "ec_ntt") { + if cfg!(feature = "no_ecntt") { config.define("ECNTT", "OFF"); } diff --git a/wrappers/rust_v3/icicle-curves/icicle-bn254/src/curve.rs b/wrappers/rust_v3/icicle-curves/icicle-bn254/src/curve.rs index ec93a83383..45b9063d7f 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bn254/src/curve.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bn254/src/curve.rs @@ -13,16 +13,16 @@ use icicle_runtime::{ pub(crate) const SCALAR_LIMBS: usize = 8; pub(crate) const BASE_LIMBS: usize = 8; -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] pub(crate) const G2_BASE_LIMBS: usize = 16; impl_scalar_field!("bn254", bn254_sf, SCALAR_LIMBS, ScalarField, ScalarCfg); impl_field!(BASE_LIMBS, BaseField, BaseCfg); impl_curve!("bn254", bn254, CurveCfg, ScalarField, BaseField, G1Affine, G1Projective); -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] impl_field!(G2_BASE_LIMBS, G2BaseField, G2BaseCfg); -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] impl_curve!( "bn254_g2", bn254_g2, @@ -36,7 +36,7 @@ impl_curve!( #[cfg(test)] mod tests { use super::{CurveCfg, ScalarField, BASE_LIMBS}; - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] use super::{G2CurveCfg, G2_BASE_LIMBS}; use icicle_core::curve::Curve; use icicle_core::test_utilities; @@ -46,7 +46,7 @@ mod tests { impl_field_tests!(ScalarField); impl_curve_tests!(BASE_LIMBS, CurveCfg); - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] mod g2 { use super::*; impl_curve_tests!(G2_BASE_LIMBS, G2CurveCfg); diff --git a/wrappers/rust_v3/icicle-curves/icicle-bn254/src/msm/mod.rs b/wrappers/rust_v3/icicle-curves/icicle-bn254/src/msm/mod.rs index f727746e94..dd77b56b3c 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bn254/src/msm/mod.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bn254/src/msm/mod.rs @@ -1,5 +1,5 @@ use crate::curve::CurveCfg; -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] use crate::curve::G2CurveCfg; use icicle_core::{ curve::{Affine, Curve, Projective}, @@ -12,19 +12,19 @@ use icicle_runtime::{ }; impl_msm!("bn254", bn254, CurveCfg); -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] impl_msm!("bn254_g2", bn254_g2, G2CurveCfg); #[cfg(test)] pub(crate) mod tests { use crate::curve::CurveCfg; - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] use crate::curve::G2CurveCfg; use icicle_core::impl_msm_tests; use icicle_core::msm::tests::*; impl_msm_tests!(CurveCfg); - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] mod g2 { use super::*; impl_msm_tests!(G2CurveCfg); diff --git a/wrappers/rust_v3/icicle-curves/icicle-bw6-761/Cargo.toml b/wrappers/rust_v3/icicle-curves/icicle-bw6-761/Cargo.toml index 17ca58da30..e13159098f 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bw6-761/Cargo.toml +++ b/wrappers/rust_v3/icicle-curves/icicle-bw6-761/Cargo.toml @@ -11,7 +11,6 @@ repository.workspace = true icicle-core = { workspace = true } icicle-runtime = { workspace = true } icicle-bls12-377 = { path = "../../icicle-curves/icicle-bls12-377", features = ["bw6-761"] } -# criterion = "0.3" [dev-dependencies] criterion = "0.3" @@ -21,8 +20,9 @@ serial_test = "3.0.0" cmake = "0.1.50" [features] -default = ["g2"] -g2 = ["icicle-bls12-377/bw6-761-g2"] +default = [] +no_g2 = ["icicle-bls12-377/no_g2"] +no_ecntt = ["icicle-bls12-377/no_ecntt"] cuda_backend = ["icicle-bls12-377/cuda_backend"] pull_cuda_backend = ["icicle-bls12-377/pull_cuda_backend"] diff --git a/wrappers/rust_v3/icicle-curves/icicle-bw6-761/src/curve.rs b/wrappers/rust_v3/icicle-curves/icicle-bw6-761/src/curve.rs index 9e02abbd79..16e9ed65f9 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bw6-761/src/curve.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bw6-761/src/curve.rs @@ -21,7 +21,7 @@ impl_curve!( G1Affine, G1Projective ); -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] impl_curve!( "bw6_761_g2", bw6_761_g2, @@ -34,7 +34,7 @@ impl_curve!( #[cfg(test)] mod tests { - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] use super::G2CurveCfg; use super::{CurveCfg, ScalarField, BASE_LIMBS}; use icicle_core::curve::Curve; @@ -45,7 +45,7 @@ mod tests { impl_field_tests!(ScalarField); impl_curve_tests!(BASE_LIMBS, CurveCfg); - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] mod g2 { use super::*; impl_curve_tests!(BASE_LIMBS, G2CurveCfg); diff --git a/wrappers/rust_v3/icicle-curves/icicle-bw6-761/src/msm/mod.rs b/wrappers/rust_v3/icicle-curves/icicle-bw6-761/src/msm/mod.rs index fc72055a79..600094ea59 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bw6-761/src/msm/mod.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bw6-761/src/msm/mod.rs @@ -1,5 +1,5 @@ use crate::curve::CurveCfg; -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] use crate::curve::G2CurveCfg; use icicle_core::{ curve::{Affine, Curve, Projective}, @@ -12,19 +12,19 @@ use icicle_runtime::{ }; impl_msm!("bw6_761", bw6_761, CurveCfg); -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] impl_msm!("bw6_761_g2", bw6_761_g2, G2CurveCfg); #[cfg(test)] pub(crate) mod tests { use crate::curve::CurveCfg; - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] use crate::curve::G2CurveCfg; use icicle_core::impl_msm_tests; use icicle_core::msm::tests::*; impl_msm_tests!(CurveCfg); - #[cfg(feature = "g2")] + #[cfg(not(feature = "no_g2"))] mod g2 { use super::*; impl_msm_tests!(G2CurveCfg); diff --git a/wrappers/rust_v3/icicle-curves/icicle-grumpkin/Cargo.toml b/wrappers/rust_v3/icicle-curves/icicle-grumpkin/Cargo.toml index 9350f3b821..c797f76acd 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-grumpkin/Cargo.toml +++ b/wrappers/rust_v3/icicle-curves/icicle-grumpkin/Cargo.toml @@ -21,7 +21,6 @@ cmake = "0.1.50" [features] default = [] -ec_ntt = ["icicle-core/ec_ntt"] # why? cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] diff --git a/wrappers/rust_v3/icicle-curves/icicle-grumpkin/src/msm/mod.rs b/wrappers/rust_v3/icicle-curves/icicle-grumpkin/src/msm/mod.rs index 0013c753c1..ca4d73727f 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-grumpkin/src/msm/mod.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-grumpkin/src/msm/mod.rs @@ -1,5 +1,5 @@ use crate::curve::CurveCfg; -#[cfg(feature = "g2")] +#[cfg(not(feature = "no_g2"))] use crate::curve::G2CurveCfg; use icicle_core::{ curve::{Affine, Curve, Projective},