Skip to content

Commit 22e766b

Browse files
committed
Remove again all unsafe code.
1 parent 530b4d8 commit 22e766b

File tree

1 file changed

+1
-45
lines changed

1 file changed

+1
-45
lines changed

src/svm/kernel/rbf.rs

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -34,53 +34,9 @@ fn compute_core(rbf: Rbf, vectors: &MatSimd<f32x8, Rows>, feature: &VecSimd<f32x
3434
}
3535
}
3636

37-
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
38-
#[target_feature(enable = "avx")]
39-
#[inline]
40-
unsafe fn compute_avx(rbf: Rbf, vectors: &MatSimd<f32x8, Rows>, feature: &VecSimd<f32x8>, output: &mut [f64]) {
41-
compute_core(rbf, vectors, feature, output);
42-
}
43-
44-
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
45-
#[target_feature(enable = "avx2")]
46-
#[inline]
47-
unsafe fn compute_avx2(rbf: Rbf, vectors: &MatSimd<f32x8, Rows>, feature: &VecSimd<f32x8>, output: &mut [f64]) {
48-
compute_core(rbf, vectors, feature, output);
49-
}
50-
51-
#[cfg(target_arch = "aarch64")]
52-
#[target_feature(enable = "neon")]
53-
#[inline]
54-
unsafe fn compute_neon(rbf: Rbf, vectors: &MatSimd<f32x8, Rows>, feature: &VecSimd<f32x8>, output: &mut [f64]) {
55-
compute_core(rbf, vectors, feature, output);
56-
}
57-
58-
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
5937
#[inline]
6038
fn compute(rbf: Rbf, vectors: &MatSimd<f32x8, Rows>, feature: &VecSimd<f32x8>, output: &mut [f64]) {
61-
if is_x86_feature_detected!("avx2") {
62-
unsafe { compute_avx2(rbf, vectors, feature, output) }
63-
} else if is_x86_feature_detected!("avx") {
64-
unsafe { compute_avx(rbf, vectors, feature, output) }
65-
} else {
66-
compute_core(rbf, vectors, feature, output);
67-
}
68-
}
69-
70-
#[cfg(target_arch = "aarch64")]
71-
#[inline]
72-
fn compute(rbf: Rbf, vectors: &MatSimd<f32x8, Rows>, feature: &VecSimd<f32x8>, output: &mut [f64]) {
73-
if std::arch::is_aarch64_feature_detected!("neon") {
74-
unsafe { compute_neon(rbf, vectors, feature, output) }
75-
} else {
76-
compute_core(rbf, vectors, feature, output)
77-
}
78-
}
79-
80-
#[cfg(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")))]
81-
#[inline]
82-
fn compute(rbf: Rbf, vectors: &MatSimd<f32x8, Rows>, feature: &VecSimd<f32x8>, output: &mut [f64]) {
83-
compute_core(rbf, vectors, feature, output)
39+
compute_core(rbf, vectors, feature, output);
8440
}
8541

8642
impl KernelDense for Rbf {

0 commit comments

Comments
 (0)