Back to PBT run

output.generic.mlir

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