Skip to content

Commit abe58fe

Browse files
authored
Merge branch 'sycl' into rm-xfail-jm
2 parents f427a41 + e94cfda commit abe58fe

File tree

23 files changed

+285
-196
lines changed

23 files changed

+285
-196
lines changed

sycl/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,8 @@ set( SYCL_TOOLCHAIN_DEPLOY_COMPONENTS
455455
sycl-headers-extras
456456
sycl
457457
libsycldevice
458-
level-zero-sycl-dev
458+
unified-memory-framework
459+
unified-runtime-loader
459460
${XPTIFW_LIBS}
460461
${SYCL_TOOLCHAIN_DEPS}
461462
)

sycl/cmake/modules/FetchUnifiedRuntime.cmake

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,13 @@ if(SYCL_UR_USE_FETCH_CONTENT)
117117
endfunction()
118118

119119
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
120-
# commit 568a96aabc6edabe8514ae163aecc64cd5a41878
121-
# Author: Mateusz P. Nowak <[email protected]>
122-
# Date: Tue Oct 15 13:57:26 2024 +0200
123-
# Benchmark updates for faster run and more reliable results (#2164)
124-
set(UNIFIED_RUNTIME_TAG 568a96aabc6edabe8514ae163aecc64cd5a41878)
120+
# commit 80fdb0261d4a3623b05d1795f2f59ace9f718d76
121+
# Merge: 568a96aa 77b6c4c7
122+
# Author: aarongreig <[email protected]>
123+
# Date: Wed Oct 16 13:53:51 2024 +0100
124+
# Merge pull request #2206 from oneapi-src/revert-2138-counter-based-3
125+
# Revert "[L0] Phase 2 of Counter-Based Event Implementation"
126+
set(UNIFIED_RUNTIME_TAG 80fdb0261d4a3623b05d1795f2f59ace9f718d76)
125127

126128
set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES")
127129
# Due to the use of dependentloadflag and no installer for UMF and hwloc we need
@@ -230,14 +232,10 @@ find_package(Threads REQUIRED)
230232

231233
if(TARGET UnifiedRuntimeLoader)
232234
# Install the UR loader.
233-
# TODO: this is piggy-backing on the existing target component level-zero-sycl-dev
234-
# When UR is moved to its separate repo perhaps we should introduce new component,
235-
# e.g. unified-runtime-sycl-dev.
236-
# See github issue #14598
237235
install(TARGETS ur_loader
238-
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT level-zero-sycl-dev
239-
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT level-zero-sycl-dev
240-
RUNTIME DESTINATION "bin" COMPONENT level-zero-sycl-dev
236+
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT unified-runtime-loader
237+
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT unified-runtime-loader
238+
RUNTIME DESTINATION "bin" COMPONENT unified-runtime-loader
241239
)
242240
endif()
243241

@@ -301,8 +299,7 @@ if("native_cpu" IN_LIST SYCL_ENABLE_BACKENDS)
301299
endif()
302300
endif()
303301

304-
# TODO: this is piggy-backing on the existing target component level-zero-sycl-dev
305302
install(TARGETS umf
306-
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT level-zero-sycl-dev
307-
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT level-zero-sycl-dev
308-
RUNTIME DESTINATION "bin" COMPONENT level-zero-sycl-dev)
303+
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT unified-memory-framework
304+
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT unified-memory-framework
305+
RUNTIME DESTINATION "bin" COMPONENT unified-memory-framework)

