Back to PBT run
input.mlir
module {
func.func @helper_double(%a: i32) -> i32 {
%d = arith.addi %a, %a : i32
return %d : i32
}
llvm.func @extern_scale(i32) -> i32
func.func @host_container(%target: memref<4xi32>, %value: i32) {
%hz = arith.constant 0 : index
%hn = arith.constant 4 : index
%hs = arith.constant 1 : index
scf.for %hi = %hz to %hn step %hs {
memref.store %value, %target[%hi] : memref<4xi32>
}
return
}
dataflow.thread private @thread_0 domain(#dataflow.thread_domain<dense>)(%mem: memref<4xi32>, %val: i32, %flag: i1) ctrl (%start: none) {
%lo = arith.constant 0 : index
%hi = arith.constant 2 : index
%stp = arith.constant 1 : index
%r0 = "loom.spatial_region"(%val)
<{operandSegmentSizes = array<i32: 1, 0, 0, 0>,
resultSegmentSizes = array<i32: 1, 0>}> ({
^bb0(%a: i32):
%s = arith.addi %a, %a : i32
%p = arith.muli %s, %a : i32
"loom.spatial_yield"(%p)
<{operandSegmentSizes = array<i32: 1, 0>}> : (i32) -> ()
}) {graph_name = "graph_0", source_maps = []} : (i32) -> i32
dataflow.thread.yield
}
dataflow.thread private @thread_1 domain(#dataflow.thread_domain<dense>)(%mem: memref<4xi32>, %val: i32, %flag: i1) ctrl (%start: none) {
%lo = arith.constant 0 : index
%hi = arith.constant 2 : index
%stp = arith.constant 1 : index
%icall = func.call @helper_double(%val) : (i32) -> i32
scf.if %flag {
%r1 = "loom.spatial_region"(%val)
<{operandSegmentSizes = array<i32: 1, 0, 0, 0>,
resultSegmentSizes = array<i32: 1, 0>}> ({
^bb0(%a: i32):
%called = func.call @helper_double(%a) : (i32) -> i32
"loom.spatial_yield"(%called)
<{operandSegmentSizes = array<i32: 1, 0>}> : (i32) -> ()
}) {graph_name = "graph_1", source_maps = []} : (i32) -> i32
}
scf.if %flag {
%r2 = "loom.spatial_region"(%val)
<{operandSegmentSizes = array<i32: 1, 0, 0, 0>,
resultSegmentSizes = array<i32: 1, 0>}> ({
^bb0(%a: i32):
%z = arith.constant 0 : index
%n = arith.constant 2 : index
%o = arith.constant 1 : index
%acc = scf.for %i = %z to %n step %o iter_args(%carry = %a) -> (i32) {
%next = arith.addi %carry, %a : i32
scf.yield %next : i32
}
"loom.spatial_yield"(%acc)
<{operandSegmentSizes = array<i32: 1, 0>}> : (i32) -> ()
}) {graph_name = "graph_2", source_maps = []} : (i32) -> i32
}
dataflow.thread.yield
}
}