Skip to content

Commit 36a8dba

Browse files
faizan-mtensorflower-gardener
authored andcommitted
Avoid losing payloads at Status recreation
PiperOrigin-RevId: 395088620 Change-Id: Ib17e2942a04351a98533c51a978f3c5227fd68d4
1 parent 83959a6 commit 36a8dba

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

tensorflow/compiler/xla/service/hlo_pass_pipeline.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ limitations under the License.
2727
#include "tensorflow/compiler/xla/status_macros.h"
2828
#include "tensorflow/compiler/xla/types.h"
2929
#include "tensorflow/compiler/xla/util.h"
30+
#include "tensorflow/core/platform/errors.h"
3031
#include "tensorflow/core/platform/logging.h"
3132

3233
namespace xla {
@@ -130,9 +131,10 @@ Status HloPassPipeline::RunInvariantCheckers(
130131
if (!changed_status.ok()) {
131132
VLOG(2) << "Failed invariant check:";
132133
XLA_VLOG_LINES(2, hlo->ToString());
133-
return Status(changed_status.status().code(),
134-
absl::StrCat(changed_status.status().error_message(),
135-
"\n\nFailed after ", after_pass_name));
134+
return tensorflow::errors::CreateWithUpdatedMessage(
135+
changed_status.status(),
136+
absl::StrCat(changed_status.status().error_message(),
137+
"\n\nFailed after ", after_pass_name));
136138
}
137139
TF_RET_CHECK(!changed_status.ValueOrDie())
138140
<< "invariant checkers must not change the graph";

tensorflow/compiler/xla/service/service.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,10 @@ Service::ResolveAndValidateArguments(
240240
for (size_t i = 0; i < arguments.size(); ++i) {
241241
auto buffer_status = allocation_tracker_.Resolve(*arguments[i]);
242242
if (!buffer_status.ok()) {
243-
return Status(buffer_status.status().code(),
244-
StrCat(buffer_status.status().error_message(), ", ",
245-
"failed to resolve allocation for parameter ", i));
243+
return tensorflow::errors::CreateWithUpdatedMessage(
244+
buffer_status.status(),
245+
StrCat(buffer_status.status().error_message(), ", ",
246+
"failed to resolve allocation for parameter ", i));
246247
}
247248
auto replicated_buffers = buffer_status.ValueOrDie();
248249
CHECK_EQ(options_.number_of_replicas(), replicated_buffers.size());

0 commit comments

Comments
 (0)