Skip to content

test(tensorscatter): cover circular prefix preservation - #32264

Open
Ti-Tai Wang (titaiwangms) wants to merge 1 commit into
microsoft:mainfrom
titaiwangms:test/tensorscatter-circular-prefix-wrap
Open

test(tensorscatter): cover circular prefix preservation#32264
Ti-Tai Wang (titaiwangms) wants to merge 1 commit into
microsoft:mainfrom
titaiwangms:test/tensorscatter-circular-prefix-wrap

Conversation

@titaiwangms

Copy link
Copy Markdown
Contributor

Description

Adds a TensorScatter circular-mode regression test where the batch dimension exceeds the maximum sequence length. The case also wraps sequence writes from slot 3 to slot 0, verifying that modulo applies only to the sequence coordinate while every batch prefix remains unchanged.

Motivation and Context

onnx/onnx#8353 identified that applying modulo to every coordinate in the full index tuple can fold one batch into another. ONNX Runtime's CPU and CUDA kernels already preserve prefix coordinates, but the existing tests use prefix dimensions smaller than the maximum sequence length and cannot distinguish the incorrect behavior.

This test makes the regression observable: with batch_size=5 and max_sequence_length=4, a full-tuple modulo maps batch 4 to batch 0.

Related: onnx/onnx#8353

Testing

  • cmake --build build/cpu_only/Debug --target onnxruntime_provider_test --parallel
  • ./onnxruntime_provider_test --gtest_filter=TensorScatterTest.Circular_BatchLargerThanMaxSequenceLength
  • ./onnxruntime_provider_test --gtest_filter=TensorScatterTest.* (23 passed)
  • lintrunner onnxruntime/test/providers/cpu/llm/tensorscatter_op_test.cc

Add a discriminating regression case where the batch dimension exceeds the maximum sequence length while sequence writes wrap from slot 3 to slot 0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 427bc0f4-eaf2-406e-95ad-b5b1af6ccdc6
Signed-off-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 25, 2026 21:08

Copilot AI 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.

Pull request overview

Adds targeted regression coverage for TensorScatter circular mode to ensure batch coordinates are preserved during sequence wrapping.

Changes:

  • Tests batch size exceeding maximum sequence length.
  • Verifies sequence writes wrap from slot 3 to slot 0 without cross-batch corruption.

No actionable issues found.


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

3 participants