@@ -658,21 +658,23 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetInfo(
658
658
// device. Since Level Zero supports only one device, there is only one
659
659
// pointer. If the pointer is NULL, we don't do anything. Otherwise, we
660
660
// copy the program's binary image to the buffer at that pointer.
661
- uint8_t **PBinary = ur_cast<uint8_t **>(ProgramInfo);
662
- if (!PBinary[0 ])
663
- break ;
661
+ if (ProgramInfo) {
662
+ uint8_t **PBinary = ur_cast<uint8_t **>(ProgramInfo);
663
+ if (!PBinary[0 ])
664
+ break ;
664
665
665
- std::shared_lock<ur_shared_mutex> Guard (Program->Mutex );
666
- if (Program->State == ur_program_handle_t_::IL ||
667
- Program->State == ur_program_handle_t_::Native ||
668
- Program->State == ur_program_handle_t_::Object) {
669
- std::memcpy (PBinary[0 ], Program->Code .get (), Program->CodeLength );
670
- } else if (Program->State == ur_program_handle_t_::Exe) {
671
- size_t SzBinary = 0 ;
672
- ZE2UR_CALL (zeModuleGetNativeBinary,
673
- (Program->ZeModule , &SzBinary, PBinary[0 ]));
674
- } else {
675
- return UR_RESULT_ERROR_INVALID_PROGRAM;
666
+ std::shared_lock<ur_shared_mutex> Guard (Program->Mutex );
667
+ if (Program->State == ur_program_handle_t_::IL ||
668
+ Program->State == ur_program_handle_t_::Native ||
669
+ Program->State == ur_program_handle_t_::Object) {
670
+ std::memcpy (PBinary[0 ], Program->Code .get (), Program->CodeLength );
671
+ } else if (Program->State == ur_program_handle_t_::Exe) {
672
+ size_t SzBinary = 0 ;
673
+ ZE2UR_CALL (zeModuleGetNativeBinary,
674
+ (Program->ZeModule , &SzBinary, PBinary[0 ]));
675
+ } else {
676
+ return UR_RESULT_ERROR_INVALID_PROGRAM;
677
+ }
676
678
}
677
679
break ;
678
680
}
@@ -720,8 +722,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetInfo(
720
722
} catch (...) {
721
723
return UR_RESULT_ERROR_UNKNOWN;
722
724
}
725
+ case UR_PROGRAM_INFO_SOURCE:
726
+ return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
723
727
default :
724
- die ( " urProgramGetInfo: not implemented " ) ;
728
+ return UR_RESULT_ERROR_INVALID_ENUMERATION ;
725
729
}
726
730
727
731
return UR_RESULT_SUCCESS;
0 commit comments