Repository navigation
Serialize CPU ScatterND string updates - #32033
Merged
Akshay Sonawane (apsonawane) merged 2 commits intoAug 13, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves CPU ScatterND behavior for string tensors by ensuring updates are applied serially (avoiding concurrent std::string mutation) and adds tests that validate deterministic behavior with duplicate indices, including "add" reduction concatenation order.
Changes:
- Disable
TryParallelForparallelism forstd::stringin the CPUScatterNDdispatch path by settingtp = nullptr. - Add a test that validates βlast update winsβ for duplicate indices with string data.
- Add a test that validates
"add"reduction concatenates strings in update order for duplicate indices.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| onnxruntime/core/providers/cpu/tensor/scatter_nd.cc | Disables parallel execution for string updates in ScatterNDDispatchTarget to avoid unsafe concurrent string operations. |
| onnxruntime/test/providers/cpu/tensor/scatter_nd_op_test.cc | Adds new string-focused tests covering duplicate indices with default reduction and "add" reduction. |
π‘ Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Ti-Tai Wang (titaiwangms)
approved these changes
Aug 13, 2026
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.
This pull request introduces improvements to the handling and testing of string data in the
ScatterNDoperator. The main changes include a fix to disable parallelization for string data types and the addition of new test cases to verify correct behavior with duplicate indices and string concatenation.Improvements to string data handling:
tp = nullptr) forstd::stringdata types in theScatterNDDispatchTargetstruct to prevent potential issues with concurrent string operations.Expanded test coverage:
ScatterND_string_duplicate_indicestest to verify that when duplicate indices are present, the last update value is used for string data.ScatterND_string_add_duplicate_indicestest to verify that when the reduction attribute is set to"add", updates to the same string index are concatenated in order.