Back to PBT run

output.generic.mlir

"builtin.module"() ({
  "func.func"() <{function_type = (i32) -> i32, sym_name = "helper_double"}> ({
  ^bb0(%arg21: i32):
    %44 = "arith.addi"(%arg21, %arg21) <{overflowFlags = #arith.overflow<none>}> : (i32, i32) -> i32
    "func.return"(%44) : (i32) -> ()
  }) : () -> ()
  "llvm.func"() <{CConv = #llvm.cconv<ccc>, function_type = !llvm.func<i32 (i32)>, linkage = #llvm.linkage<external>, sym_name = "extern_scale", unnamed_addr = 0 : i64, visibility_ = 0 : i64}> ({
  }) : () -> ()
  "func.func"() <{function_type = (memref<4xi32>, i32) -> (), sym_name = "host_container"}> ({
  ^bb0(%arg18: memref<4xi32>, %arg19: i32):
    %41 = "arith.constant"() <{value = 0 : index}> : () -> index
    %42 = "arith.constant"() <{value = 4 : index}> : () -> index
    %43 = "arith.constant"() <{value = 1 : index}> : () -> index
    "scf.for"(%41, %42, %43) ({
    ^bb0(%arg20: index):
      "memref.store"(%arg19, %arg18, %arg20) : (i32, memref<4xi32>, index) -> ()
      "scf.yield"() : () -> ()
    }) : (index, index, index) -> ()
    "func.return"() : () -> ()
  }) : () -> ()
  "dataflow.thread"() <{domain = #dataflow.thread_domain<dense>, function_type = (memref<4xi32>, i32, i1) -> (), sym_name = "thread_0", sym_visibility = "private"}> ({
  ^bb0(%arg14: memref<4xi32>, %arg15: i32, %arg16: i1, %arg17: none):
    %33 = "arith.constant"() <{value = 0 : index}> : () -> index
    %34 = "arith.constant"() <{value = 2 : index}> : () -> index
    %35 = "arith.constant"() <{value = 1 : index}> : () -> index
    %36 = "func.call"(%arg15) <{callee = @helper_double}> : (i32) -> i32
    %37 = "scf.if"(%arg16) ({
      %40:2 = "dataflow.graph.launch"(%arg17, %arg15) <{callee = @graph_0, operandSegmentSizes = array<i32: 1, 1, 0, 0, 0>, resultSegmentSizes = array<i32: 1, 0, 1>, source_maps = []}> : (none, i32) -> (i32, none)
      "scf.yield"(%40#1) : (none) -> ()
    }, {
      "scf.yield"(%arg17) : (none) -> ()
    }) : (i1) -> none
    %38 = "scf.if"(%arg16) ({
      %39 = "dataflow.graph.launch"(%arg17, %arg15, %arg14) <{callee = @graph_1, operandSegmentSizes = array<i32: 1, 1, 0, 1, 0>, resultSegmentSizes = array<i32: 0, 0, 1>, source_maps = []}> : (none, i32, memref<4xi32>) -> none
      "scf.yield"(%39) : (none) -> ()
    }, {
      "scf.yield"(%arg17) : (none) -> ()
    }) : (i1) -> none
    "dataflow.thread.yield"(%37, %38) : (none, none) -> ()
  }) : () -> ()
  "dataflow.thread"() <{domain = #dataflow.thread_domain<dense>, function_type = (memref<4xi32>, i32, i1) -> (), sym_name = "thread_1", sym_visibility = "private"}> ({
  ^bb0(%arg10: memref<4xi32>, %arg11: i32, %arg12: i1, %arg13: none):
    %26 = "arith.constant"() <{value = 0 : index}> : () -> index
    %27 = "arith.constant"() <{value = 2 : index}> : () -> index
    %28 = "arith.constant"() <{value = 1 : index}> : () -> index
    %29 = "func.call"(%arg11) <{callee = @helper_double}> : (i32) -> i32
    %30 = "scf.if"(%arg12) ({
      %32 = "dataflow.graph.launch"(%arg13, %arg11, %arg10) <{callee = @graph_2, operandSegmentSizes = array<i32: 1, 1, 0, 1, 0>, resultSegmentSizes = array<i32: 0, 0, 1>, source_maps = []}> : (none, i32, memref<4xi32>) -> none
      "scf.yield"(%32) : (none) -> ()
    }, {
      "scf.yield"(%arg13) : (none) -> ()
    }) : (i1) -> none
    %31:2 = "dataflow.graph.launch"(%arg13, %arg11) <{callee = @graph_3, operandSegmentSizes = array<i32: 1, 1, 0, 0, 0>, resultSegmentSizes = array<i32: 1, 0, 1>, source_maps = []}> : (none, i32) -> (i32, none)
    "dataflow.thread.yield"(%30, %31#1) : (none, none) -> ()
  }) : () -> ()
  "dataflow.graph"() <{function_type = (i32) -> i32, input_segments = array<i32: 1, 0, 0>, result_segments = array<i32: 1, 0, 0>, sym_name = "graph_0", sym_visibility = "private"}> ({
  ^bb0(%arg8: none, %arg9: i32):
    %24 = "llvm.freeze"(%arg9) : (i32) -> i32
    %25:2 = "dataflow.sync"(%arg8, %24) : (none, i32) -> (none, i32)
    "dataflow.graph.return"(%25#1, %25#0) <{operandSegmentSizes = array<i32: 1, 0, 0, 1>}> : (i32, none) -> ()
  }) : () -> ()
  "dataflow.graph"() <{arg_attrs = [{}, {llvm.noalias}], function_type = (i32, memref<4xi32>) -> (), input_segments = array<i32: 1, 0, 1>, result_segments = array<i32: 0, 0, 0>, sym_name = "graph_1", sym_visibility = "private"}> ({
  ^bb0(%arg5: none, %arg6: i32, %arg7: memref<4xi32>):
    %22 = "dataflow.constant"(%arg5) <{const_value = 0 : index}> : (none) -> index
    %23 = "dataflow.store"(%arg7, %22, %arg6, %arg5) : (memref<4xi32>, index, i32, none) -> none
    "dataflow.graph.return"(%23) <{operandSegmentSizes = array<i32: 0, 0, 0, 1>}> : (none) -> ()
  }) : () -> ()
  "dataflow.graph"() <{arg_attrs = [{}, {llvm.noalias}], function_type = (i32, memref<4xi32>) -> (), input_segments = array<i32: 1, 0, 1>, result_segments = array<i32: 0, 0, 0>, sym_name = "graph_2", sym_visibility = "private"}> ({
  ^bb0(%arg2: none, %arg3: i32, %arg4: memref<4xi32>):
    %20 = "dataflow.constant"(%arg2) <{const_value = 0 : index}> : (none) -> index
    %21 = "dataflow.store"(%arg4, %20, %arg3, %arg2) : (memref<4xi32>, index, i32, none) -> none
    "dataflow.graph.return"(%21) <{operandSegmentSizes = array<i32: 0, 0, 0, 1>}> : (none) -> ()
  }) : () -> ()
  "dataflow.graph"() <{function_type = (i32) -> i32, input_segments = array<i32: 1, 0, 0>, result_segments = array<i32: 1, 0, 0>, sym_name = "graph_3", sym_visibility = "private"}> ({
  ^bb0(%arg0: none, %arg1: i32):
    %0 = "dataflow.constant"(%arg0) <{const_value = 0 : index}> : (none) -> index
    %1 = "dataflow.constant"(%arg0) <{const_value = 2 : index}> : (none) -> index
    %2 = "dataflow.constant"(%arg0) <{const_value = 1 : index}> : (none) -> index
    %3 = "arith.index_cast"(%0) : (index) -> i32
    %4 = "arith.index_cast"(%1) : (index) -> i32
    %5 = "arith.index_cast"(%2) : (index) -> i32
    %6:2 = "dataflow.stream"(%3, %4, %5) <{predicate = 2 : i64, step_kind = 0 : i32}> : (i32, i32, i32) -> (i32, i1)
    %7 = "dataflow.carry"(%6#1, %arg0, %8#1) : (i1, none, none) -> none
    %8:2 = "dataflow.demux"(%6#1, %7) : (i1, none) -> (none, none)
    %9 = "dataflow.carry"(%6#1, %arg1, %14) : (i1, i32, i32) -> i32
    %10:2 = "dataflow.demux"(%6#1, %9) : (i1, i32) -> (i32, i32)
    %11 = "dataflow.invariant"(%6#1, %arg1) : (i1, i32) -> i32
    %12:2 = "dataflow.gate"(%6#1, %11) : (i1, i32) -> (i1, i32)
    %13:2 = "dataflow.demux"(%12#0, %12#1) : (i1, i32) -> (i32, i32)
    %14 = "arith.addi"(%10#1, %12#1) <{overflowFlags = #arith.overflow<none>}> : (i32, i32) -> i32
    %15 = "arith.cmpi"(%3, %4) <{predicate = 2 : i64}> : (i32, i32) -> i1
    %16:2 = "dataflow.demux"(%15, %8#0) : (i1, none) -> (none, none)
    %17:2 = "dataflow.sync"(%16#1, %13#0) : (none, i32) -> (none, i32)
    %18 = "dataflow.mux"(%15, %16#0, %17#0) : (i1, none, none) -> none
    %19:2 = "dataflow.sync"(%18, %10#0) : (none, i32) -> (none, i32)
    "dataflow.graph.return"(%19#1, %19#0) <{operandSegmentSizes = array<i32: 1, 0, 0, 1>}> : (i32, none) -> ()
  }) : () -> ()
}) : () -> ()