Back to PBT run

output.generic.mlir

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