Skip to content

[TIRx] Replace vars in buffer strides and elem_offset#19871

Open
guan404ming wants to merge 1 commit into
apache:mainfrom
guan404ming:tirx-fix-bufferreplacer
Open

[TIRx] Replace vars in buffer strides and elem_offset#19871
guan404ming wants to merge 1 commit into
apache:mainfrom
guan404ming:tirx-fix-bufferreplacer

Conversation

@guan404ming

Copy link
Copy Markdown
Member

Why

BufferReplacer passed strides and elem_offset through unchanged, so vars in them were never substituted

How

  • Visit and rewrite each strides expr and elem_offset when rebuilding the buffer.
  • Add test covering the fix.

Signed-off-by: Guan-Ming (Wesley) Chiu <105915352+guan404ming@users.noreply.github.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the BufferReplacer in python/tvm/tirx/transform/common.py to correctly mutate variables within a buffer's strides and element offset, resolving a previously marked FIXME. It also adds a unit test to verify this behavior. The review feedback points out a potential TypeError if buffer.strides is None and suggests adding a defensive check to handle this case safely.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread python/tvm/tirx/transform/common.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant