[XLA] Verify instruction IDs don't over/under-flow int.
The proto field is int64, but the class field is int. PiperOrigin-RevId: 225044350
This commit is contained in:
parent
74ba359321
commit
a3ad14bbd2
@ -569,6 +569,11 @@ StatusOr<std::unique_ptr<HloInstruction>> HloInstruction::CreateFromProto(
|
||||
instruction->SetAndSanitizeName(proto.name());
|
||||
instruction->metadata_ = proto.metadata();
|
||||
instruction->backend_config_ = proto.backend_config();
|
||||
|
||||
TF_RET_CHECK(proto.id() >= 0)
|
||||
<< "Instruction with negative id: " << proto.id();
|
||||
TF_RET_CHECK(proto.id() <= INT_MAX)
|
||||
<< "Instruction with id > INT_MAX: " << proto.id();
|
||||
instruction->unique_id_ = proto.id();
|
||||
|
||||
if (proto.has_sharding()) {
|
||||
|
@ -39,6 +39,7 @@ HloProto MakeHloProto(const HloModule& module) {
|
||||
|
||||
StatusOr<std::unique_ptr<HloModule>> CreateModuleFromProto(
|
||||
const HloModuleProto& proto, const HloModuleConfig& module_config) {
|
||||
VLOG(4) << proto.ShortDebugString();
|
||||
TF_ASSIGN_OR_RETURN(std::unique_ptr<HloModule> module,
|
||||
HloModule::CreateFromProto(proto, module_config));
|
||||
TF_RETURN_IF_ERROR(
|
||||
|
Loading…
Reference in New Issue
Block a user