Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dfir_lang/src/graph/ops/_lattice_fold_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use quote::{quote_spanned, ToTokens};
use syn::parse_quote;

use super::{
DelayType, OpInstGenerics, OperatorCategory, OperatorConstraints, OperatorInstance,
OpInstGenerics, OperatorCategory, OperatorConstraints, OperatorInstance,
OperatorWriteOutput, PortListSpec, WriteContextArgs, RANGE_0, RANGE_1,
};

Expand Down Expand Up @@ -44,7 +44,7 @@ pub const _LATTICE_FOLD_BATCH: OperatorConstraints = OperatorConstraints {
flo_type: None,
ports_inn: Some(|| PortListSpec::Fixed(parse_quote! { input, signal })),
ports_out: None,
input_delaytype_fn: |_| Some(DelayType::MonotoneAccum),
input_delaytype_fn: |_| None,
write_fn: |wc @ &WriteContextArgs {
ident,
op_span,
Expand Down
7 changes: 2 additions & 5 deletions dfir_lang/src/graph/ops/lattice_fold.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use syn::parse_quote_spanned;

use super::{
DelayType, OperatorCategory, OperatorConstraints, WriteContextArgs,
OperatorCategory, OperatorConstraints, WriteContextArgs,
RANGE_0, RANGE_1,
};

Expand Down Expand Up @@ -41,17 +41,14 @@ pub const LATTICE_FOLD: OperatorConstraints = OperatorConstraints {
flo_type: None,
ports_inn: None,
ports_out: None,
input_delaytype_fn: |_| Some(DelayType::MonotoneAccum),
input_delaytype_fn: |_| None,
write_fn: |wc @ &WriteContextArgs {
root,
is_pull,
op_span,
arguments,
..
},
diagnostics| {
assert!(is_pull);

let first_arg = &arguments[0];

let arguments = &parse_quote_spanned! {op_span=>
Expand Down
45 changes: 23 additions & 22 deletions dfir_lang/src/graph/ops/lattice_reduce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use quote::quote_spanned;
use syn::parse_quote_spanned;

use super::{
DelayType, OperatorCategory, OperatorConstraints, OperatorWriteOutput, RANGE_0, RANGE_1,
OperatorCategory, OperatorConstraints, OperatorWriteOutput, RANGE_0, RANGE_1,
WriteContextArgs,
};

Expand Down Expand Up @@ -42,7 +42,7 @@ pub const LATTICE_REDUCE: OperatorConstraints = OperatorConstraints {
flo_type: None,
ports_inn: None,
ports_out: None,
input_delaytype_fn: |_| Some(DelayType::MonotoneAccum),
input_delaytype_fn: |_| None,
write_fn: |wc @ &WriteContextArgs {
root,
inputs,
Expand All @@ -51,8 +51,6 @@ pub const LATTICE_REDUCE: OperatorConstraints = OperatorConstraints {
..
},
diagnostics| {
assert!(is_pull);

let arguments = &parse_quote_spanned! {op_span=>
|acc, item| { #root::lattices::Merge::<_>::merge(acc, item); }
};
Expand All @@ -68,24 +66,27 @@ pub const LATTICE_REDUCE: OperatorConstraints = OperatorConstraints {
write_tick_end,
} = (super::reduce::REDUCE.write_fn)(&wc, diagnostics)?;

assert_eq!(1, inputs.len());
let input = &inputs[0];

let write_iterator = quote_spanned! {op_span=>
let #input = {
#[inline(always)]
fn check_inputs<Lat, Prev>(
input: Prev,
) -> impl #root::dfir_pipes::pull::Pull<Item = Lat, Meta = Prev::Meta, CanPend = Prev::CanPend, CanEnd = Prev::CanEnd>
where
Lat: #root::lattices::Merge<Lat>,
Prev: #root::dfir_pipes::pull::Pull<Item = Lat>,
{
input
}
check_inputs(#input)
};
#write_iterator
let write_iterator = if is_pull {
assert_eq!(1, inputs.len());
let input = &inputs[0];
quote_spanned! {op_span=>
let #input = {
#[inline(always)]
fn check_inputs<Lat, Prev>(
input: Prev,
) -> impl #root::dfir_pipes::pull::Pull<Item = Lat, Meta = Prev::Meta, CanPend = Prev::CanPend, CanEnd = Prev::CanEnd>
where
Lat: #root::lattices::Merge<Lat>,
Prev: #root::dfir_pipes::pull::Pull<Item = Lat>,
{
input
}
check_inputs(#input)
};
#write_iterator
}
} else {
write_iterator
};
Ok(OperatorWriteOutput {
write_prologue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ digraph {
n11v1 [label="(n11v1) for_each(|x| out_send.send(x).unwrap())", shape=house, fillcolor="#ffff88"]
n12v1 [label="(n12v1) handoff", shape=parallelogram, fillcolor="#ddddff"]
n13v1 [label="(n13v1) handoff", shape=parallelogram, fillcolor="#ddddff"]
n14v1 [label="(n14v1) handoff", shape=parallelogram, fillcolor="#ddddff"]
n2v1 -> n3v1
n1v1 -> n2v1
n5v1 -> n6v1
Expand All @@ -28,10 +27,9 @@ digraph {
n3v1 -> n7v1 [label="state"]
n6v1 -> n8v1 [label="state"]
n10v1 -> n11v1
n9v1 -> n14v1
n9v1 -> n10v1
n12v1 -> n9v1 [label="0"]
n13v1 -> n9v1 [label="1"]
n14v1 -> n10v1 [color=red]
n7v1 -> n9v1 [color=red]
n8v1 -> n9v1 [color=red]
subgraph sg_1v1 {
Expand Down Expand Up @@ -69,16 +67,6 @@ digraph {
cluster=true
label="var my_join"
n9v1
}
}
subgraph sg_4v1 {
cluster=true
fillcolor="#dddddd"
style=filled
label = "sg_4v1"
subgraph sg_4v1_var_my_join {
cluster=true
label="var my_join"
n10v1
n11v1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ linkStyle default stroke:#aaa
11v1[/"(11v1) <code>for_each(|x| out_send.send(x).unwrap())</code>"\]:::pushClass
12v1["(12v1) <code>handoff</code>"]:::otherClass
13v1["(13v1) <code>handoff</code>"]:::otherClass
14v1["(14v1) <code>handoff</code>"]:::otherClass
2v1-->3v1
1v1-->2v1
5v1-->6v1
Expand All @@ -31,12 +30,11 @@ linkStyle default stroke:#aaa
3v1-->|state|7v1
6v1-->|state|8v1
10v1-->11v1
9v1-->14v1
9v1-->10v1
12v1-->|0|9v1
13v1-->|1|9v1
14v1-->10v1; linkStyle 12 stroke:#060
7v1--x9v1; linkStyle 13 stroke:red
8v1--x9v1; linkStyle 14 stroke:red
7v1--x9v1; linkStyle 12 stroke:red
8v1--x9v1; linkStyle 13 stroke:red
subgraph sg_1v1 ["sg_1v1"]
subgraph sg_1v1_var_lhs_op ["var <tt>lhs_op</tt>"]
1v1
Expand All @@ -54,10 +52,6 @@ end
subgraph sg_3v1 ["sg_3v1"]
subgraph sg_3v1_var_my_join ["var <tt>my_join</tt>"]
9v1
end
end
subgraph sg_4v1 ["sg_4v1"]
subgraph sg_4v1_var_my_join ["var <tt>my_join</tt>"]
10v1
11v1
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ digraph {
n12v1 [label="(n12v1) for_each(|x| out_send.send(x).unwrap())", shape=house, fillcolor="#ffff88"]
n13v1 [label="(n13v1) handoff", shape=parallelogram, fillcolor="#ddddff"]
n14v1 [label="(n14v1) handoff", shape=parallelogram, fillcolor="#ddddff"]
n15v1 [label="(n15v1) handoff", shape=parallelogram, fillcolor="#ddddff"]
n2v1 -> n3v1
n1v1 -> n2v1
n5v1 -> n6v1
Expand All @@ -30,10 +29,9 @@ digraph {
n3v1 -> n13v1 [label="items"]
n7v1 -> n14v1
n11v1 -> n12v1
n10v1 -> n15v1
n10v1 -> n11v1
n13v1 -> n10v1 [label="0"]
n14v1 -> n10v1 [label="1"]
n15v1 -> n11v1 [color=red]
n8v1 -> n10v1 [color=red]
n9v1 -> n10v1 [color=red]
subgraph sg_1v1 {
Expand Down Expand Up @@ -76,16 +74,6 @@ digraph {
cluster=true
label="var my_join"
n10v1
}
}
subgraph sg_4v1 {
cluster=true
fillcolor="#dddddd"
style=filled
label = "sg_4v1"
subgraph sg_4v1_var_my_join {
cluster=true
label="var my_join"
n11v1
n12v1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ linkStyle default stroke:#aaa
12v1[/"(12v1) <code>for_each(|x| out_send.send(x).unwrap())</code>"\]:::pushClass
13v1["(13v1) <code>handoff</code>"]:::otherClass
14v1["(14v1) <code>handoff</code>"]:::otherClass
15v1["(15v1) <code>handoff</code>"]:::otherClass
2v1-->3v1
1v1-->2v1
5v1-->6v1
Expand All @@ -33,12 +32,11 @@ linkStyle default stroke:#aaa
3v1-->|items|13v1
7v1-->14v1
11v1-->12v1
10v1-->15v1
10v1-->11v1
13v1-->|0|10v1
14v1-->|1|10v1
15v1-->11v1; linkStyle 13 stroke:#060
8v1--x10v1; linkStyle 14 stroke:red
9v1--x10v1; linkStyle 15 stroke:red
8v1--x10v1; linkStyle 13 stroke:red
9v1--x10v1; linkStyle 14 stroke:red
subgraph sg_1v1 ["sg_1v1"]
subgraph sg_1v1_var_lhs_op ["var <tt>lhs_op</tt>"]
1v1
Expand All @@ -59,10 +57,6 @@ end
subgraph sg_3v1 ["sg_3v1"]
subgraph sg_3v1_var_my_join ["var <tt>my_join</tt>"]
10v1
end
end
subgraph sg_4v1 ["sg_4v1"]
subgraph sg_4v1_var_my_join ["var <tt>my_join</tt>"]
11v1
12v1
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ digraph {
n13v1 [label="(n13v1) for_each(|x| out_send.send(x).unwrap())", shape=house, fillcolor="#ffff88"]
n14v1 [label="(n14v1) handoff", shape=parallelogram, fillcolor="#ddddff"]
n15v1 [label="(n15v1) handoff", shape=parallelogram, fillcolor="#ddddff"]
n16v1 [label="(n16v1) handoff", shape=parallelogram, fillcolor="#ddddff"]
n2v1 -> n3v1
n1v1 -> n2v1
n5v1 -> n6v1
Expand All @@ -32,10 +31,9 @@ digraph {
n3v1 -> n14v1 [label="items"]
n7v1 -> n15v1
n12v1 -> n13v1
n11v1 -> n16v1
n11v1 -> n12v1
n14v1 -> n11v1 [label="0"]
n15v1 -> n11v1 [label="1"]
n16v1 -> n12v1 [color=red]
n9v1 -> n11v1 [color=red]
n10v1 -> n11v1 [color=red]
subgraph sg_1v1 {
Expand Down Expand Up @@ -79,16 +77,6 @@ digraph {
cluster=true
label="var my_join"
n11v1
}
}
subgraph sg_4v1 {
cluster=true
fillcolor="#dddddd"
style=filled
label = "sg_4v1"
subgraph sg_4v1_var_my_join {
cluster=true
label="var my_join"
n12v1
n13v1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ linkStyle default stroke:#aaa
13v1[/"(13v1) <code>for_each(|x| out_send.send(x).unwrap())</code>"\]:::pushClass
14v1["(14v1) <code>handoff</code>"]:::otherClass
15v1["(15v1) <code>handoff</code>"]:::otherClass
16v1["(16v1) <code>handoff</code>"]:::otherClass
2v1-->3v1
1v1-->2v1
5v1-->6v1
Expand All @@ -35,12 +34,11 @@ linkStyle default stroke:#aaa
3v1-->|items|14v1
7v1-->15v1
12v1-->13v1
11v1-->16v1
11v1-->12v1
14v1-->|0|11v1
15v1-->|1|11v1
16v1-->12v1; linkStyle 14 stroke:#060
9v1--x11v1; linkStyle 15 stroke:red
10v1--x11v1; linkStyle 16 stroke:red
9v1--x11v1; linkStyle 14 stroke:red
10v1--x11v1; linkStyle 15 stroke:red
subgraph sg_1v1 ["sg_1v1"]
subgraph sg_1v1_var_lhs_op ["var <tt>lhs_op</tt>"]
1v1
Expand All @@ -62,10 +60,6 @@ end
subgraph sg_3v1 ["sg_3v1"]
subgraph sg_3v1_var_my_join ["var <tt>my_join</tt>"]
11v1
end
end
subgraph sg_4v1 ["sg_4v1"]
subgraph sg_4v1_var_my_join ["var <tt>my_join</tt>"]
12v1
13v1
end
Expand Down
Loading
Loading