[Mlir-commits] [mlir] [mlir][tosa] Move SLICE constant-operand checks to tosa-validate (PR #234584)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Oct 22 04:22:20 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Wijkqwe

<details>
<summary>Changes</summary>

Part of #<!-- -->233457.

`SliceOp::verify()` reads start/size from their tosa.const_shape producers
and checks their values, which is not local to the operation. Move the
ERROR_IF conditions to checkErrorIfSlice():

- ERROR_IF(any(start < 0))
- ERROR_IF(any(size <= 0))
- ERROR_IF(is_block_scale && start[rank - 1] % innermost_block_size != 0)

Drop the two MLIR-specific consistency checks (output shape matching the
size values, start + size within input bounds), following #<!-- -->233064.

This also fixes a latent out-of-bounds access: the block-scaled alignment
check called startValues.back() without guarding against a non-constant
start, which left startValues empty. tosa.dim satisfies the
TosaResolvableShapeOperands trait but does not resolve to constants, so
this was reachable and aborted the verifier. A regression test covers it.

Assisted-by: AI.

---
Full diff: https://github.com/llvm/llvm-project/pull/234584.diff


5 Files Affected:

- (modified) mlir/lib/Dialect/Tosa/IR/TosaOps.cpp (-62) 
- (modified) mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp (+28) 
- (modified) mlir/test/Dialect/Tosa/error_if_check.mlir (+20) 
- (modified) mlir/test/Dialect/Tosa/tosa-validation-version-1p1-invalid.mlir (+11-1) 
- (modified) mlir/test/Dialect/Tosa/verifier.mlir (+16-60) 


``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````

</details>


https://github.com/llvm/llvm-project/pull/234584


More information about the Mlir-commits mailing list