[all-commits] [llvm/llvm-project] 108b08: [mlir] Add RuntimeVerifiableOpInterface and transform
Matthias Springer via All-commits
all-commits at lists.llvm.org
Wed Dec 21 01:57:30 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 108b08f2a91272f82d524616a337a8ce52edeed5
https://github.com/llvm/llvm-project/commit/108b08f2a91272f82d524616a337a8ce52edeed5
Author: Matthias Springer <springerm at google.com>
Date: 2022-12-21 (Wed, 21 Dec 2022)
Changed paths:
A mlir/include/mlir/Dialect/MemRef/Transforms/RuntimeOpVerification.h
M mlir/include/mlir/InitAllDialects.h
M mlir/include/mlir/Interfaces/CMakeLists.txt
A mlir/include/mlir/Interfaces/RuntimeVerifiableOpInterface.h
A mlir/include/mlir/Interfaces/RuntimeVerifiableOpInterface.td
M mlir/include/mlir/Transforms/Passes.h
M mlir/include/mlir/Transforms/Passes.td
M mlir/lib/Dialect/MemRef/Transforms/CMakeLists.txt
A mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
M mlir/lib/Interfaces/CMakeLists.txt
A mlir/lib/Interfaces/RuntimeVerifiableOpInterface.cpp
M mlir/lib/Transforms/CMakeLists.txt
A mlir/lib/Transforms/GenerateRuntimeVerification.cpp
A mlir/test/Dialect/MemRef/runtime-verification.mlir
M utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
Log Message:
-----------
[mlir] Add RuntimeVerifiableOpInterface and transform
Static op verification cannot detect cases where an op is valid at compile time but may be invalid at runtime.
An example of such an op is `memref::ExpandShapeOp`.
Invalid at compile time: `memref.expand_shape %m [[0, 1]] : memref<11xf32> into memref<2x5xf32>`
Valid at compile time (because we do not know any better): `memref.expand_shape %m [[0, 1]] : memref<?xf32> into memref<?x5xf32>`. This op may or may not be valid at runtime depending on the runtime shape of `%m`.
Invalid runtime ops such as the one above are hard to debug because they can crash the program execution at a seemingly unrelated position or (even worse) compute an invalid result without crashing.
This revision adds a new op interface `RuntimeVerifiableOpInterface` that can be implemented by ops that provide additional runtime verification. Such runtime verification can be computationally expensive, so it is only generated on an opt-in basis by running `-generate-runtime-verification`. A simple runtime verifier for `memref::ExpandShapeOp` is provided as an example.
Differential Revision: https://reviews.llvm.org/D138576
More information about the All-commits
mailing list