Back to PBT run

output.generic.mlir

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