Repository navigation
fix(kernels): reject INT32_MAX index in TensorListScatter resize - #127438
Merged
copybara-service[bot] merged 1 commit intoSep 25, 2026
Merged
copybara-service[bot] merged 1 commit into
copybara-service[bot] merged 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request prevents undefined behavior and signed integer overflow in TensorListScatter by ensuring that the calculated list length is representable as an int32_t before resizing. It also adds a corresponding unit test to verify that tensor_list_scatter correctly rejects unrepresentable list lengths. I have no feedback to provide as the changes are correct and include appropriate test coverage.
TensorListScatter resized with signed `highest_index + 1`, which overflows when the index is INT32_MAX. Apply the same guard already used by TensorListScatterIntoExistingList and size the backing vector with size_t.
adi-IL
force-pushed
the
fix/tensorlist-scatter-int32-max
branch
from
September 15, 2026 18:38
8f9ffef to
2fa1860
Compare
dmiltr3
self-requested a review
September 16, 2026 17:18
dmiltr3
approved these changes
Sep 16, 2026
dmiltr3
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Internal presubmit tests have passed.
dmiltr3
approved these changes
Sep 17, 2026
This was referenced Sep 24, 2026
This was referenced Sep 24, 2026
copybara-service Bot
pushed a commit
that referenced
this pull request
Sep 24, 2026
…alysis Replace TuplePointsToAnalysis and LogicalBuffer usage in LayoutAssignment and GpuLayoutAssignment with HloDataflowAnalysis and HloValue. Add support in HloDataflowAnalysis for disabling cross computation control flow propagation and for propagating CallMarker custom calls so layout assignment preserves per computation constraint propagation semantics. Reverts changelist 983366087 FUTURE_COPYBARA_INTEGRATE_REVIEW=#127438 from adi-IL:fix/tensorlist-scatter-int32-max 2fa1860 PiperOrigin-RevId: 646627339
copybara-service Bot
pushed a commit
that referenced
this pull request
Sep 24, 2026
host_offload_utils::GetSuccessors and GetPredecessors built a CallGraph of the whole module whenever a walk stepped across a computation root or parameter. HostOffloader did the same at three more sites, so a run built one graph per boundary step of its walks. The two utilities now take the graph as an argument. HostOffloader builds it once per run, when its first walk starts, and HostOffloadLegalize passes the graph it already had. The pass adds and removes only instructions without called computations before its final HloCSE, so the call sites, and the resulting HLO, are unchanged. Reverts changelist 986346565 FUTURE_COPYBARA_INTEGRATE_REVIEW=#127438 from adi-IL:fix/tensorlist-scatter-int32-max 2fa1860 PiperOrigin-RevId: 987075240
copybara-service Bot
pushed a commit
that referenced
this pull request
Sep 24, 2026
When `block_host_until_done` is false, `~ExecutionWatchdogScope()` releases the `HangWatchdog::Guard` asynchronously via `stream_->DoHostCallback(...)`, so the guard and its `on_timeout` and `pre_abort` callbacks outlive `ExecutionWatchdogScope` and `GpuExecutable::ExecuteThunks()`. - Copy `ExecutionTimeoutHandler` by value in `ExecutionWatchdogScope::Arm()` instead of capturing a raw `const GpuExecutableRunOptions*` pointer that can dangle when callers allocate `GpuExecutableRunOptions` on the stack. - Separate `ThunkExecutor::ProgressTracker` from `ThunkExecutor::ScopedProgressTracker` via `std::shared_ptr` so `pre_abort` in `GpuExecutable::ExecuteThunksImpl()` captures `tracker->tracker()` by value while `ScopedProgressTracker` remains a stack-local move-only RAII guard that uninstalls the thread-local pointer when leaving the dispatch scope. Reverts changelist 986346565 FUTURE_COPYBARA_INTEGRATE_REVIEW=#127438 from adi-IL:fix/tensorlist-scatter-int32-max 2fa1860 PiperOrigin-RevId: 987122634
copybara-service Bot
pushed a commit
that referenced
this pull request
Sep 24, 2026
When `block_host_until_done` is false, `~ExecutionWatchdogScope()` releases the `HangWatchdog::Guard` asynchronously via `stream_->DoHostCallback(...)`, so the guard and its `on_timeout` and `pre_abort` callbacks outlive `ExecutionWatchdogScope` and `GpuExecutable::ExecuteThunks()`. - Copy `ExecutionTimeoutHandler` by value in `ExecutionWatchdogScope::Arm()` instead of capturing a raw `const GpuExecutableRunOptions*` pointer that can dangle when callers allocate `GpuExecutableRunOptions` on the stack. - Separate `ThunkExecutor::ProgressTracker` from `ThunkExecutor::ScopedProgressTracker` via `std::shared_ptr` so `pre_abort` in `GpuExecutable::ExecuteThunksImpl()` captures `tracker->tracker()` by value while `ScopedProgressTracker` remains a stack-local move-only RAII guard that uninstalls the thread-local pointer when leaving the dispatch scope. Reverts changelist 986346565 FUTURE_COPYBARA_INTEGRATE_REVIEW=#127438 from adi-IL:fix/tensorlist-scatter-int32-max 2fa1860 PiperOrigin-RevId: 987122634
copybara-service Bot
pushed a commit
that referenced
this pull request
Sep 24, 2026
Updates LLVM usage to match [e56c2cefc3e7](llvm/llvm-project@e56c2ce) Reverts changelist 983366087 FUTURE_COPYBARA_INTEGRATE_REVIEW=#127438 from adi-IL:fix/tensorlist-scatter-int32-max 2fa1860 PiperOrigin-RevId: 986804242
This was referenced Sep 24, 2026
copybara-service Bot
pushed a commit
that referenced
this pull request
Sep 24, 2026
Adds `MismatchDetails::has_element_level_data` (default true). Producers that only know that an instruction mismatched, not which elements, can set it to false so the tensor inspector is suppressed instead of showing a fabricated single-element mismatch. FUTURE_COPYBARA_INTEGRATE_REVIEW=#127438 from adi-IL:fix/tensorlist-scatter-int32-max 2fa1860 PiperOrigin-RevId: 987543462
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.
Why
TensorListScatterresized its backing vector with signedhighest_index + 1. When an index equalsINT32_MAX, that additionoverflows (undefined behavior) before the resize. The sibling op
TensorListScatterIntoExistingListalready rejects this case; Scatter didnot.
Scope
tensorflow/core/kernels/list_kernels.h(TensorListScatter):reject
highest_index == INT32_MAXwithInvalidArgument, and computethe resize length as
size_t.testScatterRejectsUnrepresentableLengthnext to the existingIntoExistingList coverage.
No dilation GPU, LinSpace, RollKernel, Conv2DBackpropInput,
LookupTableExportOp, fused MatMul bias, or Bessel changes.
Verification
InvalidArgumentfor indexnp.iinfo(np.int32).maxwithout attempting a multi-gigabyte resize.
intent.