feature: Add External Semaphore experimental stubs [2/N]

Related-To: NEO-11488

Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@intel.com>
This commit is contained in:
Aravind Gopalakrishnan
2024-11-20 23:48:16 +00:00
committed by Compute-Runtime-Automation
parent 986ff06554
commit f4cc71f3f9
4 changed files with 63 additions and 51 deletions

View File

@ -76,9 +76,9 @@ zexCommandListAppendWriteToMemory(
ze_result_t ZE_APICALL
zeIntelCommandListAppendWaitExternalSemaphoresExp(
ze_command_list_handle_t hCmdList,
const ze_intel_external_semaphore_exp_handle_t *hSemaphores,
const ze_intel_external_semaphore_wait_exp_params_t *params,
unsigned int numExternalSemaphores,
const ze_intel_external_semaphore_exp_handle_t *hSemaphores,
const ze_intel_external_semaphore_wait_params_exp_t *params,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) {
@ -88,9 +88,9 @@ zeIntelCommandListAppendWaitExternalSemaphoresExp(
ze_result_t ZE_APICALL
zeIntelCommandListAppendSignalExternalSemaphoresExp(
ze_command_list_handle_t hCmdList,
const ze_intel_external_semaphore_exp_handle_t *hSemaphores,
const ze_intel_external_semaphore_signal_exp_params_t *params,
size_t numExternalSemaphores,
const ze_intel_external_semaphore_exp_handle_t *hSemaphores,
const ze_intel_external_semaphore_signal_params_exp_t *params,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) {

View File

@ -10,8 +10,8 @@
ze_result_t ZE_APICALL
zeIntelDeviceImportExternalSemaphoreExp(
ze_device_handle_t device,
ze_intel_external_semaphore_exp_handle_t *phSemaphore,
const ze_intel_external_semaphore_exp_desc_t *semaphoreDesc) {
const ze_intel_external_semaphore_exp_desc_t *semaphoreDesc,
ze_intel_external_semaphore_exp_handle_t *phSemaphore) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

View File

@ -15,26 +15,26 @@ namespace ult {
TEST(ExternalSemaphoreTest, givenImportExternalSemaphoreExpIsCalledThenUnsupportedFeatureIsReturned) {
ze_device_handle_t hDevice = nullptr;
const ze_intel_external_semaphore_exp_desc_t *desc = nullptr;
ze_intel_external_semaphore_exp_handle_t *hSemaphore = nullptr;
ze_result_t result = zeIntelDeviceImportExternalSemaphoreExp(hDevice, hSemaphore, desc);
ze_intel_external_semaphore_exp_handle_t hSemaphore = nullptr;
ze_result_t result = zeIntelDeviceImportExternalSemaphoreExp(hDevice, desc, &hSemaphore);
EXPECT_EQ(result, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
}
TEST(ExternalSemaphoreTest, givenAppendWaitExternalSemaphoresExpIsCalledThenUnsupportedFeatureIsReturned) {
ze_command_list_handle_t hCmdList = nullptr;
ze_intel_external_semaphore_exp_handle_t *hSemaphores = nullptr;
const ze_intel_external_semaphore_wait_exp_params_t *params = nullptr;
const ze_intel_external_semaphore_wait_params_exp_t *params = nullptr;
ze_result_t result = zeIntelCommandListAppendWaitExternalSemaphoresExp(hCmdList, hSemaphores, params, 0, nullptr, 0, nullptr);
ze_result_t result = zeIntelCommandListAppendWaitExternalSemaphoresExp(hCmdList, 0, hSemaphores, params, nullptr, 0, nullptr);
EXPECT_EQ(result, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
}
TEST(ExternalSemaphoreTest, givenAppendSignalExternalSemaphoresExpIsCalledThenUnsupportedFeatureIsReturned) {
ze_command_list_handle_t hCmdList = nullptr;
ze_intel_external_semaphore_exp_handle_t *hSemaphores = nullptr;
const ze_intel_external_semaphore_signal_exp_params_t *params = nullptr;
const ze_intel_external_semaphore_signal_params_exp_t *params = nullptr;
ze_result_t result = zeIntelCommandListAppendSignalExternalSemaphoresExp(hCmdList, hSemaphores, params, 0, nullptr, 0, nullptr);
ze_result_t result = zeIntelCommandListAppendSignalExternalSemaphoresExp(hCmdList, 0, hSemaphores, params, nullptr, 0, nullptr);
EXPECT_EQ(result, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
}

View File

@ -274,8 +274,9 @@ zeIntelKernelGetBinaryExp(
char *pKernelBinary ///< [in,out] pointer to storage area for GEN ISA binary function
);
///////////////////////////////////////////////////////////////////////////////
#ifndef ZE_INTEL_EXTERNAL_SEMAPHORE_EXP_NAME
/// @brief Event sync mode extension name
/// @brief External semaphore extension name
#define ZE_INTEL_EXTERNAL_SEMAPHORE_EXP_NAME "ZE_intel_experimental_external_semaphore"
#endif // ZE_INTEL_EXTERNAL_SEMAPHORE_EXP_NAME
@ -298,67 +299,78 @@ typedef enum _ze_intel_external_semaphore_exp_flags_t {
} ze_intel_external_semaphore_exp_flags_t;
typedef struct _ze_intel_external_semaphore_exp_desc_t {
ze_structure_type_t stype;
const void *pNext;
ze_intel_external_semaphore_exp_flags_t flags;
ze_structure_type_t stype; ///< [in] type of this structure
const void *pNext; ///< [in] must be null or a pointer to an extension-specific
///< structure (i.e. contains stype and pNext). When importing
///< a semaphore, this can be a pointer to either ze_intel_external_semaphore_win32_exp_desc_t
///< or ze_intel_external_semaphore_fd_exp_desc_t.
ze_intel_external_semaphore_exp_flags_t flags; ///< [in] External semaphore flags. Must be 0 or a valid combination of ::ze_intel_external_semaphore_exp_flags_t
} ze_intel_external_semaphore_exp_desc_t;
typedef struct _ze_intel_external_semaphore_win32_exp_desc_t {
ze_structure_type_t stype;
const void *pNext;
const char *name;
ze_structure_type_t stype; ///< [in] type of this structure
const void *pNext; ///< [in] must be null or a pointer to an extension-specific
///< structure (i.e. contains stype and pNext).
void *handle; ///< [in] Win32 HANDLE for semaphore
const char *name; ///< [in] Name of the semaphore. Must be valid NULL terminated string.
} ze_intel_external_semaphore_win32_exp_desc_t;
typedef struct _ze_intel_external_semaphore_fd_exp_desc_t {
ze_structure_type_t stype;
const void *pNext;
int fd;
ze_structure_type_t stype; ///< [in] type of this structure
const void *pNext; ///< [in] must be null or a pointer to an extension-specific
///< structure (i.e. contains stype and pNext).
int fd; ///< [in] File descriptor for semaphore. Must be valid file descriptor.
} ze_intel_external_semaphore_desc_fd_exp_desc_t;
typedef struct _ze_intel_external_semaphore_signal_exp_params_t {
ze_structure_type_t stype;
const void *pNext;
uint64_t value;
} ze_intel_external_semaphore_signal_exp_params_t;
typedef struct _ze_intel_external_semaphore_signal_params_exp_t {
ze_structure_type_t stype; ///< [in] type of this structure
const void *pNext; ///< [in] must be null or a pointer to an extension-specific
///< structure (i.e. contains stype and pNext).
uint64_t value; /// [in] [optional] Value to signal the semaphore with
} ze_intel_external_semaphore_signal_params_exp_t;
typedef struct _ze_intel_external_semaphore_wait_exp_params_t {
ze_structure_type_t stype;
const void *pNext;
uint64_t value;
} ze_intel_external_semaphore_wait_exp_params_t;
typedef struct _ze_intel_external_semaphore_wait_params_exp_t {
ze_structure_type_t stype; ///< [in] type of this structure
const void *pNext; ///< [in] must be null or a pointer to an extension-specific
///< structure (i.e. contains stype and pNext).
uint64_t value; /// [in] [optional] Value to wait on the semaphore for
} ze_intel_external_semaphore_wait_params_exp_t;
typedef struct _ze_intel_external_semaphore_exp_handle_t *ze_intel_external_semaphore_exp_handle_t;
ZE_APIEXPORT ze_result_t ZE_APICALL
zeIntelDeviceImportExternalSemaphoreExp(
ze_device_handle_t device,
ze_intel_external_semaphore_exp_handle_t *phSemaphore,
const ze_intel_external_semaphore_exp_desc_t *semaphoreDesc);
ze_device_handle_t device, ///< [in] handle of the device
const ze_intel_external_semaphore_exp_desc_t *semaphoreDesc, ///< [in] pointer to external semaphore descriptor
ze_intel_external_semaphore_exp_handle_t *phSemaphore ///< [out] pointer to handle of the external semaphore
);
ZE_APIEXPORT ze_result_t ZE_APICALL
zeIntelCommandListAppendWaitExternalSemaphoresExp(
ze_command_list_handle_t hCmdList,
const ze_intel_external_semaphore_exp_handle_t *phSemaphores,
const ze_intel_external_semaphore_wait_exp_params_t *params,
unsigned int numExternalSemaphores,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents);
ze_command_list_handle_t hCmdList, ///< [in] handle of the command list
unsigned int numExternalSemaphores, ///< [in] number of external semaphores
const ze_intel_external_semaphore_exp_handle_t *phSemaphores, ///< [in] pointer to array of external semaphore handles
const ze_intel_external_semaphore_wait_params_exp_t *params, ///< [in] pointer to array of wait parameters
ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion
uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before continuing
ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handles of the events to wait on before continuing
);
ZE_APIEXPORT ze_result_t ZE_APICALL
zeIntelCommandListAppendSignalExternalSemaphoresExp(
ze_command_list_handle_t hCmdList,
const ze_intel_external_semaphore_exp_handle_t *phSemaphores,
const ze_intel_external_semaphore_signal_exp_params_t *params,
size_t numExternalSemaphores,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents);
ze_command_list_handle_t hCmdList, ///< [in] handle of the command list
size_t numExternalSemaphores, ///< [in] number of external semaphores
const ze_intel_external_semaphore_exp_handle_t *phSemaphores, ///< [in] pointer to array of external semaphore handles
const ze_intel_external_semaphore_signal_params_exp_t *params, ///< [in] pointer to array of signal parameters
ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion
uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before continuing
ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handles of the events to wait on before continuing
);
ZE_APIEXPORT ze_result_t ZE_APICALL
zeIntelDeviceReleaseExternalSemaphoreExp(
ze_intel_external_semaphore_exp_handle_t hSemaphore);
ze_intel_external_semaphore_exp_handle_t hSemaphore ///< [in] handle of the external semaphore
);
#if defined(__cplusplus)
} // extern "C"