Back to PBT run

output.generic.mlir

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