Skip to content
Snippets Groups Projects
Commit 620f17d3 authored by Russel Arbore's avatar Russel Arbore
Browse files

fork join test for array slf

parent c3e539f9
No related branches found
No related tags found
1 merge request!212More optimization
Pipeline #201994 passed
This commit is part of merge request !212. Comments created here will be created in the context of that merge request.
......@@ -3,7 +3,7 @@ gvn(*);
phi-elim(*);
dce(*);
let auto = auto-outline(test1, test2, test3, test4, test5, test7, test8, test9);
let auto = auto-outline(test1, test2, test3, test4, test5, test7, test8, test9, test10);
cpu(auto.test1);
cpu(auto.test2);
cpu(auto.test3);
......@@ -12,6 +12,7 @@ cpu(auto.test5);
cpu(auto.test7);
cpu(auto.test8);
cpu(auto.test9);
cpu(auto.test10);
let test1_cpu = auto.test1;
rename["test1_cpu"](test1_cpu);
......@@ -94,6 +95,11 @@ dce(auto.test8);
simplify-cfg(auto.test8);
dce(auto.test8);
no-memset(test9@const);
array-slf(auto.test10);
ccp(auto.test10);
dce(auto.test10);
simplify-cfg(auto.test10);
dce(auto.test10);
unforkify(auto.test10);
gcm(*);
......@@ -147,3 +147,16 @@ fn test9<r, c : usize>(input : i32[r, c]) -> i32[r, c] {
return out;
}
#[entry]
fn test10(k1 : i32[8], k2 : i32[8], v : i32[8]) -> i32 {
@const let s : i32[8];
for i = 0 to 8 {
s[i] = v[k1[i] as u64];
}
let sum = 0;
for i = 0 to 8 {
sum += s[k2[i] as u64];
}
return sum;
}
\ No newline at end of file
......@@ -8,12 +8,13 @@ no-memset(test6@const);
no-memset(test8@const1);
no-memset(test8@const2);
no-memset(test9@const);
no-memset(test10@const);
gvn(*);
phi-elim(*);
dce(*);
let auto = auto-outline(test1, test2, test3, test4, test5, test7, test8, test9);
let auto = auto-outline(test1, test2, test3, test4, test5, test7, test8, test9, test10);
gpu(auto.test1);
gpu(auto.test2);
gpu(auto.test3);
......@@ -22,6 +23,7 @@ gpu(auto.test5);
gpu(auto.test7);
gpu(auto.test8);
gpu(auto.test9);
gpu(auto.test10);
ip-sroa(*);
sroa(*);
......
......@@ -74,6 +74,20 @@ fn main() {
5 + 6 + 8 + 9,
];
assert(&correct, output);
let mut r = runner!(test10);
let k1 = vec![0, 4, 3, 7, 3, 4, 2, 1];
let k2 = vec![6, 4, 3, 2, 4, 1, 0, 5];
let v = vec![3, -499, 4, 32, -2, 55, -74, 10];
let mut correct = 0;
for i in 0..8 {
correct += v[k1[k2[i] as usize] as usize];
}
let k1 = HerculesImmBox::from(&k1 as &[i32]);
let k2 = HerculesImmBox::from(&k2 as &[i32]);
let v = HerculesImmBox::from(&v as &[i32]);
let output = r.run(k1.to(), k2.to(), v.to()).await;
assert_eq!(output, correct);
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment