Skip to content

Commit 13ef5d9

Browse files
committed
Add ci job for simd models tests, with logging of rng seed.
1 parent 52cd8d9 commit 13ef5d9

File tree

7 files changed

+205
-67
lines changed

7 files changed

+205
-67
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This workflow runs the tests for testable simd models.
2+
3+
name: Testable simd models
4+
5+
on:
6+
workflow_dispatch:
7+
merge_group:
8+
pull_request:
9+
branches: [ main ]
10+
push:
11+
paths:
12+
- '.github/workflows/testable-simd-models.yml'
13+
- 'testable-simd-models/**'
14+
15+
defaults:
16+
run:
17+
shell: bash
18+
19+
jobs:
20+
testable-simd-models:
21+
name: Test testable simd models
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout Repository
26+
uses: actions/checkout@v4
27+
28+
- name: Run tests
29+
run: cargo test -- --test-threads=1 --nocapture
30+

testable-simd-models/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ readme = "README.md"
1111
[dependencies]
1212
rand = "0.9"
1313
pastey = "0.1.0"
14+
lazy_static = "1.5.0"
1415

1516
[lints.rust]
1617
unexpected_cfgs = { level = "warn" }

testable-simd-models/src/abstractions/bitvec.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,6 @@ impl<const N: u32> BitVec<N> {
106106
.map(int_from_bit_slice)
107107
.collect()
108108
}
109-
110-
/// Generate a random BitVec.
111-
pub fn rand() -> Self {
112-
use rand::prelude::*;
113-
let random_source: Vec<_> = {
114-
let mut rng = rand::rng();
115-
(0..N).map(|_| rng.random::<bool>()).collect()
116-
};
117-
Self::from_fn(|i| random_source[i as usize].into())
118-
}
119109
}
120110

121111
impl<const N: u32> BitVec<N> {

testable-simd-models/src/core_arch/x86/models/avx2_handwritten.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@ pub fn psravd(a: i32x4, count: i32x4) -> i32x4 {
419419
}
420420

421421
pub fn psravd256(a: i32x8, count: i32x8) -> i32x8 {
422-
dbg!(a, count);
423422
i32x8::from_fn(|i| {
424423
if count[i] > 31 || count[i] < 0 {
425424
if a[i] < 0 {

testable-simd-models/src/core_arch/x86/tests/avx.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ fn _mm256_movemask_ps() {
4949
let a: BitVec<256> = BitVec::random();
5050
assert_eq!(
5151
super::super::models::avx::_mm256_movemask_ps(a.into()),
52-
unsafe { upstream::_mm256_movemask_ps(a.into()) }
52+
unsafe { upstream::_mm256_movemask_ps(a.into()) },
53+
"Failed with input value: {:?}",
54+
a
5355
);
5456
}
5557
}
@@ -62,7 +64,9 @@ fn _mm256_movemask_pd() {
6264
let a: BitVec<256> = BitVec::random();
6365
assert_eq!(
6466
super::super::models::avx::_mm256_movemask_pd(a.into()),
65-
unsafe { upstream::_mm256_movemask_pd(a.into()) }
67+
unsafe { upstream::_mm256_movemask_pd(a.into()) },
68+
"Failed with input value: {:?}",
69+
a
6670
);
6771
}
6872
}
@@ -76,7 +80,10 @@ fn _mm256_testz_si256() {
7680
let b: BitVec<256> = BitVec::random();
7781
assert_eq!(
7882
super::super::models::avx::_mm256_testz_si256(a.into(), b.into()),
79-
unsafe { upstream::_mm256_testz_si256(a.into(), b.into()) }
83+
unsafe { upstream::_mm256_testz_si256(a.into(), b.into()) },
84+
"Failed with input values: {:?}, {:?}",
85+
a,
86+
b
8087
);
8188
}
8289
}
@@ -90,7 +97,10 @@ fn _mm256_testc_si256() {
9097
let b: BitVec<256> = BitVec::random();
9198
assert_eq!(
9299
super::super::models::avx::_mm256_testc_si256(a.into(), b.into()),
93-
unsafe { upstream::_mm256_testc_si256(a.into(), b.into()) }
100+
unsafe { upstream::_mm256_testc_si256(a.into(), b.into()) },
101+
"Failed with input values: {:?}, {:?}",
102+
a,
103+
b
94104
);
95105
}
96106
}
@@ -116,7 +126,9 @@ fn _mm256_cvtsi256_si32() {
116126
let a: BitVec<256> = BitVec::random();
117127
assert_eq!(
118128
super::super::models::avx::_mm256_cvtsi256_si32(a.into()),
119-
unsafe { upstream::_mm256_cvtsi256_si32(a.into()) }
129+
unsafe { upstream::_mm256_cvtsi256_si32(a.into()) },
130+
"Failed with input value: {:?}",
131+
a
120132
);
121133
}
122134
}

0 commit comments

Comments
 (0)