Back to PBT run

test.mlir

// RUN: loom-raise-opt --loom-lower-graph-memory --mlir-print-op-generic %s | FileCheck %s

dataflow.graph private @sb_strand(
    %start: none, %idx: index, %val: i32, %exp: i32, %des: i32,
    %a: memref<16xi32>, %b: memref<16xi32>) -> ()
    attributes {input_segments = array<i32: 4, 0, 2>,
                result_segments = array<i32: 0, 0, 0>} {
  %r0, %d0 = dataflow.load %b[%idx] %start {sb_index = 0 : i64} : memref<16xi32>
  %r2, %d2 = dataflow.load %b[%idx] %start {contract = #dataflow.plain_access<is_volatile = true>, sb_index = 2 : i64} : memref<16xi32>
  %r3, %d3 = dataflow.load %a[%idx] %start {contract = #dataflow.atomic_access<ordering = acquire, sync_scope = <system>, source_alignment_bytes = 4>, sb_index = 3 : i64} : memref<16xi32>
  %d4 = dataflow.store %a[%idx] %val %start {contract = #dataflow.atomic_access<ordering = release, sync_scope = <system>, source_alignment_bytes = 4>, sb_index = 4 : i64} : memref<16xi32>
  dataflow.graph.return %start : none
}

// CHECK: "builtin.module"() ({
// CHECK-NEXT:   "dataflow.graph"() <{function_type = (index, i32, i32, i32, memref<16xi32>, memref<16xi32>) -> (), input_segments = array<i32: 4, 0, 2>, result_segments = array<i32: 0, 0, 0>, sym_name = "sb_strand", sym_visibility = "private"}> ({
// CHECK-NEXT:   ^bb0(%arg0: none, %arg1: index, %arg2: i32, %arg3: i32, %arg4: i32, %arg5: memref<16xi32>, %arg6: memref<16xi32>):
// CHECK-NEXT:     %0:2 = "dataflow.load"(%arg6, %arg1, %arg0) {sb_index = 0 : i64} : (memref<16xi32>, index, none) -> (i32, none)
// CHECK-NEXT:     %1:2 = "dataflow.load"(%arg6, %arg1, %arg0) <{contract = #dataflow.plain_access<is_volatile = true>}> {sb_index = 2 : i64} : (memref<16xi32>, index, none) -> (i32, none)
// CHECK-NEXT:     %2:2 = "dataflow.load"(%arg5, %arg1, %arg0) <{contract = #dataflow.atomic_access<ordering = acquire, sync_scope = <system>, source_alignment_bytes = 4>}> {sb_index = 3 : i64} : (memref<16xi32>, index, none) -> (i32, none)
// CHECK-NEXT:     %3 = "dataflow.store"(%arg5, %arg1, %arg2, %5#0) <{contract = #dataflow.atomic_access<ordering = release, sync_scope = <system>, source_alignment_bytes = 4>}> {sb_index = 4 : i64} : (memref<16xi32>, index, i32, none) -> none
// CHECK-NEXT:     %4:2 = "dataflow.sync"(%0#1, %1#1) : (none, none) -> (none, none)
// CHECK-NEXT:     %5:2 = "dataflow.sync"(%4#0, %2#1) : (none, none) -> (none, none)
// CHECK-NEXT:     "dataflow.graph.return"(%3) <{operandSegmentSizes = array<i32: 0, 0, 0, 1>}> : (none) -> ()
// CHECK-NEXT:   }) : () -> ()
// CHECK-NEXT: }) : () -> ()
// CHECK-EMPTY: