Skip to content
Merged
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
13 changes: 7 additions & 6 deletions sycl/source/detail/device_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1580,16 +1580,17 @@ class device_impl : public std::enable_shared_from_this<device_impl> {
.value_or(0);
}
CASE(ext_oneapi_clock_sub_group) {
// Will be updated in a follow-up UR patch.
return false;
return get_info_impl_nocheck<UR_DEVICE_INFO_CLOCK_SUB_GROUP_SUPPORT_EXP>()
.value_or(0);
}
CASE(ext_oneapi_clock_work_group) {
// Will be updated in a follow-up UR patch.
return false;
return get_info_impl_nocheck<
UR_DEVICE_INFO_CLOCK_WORK_GROUP_SUPPORT_EXP>()
.value_or(0);
}
CASE(ext_oneapi_clock_device) {
// Will be updated in a follow-up UR patch.
return false;
return get_info_impl_nocheck<UR_DEVICE_INFO_CLOCK_DEVICE_SUPPORT_EXP>()
.value_or(0);
}
else {
return false; // This device aspect has not been implemented yet.
Expand Down
3 changes: 3 additions & 0 deletions sycl/source/detail/ur_device_info_ret_types.inc
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,7 @@ MAP(UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP, ur_bool_t)
MAP(UR_DEVICE_INFO_TIMESTAMP_RECORDING_SUPPORT_EXP, ur_bool_t)
MAP(UR_DEVICE_INFO_KERNEL_LAUNCH_CAPABILITIES, ur_kernel_launch_properties_flags_t)
MAP(UR_DEVICE_INFO_MEMORY_EXPORT_EXPORTABLE_DEVICE_MEM_EXP, ur_bool_t)
MAP(UR_DEVICE_INFO_CLOCK_SUB_GROUP_SUPPORT_EXP, ur_bool_t)
MAP(UR_DEVICE_INFO_CLOCK_WORK_GROUP_SUPPORT_EXP, ur_bool_t)
MAP(UR_DEVICE_INFO_CLOCK_DEVICE_SUPPORT_EXP, ur_bool_t)
// clang-format on
9 changes: 9 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.

48 changes: 48 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.

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

.. _experimental-clock:

================================================================================
Clock
================================================================================

.. 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 experimental extension enables the sycl_ext_oneapi_clock feature:
https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/proposed/sycl_ext_oneapi_clock.asciidoc
It introduces descriptors to query sub-group/work-group/device clock support.

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

Enums
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ${x}_device_info_t
* ${X}_DEVICE_INFO_CLOCK_SUB_GROUP_SUPPORT_EXP
* ${X}_DEVICE_INFO_CLOCK_WORK_GROUP_SUPPORT_EXP
* ${X}_DEVICE_INFO_CLOCK_DEVICE_SUPPORT_EXP

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

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


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

Adapters which support this experimental feature *must* return ${X}_RESULT_SUCCESS from
the ${x}DeviceGetInfo call with new ${X}_DEVICE_INFO_CLOCK_SUB_GROUP_SUPPORT_EXP,
${X}_DEVICE_INFO_CLOCK_WORK_GROUP_SUPPORT_EXP or ${X}_DEVICE_INFO_CLOCK_DEVICE_SUPPORT_EXP
device descriptors.

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

* Kornev, Nikita `nikita.kornev@intel.com <nikita.kornev@intel.com>`_
31 changes: 31 additions & 0 deletions unified-runtime/scripts/core/exp-clock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Copyright (C) 2025 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 Clock"
ordinal: "99"
--- #--------------------------------------------------------------------------
type: enum
extend: true
typed_etors: true
desc: "Extension enums for $x_device_info_t to support multi device compile."
name: $x_device_info_t
etors:
- name: CLOCK_SUB_GROUP_SUPPORT_EXP
value: "0x2060"
desc: "[$x_bool_t] returns true if the device supports sampling values from the sub-group clock."
- name: CLOCK_WORK_GROUP_SUPPORT_EXP
value: "0x2061"
desc: "[$x_bool_t] returns true if the device supports sampling values from the work-group clock."
- name: CLOCK_DEVICE_SUPPORT_EXP
value: "0x2062"
desc: "[$x_bool_t] returns true if the device supports sampling values from the device clock."
30 changes: 30 additions & 0 deletions unified-runtime/source/adapters/opencl/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,36 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,

return ReturnValue(nodeMask);
}
case UR_DEVICE_INFO_CLOCK_SUB_GROUP_SUPPORT_EXP:
case UR_DEVICE_INFO_CLOCK_WORK_GROUP_SUPPORT_EXP:
case UR_DEVICE_INFO_CLOCK_DEVICE_SUPPORT_EXP: {
bool Supported = false;
size_t ExtSize = 0;

CL_RETURN_ON_FAILURE(clGetDeviceInfo(
hDevice->CLDevice, CL_DEVICE_EXTENSIONS, 0, nullptr, &ExtSize));
std::string ExtStr(ExtSize, '\0');
CL_RETURN_ON_FAILURE(clGetDeviceInfo(hDevice->CLDevice,
CL_DEVICE_EXTENSIONS, ExtSize,
ExtStr.data(), nullptr));

if (ExtStr.find("cl_khr_kernel_clock") != std::string::npos) {
cl_device_kernel_clock_capabilities_khr caps = 0;

CL_RETURN_ON_FAILURE(clGetDeviceInfo(
hDevice->CLDevice, CL_DEVICE_KERNEL_CLOCK_CAPABILITIES_KHR,
sizeof(cl_device_kernel_clock_capabilities_khr), &caps, nullptr));

if ((propName == UR_DEVICE_INFO_CLOCK_SUB_GROUP_SUPPORT_EXP &&
(caps & CL_DEVICE_KERNEL_CLOCK_SCOPE_SUB_GROUP_KHR)) ||
(propName == UR_DEVICE_INFO_CLOCK_WORK_GROUP_SUPPORT_EXP &&
(caps & CL_DEVICE_KERNEL_CLOCK_SCOPE_WORK_GROUP_KHR)) ||
(propName == UR_DEVICE_INFO_CLOCK_DEVICE_SUPPORT_EXP &&
(caps & CL_DEVICE_KERNEL_CLOCK_SCOPE_DEVICE_KHR)))
Supported = true;
}
return ReturnValue(Supported);
}
// TODO: We can't query to check if these are supported, they will need to be
// manually updated if support is ever implemented.
case UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS:
Expand Down
8 changes: 8 additions & 0 deletions unified-runtime/tools/urinfo/urinfo.hpp

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