metagraph-dev / mlir-graphblas

MLIR tools and dialect for GraphBLAS
https://mlir-graphblas.readthedocs.io/en/latest/
Apache License 2.0
15 stars 6 forks source link

Add scf.if support to the IR builder. #247

Open paul-tqh-nguyen opened 2 years ago

paul-tqh-nguyen commented 2 years ago

It would be nice to be able to add scf.if statements via the IR builder.

I think something like this would be useful:

with irb.if(bool_var) as if_vars:
    with if_vars.true as true_branch:
        true_branch.yield_vars(c1, c2)
    with if_vars.false false_branch:
        false_branch.yield_vars(c3, c4)
irb.graphblas.print(if_vars.returned_variable[0])