Regression test from seed 0

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

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

This adds one LIT test covering 1 line and 5 branch outcomes that the existing suite does not reach, across 2 source files, at 48615bc5925ef4b9db8b4550b5d4322933cf4b7b.

Coverage this test adds

Source file Newly covered lines Newly covered branch outcomes
lib/Dataflow/IR/DataflowActorSemantics.cpp 287 285:7–285:17 true; 285:7–286:48 true; 308:42–308:78 false; 308:9–308:38 false
lib/Dataflow/IR/OperationSchema.cpp — 730:7–730:27 true

lib/Dataflow/IR/DataflowActorSemantics.cpp

 283      return {}; 284    auto invariant = demux.getInput().getDefiningOp<dataflow::InvariantOp>();+285    if (!invariant || invariant.getCond() != stream.getPhase() ||    [true branch at 285:7, true branch at 285:7]+286        invariant.getOutput() != demux.getInput())+287      return {}; 288    return invariant.getInit(); 289  }@@ 306      auto stream = demux.getSel().getDefiningOp<dataflow::StreamOp>(); 307      if (stream && demux.getSel() == stream.getPhase() &&+308          result.getResultNumber() == 1 && unwrapPhaseProjection(value, stream))    [false branch at 308:42, false branch at 308:9] 309        return; 310    }

The test

The input was reduced from 37 to 33 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-scf-to-dfg --mlir-print-op-generic %s | FileCheck %s

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
      scf.for %iv0 = %zero to %two step %one {
      %ld1 = memref.load %target[%zero] : memref<?xindex>
      %ad1 = arith.addi %ld1, %one : index
      memref.store %ad1, %target[%zero] : memref<?xindex>
      }
      %wr2 = scf.while (%wa2 = %zero) : (index) -> index {
        %wc2 = arith.cmpi ult, %wa2, %two : index
        scf.condition(%wc2) %wa2 : index
      } do {
      ^bb0(%wb2: index):
      memref.store %one, %target[%zero] : memref<?xindex>
        %wn2 = arith.addi %wb2, %one : index
        scf.yield %wn2 : index
      }
      "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) {
  dataflow.thread.yield
}

