8000 Reintroduces the ability to load IOPDDL json files (at least internal… · IBMZ-Linux-OSS-Python/tensorflow@3e7742d · GitHub
[go: up one dir, main page]

Skip to content

Commit 3e7742d

Browse files
Reintroduces the ability to load IOPDDL json files (at least internally).
PiperOrigin-RevId: 766413274
1 parent 45473f6 commit 3e7742d

File tree

5 files changed

+0
-95
lines changed

5 files changed

+0
-95
lines changed

third_party/xla/xla/hlo/experimental/auto_sharding/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,6 @@ cc_test(
476476
# CC_TEST_OK=tests imported from the IOPDDL library.
477477
name = "iopddl_test",
478478
srcs = ["iopddl_test.cc"],
479-
data = ["example.json"],
480479
deps = [
481480
":iopddl_lib",
482481
"//xla/tsl/platform:status_matchers",

third_party/xla/xla/hlo/experimental/auto_sharding/example.json

Lines changed: 0 additions & 45 deletions
This file was deleted.

third_party/xla/xla/hlo/experimental/auto_sharding/iopddl.cc

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ limitations under the License.
1919
#include <algorithm>
2020
#include <cstdint>
2121
#include <optional>
22-
#include <string>
2322
#include <vector>
2423

2524
#include "absl/status/status.h"
@@ -89,45 +88,4 @@ absl::StatusOr<TotalCost> Evaluate(const Problem& problem,
8988
return cost;
9089
}
9190

92-
// TODO(moffitt): Re-implement this using an XLA-friendly library (eg, jsoncpp).
93-
absl::StatusOr<Problem> ReadProblem(const std::string& filename) {
94-
/*
95-
const nlohmann::json data = nlohmann::json::parse(std::ifstream(filename));
96-
Problem problem = {.name = data["problem"]["name"]};
97-
const auto& nodes = data["problem"]["nodes"];
98-
for (const auto& node_interval : nodes["intervals"]) {
99-
problem.nodes.push_back({.interval = {node_interval[0], node_interval[1]}});
100-
}
101-
for (NodeIdx node_idx = 0; node_idx < problem.nodes.size(); ++node_idx) {
102-
Node& node = problem.nodes[node_idx];
103-
const auto& costs = nodes["costs"][node_idx];
104-
const auto& usages = nodes["usages"][node_idx];
105-
node.strategies.reserve(costs.size());
106-
for (StrategyIdx strategy_idx = 0; strategy_idx < costs.size();
107-
++strategy_idx) {
108-
node.strategies.push_back(
109-
{.cost = costs[strategy_idx], .usage = usages[strategy_idx]});
110-
}
111-
}
112-
const auto& edges = data["problem"]["edges"];
113-
for (const auto& node_list : edges["nodes"]) {
114-
problem.edges.push_back({});
115-
for (const NodeIdx node_idx : node_list) {
116-
problem.edges.back().nodes.push_back(node_idx);
117-
}
118-
}
119-
for (EdgeIdx edge_idx = 0; edge_idx < problem.edges.size(); ++edge_idx) {
120-
Edge& edge = problem.edges[edge_idx];
121-
for (const Cost cost : edges["costs"][edge_idx]) {
122-
edge.strategies.push_back({.cost = cost, .usage = 0});
123-
}
124-
}
125-
if (data["problem"].contains("usage_limit")) {
126-
problem.usage_limit = data["problem"]["usage_limit"];
127-
}
128-
return problem;
129-
*/
130-
return absl::UnimplementedError("ReadProblem is not implemented");
131-
}
132-
13391
} // namespace iopddl

third_party/xla/xla/hlo/experimental/auto_sharding/iopddl.h

Lines changed: 0 additions & 2 deletions
C18A
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ struct Problem {
7474
absl::StatusOr<TotalCost> Evaluate(const Problem& problem,
7575
const Solution& solution);
7676

77-
absl::StatusOr<Problem> ReadProblem(const std::string& filename);
78-
7977
} // namespace iopddl
8078

8179
#endif // XLA_HLO_EXPERIMENTAL_AUTO_SHARDING_IOPDDL_H_

third_party/xla/xla/hlo/experimental/auto_sharding/iopddl_test.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ TEST(EvaluateTest, IllegalSolutionHasBogusStrategyIndex) {
109109
absl::StatusCode::kOutOfRange);
110110
}
111111

112-
TEST(DISABLED_ReadProblemTest, ExampleFile) {
113-
const std::string filename = "example.json";
114-
EXPECT_THAT(ReadProblem(filename), IsOkAndHolds(GetExampleProblem()));
115-
}
116-
117112
TEST(SolveTest, FindsOptimalSolution) {
118113
EXPECT_THAT(Solver().Solve(GetExampleProblem(), absl::Seconds(1)),
119114
IsOkAndHolds(Solution{0, 0, 2, 1, 0}));

0 commit comments

Comments
 (0)
0