Skip to content

Commit

Permalink
Add UR_DEVICE_INFO_ESIMD_SUPPORT_EXP
Browse files Browse the repository at this point in the history
This will be used by DPC++ PI to determine if a device supports the DPC++ ESIMD extension.

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
  • Loading branch information
sarnex committed Aug 2, 2023
1 parent 8454362 commit 8c69f44
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 4 deletions.
1 change: 1 addition & 0 deletions include/ur.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ class ur_device_info_v(IntEnum):
## semaphore resources
INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP = 0x200F ## [::ur_bool_t] returns true if the device supports exporting internal
## event resources
ESIMD_SUPPORT_EXP = 0x2010 ## [::ur_bool_t] returns true if the device supports ESIMD

class ur_device_info_t(c_int):
def __str__(self):
Expand Down
3 changes: 2 additions & 1 deletion include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,7 @@ typedef enum ur_device_info_t {
///< semaphore resources
UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP = 0x200F, ///< [::ur_bool_t] returns true if the device supports exporting internal
///< event resources
UR_DEVICE_INFO_ESIMD_SUPPORT_EXP = 0x2010, ///< [::ur_bool_t] returns true if the device supports ESIMD
/// @cond
UR_DEVICE_INFO_FORCE_UINT32 = 0x7fffffff
/// @endcond
Expand All @@ -1511,7 +1512,7 @@ typedef enum ur_device_info_t {
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hDevice`
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP < propName`
/// + `::UR_DEVICE_INFO_ESIMD_SUPPORT_EXP < propName`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
Expand Down
50 changes: 50 additions & 0 deletions scripts/core/EXP-ESIMD.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<%
OneApi=tags['$OneApi']
x=tags['$x']
X=x.upper()
%>

.. _experimental-ESIMD:

================================================================================
ESIMD
================================================================================

.. 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
--------------------------------------------------------------------------------
The `DPC++ ESIMD extension <https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/supported/sycl_ext_intel_esimd/sycl_ext_intel_esimd.md>`_
provides the user the ability to write explicitly vectorized code. In order
for DPC++ PI to query if a backend supports ESIMD, the Unified Runtime
will need a new device info enumeration.

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

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

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

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


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

* Sarnie, Nick `nick.sarnie@intel.com <nick.sarnie@intel.com>`_
23 changes: 23 additions & 0 deletions scripts/core/exp-esimd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# 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 ESIMD"
ordinal: "99"
--- #--------------------------------------------------------------------------
type: enum
extend: true
typed_etors: true
desc: "Extension enums to $x_device_info_t to support ESIMD."
name: $x_device_info_t
etors:
- name: ESIMD_SUPPORT_EXP
value: "0x2010"
desc: "[$x_bool_t] returns true if the device supports ESIMD"
18 changes: 18 additions & 0 deletions source/common/ur_params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2835,6 +2835,10 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) {
case UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP:
os << "UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP";
break;

case UR_DEVICE_INFO_ESIMD_SUPPORT_EXP:
os << "UR_DEVICE_INFO_ESIMD_SUPPORT_EXP";
break;
default:
os << "unknown enumerator";
break;
Expand Down Expand Up @@ -4633,6 +4637,20 @@ inline void serializeTagged(std::ostream &os, const void *ptr,

os << ")";
} break;

case UR_DEVICE_INFO_ESIMD_SUPPORT_EXP: {
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
if (sizeof(ur_bool_t) > size) {
os << "invalid size (is: " << size
<< ", expected: >=" << sizeof(ur_bool_t) << ")";
return;
}
os << (void *)(tptr) << " (";

os << *tptr;

os << ")";
} break;
default:
os << "unknown enumerator";
break;
Expand Down
2 changes: 1 addition & 1 deletion source/loader/layers/validation/ur_valddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetInfo(
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
}

if (UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP < propName) {
if (UR_DEVICE_INFO_ESIMD_SUPPORT_EXP < propName) {
return UR_RESULT_ERROR_INVALID_ENUMERATION;
}

Expand Down
2 changes: 1 addition & 1 deletion source/loader/ur_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ ur_result_t UR_APICALL urDeviceGet(
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hDevice`
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP < propName`
/// + `::UR_DEVICE_INFO_ESIMD_SUPPORT_EXP < propName`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
Expand Down
2 changes: 1 addition & 1 deletion source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ ur_result_t UR_APICALL urDeviceGet(
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hDevice`
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP < propName`
/// + `::UR_DEVICE_INFO_ESIMD_SUPPORT_EXP < propName`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
Expand Down

0 comments on commit 8c69f44

Please sign in to comment.