Back to PBT run

output.generic.mlir

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