extra.push_back(StrCat("exponent_bits=", exponent_bits_));
extra.push_back(StrCat("mantissa_bits=", mantissa_bits_));
}
+ if (opcode() == HloOpcode::kCustomCall) {
+ extra.push_back(
+ StrCat("custom_call_target=\"", CEscape(custom_call_target_), "\""));
+ }
return extra;
}
/*false_computation_arg=*/operands[2], *false_computation));
break;
}
- case HloOpcode::kCustomCall:
+ case HloOpcode::kCustomCall: {
+ optional<string> custom_call_target;
+ attrs["custom_call_target"] = {/*required=*/true, AttrTy::kString,
+ &custom_call_target};
+ if (!ParseOperands(&operands) || !ParseAttributes(attrs)) {
+ return false;
+ }
+ instruction = builder->AddInstruction(HloInstruction::CreateCustomCall(
+ shape, operands, *custom_call_target));
+ break;
+ }
case HloOpcode::kTrace:
return TokenError(StrCat("parsing not yet implemented for op: ",
HloOpcodeString(opcode)));
}
)"
+},
+
+// CustomCall
+{
+"CustomCall",
+R"(HloModule custom_call:
+
+ENTRY %CustomCall () -> f32[1,2,3] {
+ %constant = f32[1]{0} constant({12345})
+ ROOT %custom-call = f32[1,2,3]{0,2,1} custom-call(f32[1]{0} %constant), custom_call_target="foo\"bar"
}
+
+)"
+},
});
// clang-format on
}