sycl/include/sycl/accessor_image.hpp

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,21 @@
1212
namespace sycl {
1313
inline namespace _V1 {
1414
namespace detail {
15-
template <int Dim, typename T> struct IsValidCoordDataT;
16-
template <typename T> struct IsValidCoordDataT<1, T> {
17-
constexpr static bool value = detail::is_contained<
18-
T, detail::type_list<opencl::cl_int, opencl::cl_float>>::type::value;
15+
template <int Dim, typename T, bool AllowFP = true> struct IsValidCoordDataT;
16+
template <typename T, bool AllowFP> struct IsValidCoordDataT<1, T, AllowFP> {
17+
constexpr static bool value =
18+
std::is_same_v<T, opencl::cl_int> ||
19+
(AllowFP && std::is_same_v<T, opencl::cl_float>);
1920
};
20-
template <typename T> struct IsValidCoordDataT<2, T> {
21-
constexpr static bool value = detail::is_contained<
22-
T, detail::type_list<vec<opencl::cl_int, 2>,
23-
vec<opencl::cl_float, 2>>>::type::value;
21+
template <typename T, bool AllowFP> struct IsValidCoordDataT<2, T, AllowFP> {
22+
constexpr static bool value =
23+
std::is_same_v<T, vec<opencl::cl_int, 2>> ||
24+
(AllowFP && std::is_same_v<T, vec<opencl::cl_float, 2>>);
2425
};
25-
template <typename T> struct IsValidCoordDataT<3, T> {
26-
constexpr static bool value = detail::is_contained<
27-
T, detail::type_list<vec<opencl::cl_int, 4>,
28-
vec<opencl::cl_float, 4>>>::type::value;
26+
template <typename T, bool AllowFP> struct IsValidCoordDataT<3, T, AllowFP> {
27+
constexpr static bool value =
28+
std::is_same_v<T, vec<opencl::cl_int, 4>> ||
29+
(AllowFP && std::is_same_v<T, vec<opencl::cl_float, 4>>);
2930
};
3031

3132
template <int Dim, typename T> struct IsValidUnsampledCoord2020DataT;
@@ -448,12 +449,12 @@ class image_accessor
448449
// (accessTarget == access::target::image && accessMode == access::mode::read)
449450
// || (accessTarget == access::target::host_image && ( accessMode ==
450451
// access::mode::read || accessMode == access::mode::read_write))
451-
template <typename CoordT, int Dims = Dimensions,
452-
typename = std::enable_if_t<
453-
(Dims > 0) && (IsValidCoordDataT<Dims, CoordT>::value) &&
454-
(detail::is_genint_v<CoordT>) &&
455-
((IsImageAcc && IsImageAccessReadOnly) ||
456-
(IsHostImageAcc && IsImageAccessAnyRead))>>
452+
template <
453+
typename CoordT, int Dims = Dimensions,
454+
typename = std::enable_if_t<
455+
(IsValidCoordDataT<Dims, CoordT, /* AllowFP = */ false>::value) &&
456+
((IsImageAcc && IsImageAccessReadOnly) ||
457+
(IsHostImageAcc && IsImageAccessAnyRead))>>
457458
DataT read(const CoordT &Coords) const {
458459
#ifdef __SYCL_DEVICE_ONLY__
459460
return __invoke__ImageRead<DataT, OCLImageTy, CoordT>(MImageObj, Coords);
@@ -470,7 +471,7 @@ class image_accessor
470471
// access::mode::read || accessMode == access::mode::read_write))
471472
template <typename CoordT, int Dims = Dimensions,
472473
typename = std::enable_if_t<
473-
(Dims > 0) && (IsValidCoordDataT<Dims, CoordT>::value) &&
474+
(IsValidCoordDataT<Dims, CoordT>::value) &&
474475
((IsImageAcc && IsImageAccessReadOnly) ||
475476
(IsHostImageAcc && IsImageAccessAnyRead))>>
476477
DataT read(const CoordT &Coords, const sampler &Smpl) const {
@@ -494,10 +495,10 @@ class image_accessor
494495
// accessMode == access::mode::read_write))
495496
template <
496497
typename CoordT, int Dims = Dimensions,
497-
typename = std::enable_if_t<(Dims > 0) && (detail::is_genint_v<CoordT>) &&
498-
(IsValidCoordDataT<Dims, CoordT>::value) &&
499-
((IsImageAcc && IsImageAccessWriteOnly) ||
500-
(IsHostImageAcc && IsImageAccessAnyWrite))>>
498+
typename = std::enable_if_t<
499+
(IsValidCoordDataT<Dims, CoordT, /* AllowFP = */ false>::value) &&
500+
((IsImageAcc && IsImageAccessWriteOnly) ||
501+
(IsHostImageAcc && IsImageAccessAnyWrite))>>
501502
void write(const CoordT &Coords, const DataT &Color) const {
502503
#ifdef __SYCL_DEVICE_ONLY__
503504
__invoke__ImageWrite<OCLImageTy, CoordT, DataT>(MImageObj, Coords, Color);
@@ -546,23 +547,21 @@ class __image_array_slice__ {
546547
size_t Idx)
547548
: MBaseAcc(BaseAcc), MIdx(Idx) {}
548549

549-
template <typename CoordT, int Dims = Dimensions,
550-
typename = std::enable_if_t<
551-
(Dims > 0) && (IsValidCoordDataT<Dims, CoordT>::value)>>
550+
template <
551+
typename CoordT, int Dims = Dimensions,
552+
typename = std::enable_if_t<(IsValidCoordDataT<Dims, CoordT>::value)>>
552553
DataT read(const CoordT &Coords) const {
553554
return MBaseAcc.read(getAdjustedCoords(Coords));
554555
}
555556

556557
template <typename CoordT, int Dims = Dimensions,
557-
typename = std::enable_if_t<(Dims > 0) &&
558-
IsValidCoordDataT<Dims, CoordT>::value>>
558+
typename = std::enable_if_t<IsValidCoordDataT<Dims, CoordT>::value>>
559559
DataT read(const CoordT &Coords, const sampler &Smpl) const {
560560
return MBaseAcc.read(getAdjustedCoords(Coords), Smpl);
561561
}
562562

563563
template <typename CoordT, int Dims = Dimensions,
564-
typename = std::enable_if_t<(Dims > 0) &&
565-
IsValidCoordDataT<Dims, CoordT>::value>>
564+
typename = std::enable_if_t<IsValidCoordDataT<Dims, CoordT>::value>>
566565
void write(const CoordT &Coords, const DataT &Color) const {
567566
return MBaseAcc.write(getAdjustedCoords(Coords), Color);
568567
}

sycl/include/sycl/detail/generic_type_lists.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ using scalar_vector_bfloat16_list =
7070
using bfloat16_list =
7171
tl_append<scalar_bfloat16_list, vector_bfloat16_list, marray_bfloat16_list>;
7272

73-
using half_bfloat16_list = tl_append<scalar_half_list, scalar_bfloat16_list>;
74-
7573
using scalar_float_list = type_list<float>;
7674

7775
using vector_float_list =

sycl/include/sycl/detail/generic_type_traits.hpp

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,6 @@ template <typename T>
3131
inline constexpr bool is_svgenfloatf_v =
3232
is_contained_v<T, gtl::scalar_vector_float_list>;
3333

34-
template <typename T>
35-
inline constexpr bool is_half_v = is_contained_v<T, gtl::scalar_half_list>;
36-
37-
template <typename T>
38-
inline constexpr bool is_bfloat16_v =
39-
is_contained_v<T, gtl::scalar_bfloat16_list>;
40-
41-
template <typename T>
42-
inline constexpr bool is_half_or_bf16_v =
43-
is_contained_v<T, gtl::half_bfloat16_list>;
44-
4534
template <typename T>
4635
inline constexpr bool is_svgenfloath_v =
4736
is_contained_v<T, gtl::scalar_vector_half_list>;
@@ -57,9 +46,6 @@ template <typename T>
5746
inline constexpr bool is_vgenfloat_v =
5847
is_contained_v<T, gtl::vector_floating_list>;
5948

60-
template <typename T>
61-
inline constexpr bool is_genint_v = is_contained_v<T, gtl::signed_int_list>;
62-
6349
template <typename T>
6450
inline constexpr bool is_geninteger_v = is_contained_v<T, gtl::integer_list>;
6551

@@ -141,10 +127,11 @@ template <typename T> auto convertToOpenCLType(T &&x) {
141127
// sycl::half may convert to _Float16, and we would try to instantiate
142128
// vec class with _Float16 DataType, which is not expected there. As
143129
// such, leave vector<half, N> as-is.
144-
using MatchingVec = vec<std::conditional_t<is_half_v<ElemTy>, ElemTy,
145-
decltype(convertToOpenCLType(
146-
std::declval<ElemTy>()))>,
147-
no_ref::size()>;
130+
using MatchingVec =
131+
vec<std::conditional_t<std::is_same_v<ElemTy, half>, ElemTy,
132+
decltype(convertToOpenCLType(
133+
std::declval<ElemTy>()))>,
134+
no_ref::size()>;
148135
#ifdef __SYCL_DEVICE_ONLY__
149136
return sycl::bit_cast<typename MatchingVec::vector_t>(x);
150137
#else
@@ -160,11 +147,11 @@ template <typename T> auto convertToOpenCLType(T &&x) {
160147
fixed_width_unsigned<sizeof(no_ref)>>;
161148
static_assert(sizeof(OpenCLType) == sizeof(T));
162149
return static_cast<OpenCLType>(x);
163-
} else if constexpr (is_half_v<no_ref>) {
150+
} else if constexpr (std::is_same_v<no_ref, half>) {
164151
using OpenCLType = sycl::detail::half_impl::BIsRepresentationT;
165152
static_assert(sizeof(OpenCLType) == sizeof(T));
166153
return static_cast<OpenCLType>(x);
167-
} else if constexpr (is_bfloat16_v<no_ref>) {
154+
} else if constexpr (std::is_same_v<no_ref, ext::oneapi::bfloat16>) {
168155
// On host, don't interpret BF16 as uint16.
169156
#ifdef __SYCL_DEVICE_ONLY__
170157
using OpenCLType = sycl::ext::oneapi::detail::Bfloat16StorageT;

sycl/include/sycl/detail/helpers.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,11 @@ getSPIRVMemorySemanticsMask(const access::fence_space AccessSpace,
240240

241241
// To ensure loop unrolling is done when processing dimensions.
242242
template <size_t... Inds, class F>
243-
void loop_impl(std::integer_sequence<size_t, Inds...>, F &&f) {
243+
constexpr void loop_impl(std::integer_sequence<size_t, Inds...>, F &&f) {
244244
(f(std::integral_constant<size_t, Inds>{}), ...);
245245
}
246246

247-
template <size_t count, class F> void loop(F &&f) {
247+
template <size_t count, class F> constexpr void loop(F &&f) {
248248
loop_impl(std::make_index_sequence<count>{}, std::forward<F>(f));
249249
}
250250
inline constexpr bool is_power_of_two(int x) { return (x & (x - 1)) == 0; }

sycl/include/sycl/ext/oneapi/experimental/invoke_simd.hpp

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <sycl/ext/oneapi/experimental/detail/invoke_simd_types.hpp>
1515
#include <sycl/ext/oneapi/experimental/uniform.hpp>
1616

17-
#include <sycl/detail/boost/mp11.hpp>
1817
#include <sycl/sub_group.hpp>
1918

2019
#include <functional>
@@ -71,8 +70,6 @@ namespace ext::oneapi::experimental {
7170
// --- Helpers
7271
namespace detail {
7372

74-
namespace __MP11_NS = sycl::detail::boost::mp11;
75-
7673
// This structure performs the SPMD-to-SIMD parameter type conversion as defined
7774
// by the spec.
7875
template <class T, int N, class = void> struct spmd2simd;
@@ -154,8 +151,7 @@ struct is_simd_or_mask_type<simd_mask<T, N>> : std::true_type {};
154151
// Checks if all the types in the parameter pack are uniform<T>.
155152
template <class... SpmdArgs> struct all_uniform_types {
156153
constexpr operator bool() {
157-
using TypeList = __MP11_NS::mp_list<SpmdArgs...>;
158-
return __MP11_NS::mp_all_of<TypeList, is_uniform_type>::value;
154+
return ((is_uniform_type<SpmdArgs>::value && ...));
159155
}
160156
};
161157

@@ -193,26 +189,32 @@ constexpr void verify_return_type_matches_sg_size() {
193189
// as prescribed by the spec assuming this subgroup size. One and only one
194190
// subgroup size should conform.
195191
template <class SimdCallable, class... SpmdArgs> struct sg_size {
196-
template <class N>
197-
using IsInvocableSgSize = __MP11_NS::mp_bool<std::is_invocable_v<
198-
SimdCallable, typename spmd2simd<SpmdArgs, N::value>::type...>>;
199-
200192
__DPCPP_SYCL_EXTERNAL constexpr operator int() {
201-
using SupportedSgSizes = __MP11_NS::mp_list_c<int, 1, 2, 4, 8, 16, 32>;
202-
using InvocableSgSizes =
203-
__MP11_NS::mp_copy_if<SupportedSgSizes, IsInvocableSgSize>;
204-
constexpr auto found_invoke_simd_target =
205-
__MP11_NS::mp_empty<InvocableSgSizes>::value != 1;
206-
if constexpr (found_invoke_simd_target) {
207-
static_assert((__MP11_NS::mp_size<InvocableSgSizes>::value == 1) &&
208-
"multiple invoke_simd targets found");
209-
return __MP11_NS::mp_front<InvocableSgSizes>::value;
210-
}
211-
static_assert(
212-
found_invoke_simd_target,
213-
"No callable invoke_simd target found. Confirm the "
214-
"invoke_simd invocation argument types are convertible to the "
215-
"invoke_simd target argument types");
193+
constexpr auto x = []() constexpr {
194+
constexpr int supported_sg_sizes[] = {1, 2, 4, 8, 16, 32};
195+
int num_found = 0;
196+
int found_sg_size = 0;
197+
sycl::detail::loop<std::size(supported_sg_sizes)>([&](auto idx) {
198+
constexpr auto sg_size = supported_sg_sizes[idx];
199+
if (std::is_invocable_v<
200+
SimdCallable, typename spmd2simd<SpmdArgs, sg_size>::type...>) {
201+
++num_found;
202+
found_sg_size = sg_size;
203+
}
204+
});
205+
return std::pair{num_found, found_sg_size};
206+
}();
207+
208+
constexpr auto num_found = x.first;
209+
constexpr auto found_sg_size = x.second;
210+
211+
static_assert(num_found != 0,
212+
"No callable invoke_simd target found. Confirm the "
213+
"invoke_simd invocation argument types are convertible to "
214+
"the invoke_simd target argument types");
215+
static_assert(num_found == 1, "Multiple invoke_simd targets found!");
216+
217+
return found_sg_size;
216218
}
217219
};
218220

sycl/include/sycl/ext/oneapi/memcpy2d.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ template <typename T, typename>
1818
void handler::ext_oneapi_memcpy2d(void *Dest, size_t DestPitch, const void *Src,
1919
size_t SrcPitch, size_t Width,
2020
size_t Height) {
21+
#ifndef __SYCL_DEVICE_ONLY__
2122
throwIfGraphAssociated<
2223
ext::oneapi::experimental::detail::UnsupportedGraphFeatures::
2324
sycl_ext_oneapi_memcpy2d>();
@@ -30,6 +31,7 @@ void handler::ext_oneapi_memcpy2d(void *Dest, size_t DestPitch, const void *Src,
3031
throw sycl::exception(sycl::make_error_code(errc::invalid),
3132
"Source pitch must be greater than or equal "
3233
"to the width specified in 'ext_oneapi_memcpy2d'");
34+
#endif
3335

3436
// Get the type of the pointers.
3537
context Ctx = detail::createSyclObjFromImpl<context>(getContextImplPtr());

0 commit comments

Comments
 (0)