Skip to content

Commit 575b915

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web'
2 parents e7ed918 + 3468f49 commit 575b915

File tree

62 files changed

+125
-100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+125
-100
lines changed

sycl/plugins/cuda/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ add_sycl_plugin(cuda
3636
${UR_CUDA_ADAPTER_SOURCES}
3737
# Some code is shared with the UR adapter
3838
"../unified_runtime/pi2ur.hpp"
39-
"../unified_runtime/pi2ur.cpp"
4039
"${sycl_inc_dir}/sycl/detail/pi.h"
4140
"${sycl_inc_dir}/sycl/detail/pi.hpp"
4241
"pi_cuda.hpp"

sycl/plugins/hip/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ add_sycl_plugin(hip
9898
SOURCES
9999
# Some code is shared with the UR adapter
100100
"../unified_runtime/pi2ur.hpp"
101-
"../unified_runtime/pi2ur.cpp"
102101
${UR_HIP_ADAPTER_SOURCES}
103102
"${sycl_inc_dir}/sycl/detail/pi.h"
104103
"${sycl_inc_dir}/sycl/detail/pi.hpp"

sycl/plugins/level_zero/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ add_sycl_plugin(level_zero
7777
#
7878
"ur_bindings.hpp"
7979
"../unified_runtime/pi2ur.hpp"
80-
"../unified_runtime/pi2ur.cpp"
8180
${UR_L0_ADAPTER_SOURCES}
8281
# Following are the PI Level-Zero Plugin only codes.
8382
"pi_level_zero.cpp"

sycl/plugins/native_cpu/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ add_sycl_plugin(native_cpu
99
${UR_NATIVE_CPU_ADAPTER_SOURCES}
1010
# Some code is shared with the UR adapter
1111
"../unified_runtime/pi2ur.hpp"
12-
"../unified_runtime/pi2ur.cpp"
1312
"${sycl_inc_dir}/sycl/detail/pi.h"
1413
"${sycl_inc_dir}/sycl/detail/pi.hpp"
1514
"pi_native_cpu.cpp"

sycl/plugins/opencl/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ add_sycl_plugin(opencl
99
${UR_OPENCL_ADAPTER_SOURCES}
1010
# Some code is shared with the UR adapter
1111
"../unified_runtime/pi2ur.hpp"
12-
"../unified_runtime/pi2ur.cpp"
1312
"${sycl_inc_dir}/sycl/detail/pi.h"
1413
"${sycl_inc_dir}/sycl/detail/pi.hpp"
1514
"pi_opencl.cpp"

sycl/plugins/unified_runtime/CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT)
5757
include(FetchContent)
5858

5959
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
60-
# commit 3e4d7248b4b1c7d70fa40c08e627833279c8fd5f
61-
# Merge: 95f90926 815a2869
60+
# commit 67e4d1bcf0057eef7910851bfb5020df9e5befd6
6261
# Author: Kenneth Benzie (Benie) <k.benzie@codeplay.com>
63-
# Date: Thu Dec 14 12:03:01 2023 +0000
64-
# Merge pull request #1105 from jandres742/fixtestusm
65-
# [UR][L0] Add several fixes to L0 adapter for test-usm
66-
set(UNIFIED_RUNTIME_TAG 3e4d7248b4b1c7d70fa40c08e627833279c8fd5f)
62+
# Date: Fri Dec 15 10:09:02 2023 +0000
63+
# Merge pull request #1185 from aarongreig/aaron/fixCoverityCudaCL
64+
# Fix coverity issues in OpenCL, cuda and hip adapters.[L0] Add several fixes to L0 adapter
65+
# for test-usm
66+
set(UNIFIED_RUNTIME_TAG 67e4d1bcf0057eef7910851bfb5020df9e5befd6)
6767

6868
if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO)
6969
set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}")
@@ -141,7 +141,6 @@ set(UNIFIED_RUNTIME_PLUGIN_ARGS
141141
# their "ur_bindings.hpp" files.
142142
"ur_bindings.hpp"
143143
"pi2ur.hpp"
144-
"pi2ur.cpp"
145144
# These below belong to Unified Runtime PI Plugin only
146145
"pi_unified_runtime.hpp"
147146
"pi_unified_runtime.cpp"

sycl/plugins/unified_runtime/pi2ur.cpp

Lines changed: 0 additions & 10 deletions
This file was deleted.

sycl/source/detail/device_impl.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,8 @@ ext::oneapi::experimental::architecture device_impl::getDeviceArch() const {
599599
return MDeviceArch;
600600
}
601601

602-
// On first call this function queries for device timestamp
603-
// along with host synchronized timestamp and stores it in memeber varaible
602+
// On the first call this function queries for device timestamp
603+
// along with host synchronized timestamp and stores it in member variable
604604
// MDeviceHostBaseTime. Subsequent calls to this function would just retrieve
605605
// the host timestamp, compute difference against the host timestamp in
606606
// MDeviceHostBaseTime and calculate the device timestamp based on the
@@ -622,14 +622,28 @@ uint64_t device_impl::getCurrentDeviceTime() {
622622
// To account for potential clock drift between host clock and device clock.
623623
// The value set is arbitrary: 200 seconds
624624
constexpr uint64_t TimeTillRefresh = 200e9;
625+
assert(HostTime >= MDeviceHostBaseTime.second);
625626
uint64_t Diff = HostTime - MDeviceHostBaseTime.second;
626627

627-
if (Diff > TimeTillRefresh || Diff <= 0) {
628+
// If getCurrentDeviceTime is called for the first time or we have to refresh.
629+
if (!MDeviceHostBaseTime.second || Diff > TimeTillRefresh) {
628630
const auto &Plugin = getPlugin();
629631
auto Result =
630632
Plugin->call_nocheck<detail::PiApiKind::piGetDeviceAndHostTimer>(
631633
MDevice, &MDeviceHostBaseTime.first, &MDeviceHostBaseTime.second);
632-
634+
// We have to remember base host timestamp right after PI call and it is
635+
// going to be used for calculation of the device timestamp at the next
636+
// getCurrentDeviceTime() call. We need to do it here because getPlugin()
637+
// and piGetDeviceAndHostTimer calls may take significant amount of time,
638+
// for example on the first call to getPlugin plugins may need to be
639+
// initialized. If we use timestamp from the beginning of the function then
640+
// the difference between host timestamps of the current
641+
// getCurrentDeviceTime and the next getCurrentDeviceTime will be incorrect
642+
// because it will include execution time of the code before we get device
643+
// timestamp from piGetDeviceAndHostTimer.
644+
HostTime =
645+
duration_cast<nanoseconds>(steady_clock::now().time_since_epoch())
646+
.count();
633647
if (Result == PI_ERROR_INVALID_OPERATION) {
634648
char *p = nullptr;
635649
Plugin->call_nocheck<detail::PiApiKind::piPluginGetLastError>(&p);

sycl/source/detail/device_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ class device_impl {
274274
mutable std::once_flag MDeviceNameFlag;
275275
mutable ext::oneapi::experimental::architecture MDeviceArch{};
276276
mutable std::once_flag MDeviceArchFlag;
277-
std::pair<uint64_t, uint64_t> MDeviceHostBaseTime;
277+
std::pair<uint64_t, uint64_t> MDeviceHostBaseTime{0, 0};
278278
}; // class device_impl
279279

280280
} // namespace detail

sycl/source/detail/device_info.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,8 +1009,13 @@ struct get_device_info_impl<
10091009
#if SYCL_EXT_CODEPLAY_KERNEL_FUSION
10101010
// Currently fusion is only supported for SPIR-V based backends,
10111011
// CUDA and HIP.
1012+
if (Dev->getBackend() == backend::opencl) {
1013+
// Exclude all non-CPU or non-GPU devices on OpenCL, in particular
1014+
// accelerators.
1015+
return Dev->is_cpu() || Dev->is_gpu();
1016+
}
1017+
10121018
return (Dev->getBackend() == backend::ext_oneapi_level_zero) ||
1013-
(Dev->getBackend() == backend::opencl) ||
10141019
(Dev->getBackend() == backend::ext_oneapi_cuda) ||
10151020
(Dev->getBackend() == backend::ext_oneapi_hip);
10161021
#else // SYCL_EXT_CODEPLAY_KERNEL_FUSION

0 commit comments

Comments
 (0)