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

Method ParseHloModule

tensorflow/compiler/xla/service/hlo_parser.cc:501–530  ·  view source on GitHub ↗

::= 'HloModule' name computations

Source from the content-addressed store, hash-verified

499
500// ::= 'HloModule' name computations
501bool HloParserImpl::ParseHloModule(HloModule* module) {
502 if (lexer_.GetKind() != TokKind::kw_HloModule) {
503 return TokenError("expects HloModule");
504 }
505 // Eat 'HloModule'
506 lexer_.Lex();
507
508 std::string name;
509 if (!ParseName(&name)) {
510 return false;
511 }
512
513 absl::optional<bool> is_scheduled;
514 absl::flat_hash_map<std::string, AttrConfig> attrs;
515 attrs["is_scheduled"] = {/*required=*/false, AttrTy::kBool, &is_scheduled};
516 if (!ParseAttributes(attrs)) {
517 return false;
518 }
519
520 module->set_name(name);
521 if (!ParseComputations(module)) {
522 return false;
523 }
524
525 if (is_scheduled.has_value() && *is_scheduled) {
526 TF_CHECK_OK(module->set_schedule(ScheduleFromInstructionOrder(module)));
527 }
528
529 return true;
530}
531
532// computations ::= (computation)+
533bool HloParserImpl::ParseComputations(HloModule* module) {

Callers

nothing calls this directly

Calls 7

ParseAttributesFunction · 0.85
GetKindMethod · 0.80
LexMethod · 0.80
set_scheduleMethod · 0.80
set_nameMethod · 0.45
has_valueMethod · 0.45

Tested by

no test coverage detected