Skip to content

[Fix][Relax] Canonicalize strided slice begin indices - #20284

Open
napronald wants to merge 1 commit into
apache:mainfrom
napronald:fix-strided-slice-index-canonicalization
Open

[Fix][Relax] Canonicalize strided slice begin indices#20284
napronald wants to merge 1 commit into
apache:mainfrom
napronald:fix-strided-slice-index-canonicalization

Conversation

@napronald

Copy link
Copy Markdown
Contributor

Summary

This fixes #20262 and #20263.

Currently, strided_slice lowering can fail when begin falls outside the input bounds. The output shape already canonicalizes begin and end when assume_inbound=False, but the generated source index could still use the original begin value. This can produces the correct output shape while reading from the wrong location or outside the input tensor.

This PR updates the affected lowering paths to use the existing CanonicalizeIndex logic when constructing source indices and handles begin == extent with a negative stride, where the canonical start is extent - 1. Existing assume_inbound=True logic is unchanged.

@napronald
napronald marked this pull request as draft September 7, 2026 07:30
@napronald
napronald force-pushed the fix-strided-slice-index-canonicalization branch from cc499e6 to 6790484 Compare September 7, 2026 08:41
@napronald
napronald marked this pull request as ready for review September 7, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant