Back to PBT run

input.mlir

llvm.func @imported_callable(i64) -> i64
func.func private @native_callable(%arg_a: i32) -> i32 {
  return %arg_a : i32
}
dataflow.thread private @thread_0 domain(#dataflow.thread_domain<dense>)(
    %limit: index, %memory: memref<?xindex>) ctrl (%ctrl: none) {
  "loom.spatial_region"(%limit, %memory)
      <{operandSegmentSizes = array<i32: 1, 0, 1, 0>,
        resultSegmentSizes = array<i32: 0, 0>}> ({
    ^bb0(%lim: index, %target: memref<?xindex>):
      %zero = arith.constant 0 : index
      %one = arith.constant 1 : index
      %two = arith.constant 2 : index
      %flag = arith.cmpi ult, %zero, %two : index
      scf.if %flag {
      scf.for %iv1 = %zero to %two step %one {
      %ld2 = memref.load %target[%zero] : memref<?xindex>
      %ad2 = arith.addi %ld2, %one : index
      memref.store %ad2, %target[%zero] : memref<?xindex>
      %ld3 = memref.load %target[%zero] : memref<?xindex>
      %ad3 = arith.addi %ld3, %one : index
      memref.store %ad3, %target[%zero] : memref<?xindex>
      }
      scf.for %iv4 = %zero to %two step %one {
      memref.store %one, %target[%zero] : memref<?xindex>
      }
      } else {
      %wr6 = scf.while (%wa6 = %zero) : (index) -> index {
        %wc6 = arith.cmpi ult, %wa6, %two : index
        scf.condition(%wc6) %wa6 : index
      } do {
      ^bb0(%wb6: index):
      memref.store %one, %target[%zero] : memref<?xindex>
      memref.store %one, %target[%zero] : memref<?xindex>
        %wn6 = arith.addi %wb6, %one : index
        scf.yield %wn6 : index
      }
      }
      scf.if %flag {
      %wr10 = scf.while (%wa10 = %zero) : (index) -> index {
        %wc10 = arith.cmpi ult, %wa10, %two : index
        scf.condition(%wc10) %wa10 : index
      } do {
      ^bb0(%wb10: index):
      memref.store %one, %target[%zero] : memref<?xindex>
        %wn10 = arith.addi %wb10, %one : index
        scf.yield %wn10 : index
      }
      %ld12 = memref.load %target[%zero] : memref<?xindex>
      %ad12 = arith.addi %ld12, %one : index
      memref.store %ad12, %target[%zero] : memref<?xindex>
      }
      "loom.spatial_yield"()
          <{operandSegmentSizes = array<i32: 0, 0>}> : () -> ()
  }) {graph_name = "g_thread_0", source_maps = []} :
      (index, memref<?xindex>) -> ()
  dataflow.thread.yield
}
dataflow.thread private @thread_1 domain(#dataflow.thread_domain<dense>)(
    %limit: index, %memory: memref<?xindex>) ctrl (%ctrl: none) {
  "loom.spatial_region"(%limit, %memory)
      <{operandSegmentSizes = array<i32: 1, 0, 1, 0>,
        resultSegmentSizes = array<i32: 0, 0>}> ({
    ^bb0(%lim: index, %target: memref<?xindex>):
      %zero = arith.constant 0 : index
      %one = arith.constant 1 : index
      %two = arith.constant 2 : index
      %flag = arith.cmpi ult, %zero, %two : index
      scf.parallel (%iv13) = (%zero) to (%two) step (%one) {
        %mx13 = arith.muli %zero, %two : index
        %ix13 = arith.addi %mx13, %iv13 : index
      memref.store %one, %target[%ix13] : memref<?xindex>
      memref.store %one, %target[%ix13] : memref<?xindex>
        scf.reduce
      }
      scf.for %iv16 = %zero to %two step %one {
      %ld17 = memref.load %target[%zero] : memref<?xindex>
      %ad17 = arith.addi %ld17, %one : index
      memref.store %ad17, %target[%zero] : memref<?xindex>
      %ld18 = memref.load %target[%zero] : memref<?xindex>
      %ad18 = arith.addi %ld18, %one : index
      memref.store %ad18, %target[%zero] : memref<?xindex>
      }
      "loom.spatial_yield"()
          <{operandSegmentSizes = array<i32: 0, 0>}> : () -> ()
  }) {graph_name = "g_thread_1", source_maps = []} :
      (index, memref<?xindex>) -> ()
  dataflow.thread.yield
}