Skip to content

Commit 9d69edb

Browse files
authored
Merge pull request #12301 from hppritcha/add_ze_wait_event
accelerator/ze: actually implement wait event
2 parents 8197ce9 + 123bfc8 commit 9d69edb

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

opal/mca/accelerator/ze/accelerator_ze_module.c

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights reserved.
3-
* Copyright (c) 2023 Triad National Security, LLC. All rights reserved.
3+
* Copyright (c) 2023-2024 Triad National Security, LLC. All rights reserved.
44
* $COPYRIGHT$
55
*
66
* Additional copyrights may follow
@@ -370,6 +370,32 @@ static int mca_accelerator_ze_record_event(int dev_id, opal_accelerator_event_t
370370
return OPAL_SUCCESS;
371371
}
372372

373+
static int mca_accelerator_ze_wait_event(int __opal_attribute_unused__ dev_id,
374+
opal_accelerator_event_t *event,
375+
opal_accelerator_stream_t * __opal_attribute_unused__ stream)
376+
{
377+
ze_result_t zret;
378+
379+
zret = zeEventHostSynchronize(*((ze_event_handle_t *)event->event),
380+
UINT64_MAX);
381+
switch (zret) {
382+
case ZE_RESULT_SUCCESS:
383+
return OPAL_SUCCESS;
384+
break;
385+
case ZE_RESULT_NOT_READY:
386+
return OPAL_ERR_RESOURCE_BUSY;
387+
break;
388+
default:
389+
opal_output_verbose(10, opal_accelerator_base_framework.framework_output,
390+
"zeEventHostSynchronize returned %d", zret);
391+
return OPAL_ERROR;
392+
}
393+
394+
return OPAL_SUCCESS;
395+
}
396+
397+
398+
373399
static int mca_accelerator_ze_query_event(int dev_id, opal_accelerator_event_t *event)
374400
{
375401
ze_result_t zret;
@@ -411,7 +437,7 @@ static int mca_accelerator_ze_memcpy_async(int dest_dev_id, int src_dev_id, void
411437
}
412438

413439
ze_stream = (opal_accelerator_ze_stream_t *)stream->stream;
414-
assert(NULL != ze_stream);
440+
assert(NULL != ze_stream);
415441

416442
zret = zeCommandListAppendMemoryCopy(ze_stream->hCommandList,
417443
dest,

0 commit comments

Comments
 (0)