Back to PBT run

output.generic.mlir

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