refactor: remove sve feature flag
This commit is contained in:
parent
f894ed9cde
commit
457c985a92
4 changed files with 6 additions and 7 deletions
|
@ -36,7 +36,6 @@ default = ["std"]
|
||||||
executable = ["dep:clap", "dep:rand_utils", "std"]
|
executable = ["dep:clap", "dep:rand_utils", "std"]
|
||||||
serde = ["dep:serde", "serde?/alloc", "winter_math/serde"]
|
serde = ["dep:serde", "serde?/alloc", "winter_math/serde"]
|
||||||
std = ["blake3/std", "dep:cc", "dep:libc", "winter_crypto/std", "winter_math/std", "winter_utils/std"]
|
std = ["blake3/std", "dep:cc", "dep:libc", "winter_crypto/std", "winter_math/std", "winter_utils/std"]
|
||||||
sve = ["std"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
blake3 = { version = "1.5", default-features = false }
|
blake3 = { version = "1.5", default-features = false }
|
||||||
|
|
|
@ -53,9 +53,9 @@ RUSTFLAGS="-C target-feature=+avx2" cargo build --release
|
||||||
```
|
```
|
||||||
|
|
||||||
### SVE acceleration
|
### 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
|
```shell
|
||||||
RUSTFLAGS="-C target-cpu=native" cargo build --release --features sve
|
RUSTFLAGS="-C target-feature=+sve" cargo build --release
|
||||||
```
|
```
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
4
build.rs
4
build.rs
|
@ -2,7 +2,7 @@ fn main() {
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
compile_rpo_falcon();
|
compile_rpo_falcon();
|
||||||
|
|
||||||
#[cfg(all(target_feature = "sve", feature = "sve"))]
|
#[cfg(target_feature = "sve")]
|
||||||
compile_arch_arm64_sve();
|
compile_arch_arm64_sve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ fn compile_rpo_falcon() {
|
||||||
.compile("rpo_falcon512");
|
.compile("rpo_falcon512");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_feature = "sve", feature = "sve"))]
|
#[cfg(target_feature = "sve")]
|
||||||
fn compile_arch_arm64_sve() {
|
fn compile_arch_arm64_sve() {
|
||||||
const RPO_SVE_PATH: &str = "arch/arm64-sve/rpo";
|
const RPO_SVE_PATH: &str = "arch/arm64-sve/rpo";
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[cfg(all(target_feature = "sve", feature = "sve"))]
|
#[cfg(target_feature = "sve")]
|
||||||
pub mod optimized {
|
pub mod optimized {
|
||||||
use crate::hash::rescue::STATE_WIDTH;
|
use crate::hash::rescue::STATE_WIDTH;
|
||||||
use crate::Felt;
|
use crate::Felt;
|
||||||
|
@ -78,7 +78,7 @@ pub mod optimized {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(target_feature = "avx2", all(target_feature = "sve", feature = "sve"))))]
|
#[cfg(not(any(target_feature = "avx2", target_feature = "sve")))]
|
||||||
pub mod optimized {
|
pub mod optimized {
|
||||||
use crate::hash::rescue::STATE_WIDTH;
|
use crate::hash::rescue::STATE_WIDTH;
|
||||||
use crate::Felt;
|
use crate::Felt;
|
||||||
|
|
Loading…
Add table
Reference in a new issue