Regression test from seed 3

mlir-stage-21-v1 · regression test PR · draft · ← all drafts

Add a regression test for mlir-stage-21-v1

This adds one LIT test covering 4 lines and 1 branch outcome that the existing suite does not reach, across 1 source file, at 48615bc5925ef4b9db8b4550b5d4322933cf4b7b.

Coverage this test adds

Source file Newly covered lines Newly covered branch outcomes
lib/Frontend/Lowering/GraphIndexLowering.cpp 94–97 93:12–93:15 true

lib/Frontend/Lowering/GraphIndexLowering.cpp

 91            .getResult(); 92      });+93    if (auto mul = value.getDefiningOp<::mlir::arith::MulIOp>())    [true branch at 93:12]+94      return materializeBinary(mul, [&](::mlir::Value lhs, ::mlir::Value rhs) {+95        return ::mlir::arith::MulIOp::create(builder, mul.getLoc(), lhs, rhs)+96            .getResult();+97      }); 98    if (auto shl = value.getDefiningOp<::mlir::arith::ShLIOp>()) 99      return materializeBinary(shl, [&](::mlir::Value lhs, ::mlir::Value rhs) {

The test

The input was reduced from 41 to 34 lines while keeping every covered line and branch outcome above, and while the compiler still accepted it. The CHECK lines are the compiler's exact output on this input at 48615bc5925ef4b9db8b4550b5d4322933cf4b7b.

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

dataflow.graph private @pair_0(%start: none, %lb: i64, %ub: i64, %step: i64,
    %a: memref<?xi32>, %b: memref<?xi32>) -> ()
    attributes {input_segments = array<i32: 3, 0, 2>,
                result_segments = array<i32: 0, 0, 0>} {
  scf.for %i = %lb to %ub step %step : i64 {
    %scaled = arith.muli %i, %step : i64
    %idx = arith.index_cast %scaled : i64 to index
  }
  dataflow.graph.return %start : none
}

dataflow.graph private @acc_1(%start: none, %lb: i64, %ub: i64, %step: i64, %init: i32,
    %a: memref<?xi32>) -> (i32)
    attributes {input_segments = array<i32: 4, 0, 1>,
                result_segments = array<i32: 1, 0, 0>} {
  %total = scf.for %i = %lb to %ub step %step
      iter_args(%state = %init) -> (i32) : i64 {
    %shifted = arith.addi %i, %lb : i64
    %idx = arith.index_cast %shifted : i64 to index
    %aloaded = memref.load %a[%idx] : memref<?xi32>
    %asum = arith.addi %state, %aloaded : i32
    memref.store %asum, %a[%idx] : memref<?xi32>
    scf.yield %asum : i32
  }
  dataflow.graph.return %start, %total : none, i32
}

dataflow.graph private @pair_2(%start: none, %lb: i64, %ub: i64, %step: i64,
    %a: memref<?xi32>, %b: memref<?xi32>) -> ()
    attributes {input_segments = array<i32: 3, 0, 2>,
                result_segments = array<i32: 0, 0, 0>} {
  dataflow.graph.return %start : none
}


// CHECK: "builtin.module"() ({
// CHECK-NEXT:   "dataflow.graph"() <{function_type = (i64, i64, i64, memref<?xi32>, memref<?xi32>) -> (), input_segments = array<i32: 3, 0, 2>, result_segments = array<i32: 0, 0, 0>, sym_name = "pair_0", sym_visibility = "private"}> ({
// CHECK-NEXT:   ^bb0(%arg12: none, %arg13: i64, %arg14: i64, %arg15: i64, %arg16: memref<?xi32>, %arg17: memref<?xi32>):
// CHECK-NEXT:     %26:2 = "dataflow.stream"(%arg13, %arg14, %arg15) <{predicate = 2 : i64, step_kind = 0 : i32}> : (i64, i64, i64) -> (i64, i1)
// CHECK-NEXT:     %27 = "dataflow.carry"(%26#1, %arg12, %28#1) : (i1, none, none) -> none
// CHECK-NEXT:     %28:2 = "dataflow.demux"(%26#1, %27) : (i1, none) -> (none, none)
// CHECK-NEXT:     %29 = "dataflow.invariant"(%26#1, %arg15) : (i1, i64) -> i64
// CHECK-NEXT:     %30:2 = "dataflow.gate"(%26#1, %29) : (i1, i64) -> (i1, i64)
// CHECK-NEXT:     %31:2 = "dataflow.demux"(%30#0, %30#1) : (i1, i64) -> (i64, i64)
// CHECK-NEXT:     %32 = "arith.cmpi"(%arg13, %arg14) <{predicate = 2 : i64}> : (i64, i64) -> i1
// CHECK-NEXT:     %33:2 = "dataflow.demux"(%32, %28#0) : (i1, none) -> (none, none)
// CHECK-NEXT:     %34:2 = "dataflow.sync"(%33#1, %31#0) : (none, i64) -> (none, i64)
// CHECK-NEXT:     %35 = "dataflow.mux"(%32, %33#0, %34#0) : (i1, none, none) -> none
// CHECK-NEXT:     "dataflow.graph.return"(%35) <{operandSegmentSizes = array<i32: 0, 0, 0, 1>}> : (none) -> ()
// CHECK-NEXT:   }) : () -> ()
// CHECK-NEXT:   "dataflow.graph"() <{function_type = (i64, i64, i64, i32, memref<?xi32>) -> i32, input_segments = array<i32: 4, 0, 1>, result_segments = array<i32: 1, 0, 0>, sym_name = "acc_1", sym_visibility = "private"}> ({
// CHECK-NEXT:   ^bb0(%arg6: none, %arg7: i64, %arg8: i64, %arg9: i64, %arg10: i32, %arg11: memref<?xi32>):
// CHECK-NEXT:     %0:2 = "dataflow.stream"(%arg7, %arg8, %arg9) <{predicate = 2 : i64, step_kind = 0 : i32}> : (i64, i64, i64) -> (i64, i1)
// CHECK-NEXT:     %1 = "dataflow.carry"(%0#1, %arg6, %2#1) : (i1, none, none) -> none
// CHECK-NEXT:     %2:2 = "dataflow.demux"(%0#1, %1) : (i1, none) -> (none, none)
// CHECK-NEXT:     %3 = "dataflow.carry"(%0#1, %arg10, %18) : (i1, i32, i32) -> i32
// CHECK-NEXT:     %4:2 = "dataflow.demux"(%0#1, %3) : (i1, i32) -> (i32, i32)
// CHECK-NEXT:     %5 = "dataflow.invariant"(%0#1, %arg7) : (i1, i64) -> i64
// CHECK-NEXT:     %6:2 = "dataflow.gate"(%0#1, %5) : (i1, i64) -> (i1, i64)
// CHECK-NEXT:     %7:2 = "dataflow.demux"(%6#0, %6#1) : (i1, i64) -> (i64, i64)
// CHECK-NEXT:     %8 = "dataflow.carry"(%0#1, %arg6, %19) : (i1, none, none) -> none
// CHECK-NEXT:     %9 = "dataflow.carry"(%0#1, %arg6, %19) : (i1, none, none) -> none
// CHECK-NEXT:     %10:2 = "dataflow.demux"(%0#1, %8) : (i1, none) -> (none, none)
// CHECK-NEXT:     %11:2 = "dataflow.demux"(%0#1, %9) : (i1, none) -> (none, none)
// CHECK-NEXT:     %12 = "arith.index_cast"(%0#0) : (i64) -> index
// CHECK-NEXT:     %13 = "arith.index_cast"(%6#1) : (i64) -> index
// CHECK-NEXT:     %14 = "arith.addi"(%12, %13) <{overflowFlags = #arith.overflow<none>}> : (index, index) -> index
// CHECK-NEXT:     %15:2 = "dataflow.sync"(%2#1, %10#1) : (none, none) -> (none, none)
// CHECK-NEXT:     %16:2 = "dataflow.load"(%arg11, %14, %15#0) : (memref<?xi32>, index, none) -> (i32, none)
// CHECK-NEXT:     %17:2 = "dataflow.sync"(%11#1, %16#1) : (none, none) -> (none, none)
// CHECK-NEXT:     %18 = "arith.addi"(%4#1, %16#0) <{overflowFlags = #arith.overflow<none>}> : (i32, i32) -> i32
// CHECK-NEXT:     %19 = "dataflow.store"(%arg11, %14, %18, %17#0) : (memref<?xi32>, index, i32, none) -> none
// CHECK-NEXT:     %20 = "arith.cmpi"(%arg7, %arg8) <{predicate = 2 : i64}> : (i64, i64) -> i1
// CHECK-NEXT:     %21:2 = "dataflow.demux"(%20, %2#0) : (i1, none) -> (none, none)
// CHECK-NEXT:     %22:2 = "dataflow.sync"(%21#1, %7#0) : (none, i64) -> (none, i64)
// CHECK-NEXT:     %23 = "dataflow.mux"(%20, %21#0, %22#0) : (i1, none, none) -> none
// CHECK-NEXT:     %24:2 = "dataflow.sync"(%23, %11#0) : (none, none) -> (none, none)
// CHECK-NEXT:     %25:2 = "dataflow.sync"(%24#0, %4#0) : (none, i32) -> (none, i32)
// CHECK-NEXT:     "dataflow.graph.return"(%25#1, %25#0) <{operandSegmentSizes = array<i32: 1, 0, 0, 1>}> : (i32, none) -> ()
// CHECK-NEXT:   }) : () -> ()
// CHECK-NEXT:   "dataflow.graph"() <{function_type = (i64, i64, i64, memref<?xi32>, memref<?xi32>) -> (), input_segments = array<i32: 3, 0, 2>, result_segments = array<i32: 0, 0, 0>, sym_name = "pair_2", sym_visibility = "private"}> ({
// CHECK-NEXT:   ^bb0(%arg0: none, %arg1: i64, %arg2: i64, %arg3: i64, %arg4: memref<?xi32>, %arg5: memref<?xi32>):
// CHECK-NEXT:     "dataflow.graph.return"(%arg0) <{operandSegmentSizes = array<i32: 0, 0, 0, 1>}> : (none) -> ()
// CHECK-NEXT:   }) : () -> ()
// CHECK-NEXT: }) : () -> ()
// CHECK-EMPTY:

Validation

  • Native compiler and FileCheck replay: passed at 48615bc5925ef4b9db8b4550b5d4322933cf4b7b.
  • Property checker verdict on the reduced pair: PASS (postcondition.spct, SHA-256 4e78786f5374b18cbbafc81bcb69ec15749e015ab6359de6e7af6022321918c8).
  • Reduction criterion: accepted checker PASS and every original line/branch increment over the suite baseline.

Where this test came from

PBT mlir-stage-21-v1, run 20260911-085343, seed 3.

The property under test is anchored on documentation:

  • selected output: docs/spec-compiler-part-3-mem.md lines 327–329 (output side)
  • linked input 29: docs/spec-compiler-part-3-mem.md lines 482–486 (input side)
  • linked input 32: docs/spec-compiler-part-3-mem.md lines 92–97 (input side)
  • linked input 50: docs/spec-compiler-part-3-mem.md lines 148–152 (input side)
  • linked input 59: docs/spec-compiler-part-3-mem.md lines 136–140 (input side)
  • linked input 66: docs/spec-compiler-part-3-mem.md lines 489–493 (input side)
  • linked input 67: docs/spec-compiler-part-3-mem.md lines 3–6 (input side)
  • linked input 68: docs/spec-compiler-part-3-mem.md lines 79–90 (input side)
  • linked input 80: docs/spec-compiler-part-3-mem.md lines 99–106 (input side)
  • linked input 102: docs/spec-compiler-part-3-mem.md lines 389–393 (input side)
  • linked input 104: docs/spec-compiler-part-3-mem.md lines 470–480 (input side)
  • linked input 115: docs/spec-compiler-part-3-mem.md lines 486–489 (input side)
  • linked input 126: docs/spec-compiler-part-3-mem.md lines 142–146 (input side)
  • linked input 149: docs/spec-compiler-part-3-mem.md lines 43–46 (input side)
  • linked input 170: docs/spec-compiler-part-3-mem.md lines 154–157 (input side)
  • linked input 182: docs/spec-compiler-part-3-mem.md lines 382–387 (input side)
  • linked input 184: docs/spec-compiler-part-3-mem.md lines 34–35 (input side)
  • linked input 195: docs/spec-compiler-part-3-mem.md lines 159–161 (input side)
  • linked input 200: docs/spec-compiler-part-3-mem.md lines 40–41 (input side)
  • linked input 202: docs/spec-compiler-part-3-mem.md lines 31–32 (input side)
  • linked input 211: docs/spec-compiler-part-3-mem.md lines 245–251 (input side)

Coverage is measured against the recorded baseline suite at this revision, and counts unique mapped file locations including generated code. Reduction retains every added line or branch outcome and a passing property check; it is not a claim of global minimality, nor of a defect.

Originating PBT run · Seed 3

LIT test · PR patch · Native verification