Skip to content

Commit fe96358

Browse files
pizzudGoogle-ML-Automation
authored andcommitted
hlo_instruction: Don't derefence a NULL OpMetadata during printing.
It's unclear as yet why this happens, but a NULL check is cheap to add. PiperOrigin-RevId: 738911264
1 parent e05e955 commit fe96358

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

xla/hlo/ir/hlo_instruction.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3918,9 +3918,10 @@ void HloInstruction::PrintWithCanonicalNameMap(
39183918
}
39193919

39203920
if (options.print_metadata() &&
3921-
(!metadata_->op_type().empty() || !metadata_->op_name().empty() ||
3922-
!metadata_->source_file().empty() ||
3923-
!metadata_->scheduling_name().empty())) {
3921+
(metadata_ != nullptr &&
3922+
(!metadata_->op_type().empty() || !metadata_->op_name().empty() ||
3923+
!metadata_->source_file().empty() ||
3924+
!metadata_->scheduling_name().empty()))) {
39243925
printer->Append(", metadata={");
39253926
printer->Append(xla::OpMetadataToString(
39263927
*metadata_, options.print_metadata_only_op_name()));

0 commit comments

Comments
 (0)