diff --git a/unified-runtime/source/adapters/cuda/program.hpp b/unified-runtime/source/adapters/cuda/program.hpp index b6478a4973d58..7371283c274d1 100644 --- a/unified-runtime/source/adapters/cuda/program.hpp +++ b/unified-runtime/source/adapters/cuda/program.hpp @@ -53,6 +53,10 @@ struct ur_program_handle_t_ : ur::cuda::handle_base { KernelReqdWorkGroupSizeMD{}, KernelMaxWorkGroupSizeMD{}, KernelMaxLinearWorkGroupSizeMD{}, KernelReqdSubGroupSizeMD{} { urContextRetain(Context); + + // When the log is queried we use strnlen(InfoLog), so it needs to be + // initialized like this when it's empty to correctly return 0. + InfoLog[0] = '\0'; } ~ur_program_handle_t_() { urContextRelease(Context); } diff --git a/unified-runtime/source/adapters/hip/program.hpp b/unified-runtime/source/adapters/hip/program.hpp index 38857f635bcfd..c94818c6c43ab 100644 --- a/unified-runtime/source/adapters/hip/program.hpp +++ b/unified-runtime/source/adapters/hip/program.hpp @@ -52,6 +52,10 @@ struct ur_program_handle_t_ : ur::hip::handle_base { RefCount{1}, Context{Ctxt}, Device{Device}, KernelReqdWorkGroupSizeMD{}, KernelReqdSubGroupSizeMD{} { urContextRetain(Context); + + // When the log is queried we use strnlen(InfoLog), so it needs to be + // initialized like this when it's empty to correctly return 0. + InfoLog[0] = '\0'; } ~ur_program_handle_t_() { urContextRelease(Context); } diff --git a/unified-runtime/test/conformance/program/urProgramGetBuildInfo.cpp b/unified-runtime/test/conformance/program/urProgramGetBuildInfo.cpp index 9d956f3606f58..a01e4251828c0 100644 --- a/unified-runtime/test/conformance/program/urProgramGetBuildInfo.cpp +++ b/unified-runtime/test/conformance/program/urProgramGetBuildInfo.cpp @@ -55,8 +55,6 @@ TEST_P(urProgramGetBuildInfoTest, SuccessOptions) { } TEST_P(urProgramGetBuildInfoTest, SuccessLog) { - UUR_KNOWN_FAILURE_ON(uur::CUDA{}); - size_t property_size = 0; const ur_program_build_info_t property_name = UR_PROGRAM_BUILD_INFO_LOG;