Skip to content

Commit 753a230

Browse files
author
Jaime Arteaga
committed
Port Retain build-log when program build failed
intel#8848 Signed-off-by: Jaime Arteaga <[email protected]>
1 parent da1e57d commit 753a230

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero_program.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,18 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetBuildInfo(
654654
if (PropSizeRet) {
655655
*PropSizeRet = LogSize;
656656
}
657+
if (PropValue) {
658+
// When the program build fails in piProgramBuild(), we delayed cleaning
659+
// up the build log because RT later calls this routine to get the
660+
// failed build log.
661+
// To avoid memory leaks, we should clean up the failed build log here
662+
// because RT does not create sycl::program when piProgramBuild() fails,
663+
// thus it won't call piProgramRelease() to clean up the build log.
664+
if (Program->State == ur_program_handle_t_::Invalid) {
665+
ZE_CALL_NOCHECK(zeModuleBuildLogDestroy, (Program->ZeBuildLog));
666+
Program->ZeBuildLog = nullptr;
667+
}
668+
}
657669
return UR_RESULT_SUCCESS;
658670
}
659671

0 commit comments

Comments
 (0)