@@ -283,7 +283,11 @@ urProgramCreateWithIL(ur_context_handle_t, const void *, size_t,
283
283
UR_APIEXPORT ur_result_t UR_APICALL
284
284
urProgramCompile (ur_context_handle_t hContext, ur_program_handle_t hProgram,
285
285
const char *pOptions) {
286
- return urProgramBuild (hContext, hProgram, pOptions);
286
+ UR_CHECK_ERROR (urProgramBuild (hContext, hProgram, pOptions));
287
+ // urProgramBuild sets the BinaryType to UR_PROGRAM_BINARY_TYPE_EXECUTABLE, so
288
+ // set it to the correct value for urProgramCompile post-hoc.
289
+ hProgram->BinaryType = UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT;
290
+ return UR_RESULT_SUCCESS;
287
291
}
288
292
289
293
UR_APIEXPORT ur_result_t UR_APICALL urProgramCompileExp (ur_program_handle_t ,
@@ -312,6 +316,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramBuild(ur_context_handle_t,
312
316
ScopedContext Active (hProgram->getDevice ());
313
317
314
318
hProgram->buildProgram (pOptions);
319
+ hProgram->BinaryType = UR_PROGRAM_BINARY_TYPE_EXECUTABLE;
315
320
316
321
} catch (ur_result_t Err) {
317
322
Result = Err;
@@ -355,13 +360,14 @@ urProgramGetBuildInfo(ur_program_handle_t hProgram, ur_device_handle_t,
355
360
UrReturnHelper ReturnValue (propSize, pPropValue, pPropSizeRet);
356
361
357
362
switch (propName) {
358
- case UR_PROGRAM_BUILD_INFO_STATUS: {
363
+ case UR_PROGRAM_BUILD_INFO_STATUS:
359
364
return ReturnValue (hProgram->BuildStatus );
360
- }
361
365
case UR_PROGRAM_BUILD_INFO_OPTIONS:
362
366
return ReturnValue (hProgram->BuildOptions .c_str ());
363
367
case UR_PROGRAM_BUILD_INFO_LOG:
364
368
return ReturnValue (hProgram->InfoLog , hProgram->MAX_LOG_SIZE );
369
+ case UR_PROGRAM_BUILD_INFO_BINARY_TYPE:
370
+ return ReturnValue (hProgram->BinaryType );
365
371
default :
366
372
break ;
367
373
}
@@ -494,6 +500,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithBinary(
494
500
UR_ASSERT (Result == UR_RESULT_SUCCESS, Result);
495
501
496
502
*phProgram = RetProgram.release ();
503
+ (*phProgram)->BinaryType = UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT;
497
504
498
505
return Result;
499
506
}
0 commit comments