mirror of
https://github.com/zebrajr/tensorflow.git
synced 2025-12-06 12:20:11 +01:00
[NanoRt] NanoRt IFRT now returns a nullptr if it knows that the Array layout represents a default layout. The user code previously has been migrated to handle this new behavior gracefully, obtaining a concrete default layout as before.
Future note: At some point, `NanoArray` would need to distinguish between a default layout vs. a concrete layout that is equal to the default layout. If the latter is used, `NanoArray::pjrt_layout()` is expected to return the concrete layout. This is not required by IFRT API semantics yet, but it will be enforced later in the future. PiperOrigin-RevId: 821808592
This commit is contained in:
parent
dc12ec4556
commit
b915d3103a
|
|
@ -412,9 +412,7 @@ class NanoArray final : public NanoValue<NanoArray, ifrt::Array> {
|
|||
|
||||
absl::StatusOr<std::shared_ptr<const PjRtLayout>> pjrt_layout()
|
||||
const override {
|
||||
TF_RETURN_IF_ERROR(ValidateNotDeleted());
|
||||
return std::make_shared<PjRtLayout>(
|
||||
LayoutUtil::MakeDescendingLayout(shape().dims().size()));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
absl::StatusOr<std::vector<ifrt::ArrayRef>> DisassembleIntoSingleDeviceArrays(
|
||||
|
|
@ -646,7 +644,7 @@ class ShardedNanoArray final : public NanoValue<ShardedNanoArray, ifrt::Array> {
|
|||
|
||||
absl::StatusOr<std::shared_ptr<const PjRtLayout>> pjrt_layout()
|
||||
const override {
|
||||
return std::make_shared<PjRtLayout>(Layout(shape().dims()));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
absl::StatusOr<std::vector<ifrt::ArrayRef>> DisassembleIntoSingleDeviceArrays(
|
||||
|
|
|
|||
|
|
@ -319,6 +319,8 @@ int main(int argc, char** argv) {
|
|||
"ArrayImplTest.MakeArrayFromHostBufferAndCopyToHostBufferWithString:"
|
||||
"ArrayImplTest."
|
||||
"MakeArraysFromHostBufferShardsAndCopyToHostBufferWithString:"
|
||||
// Custom layouts are not supported in NanoIfrtClient.
|
||||
"ArrayImplTest.MakeArraysFromHostBufferShardsWithLayout:"
|
||||
// `MakeErrorArrays` is not supported in NanoIfrtClient.
|
||||
"ArrayImplTest.MakeErrorArrays:"
|
||||
"ArrayImplTest.CopyPoisonedArray:"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user