Files
clang-p2996/mlir/test/Dialect/SCF/parallel-loop-invalid.mlir
Justin Fargnoli e38c8bdca8 [MLIR][scf.parallel] Don't allow a tile size of 0 (#68762)
Fix a crash reported in #64331. The crash is described in the following
comment:

> It looks like the bug is being caused by the command line argument
--scf-parallel-loop-tiling=parallel-loop-tile-sizes=0. More
specifically, --scf-parallel-loop-tiling=parallel-loop-tile-sizes sets
the tileSize variable to 0 on [this
line](7cc1bfaf37/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp (L67)).
tileSize is then used on [this
line](7cc1bfaf37/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp (L117))
causing a divide by zero exception.

This PR will:

1. Call `signalPassFail()` when 0 is passed as a tile size.
2. Avoid the divide by zero that causes the crash. 

Note: This is my first PR for MLIR, so please liberally critique it.
2023-10-23 14:28:44 -07:00

12 lines
481 B
MLIR

// RUN: mlir-opt %s -pass-pipeline='builtin.module(func.func(scf-parallel-loop-tiling{parallel-loop-tile-sizes=0,0}))' -split-input-file -verify-diagnostics
// The expected error is, "tile size cannot be 0" at an unknown location. (It's
// location is unknown because the it's caused by an invalid command line
// argument.)
// XFAIL: *
func.func @parallel_loop(%arg0 : index, %arg1 : index, %arg2 : index) {
scf.parallel (%i) = (%arg0) to (%arg1) step (%arg2) {}
return
}