@@ -477,30 +477,43 @@ ProgramManager::getPiProgramFromPiKernel(RT::PiKernel Kernel,
477
477
478
478
string_class ProgramManager::getProgramBuildLog (const RT::PiProgram &Program,
479
479
const ContextImplPtr Context) {
480
- size_t Size = 0 ;
480
+ size_t PIDevicesSize = 0 ;
481
481
const detail::plugin &Plugin = Context->getPlugin ();
482
482
Plugin.call <PiApiKind::piProgramGetInfo>(Program, PI_PROGRAM_INFO_DEVICES, 0 ,
483
- nullptr , &Size );
484
- vector_class<RT::PiDevice> PIDevices (Size / sizeof (RT::PiDevice));
483
+ nullptr , &PIDevicesSize );
484
+ vector_class<RT::PiDevice> PIDevices (PIDevicesSize / sizeof (RT::PiDevice));
485
485
Plugin.call <PiApiKind::piProgramGetInfo>(Program, PI_PROGRAM_INFO_DEVICES,
486
- Size, PIDevices.data (), nullptr );
486
+ PIDevicesSize, PIDevices.data (),
487
+ nullptr );
487
488
string_class Log = " The program was built for " +
488
489
std::to_string (PIDevices.size ()) + " devices" ;
489
490
for (RT::PiDevice &Device : PIDevices) {
491
+ std::string DeviceBuildInfoString;
492
+ size_t DeviceBuildInfoStrSize = 0 ;
490
493
Plugin.call <PiApiKind::piProgramGetBuildInfo>(
491
- Program, Device, CL_PROGRAM_BUILD_LOG, 0 , nullptr , &Size);
492
- vector_class<char > DeviceBuildInfo (Size);
493
- Plugin.call <PiApiKind::piProgramGetBuildInfo>(
494
- Program, Device, CL_PROGRAM_BUILD_LOG, Size, DeviceBuildInfo.data (),
495
- nullptr );
496
- Plugin.call <PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_INFO_NAME, 0 ,
497
- nullptr , &Size);
498
- vector_class<char > DeviceName (Size);
499
- Plugin.call <PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_INFO_NAME, Size,
500
- DeviceName.data (), nullptr );
494
+ Program, Device, CL_PROGRAM_BUILD_LOG, 0 , nullptr ,
495
+ &DeviceBuildInfoStrSize);
496
+ if (DeviceBuildInfoStrSize > 0 ) {
497
+ vector_class<char > DeviceBuildInfo (DeviceBuildInfoStrSize);
498
+ Plugin.call <PiApiKind::piProgramGetBuildInfo>(
499
+ Program, Device, CL_PROGRAM_BUILD_LOG, DeviceBuildInfoStrSize,
500
+ DeviceBuildInfo.data (), nullptr );
501
+ DeviceBuildInfoString = std::string (DeviceBuildInfo.data ());
502
+ }
501
503
502
- Log += " \n Build program log for '" + string_class (DeviceName.data ()) +
503
- " ':\n " + string_class (DeviceBuildInfo.data ());
504
+ std::string DeviceNameString;
505
+ size_t DeviceNameStrSize = 0 ;
506
+ Plugin.call <PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_INFO_NAME, 0 ,
507
+ nullptr , &DeviceNameStrSize);
508
+ if (DeviceNameStrSize > 0 ) {
509
+ vector_class<char > DeviceName (DeviceNameStrSize);
510
+ Plugin.call <PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_INFO_NAME,
511
+ DeviceNameStrSize,
512
+ DeviceName.data (), nullptr );
513
+ DeviceNameString = std::string (DeviceName.data ());
514
+ }
515
+ Log += " \n Build program log for '" + DeviceNameString + " ':\n " +
516
+ DeviceBuildInfoString;
504
517
}
505
518
return Log;
506
519
}
0 commit comments