# [Libre-soc-dev] SVP64 parallel map-reduce idea

Jacob Lifshay programmerjake at gmail.com
Sat Jun 12 01:12:03 BST 2021

On Fri, Jun 11, 2021, 16:32 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
wrote:

> ah, star.  it's quite late, i'm going to have to read it several times,
> possibly even make it executable and print out some "results"
> (plus indices) to get it fully.

from your comments I can tell you didn't understand the algorithm yet...
well...it is executable, you can use that rust playground link to run it,
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=9cbe5d650a088fb8558f2387c2758cb3

I added some debugging print statements and a main function which calls it
twice, once with both a all-true predicate and once with a predicate which
demonstrates that not all adds are performed, even after the first layer:

fn main() {
const VL: usize = 8;
let input_vec: [f32; VL] = [1.0, 2.0, 4.0, 10.0, 20.0, 40.0, 100.0,
200.0];
let mut temp_vec = [f32::NAN; VL];
let input_pred: [bool; VL] = [true, true, true, false, false, false,
true, true];
let mut temp_pred = [true; VL];
let retval = reduce(VL, &input_vec, &mut temp_vec, &input_pred, &mut
temp_pred);
println!(
"temp_pred={:?}\ntemp_vec={:?}\nretval={:?}\n",
temp_pred, temp_vec, retval
);
let input_vec: [f32; VL] = [1.0, 2.0, 4.0, 10.0, 20.0, 40.0, 100.0,
200.0];
let mut temp_vec = [f32::NAN; VL];
let input_pred = [true; VL];
let mut temp_pred = [true; VL];
let retval = reduce(VL, &input_vec, &mut temp_vec, &input_pred, &mut
temp_pred);
println!(
"temp_pred={:?}\ntemp_vec={:?}\nretval={:?}\n",
temp_pred, temp_vec, retval
);
}

Jacob