Skip to content

Commit

Permalink
a few more minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbaug committed Jun 22, 2024
1 parent 332aec7 commit 375627c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
18 changes: 12 additions & 6 deletions layers/11_semaemu/emulate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ typedef struct _cl_semaphore_khr
found_CL_SEMAPHORE_TYPE_KHR = true;
type = ((const cl_semaphore_type_khr*)(check + 1))[0];
check += 2;

switch( type )
{
case CL_SEMAPHORE_TYPE_BINARY_KHR:
break;
default:
errorCode = CL_INVALID_PROPERTY;
break;
}
}
break;
case CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR:
Expand Down Expand Up @@ -141,13 +150,10 @@ typedef struct _cl_semaphore_khr
}
numProperties = check - properties + 1;

switch( type )
// The semaphore type must be included in the property list.
if( !found_CL_SEMAPHORE_TYPE_KHR )
{
case CL_SEMAPHORE_TYPE_BINARY_KHR:
break;
default:
errorCode = CL_INVALID_PROPERTY;
break;
errorCode = CL_INVALID_VALUE;
}

if( devices.empty() )
Expand Down
17 changes: 16 additions & 1 deletion layers/11_semaemu/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,17 @@ clGetEventInfo_layer(

return errorCode;
}

static cl_int CL_API_CALL
clGetSemaphoreHandleForTypeKHR_EMU(
cl_semaphore_khr sema_object,
cl_device_id device,
cl_external_semaphore_handle_type_khr handle_type,
size_t handle_size,
void* handle_ptr,
size_t* handle_size_ret)
{
return CL_INVALID_OPERATION;
}

#define CHECK_RETURN_EXTENSION_FUNCTION( _funcname ) \
if (strcmp(func_name, #_funcname) == 0) { \
Expand All @@ -109,6 +119,11 @@ clGetExtensionFunctionAddressForPlatform_layer(
CHECK_RETURN_EXTENSION_FUNCTION( clRetainSemaphoreKHR );
CHECK_RETURN_EXTENSION_FUNCTION( clReleaseSemaphoreKHR );

// This is currently required to run the semaphore conformance tests,
// although it is part of cl_khr_external_semaphore, and not part of
// cl_khr_semaphore.
CHECK_RETURN_EXTENSION_FUNCTION( clGetSemaphoreHandleForTypeKHR );

return g_pNextDispatch->clGetExtensionFunctionAddressForPlatform(
platform,
func_name);
Expand Down

0 comments on commit 375627c

Please sign in to comment.