Back to PBT run

output.generic.mlir

"builtin.module"() ({
  "func.func"() <{function_type = (i32) -> i32, sym_name = "helper_double"}> ({
  ^bb0(%arg24: i32):
    %47 = "arith.addi"(%arg24, %arg24) <{overflowFlags = #arith.overflow<none>}> : (i32, i32) -> i32
    "func.return"(%47) : (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):
    %44 = "arith.constant"() <{value = 0 : index}> : () -> index
    %45 = "arith.constant"() <{value = 4 : index}> : () -> index
    %46 = "arith.constant"() <{value = 1 : index}> : () -> index
    "scf.for"(%44, %45, %46) ({
    ^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):
    %38 = "arith.constant"() <{value = 0 : index}> : () -> index
    %39 = "arith.constant"() <{value = 2 : index}> : () -> index
    %40 = "arith.constant"() <{value = 1 : index}> : () -> index
    %41 = "scf.for"(%38, %39, %40, %arg18) ({
    ^bb0(%arg19: index, %arg20: none):
      %43:2 = "dataflow.graph.launch"(%arg20, %arg16, %arg17) <{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"(%43#1) : (none) -> ()
    }) : (index, index, index, none) -> none
    %42:2 = "dataflow.graph.launch"(%arg18, %arg16) <{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"(%41, %42#1) : (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):
    %32 = "arith.constant"() <{value = 0 : index}> : () -> index
    %33 = "arith.constant"() <{value = 2 : index}> : () -> index
    %34 = "arith.constant"() <{value = 1 : index}> : () -> index
    %35:2 = "dataflow.graph.launch"(%arg12, %arg10) <{callee = @graph_2, operandSegmentSizes = array<i32: 1, 1, 0, 0, 0>, resultSegmentSizes = array<i32: 1, 0, 1>, source_maps = []}> : (none, i32) -> (i32, none)
    %36 = "scf.for"(%32, %33, %34, %arg12) ({
    ^bb0(%arg13: index, %arg14: none):
      %37:2 = "dataflow.graph.launch"(%arg14, %arg10) <{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"(%37#1) : (none) -> ()
    }) : (index, index, index, none) -> none
    "dataflow.thread.yield"(%35#1, %36) : (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(%arg6: none, %arg7: i32, %arg8: i1):
    %25:2 = "dataflow.demux"(%arg8, %arg6) : (i1, none) -> (none, none)
    %26:2 = "dataflow.demux"(%arg8, %arg7) : (i1, i32) -> (i32, i32)
    %27 = "arith.muli"(%26#0, %26#0) <{overflowFlags = #arith.overflow<none>}> : (i32, i32) -> i32
    %28 = "arith.addi"(%26#1, %26#1) <{overflowFlags = #arith.overflow<none>}> : (i32, i32) -> i32
    %29 = "dataflow.mux"(%arg8, %27, %28) : (i1, i32, i32) -> i32
    %30 = "dataflow.mux"(%arg8, %25#0, %25#1) : (i1, none, none) -> none
    %31:2 = "dataflow.sync"(%30, %29) : (none, i32) -> (none, i32)
    "dataflow.graph.return"(%31#1, %31#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):
    %22 = "arith.addi"(%arg5, %arg5) <{overflowFlags = #arith.overflow<none>}> : (i32, i32) -> i32
    %23 = "arith.muli"(%22, %arg5) <{overflowFlags = #arith.overflow<none>}> : (i32, 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_2", sym_visibility = "private"}> ({
  ^bb0(%arg2: none, %arg3: i32):
    %20 = "llvm.freeze"(%arg3) : (i32) -> i32
    %21:2 = "dataflow.sync"(%arg2, %20) : (none, i32) -> (none, i32)
    "dataflow.graph.return"(%21#1, %21#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 = "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) -> ()
  }) : () -> ()
}) : () -> ()