Back to PBT run

output.generic.mlir

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