#![allow(clippy::type_complexity)]
#![allow(unused_variables)]
use super::helpers::*;
use crate::dag::{DagArmSeed, DagBuilder};
use crate::pipeline::PipelineBuilder;
use crate::{IntoHandler, World};
#[inline(never)]
pub fn batch_pipe_linear_3(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(add_one, ®)
.then(double, ®)
.then(add_three, ®)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_linear_10(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(add_one, ®)
.then(double, ®)
.then(add_three, ®)
.then(square, ®)
.then(sub_ten, ®)
.then(shr_one, ®)
.then(xor_mask, ®)
.then(add_seven, ®)
.then(triple, ®)
.then(add_forty_two, ®)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_guard(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(add_one, ®)
.guard(|x: &u64| *x > 10, ®)
.unwrap_or(0)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_option_chain(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(maybe_positive, ®)
.map(double, ®)
.filter(|x: &u64| *x < 1000, ®)
.unwrap_or(0)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_result_chain(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(try_parse, ®)
.map(double, ®)
.unwrap_or(0)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_mixed_arity(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(add_one, ®)
.then(add_res_a, ®)
.then(write_res_a, ®)
.then(add_both, ®)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_splat(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(split_u64, ®)
.splat()
.then(splat_add, ®)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_route(world: &mut World) {
let reg = world.registry();
let on_true = PipelineBuilder::<u64>::new().then(double, ®);
let on_false = PipelineBuilder::<u64>::new().then(add_one, ®);
let mut bp = PipelineBuilder::<u64>::new()
.then(add_one, ®)
.route(|x: &u64| *x > 32, ®, on_true, on_false)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_large(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(add_one, ®)
.then(double, ®)
.then(add_three, ®)
.then(square, ®)
.then(sub_ten, ®)
.then(shr_one, ®)
.then(xor_mask, ®)
.then(add_seven, ®)
.then(triple, ®)
.then(add_forty_two, ®)
.then(consume_val, ®)
.build_batch(256);
bp.input_mut().extend(0..256);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_guard_skip_10(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(|x: u64| x, ®)
.guard(|x: &u64| *x > 32, ®)
.map(add_one, ®)
.map(double, ®)
.map(add_three, ®)
.map(square, ®)
.map(sub_ten, ®)
.map(shr_one, ®)
.map(xor_mask, ®)
.map(add_seven, ®)
.map(triple, ®)
.map(add_forty_two, ®)
.unwrap_or(0)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_res_skip_10(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(try_parse, ®)
.map(add_one, ®)
.map(double, ®)
.map(add_three, ®)
.map(square, ®)
.map(sub_ten, ®)
.map(shr_one, ®)
.map(xor_mask, ®)
.map(add_seven, ®)
.map(triple, ®)
.map(add_forty_two, ®)
.unwrap_or(0)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_dag_linear_3(world: &mut World) {
let reg = world.registry();
let mut bd = DagBuilder::<u64>::new()
.root(add_one, ®)
.then(ref_double, ®)
.then(ref_add_three, ®)
.then(ref_consume, ®)
.build_batch(64);
bd.input_mut().extend(0..64);
bd.run(world);
}
#[inline(never)]
pub fn batch_dag_linear_10(world: &mut World) {
let reg = world.registry();
let mut bd = DagBuilder::<u64>::new()
.root(add_one, ®)
.then(ref_double, ®)
.then(ref_add_three, ®)
.then(ref_square, ®)
.then(ref_sub_ten, ®)
.then(ref_shr_one, ®)
.then(ref_xor_mask, ®)
.then(ref_add_seven, ®)
.then(ref_triple, ®)
.then(ref_add_forty_two, ®)
.then(ref_consume, ®)
.build_batch(64);
bd.input_mut().extend(0..64);
bd.run(world);
}
#[inline(never)]
pub fn batch_dag_fork_merge(world: &mut World) {
let reg = world.registry();
let mut bd = DagBuilder::<u64>::new()
.root(add_one, ®)
.fork()
.arm(|a| a.then(ref_double, ®))
.arm(|a| a.then(ref_triple, ®))
.merge(merge_add, ®)
.then(ref_consume, ®)
.build_batch(64);
bd.input_mut().extend(0..64);
bd.run(world);
}
#[inline(never)]
pub fn batch_dag_guard(world: &mut World) {
let reg = world.registry();
let mut bd = DagBuilder::<u64>::new()
.root(add_one, ®)
.guard(|x: &u64| *x > 10, ®)
.unwrap_or(0)
.then(ref_consume, ®)
.build_batch(64);
bd.input_mut().extend(0..64);
bd.run(world);
}
#[inline(never)]
pub fn batch_dag_mixed_arity(world: &mut World) {
let reg = world.registry();
let mut bd = DagBuilder::<u64>::new()
.root(add_one, ®)
.then(ref_add_res_a, ®)
.then(ref_write_res_a, ®)
.then(ref_add_both, ®)
.then(ref_consume, ®)
.build_batch(64);
bd.input_mut().extend(0..64);
bd.run(world);
}
#[inline(never)]
pub fn batch_dag_diamond(world: &mut World) {
let reg = world.registry();
let mut bd = DagBuilder::<u64>::new()
.root(add_one, ®)
.fork()
.arm(|a| a.then(ref_double, ®))
.arm(|a| a.then(ref_triple, ®))
.merge(merge_add, ®)
.fork()
.arm(|a| a.then(ref_square, ®))
.arm(|a| a.then(ref_shr_one, ®))
.merge(merge_mul, ®)
.then(ref_consume, ®)
.build_batch(64);
bd.input_mut().extend(0..64);
bd.run(world);
}
#[inline(never)]
pub fn batch_dag_large(world: &mut World) {
let reg = world.registry();
let mut bd = DagBuilder::<u64>::new()
.root(add_one, ®)
.then(ref_double, ®)
.then(ref_add_three, ®)
.then(ref_square, ®)
.then(ref_sub_ten, ®)
.then(ref_shr_one, ®)
.then(ref_xor_mask, ®)
.then(ref_add_seven, ®)
.then(ref_triple, ®)
.then(ref_add_forty_two, ®)
.then(ref_consume, ®)
.build_batch(256);
bd.input_mut().extend(0..256);
bd.run(world);
}
#[inline(never)]
pub fn batch_pipe_guard_filter(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(add_one, ®)
.guard(|x: &u64| *x > 10, ®)
.filter(|x: &u64| *x < 1000, ®)
.unwrap_or(0)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_transition(world: &mut World) {
let reg = world.registry();
fn log_error(_err: u32) {}
let mut bp = PipelineBuilder::<u64>::new()
.then(|x: u64| x, ®)
.guard(|x: &u64| *x > 0, ®)
.ok_or(0u32)
.catch(log_error, ®)
.unwrap_or(0)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_switch(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(
|x: u64| match x % 3 {
0 => x.wrapping_mul(2),
1 => x.wrapping_add(10),
_ => x.wrapping_sub(5),
},
®,
)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_dispatch(world: &mut World) {
let reg = world.registry();
let handler = consume_val.into_handler(®);
let mut bp = PipelineBuilder::<u64>::new()
.then(add_one, ®)
.dispatch(handler)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_buffer_reuse(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(add_one, ®)
.then(double, ®)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_empty(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(add_one, ®)
.then(double, ®)
.then(add_three, ®)
.then(consume_val, ®)
.build_batch(64);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_single_item(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(add_one, ®)
.then(double, ®)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().push(42);
bp.run(world);
}
#[inline(never)]
pub fn batch_pipe_drain_codegen(world: &mut World) {
let reg = world.registry();
let mut bp = PipelineBuilder::<u64>::new()
.then(|x: u64| x, ®)
.then(consume_val, ®)
.build_batch(64);
bp.input_mut().extend(0..64);
bp.run(world);
}
#[inline(never)]
pub fn batch_dag_fork4(world: &mut World) {
let reg = world.registry();
let mut bd = DagBuilder::<u64>::new()
.root(add_one, ®)
.fork()
.arm(|a| a.then(ref_double, ®))
.arm(|a| a.then(ref_triple, ®))
.arm(|a| a.then(ref_add_seven, ®))
.arm(|a| a.then(ref_xor_mask, ®))
.merge(merge_4, ®)
.then(ref_consume, ®)
.build_batch(64);
bd.input_mut().extend(0..64);
bd.run(world);
}
#[inline(never)]
pub fn batch_dag_nested_fork(world: &mut World) {
let reg = world.registry();
let mut bd = DagBuilder::<u64>::new()
.root(add_one, ®)
.fork()
.arm(|a| {
a.then(ref_double, ®)
.fork()
.arm(|b| b.then(ref_add_one, ®))
.arm(|b| b.then(ref_triple, ®))
.merge(merge_add, ®)
})
.arm(|a| a.then(ref_add_seven, ®))
.merge(merge_add, ®)
.then(ref_consume, ®)
.build_batch(64);
bd.input_mut().extend(0..64);
bd.run(world);
}
#[inline(never)]
pub fn batch_dag_option_chain(world: &mut World) {
let reg = world.registry();
let mut bd = DagBuilder::<u64>::new()
.root(maybe_positive, ®)
.map(ref_double, ®)
.filter(|x: &u64| *x < 1000, ®)
.unwrap_or(0)
.then(ref_consume, ®)
.build_batch(64);
bd.input_mut().extend(0..64);
bd.run(world);
}
#[inline(never)]
pub fn batch_dag_result_chain(world: &mut World) {
let reg = world.registry();
let mut bd = DagBuilder::<u64>::new()
.root(try_parse, ®)
.map(ref_double, ®)
.unwrap_or(0)
.then(ref_consume, ®)
.build_batch(64);
bd.input_mut().extend(0..64);
bd.run(world);
}
#[inline(never)]
pub fn batch_dag_route(world: &mut World) {
let reg = world.registry();
let on_true = DagArmSeed::<u64>::new().then(ref_double, ®);
let on_false = DagArmSeed::<u64>::new().then(ref_add_one, ®);
let mut bd = DagBuilder::<u64>::new()
.root(add_one, ®)
.route(|x: &u64| *x > 32, ®, on_true, on_false)
.then(ref_consume, ®)
.build_batch(64);
bd.input_mut().extend(0..64);
bd.run(world);
}
#[inline(never)]
pub fn batch_dag_splat(world: &mut World) {
let reg = world.registry();
let mut bd = DagBuilder::<u64>::new()
.root(split_u64, ®)
.splat()
.then(ref_splat_add, ®)
.then(ref_consume, ®)
.build_batch(64);
bd.input_mut().extend(0..64);
bd.run(world);
}
#[inline(never)]
pub fn batch_dag_heavy(world: &mut World) {
let reg = world.registry();
let mut bd = DagBuilder::<u64>::new()
.root(add_one, ®)
.fork()
.arm(|a| {
a.then(ref_double, ®)
.then(ref_add_three, ®)
.then(ref_square, ®)
.then(ref_sub_ten, ®)
.then(ref_shr_one, ®)
})
.arm(|a| {
a.then(ref_add_one, ®)
.then(ref_triple, ®)
.then(ref_xor_mask, ®)
.then(ref_add_seven, ®)
.then(ref_add_forty_two, ®)
})
.arm(|a| {
a.then(ref_triple, ®)
.then(ref_add_three, ®)
.then(ref_double, ®)
.then(ref_square, ®)
.then(ref_add_one, ®)
})
.arm(|a| {
a.then(ref_xor_mask, ®)
.then(ref_shr_one, ®)
.then(ref_add_seven, ®)
.then(ref_triple, ®)
.then(ref_sub_ten, ®)
})
.merge(merge_4, ®)
.then(ref_consume, ®)
.build_batch(64);
bd.input_mut().extend(0..64);
bd.run(world);
}
#[inline(never)]
pub fn batch_dag_dispatch(world: &mut World) {
let reg = world.registry();
let handler = consume_val.into_handler(®);
let mut bd = DagBuilder::<u64>::new()
.root(add_one, ®)
.then(ref_double, ®)
.dispatch(handler)
.build_batch(64);
bd.input_mut().extend(0..64);
bd.run(world);
}