Back to PBT run

output.generic.mlir

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