Skip to content

Commit

Permalink
make rust features disable instead of enable and use in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
yshekel committed Aug 21, 2024
1 parent 6c25fc1 commit d5e4e73
Show file tree
Hide file tree
Showing 37 changed files with 108 additions and 95 deletions.
4 changes: 2 additions & 2 deletions examples/c++/best-practice-ntt/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions examples/c++/msm/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions examples/c++/ntt/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion examples/c++/pedersen-commitment/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
2 changes: 1 addition & 1 deletion examples/c++/polynomial-api/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ void example_device_memory_view()
auto coset_evals = std::make_unique<scalar_t[]>(size);
auto ntt_config = default_ntt_config<scalar_t>();
ntt_config.are_inputs_on_device = true; // using the device data directly as a view
ntt_config.coset_gen = get_root_of_unity<scalar_t>(size * 2);
ICICLE_CHECK(get_root_of_unity<scalar_t>(size * 2, &ntt_config.coset_gen));
ntt(d_coeffs.get(), size, NTTDir::kForward, ntt_config, coset_evals.get());
}

Expand Down
2 changes: 1 addition & 1 deletion examples/c++/polynomial-api/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
4 changes: 2 additions & 2 deletions examples/c++/polynomial_multiplication/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion examples/c++/risc0/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
9 changes: 7 additions & 2 deletions examples/rust/msm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
11 changes: 9 additions & 2 deletions examples/rust/ntt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
8 changes: 6 additions & 2 deletions examples/rust/polynomials/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]

4 changes: 2 additions & 2 deletions examples/rust/polynomials/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion icicle_v3/cmake/curve.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion icicle_v3/cmake/field.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 5 additions & 6 deletions icicle_v3/cmake/target_editor.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion icicle_v3/src/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
};

Expand Down
4 changes: 2 additions & 2 deletions wrappers/rust_v3/icicle-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ serial_test = "3.0.0"
once_cell = "1.10.0"

[features]
g2 = []
ec_ntt = []
no_g2 = []
no_ecntt = []
7 changes: 3 additions & 4 deletions wrappers/rust_v3/icicle-curves/icicle-bls12-377/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
Original file line number Diff line number Diff line change
@@ -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"))]
Expand Down
6 changes: 3 additions & 3 deletions wrappers/rust_v3/icicle-curves/icicle-bls12-377/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions wrappers/rust_v3/icicle-curves/icicle-bls12-377/src/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
Expand All @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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},
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions wrappers/rust_v3/icicle-curves/icicle-bls12-381/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
Original file line number Diff line number Diff line change
@@ -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"))]
Expand Down
4 changes: 2 additions & 2 deletions wrappers/rust_v3/icicle-curves/icicle-bls12-381/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
Loading

0 comments on commit d5e4e73

Please sign in to comment.