Fix out-of-bounds access in nested select/if_then_else codegen#26
Merged
LeiWang1999 merged 1 commit intotilelang_mainfrom Feb 3, 2026
Merged
Fix out-of-bounds access in nested select/if_then_else codegen#26LeiWang1999 merged 1 commit intotilelang_mainfrom
LeiWang1999 merged 1 commit intotilelang_mainfrom
Conversation
- Improved the handling of nested conditions in the if_then_else construct to prevent out-of-bounds access by combining outer select conditions. - Added a stack to manage select conditions during code generation, ensuring proper evaluation order and safety. - Updated comments for clarity and better understanding of the changes made.
LeiWang1999
added a commit
to LeiWang1999/tilelang
that referenced
this pull request
Feb 3, 2026
Update TVM to include fix for out-of-bounds memory access when if_then_else is nested inside select during code generation. See: tile-ai/tvm#26 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
LeiWang1999
added a commit
to tile-ai/tilelang
that referenced
this pull request
Feb 3, 2026
Update TVM submodule: fix select/if_then_else OOB access Update TVM to include fix for out-of-bounds memory access when if_then_else is nested inside select during code generation. See: tile-ai/tvm#26 Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
if_then_elseis nested insideselectselect_condition_stack_to track outer select conditions during code generationProblem
When generating code for
select(cond1, if_then_else(cond2, A[index], default), fallback), the previous implementation would evaluateA[index]even whencond1is false, potentially causing out-of-bounds access.Before:
After:
Test plan
select_oob.pyexample that triggers OOB when index < 0🤖 Generated with Claude Code