Repository navigation
PR #129186: Validate that LoopCond nodes are inside a while loop frame - #129461
Draft
copybara-service[bot] wants to merge 1 commit into
Draft
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
Imported from GitHub PR #129186 Calling `tf.raw_ops.LoopCond(input=True)` outside of a while loop frame aborts in debug builds (`--config=dbg`) with: ``` F tensorflow/core/graph/graph_partition.cc:649] Check failed: !frame_name.empty() Aborted (core dumped) ``` ### Cause A `LoopCond` op placed directly in the graph outside of an `Enter` op has an empty `frame_name` (`""`). In `AddControlFlow` (`tensorflow/core/graph/graph_partition.cc`), debug builds assert `DCHECK(!frame_name.empty())` when populating `frame_cond_map`. ### Solution - Replaced `DCHECK(!frame_name.empty())` in `AddControlFlow` (`tensorflow/core/graph/graph_partition.cc`) with an explicit `InvalidArgumentError` return. - Added unit tests in `tensorflow/core/graph/graph_partition_test.cc` and `tensorflow/python/kernel_tests/control_flow/control_flow_ops_py_test.py`. Fixes #62982. Copybara import of the project: -- 13bd94f by bodapatisaikrishna <[email protected]>: Validate that LoopCond nodes are inside a while loop frame -- 67e499f by bodapatisaikrishna <[email protected]>: Validate LoopCond frame in AddControlFlow and drop ValidateControlFlowInfo check Revert the empty frame check in ValidateControlFlowInfo to preserve incomplete graph handling in XLA compilation passes, keep the validation in AddControlFlow, and add a C++ partition regression test along with pinned Python test assertions under deprecated v1. -- 1a2b45d by bodapatisaikrishna <[email protected]>: Add direct status and str_cat includes to graph_partition.cc Include absl/status/status.h and absl/strings/str_cat.h directly for absl::InvalidArgumentError and absl::StrCat. Merging this change closes #129186 Reverts 7f20bc9 FUTURE_COPYBARA_INTEGRATE_REVIEW=#129186 from bodapatisaikrishna:fix/62982-loopcond-empty-frame 1a2b45d PiperOrigin-RevId: 1005356514
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.
PR #129186: Validate that LoopCond nodes are inside a while loop frame
Imported from GitHub PR #129186
Calling
tf.raw_ops.LoopCond(input=True)outside of a while loop frame aborts in debug builds (--config=dbg) with:Cause
A
LoopCondop placed directly in the graph outside of anEnterop has an emptyframe_name(""). InAddControlFlow(tensorflow/core/graph/graph_partition.cc), debug builds assertDCHECK(!frame_name.empty())when populatingframe_cond_map.Solution
DCHECK(!frame_name.empty())inAddControlFlow(tensorflow/core/graph/graph_partition.cc) with an explicitInvalidArgumentErrorreturn.tensorflow/core/graph/graph_partition_test.ccandtensorflow/python/kernel_tests/control_flow/control_flow_ops_py_test.py.Fixes #62982.
Copybara import of the project:
--
13bd94f by bodapatisaikrishna [email protected]:
Validate that LoopCond nodes are inside a while loop frame
--
67e499f by bodapatisaikrishna [email protected]:
Validate LoopCond frame in AddControlFlow and drop ValidateControlFlowInfo check
Revert the empty frame check in ValidateControlFlowInfo to preserve
incomplete graph handling in XLA compilation passes, keep the validation
in AddControlFlow, and add a C++ partition regression test along with
pinned Python test assertions under deprecated v1.
--
1a2b45d by bodapatisaikrishna [email protected]:
Add direct status and str_cat includes to graph_partition.cc
Include absl/status/status.h and absl/strings/str_cat.h directly for
absl::InvalidArgumentError and absl::StrCat.
Merging this change closes #129186
Reverts 7f20bc9
FUTURE_COPYBARA_INTEGRATE_REVIEW=#129186 from bodapatisaikrishna:fix/62982-loopcond-empty-frame 1a2b45d