[Mlir-commits] [mlir] [mlir][tensor] Fix runtime verification for tensor.extract_slice for empty tensor slices (PR #166569)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Nov 7 04:39:01 PST 2025
Hanumanth04 wrote:
> A pedantic comment about the comparison to numpy/python. Python/NumPy allows fully out-of-bounds slicing without throwing errors, so it's different, much looser semantics, than what you're seeking to implement. Your other points seem valid.
>
> ```
> arr = np.arange(10)
> empty = arr[15:4] # returns [], valid or not
> empty = arr[15:15] # returns [], valid or not
> clamped = arr[9:15] # returns [9], the out-of-bounds arg value is clamped
> ```
Thanks @[noclowns](https://github.com/noclowns) for looking into this PR. Appreciate it.
Good point! You're right that Python/NumPy has looser semantics. I'll remove the example from the description to avoid confusion.
The core issue is that the verifier is rejecting empty slices at boundary positions, which are valid operations since no memory is accessed. I'll update the PR description to focus on that.
https://github.com/llvm/llvm-project/pull/166569
More information about the Mlir-commits
mailing list