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

Method Run

tensorflow/compiler/xla/tests/hlo_test_base.cc:328–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328::testing::AssertionResult HloTestBase::Run(string_view hlo_string,
329 bool run_hlo_passes,
330 ExecutionProfile* profile,
331 string backend_config) {
332 auto module_or_status = ParseAndReturnVerifiedModule(hlo_string);
333 if (!module_or_status.ok()) {
334 return ::testing::AssertionFailure()
335 << "Error while parsing HLO text format: "
336 << module_or_status.status().ToString();
337 }
338
339 std::unique_ptr<HloModule> module = std::move(module_or_status.ValueOrDie());
340 const auto& fake_arguments =
341 MakeFakeArguments(module.get()).ConsumeValueOrDie();
342 std::vector<Literal*> fake_argument_ptrs;
343 absl::c_transform(
344 fake_arguments, std::back_inserter(fake_argument_ptrs),
345 [](const Literal& literal) { return const_cast<Literal*>(&literal); });
346
347 if (profile != nullptr) {
348 // We have to enable HLO profiling since otherwise currently the
349 // ExecutionProfile is not correct.
350 //
351 // TODO(b/119432044): Fix collection of the ExecutionProfile
352 // so that this is not necessary.
353 HloModuleConfig config = module->config();
354 DebugOptions debug_options = config.debug_options();
355 debug_options.set_xla_hlo_profile(true);
356 config.set_debug_options(debug_options);
357 module->set_config(config);
358 }
359
360 if (!backend_config.empty()) {
361 // Set backend configuration if it is given.
362 HloInstruction* instruction =
363 module->entry_computation()->root_instruction();
364 instruction->set_raw_backend_config_string(backend_config);
365 }
366
367 auto output = test_runner_.Execute(std::move(module), fake_argument_ptrs,
368 /*run_hlo_passes=*/run_hlo_passes,
369 /*profile=*/profile);
370
371 return output.ok()
372 ? ::testing::AssertionSuccess()
373 : ::testing::AssertionFailure() << output.status().error_message();
374}
375
376::testing::AssertionResult HloTestBase::RunMultipleTimes(
377 string_view hlo_string, bool run_hlo_passes,

Callers 15

ExtractModuleFunction · 0.45
PrepareReferenceModuleFunction · 0.45
RunHloPassMethod · 0.45
MakeReferenceModuleMethod · 0.45
RunAndCompareInternalMethod · 0.45
BM_ParallelFusionFunction · 0.45
XLA_TEST_PFunction · 0.45
DOT_ReorderContractingFunction · 0.45
BM_WhileLoopFunction · 0.45
XLA_TEST_PFunction · 0.45
VerifyHloModuleFunction · 0.45
XLA_TEST_FFunction · 0.45

Calls 14

MakeFakeArgumentsFunction · 0.85
ConsumeValueOrDieMethod · 0.80
set_debug_optionsMethod · 0.80
set_configMethod · 0.80
root_instructionMethod · 0.80
entry_computationMethod · 0.80
okMethod · 0.45
ToStringMethod · 0.45
statusMethod · 0.45
getMethod · 0.45
configMethod · 0.45

Tested by

no test coverage detected