arnaucube
arnaucube/miden-cryptoPublic Self-hosted repository
refactor: remove sve feature flag
Bobbin Threadbare bobbinth@protonmail.com
Fri, 05 Jan 2024 22:06:55 -0800
commit

457c985a924c9713d9fdaf527c5f2e4336414d7c

parent

f894ed9cdee7fa5a5bd0cb6c3f4b4ac902648762

4 files changed, 6 insertions(+), 7 deletions(-)

jump to
M Cargo.toml → Cargo.toml

@@ -36,7 +36,6 @@ default = ["std"]

executable = ["dep:clap", "dep:rand_utils", "std"] serde = ["dep:serde", "serde?/alloc", "winter_math/serde"] std = ["blake3/std", "dep:cc", "dep:libc", "winter_crypto/std", "winter_math/std", "winter_utils/std"] -sve = ["std"] [dependencies] blake3 = { version = "1.5", default-features = false }
M README.md → README.md

@@ -53,9 +53,9 @@ RUSTFLAGS="-C target-feature=+avx2" cargo build --release

``` ### SVE acceleration -On platforms with [SVE](https://en.wikipedia.org/wiki/AArch64#Scalable_Vector_Extension_(SVE)) support, RPO and RPX hash function can be accelerated by using the vector processing unit. To enable SVE acceleration, the code needs to be compiled with the `sve` feature enabled. This feature has an effect only if the platform exposes `target-feature=sve` flag. On some platforms (e.g., Graviton 3), for this flag to be set, the compilation must be done in "native" mode. For example, to enable SVE acceleration on Graviton 3, we can execute the following: +On platforms with [SVE](https://en.wikipedia.org/wiki/AArch64#Scalable_Vector_Extension_(SVE)) support, RPO and RPX hash function can be accelerated by using the vector processing unit. To enable SVE acceleration, the code needs to be compiled with the `sve` target feature enabled. For example: ```shell -RUSTFLAGS="-C target-cpu=native" cargo build --release --features sve + RUSTFLAGS="-C target-feature=+sve" cargo build --release ``` ## Testing
M build.rs → build.rs

@@ -2,7 +2,7 @@ fn main() {

#[cfg(feature = "std")] compile_rpo_falcon(); - #[cfg(all(target_feature = "sve", feature = "sve"))] + #[cfg(target_feature = "sve")] compile_arch_arm64_sve(); }

@@ -34,7 +34,7 @@ .flag("-O3")

.compile("rpo_falcon512"); } -#[cfg(all(target_feature = "sve", feature = "sve"))] +#[cfg(target_feature = "sve")] fn compile_arch_arm64_sve() { const RPO_SVE_PATH: &str = "arch/arm64-sve/rpo";
M src/hash/rescue/arch/mod.rs → src/hash/rescue/arch/mod.rs

@@ -1,4 +1,4 @@

-#[cfg(all(target_feature = "sve", feature = "sve"))] +#[cfg(target_feature = "sve")] pub mod optimized { use crate::hash::rescue::STATE_WIDTH; use crate::Felt;

@@ -78,7 +78,7 @@ true

} } -#[cfg(not(any(target_feature = "avx2", all(target_feature = "sve", feature = "sve"))))] +#[cfg(not(any(target_feature = "avx2", target_feature = "sve")))] pub mod optimized { use crate::hash::rescue::STATE_WIDTH; use crate::Felt;