// CHECK: "builtin.module"() ({
// CHECK-NEXT:   "dataflow.thread"() <{domain = #dataflow.thread_domain<dense>, function_type = (index, memref<?xindex>) -> (), sym_name = "thread_0", sym_visibility = "private"}> ({
// CHECK-NEXT:   ^bb0(%arg6: index, %arg7: memref<?xindex>, %arg8: none):
// CHECK-NEXT:     %53 = "dataflow.graph.launch"(%arg8, %arg6, %arg7) <{callee = @g_thread_0, operandSegmentSizes = array<i32: 1, 1, 0, 1, 0>, resultSegmentSizes = array<i32: 0, 0, 1>, source_maps = []}> : (none, index, memref<?xindex>) -> none
// CHECK-NEXT:     "dataflow.thread.yield"(%53) : (none) -> ()
// CHECK-NEXT:   }) : () -> ()
// CHECK-NEXT:   "dataflow.thread"() <{domain = #dataflow.thread_domain<dense>, function_type = (index, memref<?xindex>) -> (), sym_name = "thread_1", sym_visibility = "private"}> ({
// CHECK-NEXT:   ^bb0(%arg3: index, %arg4: memref<?xindex>, %arg5: none):
// CHECK-NEXT:     "dataflow.thread.yield"() : () -> ()
// CHECK-NEXT:   }) : () -> ()
// CHECK-NEXT:   "dataflow.graph"() <{arg_attrs = [{}, {llvm.noalias}], function_type = (index, memref<?xindex>) -> (), input_segments = array<i32: 1, 0, 1>, result_segments = array<i32: 0, 0, 0>, sym_name = "g_thread_0", sym_visibility = "private"}> ({
// CHECK-NEXT:   ^bb0(%arg0: none, %arg1: index, %arg2: memref<?xindex>):
// CHECK-NEXT:     %0 = "dataflow.constant"(%arg0) <{const_value = 0 : index}> : (none) -> index
// CHECK-NEXT:     %1 = "dataflow.constant"(%arg0) <{const_value = 1 : index}> : (none) -> index
// CHECK-NEXT:     %2 = "dataflow.constant"(%arg0) <{const_value = 2 : index}> : (none) -> index
// CHECK-NEXT:     %3 = "arith.index_cast"(%0) : (index) -> i32
// CHECK-NEXT:     %4 = "arith.index_cast"(%2) : (index) -> i32
// CHECK-NEXT:     %5 = "arith.index_cast"(%1) : (index) -> i32
// CHECK-NEXT:     %6:2 = "dataflow.stream"(%3, %4, %5) <{predicate = 2 : i64, step_kind = 0 : i32}> : (i32, i32, i32) -> (i32, i1)
// CHECK-NEXT:     %7 = "dataflow.carry"(%6#1, %arg0, %8#1) : (i1, none, none) -> none
// CHECK-NEXT:     %8:2 = "dataflow.demux"(%6#1, %7) : (i1, none) -> (none, none)
// CHECK-NEXT:     %9 = "dataflow.invariant"(%6#1, %0) : (i1, index) -> index
// CHECK-NEXT:     %10:2 = "dataflow.gate"(%6#1, %9) : (i1, index) -> (i1, index)
// CHECK-NEXT:     %11:2 = "dataflow.demux"(%10#0, %10#1) : (i1, index) -> (index, index)
// CHECK-NEXT:     %12 = "dataflow.invariant"(%6#1, %1) : (i1, index) -> index
// CHECK-NEXT:     %13:2 = "dataflow.gate"(%6#1, %12) : (i1, index) -> (i1, index)
// CHECK-NEXT:     %14:2 = "dataflow.demux"(%13#0, %13#1) : (i1, index) -> (index, index)
// CHECK-NEXT:     %15 = "dataflow.carry"(%6#1, %arg0, %23) : (i1, none, none) -> none
// CHECK-NEXT:     %16 = "dataflow.carry"(%6#1, %arg0, %23) : (i1, none, none) -> none
// CHECK-NEXT:     %17:2 = "dataflow.demux"(%6#1, %15) : (i1, none) -> (none, none)
// CHECK-NEXT:     %18:2 = "dataflow.demux"(%6#1, %16) : (i1, none) -> (none, none)
// CHECK-NEXT:     %19:2 = "dataflow.sync"(%8#1, %17#1) : (none, none) -> (none, none)
// CHECK-NEXT:     %20:2 = "dataflow.load"(%arg2, %10#1, %19#0) : (memref<?xindex>, index, none) -> (index, none)
// CHECK-NEXT:     %21:2 = "dataflow.sync"(%18#1, %20#1) : (none, none) -> (none, none)
// CHECK-NEXT:     %22 = "arith.addi"(%20#0, %13#1) <{overflowFlags = #arith.overflow<none>}> : (index, index) -> index
// CHECK-NEXT:     %23 = "dataflow.store"(%arg2, %10#1, %22, %21#0) : (memref<?xindex>, index, index, none) -> none
// CHECK-NEXT:     %24 = "arith.cmpi"(%3, %4) <{predicate = 2 : i64}> : (i32, i32) -> i1
// CHECK-NEXT:     %25:2 = "dataflow.demux"(%24, %8#0) : (i1, none) -> (none, none)
// CHECK-NEXT:     %26:3 = "dataflow.sync"(%25#1, %11#0, %14#0) : (none, index, index) -> (none, index, index)
// CHECK-NEXT:     %27 = "dataflow.mux"(%24, %25#0, %26#0) : (i1, none, none) -> none
// CHECK-NEXT:     %28 = "dataflow.carry"(%32, %27, %34#1) : (i1, none, none) -> none
// CHECK-NEXT:     %29 = "dataflow.carry"(%32, %0, %46) : (i1, index, index) -> index
// CHECK-NEXT:     %30 = "dataflow.invariant"(%32, %2) : (i1, index) -> index
// CHECK-NEXT:     %31 = "dataflow.carry"(%32, %18#0, %45) : (i1, none, none) -> none
// CHECK-NEXT:     %32 = "arith.cmpi"(%29, %30) <{predicate = 6 : i64}> : (index, index) -> i1
// CHECK-NEXT:     %33:2 = "dataflow.demux"(%32, %28) : (i1, none) -> (none, none)
// CHECK-NEXT:     %34:2 = "dataflow.gate"(%32, %28) : (i1, none) -> (i1, none)
// CHECK-NEXT:     %35:2 = "dataflow.demux"(%34#0, %34#1) : (i1, none) -> (none, none)
// CHECK-NEXT:     %36:2 = "dataflow.demux"(%32, %31) : (i1, none) -> (none, none)
// CHECK-NEXT:     %37:2 = "dataflow.demux"(%32, %29) : (i1, index) -> (index, index)
// CHECK-NEXT:     %38 = "dataflow.invariant"(%32, %1) : (i1, index) -> index
// CHECK-NEXT:     %39:2 = "dataflow.gate"(%32, %38) : (i1, index) -> (i1, index)
// CHECK-NEXT:     %40:2 = "dataflow.demux"(%39#0, %39#1) : (i1, index) -> (index, index)
// CHECK-NEXT:     %41 = "dataflow.invariant"(%32, %0) : (i1, index) -> index
// CHECK-NEXT:     %42:2 = "dataflow.gate"(%32, %41) : (i1, index) -> (i1, index)
// CHECK-NEXT:     %43:2 = "dataflow.demux"(%42#0, %42#1) : (i1, index) -> (index, index)
// CHECK-NEXT:     %44:2 = "dataflow.sync"(%34#1, %36#1) : (none, none) -> (none, none)
// CHECK-NEXT:     %45 = "dataflow.store"(%arg2, %42#1, %39#1, %44#0) : (memref<?xindex>, index, index, none) -> none
// CHECK-NEXT:     %46 = "arith.addi"(%37#1, %39#1) <{overflowFlags = #arith.overflow<none>}> : (index, index) -> index
// CHECK-NEXT:     %47:2 = "dataflow.demux"(%34#0, %34#1) : (i1, none) -> (none, none)
// CHECK-NEXT:     %48:4 = "dataflow.sync"(%47#0, %35#0, %40#0, %43#0) : (none, none, index, index) -> (none, none, index, index)
// CHECK-NEXT:     %49 = "dataflow.mux"(%34#0, %48#0, %47#1) : (i1, none, none) -> none
// CHECK-NEXT:     %50 = "dataflow.carry"(%32, %27, %49) : (i1, none, none) -> none
// CHECK-NEXT:     %51:2 = "dataflow.demux"(%32, %50) : (i1, none) -> (none, none)
// CHECK-NEXT:     %52:2 = "dataflow.sync"(%33#0, %51#0) : (none, none) -> (none, none)
// CHECK-NEXT:     "dataflow.graph.return"(%52#0, %36#0) <{operandSegmentSizes = array<i32: 0, 0, 0, 2>}> : (none, 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 1b36ea6d4e36596888d4e5081bae7a2edc8494a8b4713cc2852e0b4c08951bdd).
  • Reduction criterion: accepted checker PASS and every original line/branch increment over the suite baseline.

Where this test came from

PBT mlir-stage-06-v1, run 20260911-081718, seed 0.

The property under test is anchored on documentation:

  • selected output: docs/spec-compiler-part-3-dfg.md lines 102–109 (output side)
  • linked input 69: docs/spec-compiler-part-3-dfg.md lines 110–117 (input side)
  • linked input 76: docs/spec-compiler-part-3-dfg.md lines 92–100 (input side)
  • linked input 83: docs/spec-compiler-part-3-dfg.md lines 1454–1461 (input side)
  • linked input 92: docs/spec-compiler-part-3-dfg.md lines 117–120 (input side)
  • linked input 176: docs/spec-compiler-part-3-dfg.md lines 127–132 (input side)
  • linked input 203: docs/spec-compiler-part-3-dfg.md lines 87–90 (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 0

LIT test · PR patch · Native verification