Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions unified-runtime/include/ur_api.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions unified-runtime/include/ur_api_funcs.def

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions unified-runtime/include/ur_ddi.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions unified-runtime/include/ur_print.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions unified-runtime/include/ur_print.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions unified-runtime/scripts/core/EXP-DEVICE-WAIT.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<%
OneApi=tags['$OneApi']
x=tags['$x']
X=x.upper()
%>

.. _experimental-device-wait:

================================================================================
Device Wait
================================================================================

.. warning::

Experimental features:

* May be replaced, updated, or removed at any time.
* Do not require maintaining API/ABI stability of their own additions over
time.
* Do not require conformance testing of their own additions.



Motivation
--------------------------------------------------------------------------------

This extension adds the ability to do device-wide synchronization, instead of at
queue or event level.

API
--------------------------------------------------------------------------------

Enums
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ${x}_device_info_t
* ${X}_DEVICE_INFO_DEVICE_WAIT_SUPPORT_EXP

Functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* ${x}DeviceWaitExp

Changelog
--------------------------------------------------------------------------------

+-----------+---------------------------------------------+
| Revision | Changes |
+===========+=============================================+
| 1.0 | Initial Draft |
+-----------+---------------------------------------------+

Support
--------------------------------------------------------------------------------

Adapters which support this experimental feature *must* return ``true`` when
queried for ${X}_DEVICE_INFO_DEVICE_WAIT_SUPPORT_EXP via
${x}DeviceGetInfo. Conversely, before using any of the functionality defined
in this experimental feature the user *must* use the device query to determine
if the adapter supports this feature.

Contributors
--------------------------------------------------------------------------------

* Steffen Larsen `steffen.larsen@intel.com <steffen.larsen@intel.com>`_
38 changes: 38 additions & 0 deletions unified-runtime/scripts/core/exp-device-wait.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# Copyright (C) 2023 Intel Corporation
#
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# See YaML.md for syntax definition
#
--- #--------------------------------------------------------------------------
type: header
desc: "Intel $OneApi Unified Runtime Experimental APIs for device-wide synchronization"
ordinal: "99"
--- #--------------------------------------------------------------------------
type: enum
extend: true
typed_etors: true
desc: "Extension enums for $x_device_info_t to support device-wide synchronization."
name: $x_device_info_t
etors:
- name: DEVICE_WAIT_SUPPORT_EXP
value: "0x6002"
desc: "[$x_bool_t] Returns true if the device supports the device-wide synchronization experimental feature."
--- #--------------------------------------------------------------------------
type: function
desc: "Synchronizes with all queues on the device."
class: $xDevice
name: WaitExp
decl: static
ordinal: "1"
params:
- type: $x_device_handle_t
name: hDevice
desc: "[in] handle of the device instance."
returns:
- $X_RESULT_ERROR_INVALID_DEVICE
- $X_RESULT_ERROR_INVALID_NULL_HANDLE:
- "`hDevice == nullptr`"
5 changes: 4 additions & 1 deletion unified-runtime/scripts/core/registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,10 @@ etors:
- name: IPC_CLOSE_MEM_HANDLE_EXP
desc: Enumerator for $xIPCCloseMemHandleExp
value: '292'
max_id: '292'
- name: DEVICE_WAIT_EXP
desc: Enumerator for $xDeviceWaitExp
value: '293'
max_id: '293'
---
type: enum
desc: Defines structure types
Expand Down
1 change: 1 addition & 0 deletions unified-runtime/source/adapters/adapter.def.in

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions unified-runtime/source/adapters/adapter.map.in

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions unified-runtime/source/adapters/cuda/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
return ReturnValue(true);
case UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP:
return ReturnValue(false);
case UR_DEVICE_INFO_DEVICE_WAIT_SUPPORT_EXP:
return ReturnValue(true);
case UR_DEVICE_INFO_ASYNC_USM_ALLOCATIONS_SUPPORT_EXP:
return ReturnValue(true);
case UR_DEVICE_INFO_KERNEL_LAUNCH_CAPABILITIES: {
Expand Down Expand Up @@ -1402,3 +1404,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceSelectBinary(
// No image can be loaded for the given device
return UR_RESULT_ERROR_INVALID_BINARY;
}

/// Synchronizes with all queues on the device.
UR_APIEXPORT ur_result_t UR_APICALL
urDeviceWaitExp(ur_device_handle_t hDevice) {
ScopedContext Active(hDevice);
UR_CHECK_ERROR(cuCtxSynchronize());
return UR_RESULT_SUCCESS;
}
11 changes: 11 additions & 0 deletions unified-runtime/source/adapters/cuda/ur_interface_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,16 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetDeviceProcAddrTable(
return UR_RESULT_SUCCESS;
}

UR_DLLEXPORT ur_result_t UR_APICALL urGetDeviceExpProcAddrTable(
ur_api_version_t version, ur_device_exp_dditable_t *pDdiTable) {
auto result = validateProcInputs(version, pDdiTable);
if (UR_RESULT_SUCCESS != result) {
return result;
}
pDdiTable->pfnWaitExp = urDeviceWaitExp;
return UR_RESULT_SUCCESS;
}

UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable(
/// [in] API version requested
ur_api_version_t version,
Expand Down Expand Up @@ -510,6 +520,7 @@ UR_DLLEXPORT ur_result_t UR_APICALL urAllAddrTable(ur_api_version_t version,
urGetUsmP2PExpProcAddrTable(version, &pDdiTable->UsmP2PExp);
urGetVirtualMemProcAddrTable(version, &pDdiTable->VirtualMem);
urGetDeviceProcAddrTable(version, &pDdiTable->Device);
urGetDeviceExpProcAddrTable(version, &pDdiTable->DeviceExp);
urGetMemoryExportExpProcAddrTable(version, &pDdiTable->MemoryExportExp);

return UR_RESULT_SUCCESS;
Expand Down
6 changes: 6 additions & 0 deletions unified-runtime/source/adapters/hip/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
return ReturnValue(true);
case UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP:
return ReturnValue(false);
case UR_DEVICE_INFO_DEVICE_WAIT_SUPPORT_EXP:
return ReturnValue(false);
case UR_DEVICE_INFO_KERNEL_LAUNCH_CAPABILITIES:
return ReturnValue(0);
case UR_DEVICE_INFO_MEMORY_EXPORT_EXPORTABLE_DEVICE_MEM_EXP:
Expand Down Expand Up @@ -1241,3 +1243,7 @@ ur_result_t UR_APICALL urDeviceGetGlobalTimestamps(ur_device_handle_t hDevice,
}
return UR_RESULT_SUCCESS;
}

ur_result_t UR_APICALL urDeviceWaitExp(ur_device_handle_t) {
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
Loading
Loading