2022-06-27 15:07:52 -07:00
|
|
|
use crate::packed::PackedField;
|
2022-06-27 12:24:09 -07:00
|
|
|
use crate::types::Field;
|
2021-09-03 15:33:44 -07:00
|
|
|
|
|
|
|
|
/// Points us to the default packing for a particular field. There may me multiple choices of
|
2021-12-02 00:01:24 -08:00
|
|
|
/// PackedField for a particular Field (e.g. every Field is also a PackedField), but this is the
|
2021-09-03 15:33:44 -07:00
|
|
|
/// recommended one. The recommended packing varies by target_arch and target_feature.
|
|
|
|
|
pub trait Packable: Field {
|
2021-12-03 13:12:19 -08:00
|
|
|
type Packing: PackedField<Scalar = Self>;
|
2021-09-03 15:33:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<F: Field> Packable for F {
|
2021-12-03 13:12:19 -08:00
|
|
|
default type Packing = Self;
|
2021-09-03 15:33:44 -07:00
|
|
|
}
|
2021-09-03 19:55:16 -07:00
|
|
|
|
2022-01-06 09:19:32 -08:00
|
|
|
#[cfg(all(
|
|
|
|
|
target_arch = "x86_64",
|
|
|
|
|
target_feature = "avx2",
|
|
|
|
|
not(all(
|
|
|
|
|
target_feature = "avx512bw",
|
|
|
|
|
target_feature = "avx512cd",
|
|
|
|
|
target_feature = "avx512dq",
|
|
|
|
|
target_feature = "avx512f",
|
|
|
|
|
target_feature = "avx512vl"
|
|
|
|
|
))
|
|
|
|
|
))]
|
2021-12-28 11:51:13 -08:00
|
|
|
impl Packable for crate::goldilocks_field::GoldilocksField {
|
|
|
|
|
type Packing = crate::arch::x86_64::avx2_goldilocks_field::Avx2GoldilocksField;
|
2021-09-03 19:55:16 -07:00
|
|
|
}
|
2022-01-06 09:19:32 -08:00
|
|
|
|
|
|
|
|
#[cfg(all(
|
|
|
|
|
target_arch = "x86_64",
|
|
|
|
|
target_feature = "avx512bw",
|
|
|
|
|
target_feature = "avx512cd",
|
|
|
|
|
target_feature = "avx512dq",
|
|
|
|
|
target_feature = "avx512f",
|
|
|
|
|
target_feature = "avx512vl"
|
|
|
|
|
))]
|
|
|
|
|
impl Packable for crate::goldilocks_field::GoldilocksField {
|
|
|
|
|
type Packing = crate::arch::x86_64::avx512_goldilocks_field::Avx512GoldilocksField;
|
|
|
|
|
}
|