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

Method ParseInstruction

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

instruction ::= ('ROOT')? name '=' shape opcode operands (attribute)

Source from the content-addressed store, hash-verified

655
656// instruction ::= ('ROOT')? name '=' shape opcode operands (attribute)*
657bool HloParserImpl::ParseInstruction(HloComputation::Builder* builder,
658 std::string* root_name) {
659 std::string name;
660 LocTy maybe_root_loc = lexer_.GetLoc();
661 bool is_root = EatIfPresent(TokKind::kw_ROOT);
662
663 const LocTy name_loc = lexer_.GetLoc();
664 if (!ParseName(&name) ||
665 !ParseToken(TokKind::kEqual, "expects '=' in instruction")) {
666 return false;
667 }
668
669 if (is_root) {
670 if (!root_name->empty()) {
671 return Error(maybe_root_loc, "one computation should have only one ROOT");
672 }
673 *root_name = name;
674 }
675
676 return ParseInstructionRhs(builder, name, name_loc);
677}
678
679bool HloParserImpl::ParseInstructionRhs(HloComputation::Builder* builder,
680 const std::string& name,

Callers

nothing calls this directly

Calls 3

GetLocMethod · 0.80
ErrorFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected