MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ExecuteOnPlatform

Function ExecuteOnPlatform

tensorflow/compiler/xla/tools/run_hlo_module.cc:48–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46namespace {
47
48Literal ExecuteOnPlatform(std::unique_ptr<HloModule> module,
49 absl::Span<const Literal> args,
50 se::Platform* platform, bool run_hlo_passes) {
51 HloRunner runner(platform);
52
53 TF_QCHECK_OK(VerifyHloModule(module.get(), /*layout_sensitive=*/false,
54 /*allow_mixed_precision=*/true))
55 << " (on " << platform->Name() << ")";
56
57 std::cerr << "Running HLO module on platform " << platform->Name() << "...\n";
58 XLA_VLOG_LINES(1, module->ToString());
59 const auto start = std::chrono::high_resolution_clock::now();
60 auto result_status = runner.Execute(std::move(module), args, run_hlo_passes);
61 const auto end = std::chrono::high_resolution_clock::now();
62 std::chrono::duration<double> diff = end - start;
63 std::cerr << "... compiled and ran in " << diff.count() << "s.\n";
64
65 TF_QCHECK_OK(result_status.status())
66 << "Failed to execute on " << platform->Name() << "\n";
67
68 return result_status.ConsumeValueOrDie();
69}
70} // namespace
71
72::testing::AssertionResult RunAndCompare(

Callers 1

RunAndCompareFunction · 0.85

Calls 8

VerifyHloModuleFunction · 0.85
ConsumeValueOrDieMethod · 0.80
getMethod · 0.45
NameMethod · 0.45
ToStringMethod · 0.45
ExecuteMethod · 0.45
countMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected