diff --git a/examples/c++/best-practice-ntt/run.sh b/examples/c++/best-practice-ntt/run.sh index d8062fe53..a064a57e6 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 db4529b87..975c87f93 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 dbf7cceda..44496b66c 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 0f2729f0d..6e4da3bad 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 79aa3caa6..06e33fa5c 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 0f2729f0d..6e4da3bad 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 d8062fe53..a064a57e6 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 de75fff93..d9b26b680 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 7e4489ea3..9d80f56dd 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 0e6dd3241..dd3fb1d2f 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 0553e9594..623106978 100644 --- a/examples/rust/polynomials/Cargo.toml +++ b/examples/rust/polynomials/Cargo.toml @@ -6,11 +6,15 @@ 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-bn254/no_ecntt", + "icicle-bn254/no_g2", +] diff --git a/examples/rust/polynomials/run.sh b/examples/rust/polynomials/run.sh index f8feb4306..2b1638b32 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 d804adf6f..c82d1b90b 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 99ccd6a5a..92f668539 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 4e8e433a5..33b9e3f19 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 4871c6b45..0180467f5 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 19d11e3ca..48c869ccf 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 bc8293f48..6f410540f 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 0fd2c027c..48a79a9b7 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 81af152bf..073aee01a 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/build.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/build.rs @@ -36,10 +36,10 @@ fn main() { 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_ecnt") { config.define("ECNTT", "OFF"); } @@ -71,7 +71,7 @@ fn main() { #[cfg(feature = "bw6-761-g2")] config_bw.define("G2", "ON"); - #[cfg(feature = "ec_ntt")] + #[cfg(not(feature = "no_ecntt"))] config_bw.define("ECNTT", "OFF"); // Build 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 6fcf6717c..16ae42b15 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 54424afbc..9155fa3af 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 8f8ca2979..33fa839d3 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 28371a5c1..c103e4c7d 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 b610a3c50..e4536daa4 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/build.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/build.rs @@ -35,10 +35,10 @@ fn main() { 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_ecnt") { 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 911ce7150..382266917 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 1d732923b..f4b4bd17e 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 ddd935c8c..be6529fe6 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 37b5b80e6..223909f9e 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 b371dbbd6..5af1471a8 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bn254/build.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bn254/build.rs @@ -35,10 +35,10 @@ fn main() { 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_ecnt") { 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 ec93a8338..45b9063d7 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 f727746e9..dd77b56b3 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 17ca58da3..b5c60679b 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bw6-761/Cargo.toml +++ b/wrappers/rust_v3/icicle-curves/icicle-bw6-761/Cargo.toml @@ -21,8 +21,8 @@ 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"] 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 9e02abbd7..16e9ed65f 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 fc72055a7..600094ea5 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 9350f3b82..c797f76ac 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 0013c753c..ca4d73727 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},