Error Handling: propagate status for ReleaseGilAndTransferData
and XlaDataToTensors
.
#9431
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 PR refactors our error handling by replacing
GetValueOrThrow
with proper status propagation usingabsl::StatusOr<T>
andXLA_ASSIGN_OR_RETURN
macros.Key Changes:
ReleaseGilAndTransferData
Function:absl::StatusOr<std::vector<xla::Literal>>
.GetComputationClientOrDie()
withGetComputationClient()
.XLA_ASSIGN_OR_RETURN
for client acquisition andTransferFromDevice
calls.tensor_util.cpp
andxla_graph_executor.cpp
to handle the newStatusOr<T>
return type.XlaDataToTensors
Function:absl::StatusOr<std::vector<at::Tensor>>
.GetValueOrThrow
withXLA_ASSIGN_OR_RETURN
for theReleaseGilAndTransferData
call.XLATensor::ToTensor
,test_xla_sharding.cpp
,init_python_bindings.cpp
, andxla_backend_impl.cpp
) to correctly handle theStatusOr<T>
return type.status.h
includes toxla_backend_impl.cpp
andtest_xla_sharding.cpp
.These modifications align with existing status propagation patterns in the codebase, as seen in
pjrt_registry.cpp
, and maintain API-level backward compatibility while improving internal error handling within the tensor conversion pipeline.