From 76a5b09ad0d374c6f597db809f002266959d9c4c Mon Sep 17 00:00:00 2001 From: "Sarnie, Nick" Date: Wed, 2 Aug 2023 07:45:30 -0700 Subject: [PATCH] Add UR_DEVICE_INFO_ESIMD_SUPPORT_EXP This will be used by DPC++ PI to determine if a device supports the DPC++ ESIMD extension. Signed-off-by: Sarnie, Nick --- include/ur.py | 1 + include/ur_api.h | 3 +- scripts/core/EXP-ESIMD.rst | 50 +++++++++++++++++++ scripts/core/exp-esimd.yml | 23 +++++++++ source/common/ur_params.hpp | 18 +++++++ source/loader/layers/validation/ur_valddi.cpp | 2 +- source/loader/ur_libapi.cpp | 2 +- source/ur_api.cpp | 2 +- 8 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 scripts/core/EXP-ESIMD.rst create mode 100644 scripts/core/exp-esimd.yml diff --git a/include/ur.py b/include/ur.py index f48acbd21b..164f034a2f 100644 --- a/include/ur.py +++ b/include/ur.py @@ -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): diff --git a/include/ur_api.h b/include/ur_api.h index 1ff0ba0905..a9c5e1c2d9 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -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 @@ -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 diff --git a/scripts/core/EXP-ESIMD.rst b/scripts/core/EXP-ESIMD.rst new file mode 100644 index 0000000000..6831ce188a --- /dev/null +++ b/scripts/core/EXP-ESIMD.rst @@ -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 `_ +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 `_ diff --git a/scripts/core/exp-esimd.yml b/scripts/core/exp-esimd.yml new file mode 100644 index 0000000000..e21da6bdeb --- /dev/null +++ b/scripts/core/exp-esimd.yml @@ -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" diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 2f9789506e..4c0ab391dc 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -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; @@ -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; diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 46b0eef491..19655b1dfe 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -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; } diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 9c7060fdbe..213ed80e87 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -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 diff --git a/source/ur_api.cpp b/source/ur_api.cpp index c8362e490c..c05c660a5e 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -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