Skip to content

Commit

Permalink
Add constructor to MockSharding that also takes device list to allow …
Browse files Browse the repository at this point in the history
…tests that need working call to Sharding::devices().

PiperOrigin-RevId: 675658638
  • Loading branch information
Google-ML-Automation committed Sep 17, 2024
1 parent cd5f5e0 commit 721395e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ CUDNN_REDIST_JSON_DICT = {
"https://developer.download.nvidia.com/compute/cudnn/redist/redistrib_9.3.0.json",
"d17d9a7878365736758550294f03e633a0b023bec879bf173349bfb34781972e",
],
"9.4.0": [
"https://developer.download.nvidia.com/compute/cudnn/redist/redistrib_9.4.0.json",
"6eeaafc5cc3d4bb2f283e6298e4c55d4c59d7c83c5d9fd8721a2c0e55aee4e54",
],
}

# The versions are different for x86 and aarch64 architectures because only
Expand Down
6 changes: 6 additions & 0 deletions xla/python/ifrt/mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,12 @@ class MockSharding : public llvm::RTTIExtends<MockSharding, Sharding> {
BasicDeviceList::Create({}), MemoryKind(),
/*is_fully_replicated=*/false) {}

explicit MockSharding(tsl::RCReference<DeviceList> devices,
MemoryKind memory_kind = MemoryKind(),
bool is_fully_replicated = false)
: llvm::RTTIExtends<MockSharding, Sharding>(devices, memory_kind,
is_fully_replicated) {}

MOCK_METHOD(
(absl::StatusOr<
std::vector<std::pair<Shape, std::shared_ptr<const Sharding>>>>),
Expand Down

0 comments on commit 721395e

Please sign in to comment.