Back to PBT run

output.generic.mlir

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